ThalesGroup / kessler-game

Kessler is a simulation environment loosely modeled after our internal project PsiBee and the external project Fuzzy Asteroids. The game has ships that shoot bullets at asteroids to gain score. Ships can collide with asteroids and other ships and lose lives.
https://github.com/ThalesGroup/kessler-game
Apache License 2.0
8 stars 5 forks source link

Store controller on ship rather than matching by id #3

Closed zachariah-phillips-Thales closed 1 year ago

zachariah-phillips-Thales commented 1 year ago

In the primary KesslerGame.run() loop controllers are assigned an ID that matches them to a given ship_id. This requires an id match check every time a ship's controller is evaluated or accessed. Ships should instead store a reference to their controller so that the controller can be access directly from the ship (useful for scoring and graphics reasons primarily).