Spaceship AI

by Unaligned

Posted on April 01, 2008 at 7:46 PM

A small project done while on holidays, the spaceships will go towards each other, shoot when facing the enemy, try to dodge bullets and move away from the other spaceship if too close.
Not complex, and not very good to make to computers kill each other, as they tend to spin around the enemy, that's why friction is added. I believe this would work better with a human-controlled spaceship, but it's still fun to watch them shoot each other.
No credit necessary, although if you use it in a game I'd like to know it.

Castypher commented April 01, 2008 at 8:32 PM
Like you said, not very complex. You had a large advantage over my Aircraft AI engine, which was the turning to face the enemy. The only problem I see is their constant identical patterns when they're trying to shoot each other. They continue to circle around, only rarely facing each other.

This would be much better off with another player rather than CPUs, as you said. I would've preferred that you put in a controllable character. Making AI is pretty difficult, good job.

Xxypher commented April 02, 2008 at 12:56 PM
You need to have a better turning code, so they won't repeat, also, try using paths, not self made paths, but have them generate a path quickest to get to the enemy and how to face them. I have a script for the turning, and a couple .gex files for the movement planning.
Mat commented April 02, 2008 at 4:42 PM
Its good but not amazing. Also vwhat does the alarm in the spaceships do?
Unaligned commented April 02, 2008 at 7:25 PM
@Mat:I forgot to delete that

I'm thinking of improving this, but I still haven't thought of a way to stop them from spinning around each other.
DoctorM64 commented April 03, 2008 at 11:58 PM
Castypher commented April 04, 2008 at 1:42 AM
Remember real AI is supposed to learn. If they spin around each other and haven't shot for a while, then they should come up with a different approach. It's not that hard, really. It's a lot like what my Lixies do.
cata100 commented April 22, 2008 at 2:26 AM
I adapted it so that they shoot each other more often, it's funner that way but it's not great. Like Doctor said it should have multiple states.
Tikaboon commented July 01, 2008 at 6:52 AM
I liked it a lot. after messing with it for an hour or so i made one of the fighters human controlled. having a human fixes the turning error so it's all good now. Message me if you want my fix
simonb commented October 18, 2008 at 10:12 AM
nice but not the best:l 6/10
koldmonster1 commented February 12, 2010 at 4:33 PM
Nice, but not very complex. You need to get focus on physics on this example. There were a few disadvantages in this example. You see, the patterns were identical when they shoot each other. And, then, they circle around by just facing each other spaceship. I rather get a 6 out of 10 on that one.