Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Space ship AI...

This topic is 5992 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Alright, i''ve got a space game with 5 different races/gruops. I''ve got some ideas for the AI, like predefined states: ATTACK_STATE, RUN_AWAY_STATE, FREE_FLY_STATE, SUPER_WEAPON_STATE, etc. So i''m curious, is there a good way to maybe group a race together and attack as a group. Say their base is attacked and the entire race comes after the ships that attacked them. Does anyone know andy good algorithms for this? I''m open for ideas too. Thanks! Brent

Share this post

Link to post
Share on other sites
Hmm, I think I remember reading about something like this in Game Programming Gems 2 or AI Gems...

One thing you could do is "group" units that are close to each other, and have them assigned a fictious "manager". This manager is responsible for deciding what states to set the groups up into.

Following your example, you could put every ship into one of lets say, 5 groups. Each group is assigned a manager. Also, the race could have a "goal" in mind, which every manager strives to accomplish. For this example, the goal could be DESTROY_RACE. The manager could tell its group to FORMATION_WEDGE and SEEK_ENEMY. When they find the enemy, the manager asseses the situation (there are a lot of ways to do this) and then assigns different states to the individual ships, such as ALL_OUT_ATTACK, RETREAT, etc.

The whole idea of the technique is the grouping of entities. By having only the manager process the high-level AI, you can reduce the CPU requirements of the AI as a whole, while having fairly nice responses.

You can also use the managers for other things, such as pathfinding. Have the manager use a good pathfinding algo to head over to where you want it to go, and the others can roughly follow the manager.

A good technique for assessing strategic placement, which can be very helpful, is Influence Mapping. Try googling it up. Hope I''ve helped.

Share this post

Link to post
Share on other sites
Kind of what my latest Spaceship AI does...

There is one high-level AI. basicly, it does nothing except making sure the the lower-levels are updated. But it has the lists of every ship.

One level lower is the Side AI. In this case, Friendly, Enemy and Neutral. For you it would be the 5 sides. What these guys do, is updating the commands for their individual ships. Friendlies would attack nearby Enemies, etc. etc.

Then there is the Ship level AI. Basicly, it is told to "go there and guard", or "attack all nearby enemies" or "do nothing".

When one location is under attack by enemies, and the Side AI is scripted to react to it, it will scan for nearby units on the same side, and will give these units a new command: "Guard location(x,y,z)". This will cause these units on their next update cycle to check if they are at their guard location , if not then go there, and if they are, to attack all enemies in a certain radius ^_^

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!