Last month we were talking about implementing the social aspects of Formula Wincars, how you can send a friendship request to anyone and how we handle that. But as I told you, being social is not only having friends, but also being able to play with them.
Whenever you want, you can send a race invitation to a friend of yours to play together. We will set up everything for you, whether it is a private or public race, with teams or free for all, but first we have to somehow connect you to your friend as a group of people willing to play.
To do so, we manage to hand over the invitation. How we do it depends on what the other player is doing, as they can be setting up their cars and skins, looking in what to expend their driving points, racing, chatting with their team about their new strategy...
At this point it is useful to remind that everyone connected to the game is connected to our central server, the so called MetaLobby. Being so, it is pretty simple to hand over the invitation, we just send it from your client to the MetaLobby and it will redirect the invitation to your friend.
That is true except if the player is racing or preparing to race (i.e.: choosing circuit, car or character). In this case, they will no longer be connected to the MetaLobby but to a server or a circuit instance instead.
If this is the case, the MetaLobby can't send the invitation directly to your friend. What we do is to pass it to the server in which your friend is connected and it will store the invitation until the end of the race. There is a list of invitations for each race so we don't have to check them all in the next step. Once the race is over, the circuit instance will ask to the server for the stored invitations and will hand them over to the players.
Et voilà! When your friend ends the race a message will be displayed showing that there are unattended invitations. To accept the invitation it is necessary to leave the race. If your friend chooses to play again with the same people, the invitation will be refused automatically.
As you can see, we have to go through a maze when it comes to send information to a player that is racing. Extra tip: We do it so because we don't want anything to mess with the connection between the racers and the circuit instance as it is the very most important part of the game, racing.
Latest tweets from @fwincars
15hours 48mins ago
19hours 1min ago
Aug 27 2014, 10:15am
Aug 27 2014, 3:30am
Contest winners announcement!!! T.co
Aug 25 2014, 5:48am
@Pikachumaniaco ¡Montana siempre se salta el día de muscular piernas!
Aug 25 2014, 3:25am
Aug 20 2014, 10:13am