Tuesday, 7 August 2012

Racing Game - Too early to go alpha?

I've still not taken care of my housekeeping tasks, but I do have a fully functional HUD now - this makes me feel a little guilty but a lot happy :)


 

I've introduced a new Settings class to manage the 'best time' value. It's simply a stripped down version of what appears in the "SuperJumper" LibGDX demo. Settings.load() is called when the GameScreen is created (loading the previously saved best time, if it exists), addTime() is called at the end of the level if the best score was beaten, and save() is called immediately after to persist changes to permanent storage.

I've also implemented the level progress indicator. A texture is drawn over the progress bar to represent the portion of the level completed/remaining. The texture moves along the bar from left (start) to right (finish) as you progress. I've added a couple of convenience methods to the Level class to help keep the code reasonably easy to read:
public int getProgress(int minPosX, int maxPosX) {
 int range = maxPosX - minPosX;
 int posX = (int)(minPosX + (range * getProgressDecimalFraction()));
 return posX;
}

public float getProgressDecimalFraction() {
 float carNose = getCar().getBounds().getY() + getCar().getBounds().getHeight();
 float finishLine = getFinishLine().getBounds().getY();
 return (carNose/finishLine);
}




Then all it takes is to add this to the GameScreen.render() method to draw the moving 'spot':
hudSpriteBatch.draw(progressIndicatorTextureRegion, level.getProgress(10,223), RaceGame.HEIGHT -38, 7, 7);


I now have the bare minimum of what you might actually get away with calling a 'game'. Here's a video of it in action:

The Neverending Wishlist

I have plenty more ideas on my to do list:
  • Housekeeping tasks (efficiency improvements, tidy up code, implement empty overridden methods, etc)
  • Tweak acceleration / deceleration
  • Force the car to remain within level bounds
  • Fix the aspect ratio so game doesn't appear stretched on non-4:3 displays (like it does on my xperia play)
  • Implement the results / best time / instructions / about screens
  • Pre-race animation (e.g. traffic lights / 3, 2, 1, Go!)
  • End-race animation (e.g. cheering crowd, car drives off-screen)
  • Background music and sound effects (plus the option to disable)
  • Animate car (maybe a reflective moving 'flicker' on wheels to suggest movement?)
  • Either rotate car or animate wheel movement (or both?) when moving horizontally
  • Improve the UI style
  • Improve the game and hud graphics
  • Introduce a splash screen
  • Facebook bragging (post high score, include link to google play page)
  • Easy / normal / hard mode (vary length, road width, etc)
  • Multiple levels (vary backdrop textures etc)
  • Level select screen (direct access to previously unlocked levels)
  • Bonuses / hazards (e.g. nitro boosts / oil slicks)
  • Level grading (earn stars for quick finish time, collecting all pickups, avoiding all hazards, etc)
  • Introduce 'infinite survival mode' - never ending level, car explodes if it leaves the road, aim is to survive as long as possible
  • Load in predefined levels from file
  • 3D, maybe with a first person drivers perspective (if spectrum can, I can)
This list will keep on growing, but I know I'll start to lose interest before I get anywhere near the end. I'll start up a new project to play around with something new (e.g. 3D), and once I do this I'll start to forget about the RaceGame, and it'll just end up on the great big pile of unfinished projects... To avoid this happening, I'm going to have to prioritise, only work on the 'must haves' (or the easy 'nice to haves'), and get something released. Extras can always be added in future updates.
So, with that in mind, what I now need to decide is what I can honestly class as a 'minimum shippable product', and once I've reached that stage - publish asap. Maybe what I have right now is enough to be published as a very early alpha, I'm not sure...
          

No comments:

Post a Comment