Hi all! I am working in a LAN multiplayer racing game project (coin-op/arcade).
I spent some months working on the game as single player thinking about make it
multiplayer later and it was a huge mistake. I discovered multiplayer feature
to be a lot more complicated than I tought. So I am like redesigning the game
almost from scratch.
I’d love to get some advice about the architecture I want to achieve because it
has some parts on the server travel mechanics that I am not sure how to solve.
Let me tell you a bit about the game specs:
-The game will run 2p to 4p (twin two player PC units)
-I think will user Listener server mode instead dedicated server, so one
of the players will be the listener server and the other the clients.
-Via configuration menu I will set the Ip of each unit, number of connected
units and if the unit is server or client. So when the units start running,
server will create a session and know how many clients to wait before server
travel to some Lobby map.
Once all the units are in the lobby, will go DEMO MODE, showing gameplay with
a blinking text saying ‘PRESS START TO RACE’.
Demo mode gameplay I plan to just use a full screen video so is not important
to be in any particular map as the game is not actually playing, just showing
a full screen video as if playing. I think this would make things easier.
Once ANY player press start, all the other players change the text ‘PRESS START
TO RACE’ by ‘PRESS START TO JOIN’. The first player that pressed START will go to
a TRACK SELECTION MENU where the Track to be raced is selected. After that will
go to a RACER SELECTION MENU where the player will select the car/racer.
If other player presses start while some other player started the game before
and is in track/selection mode, the new player can join the race but will go
straight to the RACER SELECTION MENU and cant select the track. Once the incoming
players select track/racer will wait for others to join/select. When all active
players are ready then they will travel to the race map and compete.
This is the tricky part: When server travels to a new race map, it drags all the
players in the session to the race, even the ones that are not active (because
the player never pressed START. So I need those inactive players to stay in
DEMO MODE and just change the text to ‘RACE IN COURSE, PLEASE STAND BY’.
When we have all players in the session, is there some way to avoid to all be
dragged to the level that is loaded by the server?
How can I solve the case when some (non-server) player starts and other joins
but the server player doesnt join the race? server unit should stay in DEMO MODE
while the others plays the race.
A ‘hacky’ approach I am thinking of is just all players are always in the session
and demo mode is a widget on top of everything so no matter in wich level they are
they can be in demo mode anyway, then the menu and tracks instead of being standalone
maps those are stream levels and when the race starts, all players will load the
stream level race but they will check if they are in the race and if they are not
the just locally unload the race stream level. I did some tests and this works but I feel
is a bit messy and not clean way to do this. So I tried load a stream level from the server,
the stream level is loaded by all the clients and then some specific players can unload
the stream level locally.
Can someone give me some advice about how would be the best approach for what I want to achieve?
Sorry for the long message but I think all the info is relevant.
Thanks!
Dany