This post describes & shows the various bits of my tech demo I've been working on for the last month.
The eventual aim is to produce a 2D Combat Flight Sim, but before I can do that, I want to produce a tech demo - i.e. a basic game that covers all of the features I want in my final game, just without much polish. Just to prove that it is possible for me to write.
The features that are currently in the demo are:Scrolling parallax landscape
As this is a flying game, I need the landscape to whiz around the screen very quickly. As it moves fast, it also needs to be massive, otherwise the plane will reach the end of the map too quickly.
I decided to go with a landscape defined by vectors, and implemented the landscape as a heightmap. The ground is drawn as a very large polygon (or list of triangles). This allows for very small data sizes, and very good performance.
Currently there is only one texture used, and fractal style algorithm creates the natural hills / mountains.
The second layer (parallax) is just another instance of a landscape generated the same way, but scaled to appear smaller and scoll slower than the main landscape.Objects moving along the ground
Next I added moving tanks to the mix. Currently they move backwards & forwards across the landscape at random speeds.
Getting them to stick to the ground was good fun. Currently they move only in the X axis, and their Y position & angle is a function of their X position within the landscape. This means they look funny when transitioning from flat ground to a sharple angled slope, but once properly done, tanks / vehicles wont be able to climb steep slopes anyway.
I also added trees here. I want trees to provide some sort of cover for land based units, making hunting down enemies that little bit harder for the pilot, so the trees are drawn in front of the vehicles.Aeroplanes
Next, I had to get some sort of aeroplane working. I gave it a very basic flight model, where it has an angle and a speed. Later I'll add things like stalls, ground handling, etc.Camera
A basic camera was implemented at the start, and it just follows a target object around. When a plane is moving fast, it became obvious that the pilot would need lightning quick reactions to avoid the ground / other objects, so I made the camera zoom out in relation to the target object's speed. Also the camera tracks a little in front of the object, in the direction it is travelling in.
I added a little bit of code to orient the plane, so when it is pointing left, it isnt draw upside down, like in the image above.Buildings
Not much different to trees really, except the ground they occupy is flattened. I also added some variety in the tree sprites to give a more natural look to the forests.
Thats pretty much where I am at now. Next post I'll go into the fun I had with the flight model, and then I'd better start work on some new features, otherwise I'll have nothing to write about!