Unity built RTS game?

Does anyone know of any commercially released real time strategy game which implements multiplayer built in unity with the exception of AI Wars?

Cheers,
Pip

I don’t know of any other than AI Wars, but is there a particular reason you’re asking this?
If you’re curious to see if it’s technically feasible, it is. Just time consuming. Floating points are the devil in RTS games and AI Wars was made using ints, implementing his own math library etc.

I’ve seen a couple of nice prototypes, and yes, it is definitely possible

I was mostly curious, especially about if anyone else had done lockstep implementation.

Could you explain why? Just curious :slight_smile:

The “correct” way to do an RTS is with a lockstep, which means that the commands are delayed and will be sent to everyone else and will be executed on the exact turn with hopefully the exact same result. Floating points in Unity are imprecise IMO and I have not (yet) experimented with trying to force a higher accuracy. But they get imprecise pretty quickly and they’re just an approximation which is typically good enough for most things, but when you’re dealing with an RTS that uses lockstep everything needs to be deterministic and run the exact same across different hardware etc. Some ways are to use fixed points or force high accuracy on the floating points which is can be good enough for most of us etc.

I don’t really have a huge amount of knowledge in this area so take what I say lightly; but from what I’ve read there is a lot of different opinions, some say you should use fixed points and some say you should just force a higher accuracy in the compiler and some just use bigints and do maths with those.

Chaos theory comes into play with floating points and if there is a small discrepancy then it might eventually lead to small changes that lead to big ones that will change the whole outcome of the game, which is why they are the devil ;). There are comments from the developers of AoE and other similar games that they’ve had to deal with this issue a few times where something small leads to something huge.

There are also those people that think it’s perfectly okay to sync positions to other players etc, but the game will look and feel less smooth(please no one say “oh but with the right interpolation and extrapolation!”), use more bandwidth and probably limit the amount of units you can have as well dozens of other things that I could think up.

Wow, thanks for the long post :slight_smile: I think I get it.

Oh, I should have just said this at the end, I basically said what is a result of them but not what the problem is:

To put it simply, floating points can if used improperly result in different numbers across different hardware which is why they’re not recommended, angles might be slightly different and the positions of units can be slightly different etc etc.

Out of curiosity, what’s the harm in using a client-server model rather than the lockstep simulation? I’ve been following Planetary Annihilation (not made with Unity) and it doesn’t seem to use the lockstep model - in fact, they’re advertising the client-server model as a feature because most RTS fans are fed up with large games getting slowed down by the weakest computer.

The only disadvantage I can think of is that it would use a ton of bandwidth and be very chatty.

How so? You can get loss of precision with floating point computations but you should get the same result on all hardware afaik (well i don’t know when i say all hardware i mean on the same architecture, no clue about non PC stuff). While there is precision loss if you try to compute a value that can’t be represented accurately, the result is deterministic and well defined even if it’s lossy.

Can, like I said there is a lot of differing opinion.
For example, AI War:
link where he says:

Now, rounding can cause different results on different computers. Which is why I said if used improperly. If forcing compiler flags etc then you might be able to get the expected results, but I have not tried this thus far in Unity.

But are you sure he’s right? from the wording he may not even have tested it. Floating point IEEE is well standardized so there should be no such issue. If there are then that sounds like a mono bug?

I personally would consider it “good enough” that it’s not worth the investment in working with fixed points and making a whole new math library. I’m currently working on an RTS and thus far I haven’t seen any major issues and have run thousands of turns turns etc in varying angles and come to the same results, but I haven’t tested it over drastically different hardware. I’m also going to put in hash checks so if there are any errors, it will sync up it back up choosing a random person for it. I just haven’t run enough tests yet, but I do agree with you that it’s typically a non-issue for most of us.

It is still something people should be aware of when it comes to RTS games and something that precautions have to be taken for, if you do everything right then it shouldn’t be an issue for most scenarios(like forcing compiler flags etc).

There is a huge difference in “should not” and “does not” and if you are a big company and making a game that maybe millions will play would you bet the games success on a “should not” or do you go down the safe route of a “does not”?

Well no, it’s actually does not, unless someone discovered such a bug, so unless someone actually says it doesn’t work, there’s no reason to think it doesnt, just like 1+1 should be equal to 2, i didn’t test it, but i’m fairly confident it is.

By the spec it should work, and by the spec it should be inprecise, but predictable, just like by the spec 1+1 = 2. So either there’s a bug or there’s not, but if there’s not it’s not a “should” nor some number magic, it’s just the way it works.

Well, the standard doesn’t include things like transcendentals sin etc to my knowledge and these are heavily used in games and across a lot of different hardware there is always the possibility of something going wrong and if I was spending millions of dollars on a game that will be played by (hopefully) millions of people I wouldn’t take that chance. It’s usually precautionary and for good reason, for the rest of us it should be “good enough”.

Exactly my thought as well, i i would make a RTS i would probably not care, but then i would not expect it to generate much money either : p

I cheated a bit but managed to make a multiplayer RTS called Teroids with Unity.

And a made a single player RTS style game called Zombie Invasion of Eggland

Not exactly AAA quality but showing that you can do RTS style games in Unity.

There was also an RTS community project on here somewhere have a search for it!

Would you have a link to that? Sounds very interesting indeed.

That is the reason, it allows for very large number of units sync without being bottlenecked by the network layer. Allowing for potentially thousands of units, bottleneck becomes CPU / GPU rather then network.

Mine is here, still in WIP but have a good progression. I should commit an update soon :

http://forum.unity3d.com/threads/167770-sama-van-Final-Fight-iOS/page2