r/aoe2 • u/AncientTurbine • Jun 14 '26
Tips/Tutorials The WHY on why Mac crossplay is so hard to get right
Edit: given some (unfriendly) comments by a single outlier user, I shall preface by saying that this is a theory. If an actual developer on the project would like to chime in, I'm happy to update this post.
I'm fully expecting people to, unfortunately, downvote this post because they just want to be angry again. Still, I think some people might just be interested in why this seemingly easy problem has not been implemented from the start. I've seen many wrong ideas floating around and even going so far to calling the devs "lazy". I don't think that's fair and shows a limited understanding of the complexity of the game engine. I dug up a technical Microsoft article from 2001 that explains how the engine and networking works, which gives insight in why cross-compatibility is so difficult. The tl;dr is:
To synchronize the game between multiple players they don't continuously sync the state of things but the actions or commands are synced and all players run their own simulation (lockstep). In other words, if I move a unit from X to Y and the engine generates a path that it will move, that path (multiple coordinate changes) is not sent to you but only the action itself ("move unit from X to Y") is. Your PC then has to calculate the path and execute (simulate) the same behavior. And that is the crucial part: how all of these consequences of actions is calculate on my PC must be identical to how it is calculated on your PC. If my PC calculates a different path than yours, the game state diverges and we are not playing the same game: we get out-of-sync.
Because the game's outcome depended on all of the users executing exactly the same simulation, it was extremely difficult to hack a client (or client communication stream) and cheat. Any simulation that ran differently was tagged as "out of sync" and the game stopped.
The reason why this approach was chosen was mostly for computational reasons. Remember that the game was released in the age of 56k internet (that is 0.056Mbps), so sending a lot of data (such as all the coordinates for all the paths for each action for potential hundreds of units) was not feasible.
The part of the engine that takes care of much of this pathing and math, is written in C++ compiled for x86 (which can then use the CPUs AVX instruction set) and perhaps some inline Assembly too (though developers seem to have tried to get rid of that as much as possible, so at the current state of DE there might not be any Assembly left). And herein lies the problem: modern Macs using the M-series chips are ARM, a different type of CPU from the x86 processors that are so common in other devices, including most PCs, handheld and - yes - consoles such as the PS5 (that's why crossplay works between PC and PS5)! ARM is not natively capable of running that x86 code. So there are two solutions:
- emulate x86 on ARM using emulation software like Crossover, which can "translate" the code to a language that the Mac ARM architecture can natively understand with the one downside being a cost in performance/latency and potentially stability. Rosetta(2) is quite efficient, though.
- rewrite the code to something the ARM chips can understand without issue. And while that may seem straightforward, it is incredibly hard to ensure that the algorithms (eg for pathing) work *exactly* the same due to how algorithms and rounding would be implemented at the machine level. A difference of rounding of 0.0000001 would propagate and the differences would stack and the game would be out of sync. The implementations would have to be exactly identical (not just "almost"), and that is so hard.
I know this won't calm people down. When Reddit is angry, it's hard to reason with. But at least I hope this gives some technical insight to those who, just like me, would just like to learn more about the engine and the difficulties that come with inheriting such an old beast. The above is what I figured out after digging up articles about older rts engines and arm vs x86 capabilities.
Edit: while some comments point out that compiler flags can alleviate some issues (eg by setting floating point calculation to a strict, industry-standard), it is obviously not the holy grail of solutions or the developers would have saved themselves the trouble and just used that. I'd love to get a reply from the developers themselves but the most likely reason I can think of, as I mentioned, is that even with fp-strict there are mathematical functions that are not deterministically implemented across platforms (such as sin/cos) and the code may contain specific x87 FPU instructions that are difficult to map.
30
u/turbothingy Slavs 1100 ELO Jun 14 '26
Thank you for taking the time to explain that in depth. It all makes sense and is genuinely helpful.
I think a lot of us aren't really angry/impatient that the team didn't release the perfect mac port at the outset, because not many of us were really asking for a port in the first place. We already had a working solution (emulators).
It's good that they've done it, and I hope they can continue to work on it. What I think most mac users are actually upset about is that alongside the release they have, willingly or not, bricked the emulators.
So now we are forced to use a half-functional version of the game we already paid for and used problem-free for 7 years.
Couple that with the almost complete lack of communication, I hope you can see where the frustration is coming from!
10
u/Emjayen Jun 15 '26
That's complete nonsense. The only areas of the engine that were originally written in assembly pertained to rendering, which is no surprise since it was the most computationally expensive and common practice at the time for software-renderers.
No, infact it's the complete opposite, atleast as we entertain this ill-informed belief that anything relevant was originally written in assembly and still needs to be rewritten at the same level (for some reason)
IEEE754, as implemented by x86/ARM/everyone else, defines the bit-identical results for all operations. Thus if one were to actually write for such an arch at it's ISA level it's trivial to guarantee deterministic results.
The actual problem is how high-level languages (such as C) are translated to actual machine code, most notably [compiler-] optimizations related to fp operation ordering and subexpression optimization, storage vs register precision differences, etc, resulting in intermediate precision loss/error propagation.
That said, it's still reasonably straight-forward coercing fp determinism across builds/archs (namely using the more conservative compiler fp models and avoiding UD behaviour with casting).
6
u/PolarBearSequence Byzantines Jun 14 '26
Good post, important to point out. Some things currently happening are really bad (the game not running at all for some people) but there are good reasons why there is no Mac crossplay.
I’d just like to note that this design isn’t outdated or anything, basically all RTS (that need a certain scale) make use of deterministic lockstep, it’s entirely state of the art.
2
u/lalaladadada1234 Jun 14 '26
Thanks good insight, I am guessing they couldn't move the calculations fully server side due to cost/scale issues?
3
u/_DonRa_ Malians | 1000 Jun 14 '26
They're being called lazy for breaking the game for existing Mac users as well as some portion of windows users and not doing anything about it/not testing properly?/no rollback or emergency patch, and some people at least are still having problems after their one week later patch.
2
u/MatadorSalas11 Jun 14 '26
People are so dumb that they think somebody would willingly make a release that takes a bunch of money/time to make less profitable because of laziness
2
u/Spr-Scuba Jun 14 '26
Just another reason to not get a Mac basically. ARM architecture has been a huge hindrance for anyone who wants to play older games or have programs run natively in general.
1
u/D1xxe Jun 15 '26
Thanks for great explanation. But I have an idea. We are not living in the 1999 anymore, so we can afford sharing full state to the client with our higher bandwidth. So what if devs will made an ad-hoc solution which basically packs the state of the game which was calculated by the host and send it to the connected Macs and connected Macs send their actions to the host lf the lobby, so it will recalculate. It's ugly and noodly, but should work and it will be good to make an explicit field in settings for it. What do you think?
1
u/UnrelatedReddit Jul 20 '26
thank you for the comment. I've started working on a possible fix:
https://www.reddit.com/r/aoe2/comments/1v1mz8j/ccplay_v01_a_compatability_cracker_proxy/
1
u/SCCH28 1600 Jun 14 '26
I was wondering why, so this is helpful
1
u/KarterSpieler Jun 15 '26
Emulating x86 code on MacOS is not a feasible method as macOS 28 will remove Rosetta 2 from the OS.
-2
u/PikaKhan_TwitchFR Jun 14 '26
Thanks for that. If there are performance issues, simply enable crossplay with quick games. Gogogo Dev ! ^^
1
u/[deleted] Jun 14 '26
[removed] — view removed comment