Code Review May 2021 - theRAPTLab/gsgo GitHub Wiki

keeping some informal notes as I look at the current codebase in detail.

API-SIM

  • GLOOP_LOAD is probably a vestigial phase group
  • the implementation of GLOOP_PRERUN doesn't quite fit the simulation model; it's being used to imperatively execute a series of commands instead of reflecting exclusive state event
  • GLOOP_PRERUN is also missing UPDATE; in practice this should be an alternative version of GLOOP without the AI and game logic bits
  • Instead of thinking in terms of "starting" and "stopping" the simulation, you want to control active feature sets based on control flags running off the master clock. The master clock should always be running. The simulation start/stop controls just tell the simulation to stop running the ai; elapsed simulation time is a separate property.
  • SIM_RATE is related to the above; this isn't the way to do it because it creates cascading dependencies that break features that rely on a master clock (e.g. UPDATE)
  • Again: master clock !== simulation clock
  • The units of the master clock is currently frames, because these are integer types. We probably need something that converts the framecounter to actual time, as well as maintaining the sim timer.
  • There are PHASEMACHINE hooks to the UR loop, and they are also used to trigger the simulator initially. The unexpected use of PROJECT-DATA to also control the simulator compounds the issues with controlling the simulator
  • monitor_Step() also hooks into the RXJS stream that drives m_step(). Dunno if that is intentional or being clever about subscribers.

PROJECT-DATA

  • This module unexpected also controls the simulator through API-SIM, invoking the Reset(), Start(), and End() methods.
⚠️ **GitHub.com Fallback** ⚠️