This is another “not sure if anyone else would want this” thing, but here’s a module providing a “worst case” gameworld for performance testing: worstCase github repo.
By default during preinit the module’s worstCase
singleton will generate a 400-room random map consisting of four connected “zones” (in a 2x2 grid) each consisting of a 100-room random maze (in a 10x10 square).
An NPC will be generated for each room. Each NPC picks a random NPC other than themselves.
On every turn each NPC will attempt to move toward the NPC they picked.
Basic usage is just compiling with the simpleRandomMap
and worstCase
modules and the -D SIMPLE_RANDOM_MAP
and -D WORST_CASE
flags.
To place the player in a random place in the map you can use worstCase.putInRandomRoom(me)
(where me
is the player object).
The module provides a >WCM
(worst case map) action that will display an ASCII art map of the gameworld. Each tile will be one of:
@
for the player’s position.
for an empty room0
through9
to indicate the relative number of actors in the room (auto-scales for the number of actors in the game)
You can change the size of the map by setting worstCase.zoneWidth
and WorstCaseMapGenerator.mapWidth
. For example:
// Create a 1x1 grid, or a single zone.
modify worstCase zoneWidth = 1;
// Each zone will be a 3x3 maze, or 9 rooms.
modify WorstCaseMapGenerator mapWidth = 3;
Like I said I’m not sure if anyone else will find this useful. I put it together as part of refactoring…a bunch of stuff. I re-did a lot of my low-level datatypes, including the graph stuff, which in turn resulted in a refactor of my precomputed pathfinding module. This came out of performance testing of that—I wanted an easy way to do A-B testing across multiple different module versions (as well as comparing to the stock adv3 pathfinding).
As written the default gameworld takes stock adv3 a little over seven seconds a turn on my desktop; with the precomputed pathfinding it’s under a quarter of a second (which appears to be an approximate lower bound on updating that many NPCs in a turn).