Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<blockquote> <p>Since everyone has a different computer, this seems like a hard problem.</p> </blockquote> <p>It's not. Really, this kind of networking is quite simple, so long as you don't do anything that is undefined by the specification. <a href="http://en.wikipedia.org/wiki/IEEE_754-2008" rel="nofollow">IEEE-754</a> is very clear on exactly how floating-point math is to be done, how rounding is to be done, etc, and it is implemented identically across platforms.</p> <p>The biggest thing you need to not do is rely on SIMD CPU instructions in code that needs to be deterministic (note: this is physics, AI, and such: game state. Not graphics, which is where you need SIMD). These kinds of instructions play fast-and-loose with the floating-point rules. So no SIMD in your game code; only in the "client" code (graphics, sound, etc).</p> <p>Also, you need to make sure that your game state doesn't depend on things like the time; each game state clock tick should be a fixed time interval, not based on the PC's clock or anything of that nature.</p> <p>Obviously, you should avoid any random function you don't have the code to. But again, only for your main gameplay loop; the graphics stuff can be client-specific, since it's just visuals and doesn't matter.</p> <p>That is pretty much it, as far as keeping the two game states in sync. The compiler you use isn't going to be a big issue for you.</p> <p>Note that StarCraft and StarCraft II use this as the basis of their networking model. They both run on Macs and PCs, and both can play against each other. So it's very possible, and doesn't require Clang.</p> <p>Though if you like Clang, you should use it. But that should be because you like it, not for networking.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload