XNA Creators Club Online
Page 1 of 1 (8 items)
Sort Posts: Previous Next

AI for spaceship

Last post 7/9/2009 10:26 PM by zanders. 7 replies.
  • 7/6/2009 3:20 AM
    • (0)
    • premium membership
    • Posts 74

    AI for spaceship

    can anyone tell me how to make a simple AI for a spaceship in an fps?  All it needs to do is move and shoot.  I cannot make something that apears real.
  • 7/6/2009 3:42 AM In reply to

    Re: AI for spaceship

    You might want to check out the space shooter minigame.
  • 7/6/2009 5:07 AM In reply to

    Re: AI for spaceship

    The Joss Master:
    You might want to check out the space shooter minigame.


    Sadly premuim :(. Restricting access does not help the budding indie dev. I don't understand why MS would restrict these samples. App has a premium account though so he's good.
    Game hobbyist hell-bent on coding a diabolical Matrix
  • 7/6/2009 10:02 PM In reply to

    Re: AI for spaceship

    it might help

    http://www.red3d.com/cwr/steer/Obstacle.html

    steering is probably what you are looking for.

    cheers
  • 7/7/2009 9:53 AM In reply to

    Re: AI for spaceship

    Sounds like you are just starting out, so I would advise working it out yourself.

    Start by thinking about a situation, say player is at AI's six o'clock and level.

    What options does the AI have?

    Fly straight? Gonna get you killed.

    So it has to make a maneauver.
    Work out what viable moves the AI has in this situation, and code each of them up. Give them sensible names so you know what they do like BreakLeft, BreakRight, InnerLoop, OuterLoop.

    Then add a decision layer on top so the AI picks one, start out picking one at random, then as you get better at coding AI you can start adding things like decision variables to make the effect more realistic.

    Then add more situations and do it all again.

    It's a long job, but a very good learning exercise.
    Information is not knowledge, knowledge is not wisdom, wisdom is not truth, truth is not beauty, beauty is not love, love is not music, music is the best! Wisdom is the domain of the Wis (which is extinct).
  • 7/7/2009 8:26 PM In reply to
    • (0)
    • premium membership
    • Posts 74

    Re: AI for spaceship

    Stainless:
    Sounds like you are just starting out, so I would advise working it out yourself.


    Actualy I am not just starting out.  However my 3d AIs have a habit of lossing very fast, and with minimal effort.  I was hoping to see of there was a detail I was missing, not to learn how to make AIs.
  • 7/9/2009 9:52 AM In reply to

    Re: AI for spaceship

    It's a difficult problem for space combat, the nearest logical match is dogfighting, but all the parameters that make dogfighting work do not apply to space combat.

    There's no gravity, no atmosphere, so a lot of the parameters make no sense.

    Real world space combat would probably be very short, very boring, and very bloody. The most accurate weapons fire would win every time as a single hit may be enough to disable a spacecraft.

    If you have spaceship parameters like turning rate, max acceleration, etc then your best bet is to teach the AI a set of combat moves and let it choose from them based on the relative capabilities of the two ships.

    A ship that could accelerate and deccelerate quickly could make darting attacks, setting up an intercept vector with the target at a long range, running in and firing then running away again.

    A ship that can turn quickly would attempt to get in close and get on the six

    A ship that can pitch rapidly may try to sucker a target into it's six and loop behind it.

    That sort of thing.
    Information is not knowledge, knowledge is not wisdom, wisdom is not truth, truth is not beauty, beauty is not love, love is not music, music is the best! Wisdom is the domain of the Wis (which is extinct).
  • 7/9/2009 10:26 PM In reply to

    Re: AI for spaceship

    I found that simple is best for my space game!

    Simply make the AI 'chase' the player ship but try to keep a set distance away from the player, you can then point your weapon at the player. The AI can then simply launch a missile, leaving the player to create more complex behaviour and movement by running away from said missile ;)

    A chase then occurs...

    You can then layer extra things on top such as avoiding asteroids, black holes, and other obstacles... my AI just blindly flies into them, but the player can try to take advantage of that..
    Graphics Programmer,Sandswept Studios.http://www.sandswept.net
Page 1 of 1 (8 items) Previous Next