News for hackers. Stuff that matters.
Re:Why Rust Is the Future of Game Development by gtaylor on Monday November 09, 2020 @01:37PM (#25038007)
What makes games more likely to lean on global state than other kinds of applications?
Re:Why Rust Is the Future of Game Development by samatman on Monday November 09, 2020 @02:36PM (#25038856)
The main problem which global state introduces, is making the bad assumption that there will only be one example of a given sort of data.

In games, that's a safe assumption for many parts of the system, since you're definitely only going to be running one instance of the game world at a time. So making that state private just means you have to pass around references to it on the stack, and keep track of what you're doing.

Re:Why Rust Is the Future of Game Development by Animats on Monday November 09, 2020 @02:41PM (#25038927)
Classic webcrap is near-stateless, with state in the database only. That way, any server in the farm can handle the next client request. Games have a consistent world to maintain in memory. Sometimes a really big consistent world.
Re:Why Rust Is the Future of Game Development by moth-fuzz on Tuesday November 10, 2020 @03:27AM (#25043837)
I feel like this is an underrated sentiment. A lot of Rust’s design decisions (lack of inheritance, borrow checking, immutability by default) are complete non-issues when you’re reading a JSON string into some business struct or an enum and then serializing it back out to a DB again. Everything can be flat data types and functions can be pure and stateless.

But not if you actually have to keep things around in-memory. Then all the sudden your functions can’t be pure, you have to add additional parameters to each method to account for additional state, and you can’t design flat structs anymore since you have many different object types and they have to go somewhere and you can’t just declare N variables line by line. So you have to grapple with the limited definition of trait objects, or non-extensible enums, or throw everything out and use Any. It gets complicated.

Re:Why Rust Is the Future of Game Development by gameswithgo on Monday November 09, 2020 @01:38PM (#25038021)
Maybe games are more likely to lean on global in memory state, instead of the global state being in a database.