I would like to hear from Epic guys what they think about possibly adding deterministic lockstep networking for RTS style games.
As far as I know you want your engine to be used with any type of game, and for RTS and similar genres (with thousands of units) deterministic networking is the only solution. So all people who want to make such a game will have to code that themselves, and I guess for most indie devs adding such complex low level stuff is not really easy, aside from the fact that people like me who only use blueprints have absolutely no chance to implement this.
So at the moment UE4 is not suited to create a multiplayer RTS game if you are not some AAA studio. I would really like this to change.
Do you guys at epic have any plan to integrate this feature into the engine?
The replication model isn’t a great base for implementing lockstep networking and would want replacing entirely, IMHO, but I do believe the replication model is adequate so long as you are clever about how you handle things and realistic about your expectations and goals. You can certainly make a multiplayer RTS in UE4, and UI reckon you could have a Company of Heroes scale game working pretty happily using just Blueprint.
I’d like to inject a little bit of realism into this one here - if adding such a complex feature that is very specific to your game isn’t viable for you as a developer, you should pursue another route.
Lockstep protocol is to prevent Look-ahead cheating (with this cheat you can trick other clients into thinking you have high latency while for you there isn’t).
This means you can do actions in the game while the others have to wait.
For this reason we don’t really see multiplayer RTS games popping up (only single player examples). Like John says not unless you have “AAA studio” resources.
Perhaps with a little push from the Epic team would help?:rolleyes: puppyeyes
Would love to have an ‘Example RTS project’ (multiplayer ready) to learn from.
This is a question that has been raised in every generation of the Unreal Engine, and it is definitely not in the works. Lock-step execution can only work if every engine system on every platform is designed for absolutely deterministic execution. That’s not the case with UE4, as a big engine with a time-dependent game update model and reliance on a wide range of middleware and a wide range of platform and runtime OS-version and API-dependent optimizations. An engine could be designed this way, but UE wasn’t, and it’s not practicable to retrofit it for a special usage case.
Instead of lock-step determinism, I recommend working with the engine’s network replication framework. This code has fairly good performance and typical internet connections have plenty of bandwidth, so I expect it to be practical for RTS usage.
Also keep in mind that you can customize the engine’s relevancy checks (which determine whether a given object is replicated to a given client) based on the client’s view of the world, which will usually change fairly slowly in an RTS.
And this also means it’s not really possible, even for AAA developers, to implement this in UE4.
Thanks for your “recommendation”, it’s just the only option we can choose :rolleyes: It’s nice to hear you think it’s practical for RTS usage, but most people I have talked with about this topic said it’s not possible to create a RTS with thousands of units with replication. I have not tried it yet since I think it’s hopeless.
RTS games usually have a small minimap where you can easily jump immediately to the opposite site of the map with just one click on the minimap. So the clients view can change really fast.
However, I remember this post from an Epic developer (April 2014):
I find most interesting that he said option 2 would not require “any major engine modifications” while it would be “completely deterministic”. This is virtually the opposit of what you said, Tim. Who is right now? Well, you are the “Master of UE4” so you are probably right, but I just want to have some hope
You can do it in UE4, just like with Unity’s original network version I created a similar implementation back in 2008-2009. The problem here isn’t that much sending the data, the problem is keeping things deterministic (which I guess was Tim’s point).
Having something be deterministic means that input A will always return output B (e.g. a path a unit chooses to follow, or how much damage you do, you can’t rely on floats), no matter the platform. In order to achieve this in our project back then we had to create a fixed point math (based on integers) that we’d use for everything in the game.
If you’re interested in following this path, I advise you to read these 2:
BTW, as a side note, in the end this project morphed to something else. At the time doing the whole thing (without debugger, mind you, and for the browser plugin) was an insane task. We had our own network system (supported both mac & win, and back then that meant handle byte ordering when compacting data), math system (with some limitations), pathfinding system (based on Warcraft 3 iirc, can’t find any docs on it, sorry), and ai. At the time the project changed, we had the clients always in sync, what was biting in the *** was deadlocks when “large crowds” collided. Given that all this was done by 2 guys (shout out to Ramon Axelrod, without his guidance none of it would have happened), I was pretty amazed of how far we got.
Ideally in a lockstep RTS, you only send commands between the connected players using RPC and don’t replicate anything else. This is how I understand a game like Starcraft would work or Age of Empires based on that Archers over 28.8 K paper.
So would gameplay be deterministic even on UE4 if you handled a lot of logic using ints? Like damage, unit locations, etc? It might get a bit weird when you have unit positions that are stored as 3D transforms full of floats. You may have to store a unit’s true position in ints and use that for any gameplay logic. All movement and pathfinding and range calculations would have to take place in int space. Then force the actor’s transform to update based on the int position to update it visually.
I also remember reading that Supreme Commander still did things in floats but they disabled some CPU optimizations like SSE and that made the calculations deterministic as well. Maybe they compiled some of the gameplay into a dll with optimizations off while some of the other stuff that doesn’t affect game logic but benefits from optimizations like physics and graphics with them on. In an RTS physics would probably be only for pretty effects and explosions unlike in an FPS where the whole game depends on physics, so that may make sense.