Thursday, March 24, 2016

Eating my Vegetables

My last few months have been about infrastructure. I know that doesn't make for the best blog posts but I also want to record it because, well, it's important. We're getting ready to shovel tons of content onto this game, and the frame needs to be strong enough to support it all.

That means getting confident in the various systems that run the game. So one thing I did was eliminate several of the campaign-specific systems by merging them with the mission systems. This was a huge success: now there is one way of doing things, and it works everywhere.

The downside was that this gutted all of the campaign content I had developed, and so I needed to spend some time putting those systems back together under the new regime. That's basically done too.

Then, I ran into the problem that a lot of my code was difficult to reach. Specifically, code that controls conflicts in the campaign, mission resolutions, that sort of thing. Since I can only access that code (normally) by playing the game for a few minutes, it's very difficult to iterate on that code.

That is not acceptable. Now, I'm a happy-go-lucky sort of programmer, most of the time. I think it's ok to make mistakes and to iterate, and that well, not everything needs 100% test coverage. BUT I do strongly believe that if you can't see your code running, you're not done. And Legacy is at a point where I can't easily see all my code, so, therefore, I can't make easy progress.

So I booted up an integration test framework, using Cucumber for java. It runs the game server and a headless client, and the idea is that it should be able to access all of the non-ui behavior of the game with a series of scenarios, like this:
  Scenario: Player can start a mission scenario
    Given I am logged in
    And I am not in a game
    When I select the first mission scenario solo
    Then I should enter the mission
    And I should get a welcome message with lots of visible entities
I'm kinda excited. On the one hand, anything that takes me away from forward progress toward a playable game is suspicious. On the other hand, as a one-man shop without a QA team, I just can't afford to spend hours and hours of my time on manual regression. This is the right thing to do.

It doesn't have to taste great to be good for you. :-)

No comments:

Post a Comment