Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Enemy AI?

Author
Message
How is it going
16
Years of Service
User Offline
Joined: 18th Sep 2007
Location: California
Posted: 25th May 2010 04:37
I was just wondering what the best way to handle enemy AI is
I was thinks a system of events and states that result in calling different functions or something like that
haliop
User Banned
Posted: 25th May 2010 10:15 Edited at: 25th May 2010 10:25
you can search google, there are pretty amazing stuff out there.
my perssonal favorite is Evolutanry Ai, which meens :
lets say you have any type of an Ai object like an Enemy or an Ally,
the Evo Ai , random his movement according to collision , but not only his movement , once the Ai line of sight has cought up with an Ally or You (player) , it shoot, the Evo Ai makes it so that spechific Ai will do this current simulation of Moving on the Current Map searching for you or any opposite team member about 1000 times , it save the best statistic like Time,Where is the best spot to shoot, how many bullets was used and whatever you decide to be a priority in its goals.

at the end after alot of simulations , you get States and Events that based on Randomness rather then user created or programmer created routes or paths, however this method is not simple to implent but the results are far better then any ai system you will find.


if were talking about a more simpler to implent then this is what you need:


Collision Based - Places where it cannot move into
Cover Based - Places where it can "Think" about its next Event or State but also a place to take "Cover" in a real time shooting
Juctions - this is a bit diffrent then Collision or Cover , a Junction can be Randomned making the Ai move in any direction the junction is based on or Link Junctions (smoothen up CPU usage) where the Junction sends the Ai to the next Junction , this 2 can be randomned , the Ai will keep moving unless it "Feels or Sees" something if it did "Saw" you the player he can move and take cover so actually its Event State changes from Junction Link to Shoot or to Cover and Shoot or whatever you want to call it.


if you dont want to use this , you can go even simplier
there is a free plugin made by (dont remmber his name) about PathFinding , search it on the forum , i think it should be at page 2 or 3 , i used it a while a go and its pretty good and smooth.
path finding - it will let you Ai move from place to place while considering where it can move and where it can't , so you can simple attach the PF(path finding) to the Enemy Ai and make him moves toward you by XYZ decrese, so if you are at 100,0,500 and the enemy is at 0,0,300 , using PF it will find the best way to get to you.


all of this maybe overwhelming at first , but trust me its nothing once you get the hang of it , you will find your own solutions for these problems , i do suggest that you will start with PathFinding as its the simpliest way where you jsut need to declare where to move , and unless the ai Sees the Player it will move and will try to find you.



if you have any questions pls.
How is it going
16
Years of Service
User Offline
Joined: 18th Sep 2007
Location: California
Posted: 26th May 2010 23:43
Thanks for your response, haliop.
I'm not too far into planning this out, and I'd like to be able to write this all myself.
So far I have a weapon class. The player and AI will be able to pick obtain these. The gun class itself I plan on having do all the shooting, the AI will actually just focus on a single opponent.
Then I was planning on making a "team class" that holds an array of pointers to either enemies or allys.
Then the team class will actually decide where to send the team members.
Like I said I'm not very far into this, so at this point every thing is only theory.
I would, however, love to hear so opinions about my Idea... maybe stop me from making a terrible choice... lol
haliop
User Banned
Posted: 27th May 2010 00:26
it sounds good.

what i did once is
Classes:

Weapon = same as yours only that i exctracted the Accuracy and other Attributes that are the wepons attributes and calculated them with the Player or Ai attributes , so the actuall shooting class was another class combining these 2.

Ai = inside this one i've put a Boolean which stands for Ally
so 0 = enemy , 1 = ally.
then deciding what to do ...

i never got to the actuall Brain that sends information about where each ai should move , but the team class is actually the same as the Brain i wanted to design , one Ai that sends and recive real time information however this meens for me that the Ai will not have personnalities , what i wanted to do is make each Ai as an induvidual which makes his own decisions using the Evolutanry Ai system , this way , the Ai will recive commands from the Brain class which holds all the Tactics and everything , but the Ai will be able to OverRide these commands if it has encountered and Unknown Event meening , while all your allies are designed to go one place and they all runing side by side , suddenly the one at the farest right , caught something with his "eyes" or line of sight if you want , so while keeping or "knowing" its current objective to run to XYZ position with his fellow members , it can decide to check the Unknown Event , and go back to the team after invistigation it can also call them to help "him" if it signs it as a trheat , and since its Evolutanry Ai , each Ai has its own Special Attributes for Unknown Events like
my favorite "Good Presetion" which starts at 0 and goes up to 1000 the higer it is the most likely Team Members will join him , but if the Evo Ai is stupid in someway.. then other team members wont joint him.

your idea is solid and as i said earlier , you should just do it , whatever you do dont forget to create Comment Points so it will be easier to fix (i always forget to do it so it takes me some time to trace hidden bugs..)

look , Ai has alot in it , but its actually simple if you think about it , just look at your map , what do you see, then decide what you want to do each time an Ai Object "sees" that object that need to be decided.. bla bla bla... you get the point .
show us some code it will be easier..
How is it going
16
Years of Service
User Offline
Joined: 18th Sep 2007
Location: California
Posted: 27th May 2010 04:07
alright, its good to hear that I'm at least thinking on the right track.
I actually believe pathfinding will be the hardest part of the AI... I'm not sure exactlly how to good about making them do this... I understand that a lot of people use A* pathfinding although I actually know nothing about it. I guess I'm just going to google it and find out.
haliop
User Banned
Posted: 27th May 2010 10:29
you have a pathfinding library here on the forum , i think you should consider using that for now , cause the Ai just count on that but its not the Ai itself , so you can actually build your Ai classes and the PathFinding will just be the Routes your Ai will walk from point a to b.
How is it going
16
Years of Service
User Offline
Joined: 18th Sep 2007
Location: California
Posted: 27th May 2010 23:17
...looking at the pathfinding... I agree... lol
what pathfinding library are you refering to? DarkAI?
haliop
User Banned
Posted: 28th May 2010 00:21 Edited at: 28th May 2010 00:21
no DarkAi is not a pathfinding.
look at this:
http://forum.thegamecreators.com/?m=forum_view&t=157808&b=22
TechLord
21
Years of Service
User Offline
Joined: 19th Dec 2002
Location: TheGameDevStore.com
Posted: 28th May 2010 12:00
Quote: "I actually believe pathfinding will be the hardest part of the AI... I'm not sure exactlly how to good about making them do this... I understand that a lot of people use A* pathfinding although I actually know nothing about it. I guess I'm just going to google it and find out. "

I've personally used to this A* Tutorial to write a pathfinder several years ago. IMHO, its the best tutorial out there.

haliop
User Banned
Posted: 29th May 2010 23:22
any progress?
How is it going
16
Years of Service
User Offline
Joined: 18th Sep 2007
Location: California
Posted: 30th May 2010 01:13
Well, I believe that I have a pretty good base understanding of A* pathfinding, but I'm still cleaning up some of my other code and making sure that everything I've done so far looks good(I'm attempting to write my own engine). I was thinking however of doing a "zone" type of idea... so there will be several zones throughout a map. Then the "brain" can tell the teams to go to different zones instead of specific points. Also I'm being to believe that the easiest way to successfully complete my task is to make a "map editor" so I can places zones and nodes throughtout my maps...
haliop
User Banned
Posted: 30th May 2010 08:56
well if youre building an engine you will need a map editor regardless the Ai , the zone idea sounds good.
How is it going
16
Years of Service
User Offline
Joined: 18th Sep 2007
Location: California
Posted: 1st Jun 2010 05:47
cool, good to hear... I'm still not quite to the AI part of deving yet... but soon I will be; I'll probably be posting a lot of questions, lol.

Login to post a reply

Server time is: 2024-07-04 10:28:50
Your offset time is: 2024-07-04 10:28:50