iDevGames Forums

Full Version: Onslaught: Star Command
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
"Onslaught: Star Command" hopes to be a real-time strategy when it grows up. The basic premise is spaceships battling in an asteroid belt, fighting to control resources and that sort of stuff. The original reason why I decided to do space battles is that it means I don't have to spend ages animating infantry, tank treads and wheels etc, although I will have some basic animation for the spaceships and base structures eventually.

I'm a couple of weeks late to the party, since I was really busy at work at the start of month, but so far, I have set up my window and OpenGL view and established a Chipmunk space. I then introduced some little spaceships (blue triangles) and started working on their AI. Their task at present is to steer themselves to a waypoint (red triangle), at which point they are given a new (randomly generated) waypoint. (The grid in the background was just to give me a reference while I was programming the camera).
[Image: ShipAITesting.png]
My algorithm for doing this uses a few thresholds and other parameters that don't necessarily have an obvious logical value, so I have started a sort of supervised learning program for my little pilots to find sets of values that seem to work reasonably well.
This can be quite amusing to watch (particularly when the ships have a really bad pilot), and I've started to find a few designs that behave in a sensible sort of way. Since the size, mass and inertia of each ship are likely to affect the way the pilot needs to fly it, I may formalise a system for doing this with each ship design so that they have a unique pilot AI.
The general algorithm is still fairly basic at the moment, since the ships are currently unaware of each other. This means that they can crash into each other (since Chipmunk handles that) but they can't try to avoid the collision.
I'm not offering a build at the moment because my current code relies on a particular folder of "brains" being in the right place on my hard drive, but I'll hopefully have something to post tomorrow. I might not get much chance for a week after that since I will be away. I should be able to get some coding done, but Im not sure if I'll have internet access.
Also, I may have to change the game's name. I went to prefix one of my classes with its initials and realised that they are "OSC". LOL
Here's a build you can play with:

You should get 4 little ships (which have two slightly different AI setups).
The AI now makes an attempt to avoid crashing into other ships that are between it and its destination. I have also changed how the steering works: previously I was using an impulse from the side to make the ships spin, but that also caused them to drift sideways, so I have changed to just setting torque directly, which makes things more manageable for the AI.

The cursor keys will move the camera, while "," and "." will make it rotate. You can also right click to set a new waypoint for one of the ships (your selection is fixed to a particular ship at the moment).
Cool, another RTS. Smile
Good luck to you!

Btw, the camera seems a bit unresponsive on the current build.
I've had less time to work on this than I'd have liked for the last few weeks, but I have managed to get a bit done. I've mostly been adding a series of random improvements, so I started by allowing you to select ships and tell them where to move to. Then added the concept of having different sides, and changed it so you could only give orders to your own units. Once that was in place it made sense for the ships to start shooting at each other...
I started out using the OBJ format for 3D models, but I decided to implement a new format which has embedded data for collision shapes. Today I got the basics of an editor for the collision shapes working. It will probably eventually handle UV mapping too, since I have a way of handling that in mind which should be easier than what tends to be available in 3D modelling apps (if less flexible).
I'm way behind where I feel I should be at the halfway point, but the addition of a unit and structure building system would make the game feel significantly closer to completion (or at least, closer to actually being a game!)
On a more positive note, although I've had a fe evenings when I came home from work and could muster the motivation to start coding, I have used some of that time to work on some music, which is sounding pretty good. I suppose I need to throw some audio code into the mix now.
Reference URL's