Skip to content
This repository has been archived by the owner on Apr 6, 2020. It is now read-only.

Global State

Kevin Evans edited this page Jul 13, 2016 · 1 revision

In our client, we are using Redux to store the current state of the game. The state contains things like who is currently signed in, what server we're in, what the current player's health is, the current inventory, the objects around us, and so forth. Think of it as a huge object, like {user: {health: 50, location: {x: 123, y: 456}, ...}, world: [...]}, etc. Considering that objects have O(1) access in javascript, since they're usually hash maps, they can be accessed and modified extremely quickly and efficiently.

Generally, whenever we get a packet, we update the state (although sometimes we don't).

Clone this wiki locally