I’m currently designing an RTS game interface. I have some functioning code, it’s not pretty, it needs to be refactored, but it works. So far I have an RTS camera that responds to WASD input and the ability to select units. I also have some basic movement I can do pragmatically, but it’s quite unpolished. I don’t have mouse-movement or the ability to deselect units. Before I get into all of that I’m wanting to refactor my codebase, mainly so I don’t have to rewrite code later.
The biggest problem is that all of my unit selection logic is within an Character class itself and some of the functionality I need, input handling, is rooted in PlayerControllers. Ideally, I’d have an ARTSPlayerController that deals with RTS input, and an ARTSAIComponent that handles that input. That to me seems like a solid design, but I only have a couple months experience with UE.
I want to stay within the reason and logic of the UE4 framework, so my code is accessible to anyone who understands UE4. Does anyone have any suggestions? Knowledge on the proper way to divide up implementation within the framework provided?
RTS always has been the forgotten game type for most engines, and this forums is not really different in that manner. But, by looking at the UE4 Roadmap youll see that they are planning to release a RTS game template in June, since June is almost over it’s might be delayed by a few days/weeks but my best advice youll be to wait for that template to see how people that built UE4 are seeing the way RTS should be done. Don’t expect a full game but it’s should give you a good starting point by looking at other templates
RTS are less forgotten, just tend to want engines with different feature sets. Case in example, Unreal’s networking system is largely unsuitable for an RTS. You’d probably have a hard to getting something working very smoothly, though it’s certainly quite possible to do things reasonably well so long as you stick with a fairly small scale.
Yeah, most RTS games use the lockstep model of networking to keep everyone synchronised (sacrificing latency in controls for the much improved bandwidth usage and accuracy by only networking player input). Sadly this requires the game to be entirely deterministic, which UE4 doesn’t have good support for as it’s inherently not a deterministic engine as far as I’m aware. They’ve said in the past that they’re confident that the networking model used here wouldn’t be too bad even for an RTS nowadays (presumably because we have more bandwidth with broadband etc now), but I’ve yet to see an example of this. Perhaps there are some recent RTS games that don’t use lockstep and still have large numbers of units? I think Planetary Annihilation is using a slightly different/unique model for example, they’ve actually written a blog post all about it.
I saw that some times ago, very interresting read. Since then I’m working on a proto on Unreal with something similar, it’s far to be done but I think it’s possible to achieve it on a smaller scale since they are aiming to allow up to 40 player in a game and they require cloud to handle that. They are also saying that multiplayer will require about 1mbps of bandwidth which is kind of big for some people. But that system is really interresting and would put RTS to a whole new level, the possibilities are almost infinite compared to the old lockstep model
Those were really fascinating reads. I was 100% sure that there was no way we could escape the lockstep model.
However, I am still on the fence. One of the biggest issue that had to be handled was that you could have two different scenarios happening on two different machines. Let’s consider a tank moving forward with an ennemy bunker on its right. The human player behind machine A (with a good connection) orders the tank to attack the bunker. On machine A, the tank stops, shoots at a bunker and the bunker explodes. On machine B (with poor connection), the tank keeps advancing (typically because it hasn’t received the updated “curve” yet) and the bunker doesn’t explode. At some point in the future, it receives the updated curve, how should it “go back in time”?
Well you’ll have to make some choice like for every other type of game. The server only have to send what player B can see instead of the whole game at every turn so it’s should reduce bandwidth until late game. Also if someone lag it’s only affect him instead of every players in the lockstep model. In the end I guess you’ll have to put some code that let everyone know if someone lag really bad so everyone will be aware of that, especially the player who is lagging.
On the blog he say they are aiming 40 players with 1mbps so if you go with a more reasonable amount of players like 8 we typically see in RTS the bandwidth should not be too high.
In your exemple the bunker will be destroyed for everyone since it’s destroyed on the server, as for player B one way would be to put the game on fast forward as soon as he receive the update until he get in sync with everyone else, something similar to what you see in shooter games when lagging a bit too much.
One more though, RTS is the only genre that almost didn’t evolve for decades and the biggest reason is the lockstep model. Some might think its a bad idea to not use it and wonder what will happen if someone lag too much, but in the end games would never evolve if people always made games for those with old hardware or bad connection. In the end even the lockstep model don’t really care about them since they are always being kicked from games.
Planetary Annihilation’s solution is a solution, though it isn’t ideal:
You need to have a pretty large scale game to be able to afford this kind of infrastructure. 1mb/s down isn’t too bad for the end user as a client, but being able to supply that kind of bandwidth to your end users is going to cost a lot of money.
This isn’t true at all - the RTS genre is relatively new and has only been around for two decades (Dune 2 emerged back in 1992) - so to say it hasn’t evolved for decades really isn’t fair. Lockstep networking is not something that has affected the design of RTS games from a gameplay perspective and the genre has diversified a lot since Dune 2.
They stated they will need Cloud for bigger games while people could host games on a smaller scale. Even with enough bandwidth i dont think a computer would handle calculating everything for 40 players while rendering the game at the same time but for like 8 players or so yes.
Well decades was more an expression but yeah for me Dune 2 is considered the “first RTS” i spent so many hours on that game. Few years later multiplayer RTS came out and since then nothing has changed that much. Just look at Starcraft vs Starcraft 2, if you remove the graphics (only eye candy) its almost identical to Dune 2 in terme of gameplay. For me the only company thinking out of the box was Relic by releasing Homeworld in 1999, it’s still one of the best if not the best RTS i’ve ever played but never been as popular as StarCraft or C&C. On the other hand RPG and FPS evolved during that period of time. DOOM was released in 1993 and was using a lockstep model then Quake and other games began to use a client-side prediction. At first its was chubby but now that system works pretty well and allow way more liberty in term of gameplay and more and more up coming titles are “always connected” allowing people to join your game at any time, for the good or the bad, you decide But lockstep will never allow these kind of things
I mean one could make the argument that the Lockstep model is dated… I mean if you look at when it was originally put into use for games, bandwidth and large server based games were not really a common case. I don’t think there is anything wrong with making a fully server authoritative RTS… we already see them with games like League of Legends or some of these other Moba games which at their core are just RTS games.
Furthermore I think you could get away with a similar lockstep model or something very close to it in Unreal without having to hack a bunch of the network model since you have rather granular control over replication. Actually thinking about it you could easily make this model work if you just didn’t use the standard movement model Unreal uses by default.
I’m not inclined to disagree. I would certainly still consider using some of the same concepts behind lockstepping to ensure that the game simulation remains accurate when bandwidth or latency starts becoming an issue, as in strategy games the game state tends to be more important than the pacing. Unit movement is certainly the first place I’d look to start making some optimisations and change the way things are handled in networking. I’ve thought about how to do this, but haven’t experimented with anything enough to lay down some solid guidelines.
Starcraft is a pretty cherry picked example, as we always knew it wasn’t going to deviate from the formula that made it what it is. You can however look at more modern games like Supreme Commander and Company of Heroes or even Battle for Middle-Earth and compare them to Dune 2 - those games still retain the core RTS formula (base building and producing / ordering masses of units around). but the mechanics have devolved in different fairly directions.
Does anyone of you guys know if we have a test-case of that sort of some caliber already out there? If not then I will start nibbling away at my own, but I have no idea what to expect.
Epic should release a RTS game template with the 4.5 (if not delayed) so i’d say just wait for that version to see how they have done it and build from that.