Happy 2017! This is the first development blog for the year, and it's been a busy Christmas break for 39 Days to Mars. The last months saw integration with the Steam distribution platform, new artwork for the ship, the start of mouse and keyboard support, performance optimizations, and some great progress recording the voiceovers for Albert and Baxter!
All of the artwork is finally finished for the levels and puzzles in the game! I'll let this poster do the talking, click for a larger version:
39 Days to Mars will be released on PC through Steam (and a non-DRM version for those who want). To do this, I needed to make sure that the game integrated correctly with the Steam Platform, and set up the information that ensures the game will be presented correctly when it's released. This is now complete, and having the game deploy correctly and show up in my Games Library felt like a big milestone.
In early December I started working on the input system. To support different platforms, and to allow for a single-player mode, I need to support a wide range of controllers. These are the ones I had lying around and the ones I'll be getting working first:
The most important is getting mouse support working. Unfortunately this is the most different to the joystick input. It's now working in the levels, and some of the puzzles. It will require some more hard thinking in the next month to get it working in all of the mini-games and puzzles.
Over the last few months, as more final content has been added, and more sections of the spaceship have been onscreen at once, I started noticing some slow-downs and lag. I'm developing 39 Days to Mars on a laptop with no GPU, but it's a fairly simple 2D game and I wasn't expecting any major problems. So I decided to investigate.
I opened up the profiler - a tool that lets me look under the hood and see what parts of the game take the most processor time. The problem stuck out like a sore thumb, it's easy to see the difference between running well (on the left) and running slowly (on the right):
This huge slow-down happened whenever a character moved around, and didn't have anything to do with the graphics at all. I could also see from the profiler that one method was taking an astounding 56 milliseconds to run each frame. To put this in perspective, a game running at 60 frames per second has only 16ms to run *everything* in the game (and draw all the graphics too). This one method was using almost three times this limit by itself!
Opening up the code, I was greeted with a comment from over a year ago:
Any comment that starts with the words "TODO" and "Fix" is usually bad news.
But obviously, this shouldn't have come as a surprise to me. The early plans I had for the ship in 39 Days to Mars involved pieces of it moving around, or falling off. To support this, I would have had to dynamically update the pathfinding (the parts of the ship that are walkable to Albert and Baxter) as the ship changed. To focus on more important tasks at the time, I skipped the whole problem and wrote a quick-and-nasty method that just recalculated everything every single frame. I also left a comment telling my future self what needed to be fixed!
Fast-forward a year, and the design of the game has changed. Parts of the ship no longer move around or disappear, and I don't need to worry about updating pathfinding any more. A day's work shifted all the calculations to run only once, when the ship is generated. Each frame now takes less than 2 milliseconds to calculate pathfinding, and the profiler paints a much healthier picture:
Although this is an extreme case, performance optimization is as much a part of debugging as fixing crashes. I spend a lot of time behind the scenes making sure that the game will run smoothly for everyone when its released.
So here's the monthly snapshot of progress. The lines crossed out are tasks I completed this month, and everything is roughly in the order I'll be approaching it.
- Remaining Art:
- Controls tweaks after playtest
- Load Saved Game screen
- Artwork for the Ship
- Sound & Music
- Finalise Dialogue
- Voice Acting
- Audition to voice Baxter
- Record Albert's Lines
- Record Baxter's Lines
- Integrate voice acting into game
- Steam Platform Integration
- Steam API Integration
- Steam Store Page
- Save & Load System
- Singleplayer Support
- Mouse Input in Levels
- Mouse Input in Puzzles
- Gameplay & Balancing
- Level transitions
- General Polish
Until Next Time
I'll be implementing sound, music, and dialogue, and then working on controller support for the remaining puzzles.
Don't forget you can follow @philipbuchanan on Twitter for more regular updates and development pictures!