Sign in to follow this  
fuzinavl

StarCon navigation

Recommended Posts

I'm designing an asteroids pure-combat game similar to Star Control 2 or TimeWarp. I remember while playing SC2 that a syreen rocket could weave expertly through clouds of kohr-ah black blades. That always impressed me. Does anyone know how the combat-navigation algorithms work for starcon2?

Share this post


Link to post
Share on other sites
They're essentially "boid" behaviors. Do a Google search for "steering behaviors craig reynolds". Asteroids style games work really well with steering behaviors.

Every ship has a velocity vector (essentially describing direction and speed). If you want to change that, you turn the ship and fire the rockets in the correct direction to modify your velocity vector.

You can also sum other influences on the ship, like gravity from nearby planets, or tractor beams, or repulor fields, collisions, etc. So you would sum up all the other effects, add in your "ship piloting" adjustments, and then use that to modify the current velocity vector of the ship.

Hope that helps.

Share this post


Link to post
Share on other sites
Star Control II apparently had its source code freely released, and was remade as a freeware project called "The Ur-Quan Masters." See <http://sc2.sourceforge.net/>. (Remixed music too.) This is a great game, for those who haven't yet seen it.

Share this post


Link to post
Share on other sites
In the Ur-Quan Masters code, the race-specific AI appears to be in the src/sc2code/ships/racename/racename.c file, and is a function called "racename_intellegence". The general AI code seems to be in src/sc2code/cyborg.c, which appears to contain general functions used by the race-specific AI.

To me it looks like the ship AI has a few different behaviors (pursue, entice, and avoid) depending on what the situation is, and each of those behaviors specifies more fine-grained reactions depending on both ships' capabilities and current position.

You can look it up, but in my experince the UQM code tends to be rather hard to get through, since it's mostly uncommented and designed much more for efficiency than ease-of-reading. However, if you want to go for it, go for it.

Do note, however, that UQM's AI probably isn't a good model for a good, general algorithm... A LOT of the impressive things SC2 did could only be done because they had very very strict limitations. For instance, you will never have more than two ships in a battle, you will always be able to see the other ship, only X shots could exist at one time, etc. Still, you may learn a few things, and it's always fun to play with.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this