Skip to main content
gamedev.net
🔒 Locked

Fun project using AI

Started by Peon 0 replies 700+ views
Original Post
Peon
Peon
I''m sure this has probably been done before, but I just wanted to get some thoughts on it. If I ever take an AI class for my CS degree (likely), I would love to attempt something like this. The project would be to create an AI that could find its way around a user created map. What sparked this idea, was a very cool Ant demo, that has ants trying to find food and such. After creating a map (side view, perhaps), the AI player would be "dropped in" and would have to complete an objective. There could be many objectives you could use... kill this, get to point X, collect things, etc... The AI has little knowledge before being dropped in. He would have knowledge of some things, however. He would be able to look around his environment, walk around, etc... He would also have some knowledge of his capalities. This would include knowing about how high he can jump, how strong he is, how fast he is, etc.. Upon entering, the AI would scan his surroundings. He would look towards the point of his objective (assuming he could see it) and begin to take note of the objects in the area. There were would be many predefined objects, each with a set of unique properties. There are too many to list here, but I was thinking each object would have a weight, size, whether or not it was movable, material, flexibility, etc... By looking at an object, the AI could attempt to determine a possible solution to the problem. For possible scenario I thought of, is getting to a certain point above the AI. The AI looks around, and can''t find any way he could possibly jump up there, or climb. He continues looking around his surroundings, until he finds a crate on the ground, which he picks up. Unfortunately, he doesn''t really know what to do with the crate, but after playing with it for awhile, he realizes that the crate isn''t big enough to get to his final destination. The AI contiunues to look around his surroundings, until he finds a rope on the ground. He knows that his final destination is above him, and eventually throws the rope up (based on his knowledge of the rope''s length, flexibility, and other factors) The rope latches on to something up top, and he learns o climb up and reach his destination. I''m sure this project is not as trivial as I make it out to be. Heck, I know practically nothing about AI. Still, I thnink AI is an exciting field, and I''d like to learn mroe about it. Any thoughts on my above suggestion? Are there any projects that have, or plan to, implement a system like this? Peon
Peon
_Danneman_
_Danneman_
I remember a thread about 6 months ago (or more) where we actually did elaborate on this not so trivial problem (understatement of the year), where an autonomous agent would interact with a world with objects defined by its weight, size, movability, etc.

My idea about the problem was as follows (I think):
The basic matter of this problem is for the Agent to have some sort of imagination that will let it solve the problem at hand with what is available to him (the objects, his own physique and ability of movement), and the laws of physics that he has to abide to.

Since we dont want the Agent to actually perform any number of iterations of behaviours (using Genetic Alg.)to arrive to a conclusion (he´s supposed to use his imagination, right), we should implement a second dimension of the actual gameengine where all the iterations would take place. This other dimension - a fantasy-dimension of the game - would ofcourse have scaled off graphics and be otherwise simplistic.

The Agent would make an estimation of his environment with whatever sensors are his to use, and the accuracy of the perception of his surroundings would be adjusted according to what kind of perception the Agent is supposed to have (you know, in an RPG you often have this attribute). For instance, if the Agent is short-sighted, we would multiply his estimation of an objects size with a randomizer within an interval that would off-set the accurate size with maby -10% - 10%.

Well, we would now take this estimated input of his surrounding, and adjust the objects of his fantasy-engine accordingly. So now we dont actually have an exact replica of the real engine, but an estimation, prone to errors. In the fantasy-engine, the Agent will run a series of iterations of behaviours that will spawn an acceptable result.

For instance, if the problem is for the agent to climb a stair of two steps, located to his left: He has a number of pre-defined movements at his disposal (move forward, move right, lift leg, etc), which could also be distorted by a randomizer if you wanted to implement a factor of clumsiness. The size and other properties (perhaps the distance to the stair) have been altered according to his perception of them. Now, he tries a number of actions in a random order. For instance, 1) Move forward, 2) move right, 3) lift leg, 4) move forward 5) turn left. Ok, this did not result satisfactory - the Agent didnt reach the top of the stairs. So we try again, and again.

Before we move on, we should introduce two other factors that are easily implemented and will make this more humanlike.
a) Intelligence
b) Stress

a) Intelligence: if an Agent is asked to try to imagine a sequence of events that will lead to a solution of a problem, the NUMBER of actions that he will iterate trough in each loop in search for a solution will vary according to how intelligent he is. So if an Agent has Intelligence 100, he would go trough maby ten steps for a solution, while an Agent with 20 would go trough 2 iterations. This Agent went trough 5 iterations, ie. he has Intelligence 50 (according to this pointsystem). It is obvious that an agent with an intelligence below 50 could not solve the problem above, since he would have to 1) Turn left, 2) lift leg, 3) move forward, 4) lift other leg, 5) move forward.

b) Stress: well, if the agent is stressed for time (he is chased by a monkey in heat) he will loop through a fewer number of solutions than someone who has all the time in the world. So since fewer loops are made, it is more likely that he will not reach an optimal solution.

Ok, we should also implement the concept of Genetic Algoritms here. If not, we would only stumble on a good solution by chance. So what we do is we view the diferent actions that an Agent can perform as individual genes in a gene-sequence of the length established by the intelligence (here 5). After a couple of loops established by stress-level (for instance 10), the genes of the two most successful gene-sequences so far would be merged randombly (and mutated randomly) to spawn a new generation of gene-sequences to try out. This would require that we have some sort of way to establish how close the Agent is to accomplish his goal after each loop through a gene-sequence. This could be done in a number of ways - perhaps a energy/proximity to goal-parameter, or something.

So, when the Agent reaches a solution in the fantasy-engine that he sees fit to try out in the real engine (or if he has not arrived at a solution, only a partial one, he could perform the actions that will get him closest to accomplishing it, and reevaluate the problem at hand), he does so. But keep in mind that his level of perception has altered the fantasy-engine away from the real-engine, and the performance of the solution may spawn a different result in the real-engine than it did in the fantasy-engine. Just like the real world, that is.

A note on the gene-sequence, though. I didnt include the properties of objects in the gene-sequence in the simple example of climbing a stair, since it required no real usage of any objects (the stairs were climbed by lifting the legs and moving forward, not actually USING the stairs). But if the problem would require the usage of a gun, with which you would shoot something, then you would have to implement the gun (at the very least) into the sequence. 1) grab 2) gun 3) pull finger. Well, perhaps even this sequence could be coded to only use verbs : 1) grab (the gun is in the hands way, and will automatically be grabbed) 2) pull finger (the gun is in the hand and the effect will be that it will go off).

----PATRIOTISM----
“Beware the leader who bangs the drums of war in order to whip the citizenry into a patriotic fervor, for patriotism is indeed a double-edged sword. It both emboldens the blood, just as it narrows the mind. And when the drums of war have reached a fever pitch and the blood boils with hate and the mind has closed, the leader will have no need in seizing the rights of the citizenry. Rather, the citizenry, infused with fear and blinded by patriotism, will offer up all of their rights unto the leader and gladly so. How do I know? For this is what I have done.
And I am Caesar.”
— Julius Caesar

"I am enormously proud to be an American. I would say that the things that our corporate-controlled government has done at best are shameful and at worst genocidal-but there''s an incredible and a permanent culture of resistance in this country that I''m very proud to be a part of."
Tom Morello, Rage Against the Machine
------------------------Why of course the people don’t want war. ... That is understood. But after all it is the leaders of the country who determine the policy, and it is always a simple matter to drag the people along, whether it is a democracy, or a fascist dictatorship, or a parliament, or a communist dictatorship ...Voice or no voice, the people can always be brought to the bidding of the leaders. That is easy. All you have to do is to tell them they are being attacked, and denounce the pac

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.