GameRunnerclass is responsible for initialising the games' components in order to spawn a new game. It holds a reference to these objects and has some getter functions defined in order to spawn or delete new users.
update()function which runs in a loop at 2 seconds intervals. This constantly uses the embedded communicator object to get the game metadata from our Django API url.
GameRunnershould be the only class which has interactions with both simulation logic (avatar wrappers, game map etc) and worker logic (
WorkerManager). This is an important decoupling.
GameRunnerupdates the avatars and the simulation.
SimulationRunnerupdates the environment (through the
map_updaters.py) and is responsible for running a turn in the simulation.
run_turnmethod is called from
GameRunner, and it runs as follows:
AvatarWrapper's to deserialise and register their actions.
applyfunction only if the action is legal. Legal actions for
rejectfunction, applied when the actions are illegal. The
PickupActionfor instance can be rejected if your backpack is full or if there's no artefact on the cell, and in this case error messages will be printed out to the player console.
Interactableis a dynamic object that exists in the
Interactablehas 1 or more conditions it's checking for. Once the conditions are met, it will apply any effects it has to 1 or more specified targets. Currently the only compatible target is an avatar.
False. Each turn, all of an Interactable's conditions are evaluated to see if its effects should trigger.
WorldMapfor their checks.
effectsattribute with which to store its active effects.
Interactable. It is an object that can be picked up by the avatar. When picked up, it disappears from the map and generates an effect.