AI for a Space-Shooter

Hi



I'm working on a Space-Shooter and of course I need a AI for it. I recently tried to begin it, but I

have absolutely no idea how I should do it. Accelerating a node is no problem, but rotating (moving

the ship like a human would do…) is a real problem.

Are there any good tutorials how to make such a AI with jME?

Hope you can help me somehow :slight_smile:

Well I don't know much about AI, but perhaps you could build a curve (e.g. a BezierCurve) between the ship's location and its destination, and use that to move and orient the ship?

for chasing and intercepting there are some infos in this wiki entry:

http://www.jmonkeyengine.com/wiki/doku.php?id=jmonkey_related_ai_project_aigama



Stardust has very basic ai, the enemies chase and shoot at the player or any target node basically.

Maybe you can get some ideas from there.

http://code.google.com/p/jme-demos/source/browse/#svn/trunk/stardust/src/com/jmedemos/stardust/ai

One of the important decisions to make up front is does the AI play by the same rules as the player?

It is more realistic and satisfying if so, but also a much greater challenge to make it suitably intelliget (especially with true 3D motion, which you will have in a space shooter). On the other hand in space you have few obstacles to negotiate, which makes things quite a lot easier.

but perhaps you could build a curve (e.g. a BezierCurve) between the ship's location and its destination, and use that to move and orient the ship


that would lead to very predictable behaviour. reminds me of all those 100 years old shooter games on the good old c64.

imho, the ship should have basic controls like rotate, forward, backward and fire, and the ai should simply use them.
HamsterofDeath said:

but perhaps you could build a curve (e.g. a BezierCurve) between the ship's location and its destination, and use that to move and orient the ship


that would lead to very predictable behaviour. reminds me of all those 100 years old shooter games on the good old c64.

imho, the ship should have basic controls like rotate, forward, backward and fire, and the ai should simply use them.


Well I wasn't talking about hardcoding anything, but having some sort of path finding course plot, which would help the ship smoothly rotate and move, rather than jerky movement. Of course, I have no experience with something like this... :)

In stardust i have a very simple AI, but i think its not too bad.

The ships are limited by the same moving constraints as the player.

Basically its just a current direction, desired direction and a slerp() method with a modifiable multiplier.



Also jme physics automatically limits the ships accelerating / breaking possibilities.



Depending on the enemies current state like cruising / evading / attacking you can modify the enemies parameters to make it look like hes scared or the like.

If the enemy for example has to evade the player, i let them turn / speed up faster then usual.



http://www.youtube.com/watch?v=C_Nep_3lDrE



Of course it needs much more work to be usable in a real game, but it can be a start.