Talk:Lobby implementation

This page is a discussion on how the lobby system in STK should work, i.e. how people can connect to a server, find online games and join them. For now this is just a collection of ideas, hopefully with brainstorming from various people we can come up with a compromise on how it should work at the end. The beginning was based on various IRC discussions, which I (hiker) am trying to summarise here.

The actual protocol with the server is documented here.


In order to avoid confusion, the following terms are used:

  • stk-server : This is the one centralised server (i.e. the STK addon server) that is used to allow people to find online games etc.
  • server (or game-server): the instance of STK which will play the role of a server for a group of people.
  • master (or game-master): The person opening a room, which in turn means that the STK instance of this person will be the server for the online game for the people in this room.

Finalised Items

The following items have already been discussed. This section lists implementation designs which we have agreed upon.

Online IDs vs no-IDs

For full online play it will be required to have an account on the addon server. While technically we could use a different server with separate IDs for the online games, it:

  • reduces the amount of implementation work for us (since we already have the addon server in place)
  • easily allows us to integrate voting for addons.
  • the addon server is not highly loaded so that this might become a bottle neck

But to allow people to easily test the online version without creating an account, people will be able to use "anonymous logins": their name will be "anonymous-X" (with X being a unique number for each person). They won't be able to open a room, and people might decide to block anonymous players from entering their room (additionally anonymous players won't be able to vote for addons or submit online highscores).

Anonymous login can easily be implemented later.

If a player opens a server all participating players will have the option to vote for the server (i.e. if they feel the server might be patched and cheating, or if everything was fine). This vote will be attached to the ID of the person.


It should be possible for people to maintain a list of friends in STK. Friends could be used to:

  • have highscore lists, get notification if a friend has a new highscore, ...
  • restrict people playing together (i.e. you would open a room for your friends only)

Friends could be added by simply adding their online ID (and anonymous players will never have friends). Certain features of friends would require that both people are friends of each other:

  • online highscore notification (in order to avoid that someone spams everybody with his highscores), or perhaps if you add a friend you will only receive this persons notifications (but your highscores won't trigger a notification of people in your friend list)
  • you should be able to join a room if the owner of the room adds you as a friend, it would not be required that you add this person as a friend (this would easily allow people to join a room without too complicated setup; the other option are using passwords, see below).

Room attributes

To start an online race, a game master has to create a room. People can join this group, and the game master can then start the actual game. Rooms are temporary, i.e. they only exist for as long as the game-master is online. Several races could be played with the people in one room, i.e. after the race people will find themselves back in the room to discuss what to do next, or be able to leave etc.

Rooms have a set of attributes which will be displayed in STK to allow people choosing an appropriate room:

  • a name
  • an optional description
  • whether open for anonymous players
  • define the (maximum) number of karts. This can be important for people with less powerful hardware to avoid having to play with unacceptable slow frame rates.
  • A restriction on who joins: one of:
    • Open for all including anonymous player
    • Open for all except anonymous player
    • Open for friends only
  • A password: only people having the appropriate password will be able to join this room. People that want to play together can just share the password through email or chat. This will allow people to join without an account (e.g. someone with an account wants to show you STK, so he can open a room, set a password, and so allow only his anonymous friends to join). Obviously using anonymous rooms would be useful (i.e. a group of people can test without any one of them having an account), but there might be issues with security (too easy to swamp the server with 100's of anonymous logins, creating rooms, potentially DOS).
  • satisfaction rating: people could (optionally) vote for the rooms they played in, e.g. if they have a feeling that the owner was using a patched version of STK, they could vote a room (or the original user) down. The votes would actually get attached to the ID of the game master. This feature can obviously implemented later.
  • Perhaps even some kind of location of the server? This would allow e.g. to play with people in the same country, ...

a pie-in-the-sky feature might be to change the master of a room. This can be useful if e.g.:

  • the master loses internet connection (the remaining people can still play, and the master can join again later)
  • people can discuss a game, and decide later which person should be the master (the person with the fastest computer or best internet connection)

Kicking out People

The game master must have an option to kick out people from a room, and prevent them from re-entering.


Once people are in a room they should be able to chat. This would done without using the stk-server, but the game-server only.

Brain Storming

Selecting tracks

Hiker favours the Mario Kart Wii approach: each player in a room individually and independently selects a track to play (including 'random'). Once all players have made their selection, the stk-server randomly selects a track from the list of tracks selected by the player (a timeout will be used to make sure no one stalls the game for too long). The following youtube video shows the process.

Other people (Auria, Arthur) prefer that the game master just selects the track (hopefully based on the previous chat with the players). This would indeed be easier to implement.

Obviously using the latter option as a start would be good, ideally this could become an attribute of the room ('master decides vs. voting vs. random track').

Selecting Number of Laps

Same decision as for selecting the track: the options of "master decides" or "all decide" (I don't think random would be an option). Perhaps people could select (attribute of room?) the average race time, and we use 'typical' times for the track to determine the number of laps?

Or perhaps tracks & number of laps should be determined at the same time (which only applies if we use the 'player select, server selects randomly)?

Non-server playing

It would be useful to allow people to host a local session without connection to the server (e.g. scan for services on local network). This makes it easier to host lan parties, or for people who might have a firewall blocking access to the STK-server.


As a first step Stephen suggests that people opening a room would have to keep on answering to a ping from to keep your room alive. Using an ID could make it much harder for people to use scripts to open rooms or other DOS approaches.


It might be useful to maintain an ongoing list of scores for a room. We would have to consider what happens if players join later (i.e. with 0 points, perhaps give them 1 point less than the last entry in the highscore list?). So this would basically be a dynamic GP (people keep on racing, and each race would add more points). Races could be mixed (FTL, time trial, even complete GPs).

Team Games

We might add team games, e.g. red vs blue races (points of each team are added up or so). People should be able to select their team (perhaps with the option to select 'random'). Team should be persistent within a room (i.e. if you play a team game, then a non-team-race, then a team game, the teams should still be the same (as a default), but people should have the option to change this (e.g. select "play with old teams" or "new teams").

Kid-safe mode

We might want to consider a kid-safe approach.

The quick and simple way : allow disabling network play.

The more elaborate way, which is also pie-in-the-sky : parents would install STK write protected, and create online accounts for their kids. Those accounts would not be allowed to invite new friends (parents would have to do this for them), and they can't open rooms for everybody. But this would be a long term goal (if we actually decide to do this at all), parents who are concerned should disable internet (which we need to support as well, atm everybody can just enable it again).

First Concept

In the STK GUI would be a new option 'online login'. When player log in, they will get additional menu entries

  • Log off
  • Check online highscores
  • Join online game
  • Open room

[The actual design might be different due to space restrictions in the GUI, perhaps there will only be one 'online' menu entry, which then opens a menu with all online related options].

When you open a room, you can select the attributes (see above), and give it a name (which would be prefixed by your online id, so that the name is certain to be unique). Appropriate defaults would be used depending on other settings (e.g. open for everybody --> default name will be "public", for friends the default name will be "ID's friends") etc.

Joining an online game would present you a list of rooms with their attributes. You can then select one of the rooms (or select 'open room'). You should be able to filter/sort rooms, e.g. only show rooms from your friends, etc

When a room is opened (or you join an open room), you would get a list of people in that room (and a chat windows). The owner of the room has the option to start a race (and select which kind of race, e.g. a GP of races, a continuous set of races only, battle mode, ...). The name of the room should reflect the intention of the owner ("Joerg's battle mode"). People can of course leave a room taking them back to the room selection. If the owner leaves, the room will be closed, and all people end up back to the room selection list.

The owner can optionally 'close' the room, meaning no more players can join. Otherwise new players could join between races, waiting for the people to finish before they can join (pie-very-high-up-in-the-sky: those players could take over for AI karts in the race (if any); a message could be displayed to the players racing that new people are waiting).

Once the race starts, STK must synchronise the available karts and tracks, so that only karts and tracks common to all players can be picked. Players then select their kart. Game mode, #AIs, track, #laps will be set by the room owner (though see the brainstorming section above for a slightly different approach). Play then starts.

At the end of the race people will end up in the room.

Pie-in-the-sky : If you finished a room you can opt to vote for/against a room when you leave (and we should probably make sure that you can only get one vote from each player).