SpiderPig Posted January 28, 2019 Share Posted January 28, 2019 When I call Lobby::Count() it retrieves a 49 lobbies. I think I'll have to use one of the overloads and pass a string attribute that looks for lobbies made for only the current game? int _totalLobbies = Lobby::Count(); for (int id = 0; id < _totalLobbies; id++) { auto _lobby = Lobby::Get(id); if (_lobby != nullptr) { int _totalMembers = _lobby->CountMembers(); int _maxPlayers = 32; std::string _name = _lobby->GetString("lobbyname"); std::string _lobbyName = String(id) + " : " + _name + " " + String(_totalMembers) + "/" + String(_maxPlayers); Lobbies.push_back(_lobbyName); } else { MessageBox(Window::GetCurrent()->GetHandle(), "Could not load Lobby!", "Error", MB_OK); } } Quote Link to comment Share on other sites More sharing options...
Solution SpiderPig Posted January 28, 2019 Author Solution Share Posted January 28, 2019 Quote Creating a new lobby to advertise our game is easy. We just call a command to create it, and then we will set two string values. The game title is set so that we can later retrieve only lobbies that are running this particular game. (This should be done if you are using the SpaceWar app ID instead of your own Steam ID.) We also add a short description that can display information about the game. I should read more often. 1 1 Quote Link to comment Share on other sites More sharing options...
gamecreator Posted January 28, 2019 Share Posted January 28, 2019 The other fun end of that, which happened to me, is when random people join your lobby while you're testing, since their programs don't test for any keys you may set. ? 1 Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted January 28, 2019 Author Share Posted January 28, 2019 It would probably cause a crash somewhere along the line too, as they wont be sending the same data as you. Maybe when a client joins we test to see if they are running the same game or not. ? Quote Link to comment Share on other sites More sharing options...
gamecreator Posted January 28, 2019 Share Posted January 28, 2019 Pretty much. You can have the client send an ID # you made up as the very first packet after they connect. If the host receives this number, it accepts the client into the game. Otherwise, it doesn't let them play. They'll still be in the lobby (I don't think a host can remove a client from a lobby) but you treat them as if they're not. Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted January 28, 2019 Author Share Posted January 28, 2019 Pity we can't remove them from the lobby. I thought maybe adding them to the blockedusers list, but not sure what impact this might have elsewhere. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.