Which Multiplayer Solution for Fast Paced Shooters?

Hello, I’ve have a fast paced side-scrolling shooter that I am now trying to make online multiplayer.

I’ve tried Netcode for GameObjects which seems great, however clients can’t spawn Objects, and require the server to spawn for them.

The problem is that is a player has 100ms latency, shooting the weapon while moving causes bullets to spawn 100ms delayed, and behind the player, this looks and feels VERY bad.

So my question:

  1. Which multiplayer solution handles this issue the best?
  2. OR, if this is a common problem everywhere, is there a solution? Like maybe let the player shoot locally, but then the server creates a visual-only bullet to where the player shot to simulate it syncing?
1 Like

The authoritative model is still the best for this kind of game.
The shooting player should locally predict that the bullet gets created or that the shot happens. Usually, the server will confirm this and maybe there is a minimal correction necessary. In rare cases, when the server disagrees, then the local prediction was wrong and needs to be cleaned up. This may cause glitches but some can be hidden and in general the server is right and it's best that all agree.

1 Like

I agree spawning locally. Server should handle damage and players just show visuals.

Far as solutions go, Fish-Networking has a tick aligned simulation which makes this easy to accomplish. I actually am using the exact described behavior on a paid project with FishNet. https://fish-networking.gitbook.io/docs/ (links and more).

I’m going to probably add a guide to this in the docs over the next few days; there’s already a placeholder for it. https://fish-networking.gitbook.io/docs/manual/guides/lag-compensation/projectiles

1 Like

Also check out the feature comparison chart (Mirror, Fish-Net, NGO) here:
https://discussions.unity.com/t/899755

Thanks for the info, looks like Fish-Net has the most features, though while using NGO so far I can definitely say it's quite easy to get going without much hassel.

Hey @Juice-Tin , FYI NGO is not recommended for competitive fast-paced shooters, as it’s missing some much needed features such as prediction + reconciliation and rollback. It also doesn’t scale well with large amounts of network objects (even though this really depends on what data you send about these objects).

NGO is more recommended for games of up to 10 players per session/low amount of networked objects (think of Overcooked, Among Us, Hearthstone) where client-side prediction and reconciliation are not really needed (unless you’re willing to implement them yourself)

2 Likes

I applaud such an honest statement! :slight_smile:

For future readers: prediction & reconcile is on the roadmap (currently “planned”).

I tried NGO, Mirror and Fish-Net recently and have to say, as far as getting started and ease of use is concerned, they’re all on equal terms. :wink:

2 Likes

Thanks, @CodeSmile ! From my point of view, we’re here to help. Picking the right framework from the beginning is important, as it is a decision that has an incredible impact over the project in the long-term.

As a Unity user myself, working on multiplayer games, I’d hate if somebody gave me bad advice just to push a product of their company.

Making multiplayer games is hard enough on its own already!

5 Likes

Thanks, I appreciate the honesty as well. 10 people max sounds fine, however there are TONS of bullet objects are very fast paced movements happening each frame, so it’s definitely something to consider.

With my 0 networking experience, I had a working online demo with join codes & server list in my existing game in just 2 days thanks to unity Relay & Lobbies taking care of all the server side stuff.

I hear Mirror/Fishnet/Photon/etc requires your own servers & server code to connect with, which again, 0 experience. (Also on a VERY tight deadline for this, 2-3 weeks max)

Does Fish-net have any simple Relay/Lobby system that automatically handles all the server-side stuff? Every tutorial I’ve seen only shows how to connect 2 clients locally.

Yeah. I think since Unity bought Rival recently for DOTS, and that contains a twitch shooter sample, it might be worth a look for projects starting out now. What do you think?

@Juice-Tin Do they really need to be networked, though? More often than not, you can get away with raycasting on the server and notifying clients about being hit.

@hippocoder I’m not an expert of Netcode for Entities (“”“the DOTS version of NGO”“”) or DOTS in geenral, so I’m not sure of what the consequence of that purchase will be… Something seems to be moving, though!

@PaoloAbela Sort of, here’s a clip of a 6v6 with AI bots using rockets, physics-based grenades, ragdoll physics (which are important, as dead bodies also block bullets)

My concern now is because it’s so fast paced, even a small delay in: “client shoot > server authenticate > tell client” could feel like an eternity, which may be exaggerated based on the amount of networked game(and physics)objects required.

Happy to try out Fish or Photon, just can’t figure out if their online setup is as easy as NGO Lobbies/Relays was. Can’t find much info on it.

I wanted to let you know that I finished the guide today. The code examples naturally are for my networking solution but I’m sure it could be converted to anything. There’s a preview of the outcome as well so you can see the results before diving into the code.

If the page still says ‘coming soon’ you may need to refresh it.
https://fish-networking.gitbook.io/docs/manual/guides/lag-compensation/projectiles

EDIT: here’s the preview with a large ping of 220ms.
8626020--1159002--PredictedProjectile_00.gif

I just checked out your video. Looks nice.
You’ve been open to using Photon solutions, so I think it’s OK to add some details.

If it wasn’t “finished” already, I’d say it’s a perfect fit for Quantum. It is deterministic with predicted movement and can do a few nice tricks. E.g. you could actually implement jumping on (or just over) a flying rocket. See the Quantum Demo “Blueless”. There is also a Bot SDK, which helps populating multiplayer games.
It works especially well for mobile games, as our servers coordinate the input and no host / server is needed on top. This also means, it does not matter if any player gets a call or closes the app - the game continues for the others.
But … your game is basically done. It will be quite some work to convert.

Fusion would be a good fit for shooters in general. Downside: In our experience, it’s not great to run a host on a mobile client. It will be interrupted frequently during gameplay and this affects everyone. This will be the same for other solutions which use a Host/Server. Fusion helps you get Host Migration done but this technically never works without interruption.
The “shared mode” for Fusion is better for mobile (it doesn’t rely on a single host/server) but less good for fast paced games and there are likely more corrections. Check out the samples for Fusion. Reconciliation is explained here.

Unless you’d refactor the game a lot (to ECS / Quantum), you will likely end up with a client hosting the game. This has some drawbacks, no matter the solution you pick.

Happy coding :slight_smile:

And if we implement own client side prediction systems?

You may as well write your own networking solution at that point. Implementing CSP on-top of another framework that isn’t built for it will be annoying at best.

CSP isn’t easy to get right, and if you plan on using rigidbodies it just became 20x harder. If you need CSP use a solution that already has it like…
FishNet: https://assetstore.unity.com/packages/tools/network/fish-net-networking-evolved-207815
Fusion: https://www.photonengine.com/fusion

If you’re just concerned about syncing positions in “real-time”, it’s often fine to just send positions of “self-controlled character” @30fps (example of a relatively fast rate) as well as a few critical events like shooting asap.

Having 100ms or even 200ms delay (assuming single trip) between players is inevitable, and the worse situation is having a nonuniform delay pattern like [16ms, 200ms, 13ms, 500ms, …], as a developer we need design proper input/skill delay & predictions to compensate for such inevitable edge cases. Some annoying cases are worth mentioning.

  • Shooted bullet or jumped other players’ positions always teleported a few frames after invocation (input delay + skill startup frames can help mitigate)
  • Other players’ turning around motion (any kind of inertia implementation can help mitigate, either using acceleration or not)
  • Propagating momentum by chained collisions

However there are more to be concerned before you decide your netcode.

  • Do you need many npcs in any level?
  • Do you need recording of battles to be replayed, if yes do you need the history at a given frame id be the same for all players?
  • Do you have a tight budget for bandwidth of the netcode packets? A smaller bandwidth requirement often results in higher success rate of transmission.

Putting all these into consideration, I’d recommend implementing a rollback netcode for your own game mechanics, it’d take sometime to get things right especially the “rollbackable physics”. Unity seems to have a documentation about its own Physics | Netcode for Entities | 1.0.17 but it’s usually a bad idea to just take a general purpose physics engine into a specific rollback game, because of performance concerns for the wasted time in calculating all the stuff you don’t need.

To make sure that I am not just talking bullsh*t, here’s my pet project using rollback netcode Sharing an opensource delay-based rollback netcode project with some success in internet tests and by far it works great in internet tests – it’s server-authoritative but not required to run game simulation on server. You might also be interested in some edge cases’ concerns here DelayNoMore/ConcerningEdgeCases.md at main · genxium/DelayNoMore · GitHub.

Glad I ran into this thread again purely by chance because I'm working on the unthinkable: a fast-paced first-person multiplayer shooter game template built on Netcode for GameObjects. I added splitscreen online play on top where 4 clients can have up to 16 players in a match. :)

I call it MultiPal FPS , it's intended to be on the "competetive casual/fun" side of things, hence the focus on retro Boomer Shooter gameplay.

Given the future of Netcode I have no doubt that it will become suitable also for serious competitive games, especially those with mass appeal where cheating / fairness challenges are rather important. If that level of success happened to one of my customers, I'll be there to support them.

Sorry for the plug but at least to me it seems on-topic here. ;)

Nice!
Shameless plug two: In the mean time, try the Fusion Simple FPS Demo.
It’s not a “tool kit” to build shooters but aims to be quite simple to understand and adapt.

Just another shameless plug.

If anyone is looking for additional options, we’ve posted our Reactor multiplayer system recently. It is a performance-oriented multiplayer solution that is a cross between a server-authoritative networking framework and a relay system. It can be used as a relay, as an authoritative server, or any combination of both. We provide a full server-side orchestration API so you can build rooms that perform different tasks, such as lobbies, game rooms, chat rooms, etc. and have them all work together in concert.

We’re finishing up a sample project called FPS1k, which is an MMOFPS supporting 1000 or more CCU in a single world. It employs kinematic physics, full reconciliation, animation syncing, server-side animation support, rewind/replay for hit detection with headshot support using server-based animation validation, interest management, random level generation, and a server-side physics-based controller with client-side prediction. With 2000 players it used 3.8 of 16 vcpus and a total server bandwidth of 250 Mbps of bandwidth (125 kbps, or 15 kBps per player).

The sample will be posted to our website as well as our thread in this forum.

You can also mess around with an old web-based demo we made, but make sure to play with some friends to get the full effect.