Advertisement

i literaly stink at AI

Started by August 23, 2006 10:52 PM
18 comments, last by GameDev.net 18 years, 2 months ago
can someone with making a memory efficent AI system i was thinking of making nodes only when the enemy turns but i have no clue how to make nodes in the first place help please and thank you in advance
You'll have to be much more specific.

Put as much effort into your post as you'd like for us to put into our replies.
h20, member of WFG 0 A.D.
Advertisement
sorry for being so abstract but i seriously know nothing of AI besides making close combat AI

i simply want the enemy to be able to see walls that are 35-50 pixels in front of it

all the ideas i come up with either are too slow(i am a perfectionist) or makes it bump into walls before moving and making it look retarded when a player sees it moving

when i get close in to the player it will work perfectly fine and the enemy will do as i planned but when the player goes outside of it's attack/chase range and i tell it to return to it's post the thing with generaly go off screen. normaly i would be perfectly ok with this but since this will have multiple players the enemy will act retarded when going back to it's place

if i was doing single player only i could simply delete the enemy after it goes far from the player

what i want to do is to make a pathway memory system i could make objects that hold each change in direction and the order of the change but i have a feeling that it may tax the computer far more then other AI systems would

EDIT: i know AI in online games usualy suck by default but i intend to to break tradition and make the game challenging even at the easier maps

until i get a good AI system i will work on other things such as menus, items, pause screen, etc.

[Edited by - Link1426 on August 24, 2006 1:19:36 AM]
It seems that you're looking for a waypoint system. A waypoint system is an abstraction of your game level and will help your ai to determine a walkable way between point A and point B. Google for 'waypoints' to get more information or get a AI-book, any decent AI-book will include chapters about WP-systems.
thank you very uch, i tried googling "game AI" and "pathfinding" and didn't get much of anything useful
Try an A* (pronounced "A-star") algorthim. There are many tutorials out there, http://agdn.netfirms.com/main/html/astar.htm, or right here on Gamedev I found http://www.gamedev.net/reference/articles/article2003.asp, which is fairly good.
Advertisement
Agreed, with the AP above me. Coding my own A* algorithm was probably the most fun I've ever had with programming. I'm not sure what your implementation looks like, but there's probably some way to make it work.
Just thought I'd clean this up for you... since you're not too clear.

Quote: Original post by Link1426
i simply want the enemy to be able to see walls that are 35-50 pixels in front of it

Visibility Testing

Quote: Original post by Link1426
all the ideas i come up with either are too slow(i am a perfectionist) or makes it bump into walls before moving and making it look retarded when a player sees it moving

Behaviour states
(By bump into walls before moving, I assume you mean it avoids walls too soon before it is even close to them, thus looks irrational.)


Quote: Original post by Link1426
i tell it to return to it's post the thing with generaly go off screen. normaly i would be perfectly ok with this but since this will have multiple players the enemy will act retarded when going back to it's place

Pathfinding


Yes, so A* along is not going to be the single answere, youve got several separate issues here:
1. how to reprsent/detect visibility for an enemy
2. behaviour responce to the combined stimulus of both walls and the player
3. pathfinding back to 'base' when not in combat

Suggestions:
1. visibility testing depends a lot on the map/level structure, but in general i'd do a line test between the player and enemy and see if any walls block the line... in a tile based game this is easy(use modded Bresenham's Algo)...
2. behaviour needs to prioritize the two goals of avoiding walls and chaing player, if the robot turns to avoid a wall 50 feet away, while the player is 5 feet in front of him; he naturally looks very dumb. Most simple AI use a state machine to be in combat or navigate, etc modes...
3. A* might work here, but might also be overkill
you might get away with a list of navpoints that retrace the robot's previous path as he left his 'base', to keep this managable, you'll want to do a test every time a new waypoint is added, that it does not loop back onto others, just do some kind of visiblity test to the previous waypoitns and skip ones that might make the robot do dumb things like loop around a tree 5 times on the way back to base... basically if you're at point 5, and are headed for point 4, but point 2 is visible from your position, skip 4 and 3, go straight to 2...
I would also recommend getting a copy of the book AI Game Programming Wisdom. It's got some very nice gems in there that have helped me quite a bit in the past.

Also, just the pedant in me but:

"i literaly stink at AI" implies that you emit an odour towards AI. I've seen this a lot lately: people are using literally when they mean figuratively, which is horribly incorrect since they are fundamentally opposite words. Anyways, not making fun just trying to clear it up for you in future. :)
ok get books and learn not to post late at night

alright i will go to the book store ASAP and look for those and if i can't i will order the off amazon or ebay

This topic is closed to new replies.

Advertisement