-
-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Network Multiplayer Support #3
Comments
I personally wouldn't bother with a true NetSprockets implementation. There's very little that really depends on NetSprockets features, so I'd just port those parts to the networking API of our choosing. The net code from the core game looks simple enough. It's a client/server model. On every frame, the clients send their inputs to the host, which rebroadcasts them to all clients. The clients then replay the other players' inputs locally. There's obviously more setup work before the game starts, but as far as the core game loop is concerned, that's really it. I haven't culled any of the net code, it was just #if 0'd away so the game compiles without it. I think the bulk of the work will be designing new screens for matchmaking. As with other features that depended on Mac OS dialogs (settings, physics editor), we're going to need to create our own UI. |
Really, the clients send their input? That sounds to me like a dsync waiting to happen... So, everybody except the Host has a terrible input delay? |
That may explain why the original OS 9 network play was so unstable :P I have distant memories of this only working properly with identical G3 iMacs in an Apple Store, and other setups frequently failing to sync at or shortly after race start. |
I have pushed a work-in-progress branch called "net" if you're interested. It works, but only on a LAN. Just sending inputs and having each peer simulate the world in parallel isn't unheard of in multiplayer games. Unfortunately, there's no prediction/rollback mechanism in CMR. The game stalls until it's received inputs from all players on every frame. So, there better not be too much latency on the network. Right now, you'll need to be on the same LAN for the game to be playable at all. On a stable LAN, though, it does work fairly well. |
Again incredible work 😁 I just compiled the branch and gave it a quick test on my gigabit wired network between two machines (both Arch Linux.) It worked for about 10-15 seconds or so, then the client reported 'seed desync' and the host reported that all players had left 😅 I'm happy to do any sort of logging or tcpdump if that'd help. |
Ok so I did a bit more testing, and it's possible my network topology might be causing the instability. If the machine connected to 1GbE hosts it appears to work okay, however if the machine connected to 10GbE hosts it desyncs pretty quickly. |
Thanks for the updated @jorio! I guess hanging the game until all inputs are received was a technique to avoid desync, but I'm sure that would cause issues over WAN. |
I finally had the chance to test this at a real LAN party with a cross-platform build that merges the network branch with the latest main branch changes. Here is what I found:
Overall though despite the rough edges it was really fun testing the network support out. Hopefully it can be fixed up and promoted to the main branch eventually :) |
Thanks again for getting Cro-Mag Rally released; it's an excellent port :D
I know you mentioned network multiplayer support may come back in a future release. In the event someone was interested in trying to help make this a reality, what areas would require work to fully enable support? It looks like the networking source code may still be in place, although I'm not sure if it's complete and what was done to disable/exclude it in the 3.0.0 release.
Since this was originally a NetSprockets title, would https://github.com/mistysoftware/openplay be of use for re-implementation here, or is it in a state where just starting over on the network stack entirely would be more practical?
Thanks,
JM
The text was updated successfully, but these errors were encountered: