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.

Newcomers DBPro Corner / Learning AI

Author
Message
Twu Kai
18
Years of Service
User Offline
Joined: 2nd Oct 2005
Location:
Posted: 20th Mar 2006 13:48 Edited at: 7th Sep 2007 17:43
I'm making a program where the key object "Learns", I'm unsure of how I should make it do that. It's already got the AI wandering, and collision where the object turns away when it hits an object, but It would be better if it could hit an object once, and then avoid the object after it knows that it's there, sort of like a baby!

I'd be grateful if you could give me any advice on how to do this, and maybe other ideas for what it should learn!

Here's the code:


Thanks!

Show off your no Shader effects at the No Shader Effects Thread!

Attachments

Login to view attachments
David iz cool
19
Years of Service
User Offline
Joined: 21st Sep 2005
Location: somewhere lol :P
Posted: 20th Mar 2006 16:51
thats a very hard thing to do.the only thing i can recommend is going to some programming sites that specialize in ai programming.
try to study how they do it.it might give you an idea of how to start in dbp.
Pheonixx
20
Years of Service
User Offline
Joined: 6th Oct 2003
Location: Columbus, Ohio
Posted: 20th Mar 2006 17:10
When you are talking about an actor learning the map specific to itself, then you are essentially taking parts of the world map and transferring them to it's own internal map. This internal map would be used to precalculate a path from A to B and if you use a pheremoan trail, you could even have it evaluate which paths it's traveled and which of those paths resulted in life or death or whatever the goal happens to be. An explorer AI would look for empty areas on the map and dedicate itself to aquiring those locations. A Gaurdian AI would look at high traffic areas on the map and dedicate itself to patrolling it. A Warrior AI would look at the high resource value areas on the map and dedicate itself to defending it. And all AI variations would make their efforts to build/defend when threatened, even if it's just cowering.

This can be done, and is very memory heavy depending on the size of the map. It uses typical pathfinding algorythms that are usually found in Turn Based Strategy games. There are faster methods, but typically with learning AI you have to custom tailor what's available to fit your world and your circumstances.

http://ausukusa.breakset.com
Mr X
18
Years of Service
User Offline
Joined: 25th Sep 2005
Location: Universe, milkyway, sol-system, Earth...
Posted: 20th Mar 2006 17:58
Just got an idea (dont know if it will work or not). You can create an array that stores the x,y,z values of the object/objects your little "baby" hits and then make so it avoids them. And everytime it hits a new object, you dim the array and store the x,y,z values of that object. I know there are many holes in this idea (I can see many myself), but hopefully it might inspire you. Goodluck.
Twu Kai
18
Years of Service
User Offline
Joined: 2nd Oct 2005
Location:
Posted: 20th Mar 2006 19:18 Edited at: 7th Sep 2007 17:43
Thanks for all the replies!

@ David iz cool
That's a good idea, thanks!

@ Pheonixx
I don't know that much about paths, but I'll try to learn more!
I thought that maybe when it collided with another object, it would save the position it was in at that time to a file, and carry on reading that in future sessions, and detecting how close it was to the point in the file, and turning around when it did that?

@ Mr X
That's sort of like my above idea, but yours might be better though, seeing as I would have to have the same number of files as objects, so I will investigate!

Thanks again for the replies!

Show off your no Shader effects at the No Shader Effects Thread!

Attachments

Login to view attachments
Twu Kai
18
Years of Service
User Offline
Joined: 2nd Oct 2005
Location:
Posted: 22nd Mar 2006 13:30 Edited at: 13th Sep 2007 20:44
Ok, I think that the simplest way to do it, although it isn't learning,
is to make a set of small objects that are hidden, and use them as node points, so I would program it something like this:


Would that work do you think?
I know it would be fairly time consuming though.

The no Shader effects thread:

Attachments

Login to view attachments
Pheonixx
20
Years of Service
User Offline
Joined: 6th Oct 2003
Location: Columbus, Ohio
Posted: 22nd Mar 2006 16:50 Edited at: 22nd Mar 2006 16:51
If you are going to use a tree/node method, then make sure each tree nodes ID is relative to the players real world coordinates.

Simple math here...

MapMaxX = 100
MapMaxZ = 100

PlayersPositionX = 5
PlayersPositionZ = 12

... something logical happens, like hitting a wall and you want to store this event in memory ...

NodeID = (PlayersPositionX + (PlayersPositionZ*MapMaxX)
NodeID = (5+(12*100)) = 1205


By having your NodeID's relative to a real world coordinate, you can easily compare nodes in your tree to identify in this example, an expansive wall.

Also in this example you could easily say that:

If ThisNodeID = ThatNodeID+100 Then ThisNodeID is z+1
If ThisNodeID = ThatNodeID+1 Then ThisNodeID is x+1
If ThisNodeID = ThatNodeID-100 Then ThisNodeID is z-1
If ThisNodeID = ThatNodeID-1 Then ThisNodeID is x-1

Making a logic tree is pretty illogical unless you have a way to reference it's branches. Every Node has an ID, so make it useful by using this method.

http://ausukusa.breakset.com
Atreides
20
Years of Service
User Offline
Joined: 11th Oct 2003
Location: Switzerland (but NOT on a mountain !)
Posted: 22nd Mar 2006 17:25
Here's something which may interrest you.
http://forum.thegamecreators.com/?m=forum_view&t=68559&b=6

The sleeper must awaken !
Mr X
18
Years of Service
User Offline
Joined: 25th Sep 2005
Location: Universe, milkyway, sol-system, Earth...
Posted: 22nd Mar 2006 19:11
Got an idea that might improve the method I suggested. If you also make so the AI calculate the distance to the point, you can make so if it get too close, it will turn in another direction. To do this, you can both store the position of the object the "baby" hits and the point where the "baby" hits it. Then use this to calculate how big the object is (yes, I know that it will calculate it as if it was a sphere, but its better then nothing) and then put the limit where the "baby" turns to another direction a bit beyond that. Hope it helps.

Login to post a reply

Server time is: 2024-09-24 19:26:11
Your offset time is: 2024-09-24 19:26:11