I have nothing to show for the last week’s work on Concealed Intent. Not because I haven’t been working, but because the effort was spent behind the scenes. I have been working on rearchitecting the simulation maths (mainly for detection).
Originally all the simulation code was attached to classes representing the spaceships themselves. So a ship has sensors and those sensors knew how to detect other ships – typical OO design. However, during early testing a number of different ways were suggested to handle detection and determine lock. I needed to be able to change between multiple simulation schemes easily. Thus in the last week the maths has been put into its own class using a Strategy Pattern. This change made testing easier (so I wrote some tests – and found a few silly maths errors!) and allowed the ship classes to be greatly simplified.
After that it wasn’t too hard to create a builder system for creating scenarios. Below is the new code for creating my 2-against-1 test scenario. I think this is quite easy to understand what the scenario involves. It can get more complicated with goals and events added, but the declarative syntax remains.
So after a week, the game is largely where it started – just with more tests and easier to modify maths and scenarios. I think it was worth the effort. Next up, trying out various new systems for detection and lock.