|
|
|
|
|
by tkrskxyz
1269 days ago
|
|
>Avoid bugs related to mutable state. And generate a lot of overhead both in execution time and memory. Which is unacceptable in games where every ms counts. >Games tend to define update() functions which mutate some state each tick. We can avoid mutation by taking game state as an argument and returning new state. Now our game is much easier to test too! We simply call update with some game state and assert that the result is what we expect. Imagine how hard it would be test the imperative update function! As a game dev I kinda cringe on the idea of copying WHOLE world state just to update it (and if I understand correctly we copy the state EVERY TIME we want to update i.e: from every actor instance?). |
|
https://en.wikipedia.org/wiki/Persistent_data_structure