New Battle City update
Here's another project status update; unlike last time, this time I made more "visible" stuff rather than tuning the code that operates it. Well... when I think about it... there is plenty of both. This update is rather big (for me) and I cannot express how determined and happy I am because of it.
- Added level selection screen
- Level progression, scoring and life counting
- Game over and Victory mechanics
- New types of tiles (20 of them)
- Improved collision detection and destruction
- Complete level editor
- Manual (by editing config file) resolution selection
- Framerate counter
Remember the solution I used in last journal entry for destroying brick walls? If you don't, let me help you: you don't need to. It's gone. Simpler, better and faster solution was implemented instead which gives me greater control over tiles while doing the exactly same thing as pixel-perfect collision detection (PPCD in short) - tile is splitted into multiple segments which are checked if CD detects there is collision with that tile.
There were also performance issues with PPCD on levels where were many bricks which caused framerate drops from 60 FPS to 38 due to multiple checking, transforming etc. due to nature of the code. Maybe I didn't write it perfectly optimized but still, calling 40 000 times same operation is not healthy.
New CD also helped me to create new types of tiles easily, which brings us to...
Oh yeah, complete level editor with toolbox (took inspiration from Sapphire Yours) and little menu with all necessary operations. Level editor is operated by mouse (currently only place where mouse is enabled). In the toolbox you can also see all tiles which currently exist in the game; numerous variations of brick and metal tile were easy to implement thanks to new collision detection. Save and Load Level bring out dialog box where you write which level you want to load or save. Those two will be improved later, together with warning there are unsaved changes when you try to exit the editor, additional level management features and few more safety measures like prevention of saving empty level.
Since level editor exists, there is also level selection screen:
It's ugly. I know. But it's "similar" to the original (NES) version and will suffice for now. Also, game automatically transitions between levels when you kill all enemy tanks through this screen; when it does that, player is prevented from choosing other level.
For easier manipulation over destructibles (read as: I don't wanna mess with non-integers if I don't need to) resolution the game is based is increased from 800*600 to 960*720. Naturally, it caused few minor issues I didn't fix yet (respawn control going berserk, font a little smaller). Game doesn't look much different, except for fresh stuff on the right side:
What happens when you change resolution? For 4:3 resolutions (like 1280*1024) everything's same except bigger. For non-4:3 resolutions, this happens:
Screenshot is taken on HDReady resolution (1366*768). On this picture you can notice 3 things.
First one is a little gray part on the left side which "came out of nowhere". I didn't like horizontal stretching during expansion on 16:9 format so I rather kept the main part in 4:3 format and added more background part to the left, keeping nice square tiles.
For now, resolution is selected by manually editing configuration file. Aside from height and width, there are also Fullscreen and Show Framerate options. I have 32' TV as my monitor screen and game in current format looks really nice on 1920*1080 fullscreen.
Game over, Victory and game exiting
What is on of main components which makes the game "game"? Challenge. Or rather, ability to lose. Now, on the previous picture, look at the bottom right of the game screen. "Game Over" for 2nd player. Yup, it's finally properly supported. I don't need to explain rules, right?
I took advantage of Game State Machine to make this little thing that You probably spotted first on that screenshot. I think I don't need to talk about it.
What is next?
Obviously, to raise up the challenge, I need to improve AI of opponents. For now, it utilizes randomizer to create its behaviour which gives little challenge, but I swear that Random Number Generator has its own mind. Luck my ***, there is no other explanation on AIs ability to dodge perfectly fired shots in last second; if I didn't write it myself I would swear that AI tries to sabotage me.
I already have designed the behaviour of new AI, now I "just" need to implement it properly. CPU overload, here I come!
I really don't know what will I do with art and sound. I tried to draw new tank for Player 1 to replace the current one but the result was catastrophic due to overusage of Bevel&Emboss to create a 3D feeling:
I'll try to get new assets as soon as I can but until then I'll work on other things like improving code and performance and adding support for playing in 2 players over LAN.
Well, this is it for now, thanks for reading, I hope I wasn't too boring.