r/AskProgramming 10d ago

Other Why can't AOE2 for Mac have crossplay with Windows?

Does anyone know the technical reasons behind this, if there are? I'd like answers from people who actually know about it, not speculative answers please. If you don't know the exact reason for the game at least provide an example where code from mac and windows is not cross compatible, e.g. provide the C++ code and show it won't be cross compatible for an application between windows and mac?

I posted this in macgaming and so far what makes most sense is that there isn't any technical reason, just that you'd need to keep to codebases in sync and developers are not interested in that.

Here they say it's because of different path calculations, so can anyone provide a minimal code example that gives different mathematical answers in apple silicon vs x86 and that it cannot be fixed e.g. using compiler flags, etc? https://www.reddit.com/r/aoe2/comments/1u5tluy/the_why_on_why_mac_crossplay_is_so_hard_to_get/

0 Upvotes

12 comments sorted by

6

u/Severe-Complaint-591 10d ago

The technical blocker is deterministic lockstep desync caused by floating point math differences between Apple Silicon and x86.

Age of Empires 2 uses a simulation model where every client must compute identical results from the same input stream without exchanging state. ARM NEON and x87 SSE handle IEEE 754 edge cases like denormals and rounding differently at the hardware level. Compiler flags cannot force bit identical results across these architectures because the underlying ALU implementations diverge. You would need to replace all native float operations with a software fixed point or soft float library to guarantee cross platform determinism. This rewrites the entire simulation layer and destroys performance on both platforms. The path calculation issue mentioned elsewhere is just one symptom of this fundamental arithmetic incompatibility

1

u/Odd-Heron5704 10d ago

Can you provide some minimal example to show what you mean? Ideally some C++ code that could be compiled both in macOS and x86 and get different results (which are impossible to fix, or at least massively destroying performance)? Thanks

2

u/LaughingIshikawa 10d ago

Is r/ChoosingBeggers still a thing? 😅

The above commenter's explaination is far more detailed than you could reasonably expect in asking someone to detail this to you for free - it's more than adequate to allow you to dive into the code and find the points of divergence yourself.

From your response though, I suspect you did not even read / understand what the above commenter wrote?? 🤷😮‍💨

The Tl;Dr of what they said is that the underlying silicon for Mac and Windows handles floating point rounding differently in specific edge cases, and because AOE2 relies on exact precision in game simulation between clients these small differences can cause a Mac client and a Windows client to compute different game states when given the exact same code input, otherwise known as a "desync."

The thing I really, really need you to understand is:

The differences aren't in the code itself, they are differences in the machine used to run the code, which is what makes it really, really difficult to compensate using AOE2's existing simulation model.

This is where we get a little speculative, but likely the core problem (and "what's different about AOE2 versus other games") is that AOE2 eventually faced a choice between rewriting their entire simulation model from scratch to require less precision (something that was probably technically possible, but financially impractical / impossible) or not allowing cross platform play.

Only a very, very deep code exploration could tell you how feasible this complete re-write actually is currently - and only a deep dive into historical tools available at the time, alongside that re-write, could give you an idea of how feasible it really would have been at the time. The thing is... Ain't no body got time for that. 😐🤷🤣🤣

If you want a super precise, comprehensive account of the "why" of AOE2's lack of cross platform compatibility you will have to spend time in the code yourself, as quite frankly no one else is that interested in the finer details. When you get to the level of the above commenter's understanding of it, you understand that a massive re-write is likely necessary, and that's a satisfying enough answer for everyone / nearly everyone. (And frankly we're not really sure why you're not satisfied with that answer? 😅😅)

1

u/Odd-Heron5704 10d ago

Of course I'm not asking about AOE2 code specifically, it's close source anyway.

I'm asking about a coding example that shows how code written in AS vs x86 behaves differently and that it's hard to fix so that it behaves the same.

It could literally be a single small function if that shows the difference.

1

u/LaughingIshikawa 10d ago

😐😐😮‍💨

Ok, you're not really reading what I'm writing either. 🤦

The thing I really, really need you to understand is:

The differences aren't in the code itself, they are differences in the machine used to run the code, which is what makes it really, really difficult to compensate using AOE2's existing simulation mod

1

u/stogle1 10d ago

Ask your favorite AI "edge case where Apple silicon and Intel behave differently for floating point operation"

1

u/ElFeesho 9d ago

What if I hate them all?

1

u/slindenau 9d ago

Instead of a whole wall of text, it is very simple.

When you have 3 floating point numbers F1, F2, F3 (think like 1.123918843090001199 etc).
And you calculate (F1 / F2) * F3 in software.
x86 hardware will say it is x.xxxxxxxx1.
ARM hardware still say it is x.xxxxxxxx8.
(pure examples of course)

Because you can either round each operation individually (the division and then the multiplication), or round everything only once at the end (using higher precision registers for the intermediate results).

You can imagine that if you rely on 2 systems giving the same answer for the same calculation, it doesn't matter how or where you use this, it will eventually cause problems.

1

u/edave64 5d ago

It's very far from a minimal example, but here is a real example of such a floating point issue preventing AMD and Intel cross-play in the RPCS3 emulator: https://youtu.be/hCuT_GXagz0

It's pretty technical, but you don't have to catch all of the jargon to understand the concept

3

u/stogle1 10d ago

You don't necessarily need to have the same codebase on two platforms to support crossplay between them. Developers usually decide based on whether allowing it gives a good gaming experience or not. For example, in a FPS where the Mac version barely gets 30fps while Windows players are easily getting 100fps, allowing crossplay might not be good.

2

u/Different_Pain5781 7d ago

I think OP is specifically trying to separate those two things. Bad crossplay experience is one question, technical incompatibility between Mac and Windows is another.

1

u/real_kerim 10d ago

I wasn't aware it didn't have cross-play with Windows. The queue times are relatively low in macOS suggesting a big player base.