Game Mechanics P2P Rollback Netcode?

S

Shizuku

Guest
(If you already know what GGPO and P2P Rollback Netcode are, skip to the last paragraph.)

I'm currently in the process of creating a fighting game and have a few questions to see if GMS2 is a good fit for this project. In fighting games, having low latency online is crucial to whether or not a game survives, King of Fighters XIV being a huge example of this.

When working with Peer to Peer (P2P) netcode, developers usually take one of two routes; either they use delay-based netcode or rollback netcode. Delay-based netcode is straightforward as the game just delays when your inputs are read or pauses to re-sync both players. However, if there's a poor connection between both players due to long distance connections or slow connections, this causes a lot of input delay and pausing.

On the other hand, rollback netcode design works around this problem by setting a consistent input delay between both players before the fight starts, utilizing save states. This way, it predicts inputs ahead of time, and reverts to the last correct save state if it's incorrect using the input delay as a buffer to reduce rollback amounts.

For more information about these designs, read here:
https://en.wikipedia.org/wiki/Saved_game#Save_states
https://en.wikipedia.org/wiki/GGPO#Design
http://gamasutra.com/view/news/3405...g_Game_Fan_Solved_Internet_Latency_Issues.php

So my main question is: would GMS2 be able to offer me the ability to utilize save states for this rollback design? If so, how would I go about doing so?
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
GMS2 is a better fit out of the commonly used tools due to strong determinism in built-in functionality (meaning that the engine isn't shooting you in the foot) and use of epsilon in all comparisons (meaning that the CPU isn't shooting you in the foot).

State saving/loading would be handled by sequentially writing information about all meaningful game objects into a data structure one or other kind - use of buffers is the most common as that also allows to reuse this for sync integrity checks. This can be done either with custom per-object-type code (reading/writing data by direct field names can be very fast on YYC) or with generic code (variable_instance_ functions).

Related recommended reading on rollback:
http://blog.hypersect.com/rollback-networking-in-inversus/

However, I would generally recommend to settle on regular lockstep (delay-based) netcode since, as sad as it is, most games do not actually make a big enough impact or retain their audience for long enough for high-end networking to make a difference. Most games can't even maintain a sufficient userbase for ranked matchmaking to not be a waste of development time.
 
S

Shizuku

Guest
However, I would generally recommend to settle on regular lockstep (delay-based) netcode since, as sad as it is, most games do not actually make a big enough impact or retain their audience for long enough for high-end networking to make a difference. Most games can't even maintain a sufficient userbase for ranked matchmaking to not be a waste of development time.
Thanks for the informative response, YellowAfterlife! I apologize as I'm really inexperienced with game development myself, are there any resources you would recommend that could help me integrate online play into my GSM2 projects? I don't mind delay-based netcode for the time being and then switching to rollback later if the game gains enough support for it. I've always been able to program for local multiplayer, but online is something I've never truly learned yet.
 
Top