diff --git a/lib/service/configuration_service.dart b/lib/service/configuration_service.dart index d8c6084..93b89d7 100644 --- a/lib/service/configuration_service.dart +++ b/lib/service/configuration_service.dart @@ -6,6 +6,12 @@ class ConfigurationService { bool showGrid; int _simSpeed; + + /// Simulation Speed + /// + /// Sets the number of updates the simulation takes per second. Can range from + /// 1 to arbitrarily high numbers (though setting it too high can potentially + /// make the app brittle). int get simSpeed => _simSpeed; void set simSpeed(int val) { _simSpeed = val; diff --git a/lib/src/Engine.dart b/lib/src/Engine.dart index d15987d..be3f31f 100644 --- a/lib/src/Engine.dart +++ b/lib/src/Engine.dart @@ -6,8 +6,19 @@ class Engine { // Elapsed Time Counter - useful for Safety Timeout Stopwatch _elapsed = new Stopwatch(); - // Game Tick Rate - *does* impact game speed TODO add configurable option + /// Game Tick Rate + /// + /// *does* impact game speed; dictates how long each logic step takes. Only + /// interesting for engine internal calculations, to set simulation speed + /// from the outside use stepsPerSecond instead. int _MS_PER_STEP = 1000 ~/ 3; + + /// Set Logic Updates per Second + /// + /// Dictates simulation speed. Sets the amount of (logic) updates per second. + /// Translations between number of updates and their timings is not exact so + /// comparing this variable to fixed ints might not yield the expected results. + /// Does not affect render frequency, which is handled by framesPerSecond. int get stepsPerSecond => 1000 ~/ _MS_PER_STEP; set stepsPerSecond(int val) => _MS_PER_STEP = 1000 ~/ val;