I don’t intend on these being monthly updates, really – I don’t. I’m just constantly busy with other things and can’t get a sufficient amount of game work completed in the week. Once the weekend rolls around I feel like I don’t have anything worth showing. Then, in the middle of the week, I’m usually able to get some things worked out in the game, but I also begin work on new features. Come the weekend, the game seems un-presentable again. Rinse and repeat.
But not this time!
After a bunch of fumbling around and trying various different methods (even venturing into Box2D territory, but that was way too much overkill), I have finally implemented collision detection and reaction. Check out the video below!
Of course the AI there is the absolute most basic AI you can imagine. Their acceleration and steering depend on random values. The walls are made up of a bunch of convex polygons, mainly rectangles. Big shout-out to Tiled for being pretty awesome and making this level-building process pretty easy.
I also just started implementing how to detect the off-road parts of the track. Depending on how many tires are off the road (aka on the grass, for this level), the car’s friction will increase and the rear tires will no longer produce tire skids (if they are the tires that are on the grass, that is). It seems to function pretty efficiently, but I would like to optimize it somehow, just to prevent potential future hiccups. (I only “drew-in” the polygons that represent the off-road near the beginning of the track, I didn’t bother with the rest of the track yet. That’s why you can see my car producing skid marks all over the grass later in the video. This track won’t even be in the final game and is only for testing purposes.)
In this screenshot, you can see how I’m organizing the different layers of the level data in Tiled. The background image is just there to assist me in placing things in the correct spot. One of the unseen features I worked on for the game was a small sub-program to read in a .TMX (Tiled) file, parse it, produce a ByteArray of all of the parsed data (polygon points, etc), and then save the file to the game library – ready to be embedded and used in the actual game.
I also like how the level doesn’t actually loop around in a circle, if you hadn’t noticed. This way I can always have the player driving straight upward (or at least mostly in that direction). That always seemed more comfortable. (Speaking of this, I do actually have the code in-place to have the camera lead the car as it goes faster, so you can see ahead where you’re driving. It’s just a bit shaky and annoying at the moment for whatever reason so it’s not active in the video.)
Alright, here’s to hoping the next update post will be here before Halloween!