Faster testing environment
-
Right now, I'm trying to add features to get a better survival score. Unfortunately, testing these is a huge pain, since many of them depend on having a good number of enemies of varying types around to attack; my current approach is to start a simulation round on max speed, wait until round 1200-2000 or so, and then start paying attention to see what's happening, pause and tweak as appropriate.
This is aggravated by the dynamic nature of javascript; it's not unusual to suddenly start seeing errors due to mistyped variable names (or similar stupid issues that a type system would catch) in the console during a simulation (or survival game). At least in the simulation I can pause it and see what's going on; in a survival game, I just have to do my best to read the messages scrolling by. And half the time the bugs go away due to creeps dying, and there's no easy way to reproduce them.
I could probably set up a test environment in the custom mode simulation, but my guess is that that would be more effort than writing my solution so far (and, AFAICT, would have to be re-done manually for each run, though I may be mistaken).
One solution I see would be to allow skipping ahead in the survival simulation (e.g., just set the tick counter to 2000 so that the round 2000 attackers show up now.) I'd love to see something better, but anything would be better than the current situation.
-
Another thought - simple "rewind" and "step" functionality for simulations. If I could go back to the previous tick and rerun my code with fresh debug statements, that would at least solve the problem of reproducibility, if not finding bugs in the first place.
-
Be sure to use strict mode by adding
"use strict"
at the top of your files.Also, see this answer to another question. Particularly this bit:
Also, soon after the release, we're going to publish the game engine as a standalone node.js package in order for you to be able to launch the game simulation completely locally and thus test your own scripts.