Work on my animations sub editor has ground to a halt.
All is going well, but i'm getting really bored with it and not motivated to continue work at present.
Next thing to add to the sub editor are verlet constraints to keep all the joints attached to each other.
But this is just for the editor and i doubt it will get used in game.
I have been quite busy coding other things though.
I used to play a really cool overhead tank game in the arcades. Can't remember the name of it, but i've always thought i'd like to write a version of it myself.
The game used two joysticks, one for each track, a bit like battlezone and was sprite based and viewed from overhead.
The real novel thing about this game though, was that the entire play area / screen rotated around the player. So, the player always pointed up towards the top of the screen.
I remember being really impressed by it at the time.
Well, just for something to do, i decided to modify my current editor code to use the same rotational system. The code was pretty simple, just a few lines of trig strategically placed and i also knocked up some twin joystick code for the controls. Each stick per tank track.
I then loaded in a vehicle graphic as my main sprite and promptly went driving about my forrest level as a test.
I'm delighted to say that the system works really well and it was quite fun to play. So, a similar tank game is very doable. Whether i'll ever get around to writing one is another thing though.
For along time now i've wanted to write a scrolling shoot em up and i've been meaning to tackle coding splines ( curve paths ) for enemy attack patterns for a long time too.
A demo of the PC port of Armalyte ( the c64 side scrolling shoot em up ) has recently been released http://www.ovine.net/
and this renewed my interest in writing a scrolling shoot em up.
Although i found the demo a little disapointing. I find it more difficult than it should be. No mouse support either.
Looks and sounds great though and is a very faithful recreation of one of my all time favourite c64 shooters.
Well the past few days i've been tinkering away trying out different spline methods.
Drawing splines is fairly easy. The difficult bit is moving along them at a constant speed.
This sounds easy enough, but incrementing along a spline at a constant step value causes speed ups and slow downs depending on the severity of the curve.
I know there are several solutions to this problem and i found some neat code in the blitz archives for moving at a constant speed along a Bezier spline.
I ported the code across to my system, rewrote and modified alot of it and made it alot more flexible for my needs.
Created a mini editor for it. Clicking and dragging control points around to create different curves.
After some study i came to the conclusion that cubic Bezier splines ( which is what i was using ) don't really give the kind of curves i'm after for smooth enemy patterns in a shoot em up.
The curves themselves seem to have alot of straight edges ( needed to link up the curves ) and what i want are lots of smooth bendy curves so the enemies can swirl about the screen in lovely formations.
So, i decided to do some more research to see what other spline types would be more suitable.
I found a really neat article on this problem at shmup-dev.com, which i downloaded ages ago and decided to try that technique.
This time the splines use the Catmull Rom algorithm. And coding was easier using these.
The curves are much more like the type of thing i was after and it was relatively easy to get a simple editor up and running to try out various shapes.
The Catmull Rom algorithm still has the inconsistant speed issues but i was able to decifer enough of the Bezier code to realise what the author was doing and i found the equivelant equations within the shmup-dev.com article.
This involved finding the differential of the spline segment ( speed of the curve at a given a point along it ) and using that to scale the current speed that my graphic traverses the spline.
It sounds far more complicated than it actually was.
So i was delighted to find an elegant solution to a problem i'd been thinking about for a long time.
The shmup-dev.com article puts forward another solution to the inconsistant speed issues which involve a quite convoluted system of breaking the spline segments down into small straight lines and storing these in look up tables.
And using a lookup comparison test to find the relevent speed.
Looks like i've managed to sidestep that complicated method via just a few lines of code. Which i'm very pleased about.
Now, i've overcome a major hurdle for a scrolling shoot em up and in fact i'm sure the techniques and code will be useful for alot of other future projects. Smooth camera movement along splines being one further example.
So I've upoaded 2 spline demo's for anyone to try out.
Bezier spline and Catmull Rom spline demo's.
The demo's contain on screen instructions.http://www.themaskedcoder.dreamhosters.com/TMC Splines Demo.zip
And a screeny of one of them.