News for hackers. Stuff that matters.
Re:Cosmoteer: A starship design, simulation, and battle game by cpeterso on Tuesday September 17, 2019 @07:09PM (#21000997)
> Important Note: Multiplayer is NOT SUPPORTED between 32-bit and 64-bit operating systems!

Does the network protocol pass unsized integers or data pointers between clients? What other CPU architecture dependency might prevent 32-bit and 64-bit clients from playing together?

Re:Cosmoteer: A starship design, simulation, and battle game by waltdestler on Tuesday September 17, 2019 @08:01PM (#21001279)
Cosmoteer relies on deterministic floating point calculations to keep the multiplayer simulation in sync between computers. Cosmoteer is also written in C#/.NET, which uses SSE instructions for 64-bit and FPU instructions for 32-bit, which can produce slightly different results.
Re:Cosmoteer: A starship design, simulation, and battle game by gridspy on Tuesday September 17, 2019 @09:04PM (#21001599)
Oh no!

Perhaps you need to either switch to a deterministic physics approach with fixed point math or do some research on float determinism (which is much harder).

Or, give up on lockstep and move to client-server replication with prediction on your own ships?

Re:Cosmoteer: A starship design, simulation, and battle game by waltdestler on Wednesday September 18, 2019 @10:54AM (#21006043)
I've looked into all of those things in the past:

- Making C#/.NET floating point deterministic across x86/x64 is not possible, there's no way for force the JIT to output a specific instruction set.

- Client/server with prediction works for games that have relatively low numbers of objects that need to be synced (i.e. most first-person shooters). It doesn't work well when a game has thousands (or in Cosmoteer's case, tens of thousands) of individual objects that need to be synced, the bandwidth and CPU costs of keeping those synced is astronomical. Originally that's how Cosmoteer's multiplayer used to work, and it was a disaster, plus the code to keep everything in sync was insanely complicated.

- Switching to fixed-point is the only remotely-viable option you suggest, and I've strongly considered it in the past. But it'd be a huge amount of work to port all of the floating-point code to fixed-point, and there would likely be a significant performance loss in doing so. Since 32-bit users are only about 2% of all Steam users, I think it's not worth doing.

Re:Cosmoteer: A starship design, simulation, and battle game by gridspy on Wednesday September 18, 2019 @07:54PM (#21011811)
Based on playing your game, it seems you need to sync:

4 bits per object - Reload / capacity status (This is mostly visual for other player's ships)

2 bits - number of people manning module

Damage (4 bit?)

Location (x y), current orders (move, direction, orbit) per Ship

For bullets:

Bullet / missile location, velocity / goal.

Most ships have 20-200 modules? So one packet (~400 bytes) per ship? Plus a "Ship came into visual range" packet with ship layout data.

All the little people, treat them like a client-side effect. Completely predicted for other people's ships. Run the same logic on both based on the network synced capacity status.

Either change your model to predict X time to move resource from A .. B (carried by a person) or have each client claim time spent. It is highly unlikely that a player will observe another player's ship and say "But that person just carried X to Y but the levels didn't move!" So it's a case of each client saying "My ship's module's levels (based on crew) are currently XYZ" and the server / other client going "Hmmm, yep, seems feasible. OK"

It can be done, it's not impossible. Just work - it's a design choice.

I would argue that as long as the ship (as a whole) is controllable but still fully customizable people won't worry about faithful sync of other player's ships. And they will only care about accurate people in the ONE ship they are currently editing (fully zoomed in, no roof).

Re:Cosmoteer: A starship design, simulation, and battle game by cobalt on Tuesday September 17, 2019 @11:46PM (#21002231)
sure, if you want to pay them to do that
Re:Cosmoteer: A starship design, simulation, and battle game by gridspy on Wednesday September 18, 2019 @12:08AM (#21002306)
Hey, it is just what I am planning to do on my own game. Supposed to be kind advice. Surely they don't want to split their user-base?
Re:Cosmoteer: A starship design, simulation, and battle game by TheRealPomax on Wednesday September 18, 2019 @12:30AM (#21002394)
Is there anyone left on 32 bit at this point in time on their daily driver? Windows, Linux, OSX, they've all been 64 bit for many iterations now.
Re:Cosmoteer: A starship design, simulation, and battle game by cpeterso on Wednesday September 18, 2019 @02:15AM (#21002764)
About 24% of Firefox users still run a 32-bit OS, though gamers probably have newer hardware and software than the average Firefox user. See "Browsers by Architecture" in the Firefox Hardware Report for a graph over time:

https://data.firefox.com/dashboard/hardware

Re:Cosmoteer: A starship design, simulation, and battle game by Quarr on Wednesday September 18, 2019 @06:04AM (#21003728)
The Steam hardware survey suggests fewer than 2% of users are on non-64-bit OSes. There are more Mac users (~3%) than 32 bit users.

https://store.steampowered.com/hwsurvey/Steam-Hardware-Softw...

Re:Cosmoteer: A starship design, simulation, and battle game by TheRealPomax on Wednesday September 18, 2019 @01:23PM (#21007671)
As depressing as it is to say this: Firefox's marketshare is so low that we really need the Chrome numbers here. 24% of a <10% market share means "quite likely around 2.4% globally". That's basically a number that says "safe to entirely ignore in terms of userbase support" =/
Re:Cosmoteer: A starship design, simulation, and battle game by gridspy on Wednesday September 18, 2019 @08:01PM (#21011856)
This is only true if you think that the Firefox demographic is skewed towards 32 bit computers.
Re:Cosmoteer: A starship design, simulation, and battle game by TheRealPomax on Wednesday September 18, 2019 @09:50PM (#21012459)
other way around: it assumes most non-firefox users are on 64 bit, which is a pretty reasonable assumption given Apple's hard push for 64 bit (so that's the OSX-ers covered) and Chrome's "we've made finding the 32 bit installer _really hard_ because we don't want you to use it" move. I'm sure there are some 32 bit users in both segments, but far less than you'll find in firefox land.
Re:Cosmoteer: A starship design, simulation, and battle game by romwell on Thursday September 19, 2019 @03:52AM (#21014218)
I do have a 32-bit device (Asus T100 netbook/transformer) that I use regularly enough for it to be a 'daily driver', especially when I travel.

But I'd be OK with this limitation :)

Re:Cosmoteer: A starship design, simulation, and battle game by jtolmar on Wednesday September 18, 2019 @02:40AM (#21002880)
Try adding an occasional pass that rounds or truncates all your floats (maybe once a frame, maybe less). It's not really "supposed" to work in any bulletproof way, but for a given game there's usually a reasonable rounding factor that'll fix things faster than floats diverge.
Re:Cosmoteer: A starship design, simulation, and battle game by magicalhippo on Wednesday September 18, 2019 @11:14AM (#21006256)
Not all instructions are required by IEEE-758 to return the exact same result between platforms.

Though I guess the errors might be too small to notice for most object in this game.

Re:Cosmoteer: A starship design, simulation, and battle game by mattnewport on Tuesday September 17, 2019 @08:05PM (#21001291)
If they're using lock step deterministic networking like many RTS games then simulation results using floating point can differ between 32 bit and 64 bit machines (or between release and debug builds on the same architecture).
Re:Cosmoteer: A starship design, simulation, and battle game by gridspy on Wednesday September 18, 2019 @04:17AM (#21003298)
Perhaps someone will benefit from a more detailed explanation:

To be more specific, some CPUs will increase or decrease the accuracy of floats in some situations.

Different CPU instructions will do different things. For instance a "multiply and add" instruction might store a high resolution float, where a different approach would suffer an expected rounding error.

If two computers get different answers in the maths, their simulation of the world drifts apart over time. Then they start to disagree on what is happening.

When you change compiler settings, platforms (32/64/windows/mac/linux) the compiler is likely to make different choices about which instructions to use where.