Hacker News new | ask | show | jobs
by chowells 2068 days ago
If that's true, why is it an issue John Carmack discusses as affecting difficulty of writing games that work correctly in modern environments?

> When you start thinking about running, say, all the characters in a game world in parallel, it starts sinking in that the object-oriented approach of updating objects has some deep difficulties in parallel environments. Maybe if all of the object just referenced a read only version of the world state, and we copied over the updated version at the end of the frame… Hey, wait a minute…

https://gamasutra.com/view/news/169296/Indepth_Functional_pr...

1 comments

Games usually don't run the characters in parallel for the reasons Carmack stated. I believe he's arguing a hypothetical: if we want to maximize parallelization, what else can be parallelized? What patterns would or would not work in that case?

There was a talk by Carmack where he brings up another challenge with parallelizing characters where two characters want to move to the same location.

So... Most games ignore modern hardware capabilities in order to support a fragile programming model? That doesn't sound like an argument against my point. My point was that mutation makes it harder to get code correct. If the only way you can do it is by refusing to use more than one thread of execution for calculating game state updates, that's not evidence that there's no problem with that approach.

Of course, this does vary heavily by game. There certainly are games that run their world simulation across multiple threads. https://twitter.com/axelgneiting/status/1241487918046347264 is a pretty awesome note about that in the Doom Eternal engine, for instance. But I'm certain getting that to work required very carefully controlling when and how mutation happens.