Return to “General”

Post

Let's talk about AI - Just for fun

#1
First, a little about me. I do mean a little. I'm not a complete stranger to game development and, I have messed with some AI programming. Quite a number of years ago I wrote a game development framework based on a modified hopfield net. The coolest part of the thing was that it was self-organizing. What that means is that a game created in the framework was not structured by the programmer; the programmer just created all the pieces/parts and the framework took care of arranging and ordering everything into a coherent working system. Now, that might sound neat and all but, it had some significant problems.. one major problem being concurrency. If the pieces/parts were created thoughtlessly they could easily step on each others toes. Anyway, I just thought it would be fun to talk about AI so here goes...

For those of you who don't know anything about STRIPS or goal planning the basics of how a goal planning AI works is as follows. Goal planning has three major parts being:

Pre-existing states(Preconditions) -> Actions -> Goal States(Effects)

The preconditions represent a definition of the world such as a boolean value for tired(true/false). The actions represent transitions from one state to another for example the Sleep Action is a transition from state tired(true) to the state rested(true). Goal states represent a set of desired effects that you want your AI to have on the world. AkA Your AI wants to be rested(true) so it formulates the plan Sleep to achieve that state. The way the AI knows it needs to Sleep is IF it currently posseses the state tired(true) AND is NOT rested(true).

Thats very simplified but, basically the way goal planning works. An actual planning algorithm might look as follows:

1. Choose a goal to achieve.
1a. Have a goal invoked by some other Action.

2. Check preconditions(make sure its actually possible to achieve the goal) on fail choose a new goal(goto step 1).

3. Choose an optimal action sequence to achieve goal states.

4. Implement the Action Sequence(actually perfrom the actions and transition across states).

5. Check effects(test your states to see if you have arrived at your goal states).

6. Goal achieved? No(Replan-goto step 3) Yes(Do something else-goto step 1).


Ok so,if you don't already know about goal planning you might be saying, " How does that work?" Well basically its just a graph. You graph all the world states and that becomes the definition of your world. Then, you build into the actions what states they transition across and, you assign cost to the actions. Once you have that all in place you can use the A* algorithm to find the optimal action sequences for the desired goals.

Where this gets interesting is conjecturing how the AI chooses its goals. And, perhaps, conjecturing what goals the AI might have to choose from. For right now Ill leave it there. I have been at work all night, and I'm starting to get a bit too tired to think. Later, I might go into a list of all the goals that would be neat for an AI in a space sim to have or, if someone else wants to start up a list that would be cool. Then maybe talking about how an AI could choose bewteen those goals would be fun to chat about.

Bye :wave:
Post

Re: Let's talk about AI - Just for fun

#2
Color me intrigued. :) My quick, naïve impression is that this sounds something like a dynamic state machine, where part of the function of the system is to add and delete states (and transitions) -- how far off is that?

If you still like this sort of thing, you might be interested in the "Games by Angelina" work that Michael Cook has been doing on the machine generation of games.

I look forward to seeing more in this thread!
Post

Re: Let's talk about AI - Just for fun

#3
Flatfingers wrote:Color me intrigued. :) My quick, naïve impression is that this sounds something like a dynamic state machine, where part of the function of the system is to add and delete states (and transitions) -- how far off is that?

If you still like this sort of thing, you might be interested in the "Games by Angelina" work that Michael Cook has been doing on the machine generation of games.

I look forward to seeing more in this thread!
I was thinking of Angelina too. The guy who developed it is (or was) a PhD student at my university. He gave a talk to us about Angelina and how it works and stuff. It was pretty cool.
Post

Re: Let's talk about AI - Just for fun

#4
ThymineC wrote:I was thinking of Angelina too. The guy who developed it is (or was) a PhD student at my university. He gave a talk to us about Angelina and how it works and stuff. It was pretty cool.
That's awesome!

I've had a few brief, minor email conversations with him, and he seems very much Josh-like in his perspicacity and friendliness.

Never enough such folks in this world.
Post

Re: Let's talk about AI - Just for fun

#5
You might also be interested in http://users.soe.ucsc.edu/~michaelm/pub ... ia2007.pdf

I think goal planning could be a dynamic state machine. You could create a hashtable of states that an entity possesses then add and remove states from the entity as they become realized. This would take some careful planning because you wouldnt want to add a state to an entity that it could not normally possess. You could just as easily build the states into the entity as boolean values where true means the state is on and false off or you could use a bit field. Of course, then you could control the behavior of the entity based on what states are on.

However, let's think about this. What is the state rich? You really can't define rich as on or off. Well you could but, it would not be very useful. So, how do you plan to become rich when the very concept of rich is subjective? One person might think having a thousand dollars makes them rich and, another person would just laugh at them for thinking so. You could just totally ignore the concept of rich and go back to on/off planning. It could work kind of like: idle(precondition) -> do work(action) -> get paid(effect). So in effect, you don't care how much money you have you just plan to get money. This doesnt sound very useful either. (and it's also extremely simplified)

The other option is to be rich by comparison. Sooooo, what does that mean? Obviously, bit fields and boolean states aren't going to cut it. Not only that but, it implies that your planning for one entity becomes dependant on the states of another entity. Now, we're getting somewhere. We are starting to think about HOW an AI could choose its goals but I am jumping the gun. The other implication here is that some states have to be full blown values of some kind but, when a value can be more than on or off HOW do you decide at what value that state means something to the entity? Game logic/mechanics?

I am so sorry, but I am totally washed out... working at night sucks. I have hit the wall and its much harder than I am. I also have this feeling like I have walked down a road and now I don't really know why I picked that road to begin with. Kinda wierd, lol. :eh:
Post

Re: Let's talk about AI - Just for fun

#6
I would define rich as having a passive income that is greater than your working income plus your expenses. For instance, if you have 3 AI mining an asteroid field for you and the net income they generate is greater than your expenses then you no longer have to work and will gain income passively. If this happens then the player can be considered rich since working is no longer necessary.
Image
Post

Re: Let's talk about AI - Just for fun

#7
BFett wrote:I would define rich as having a passive income that is greater than your working income plus your expenses. For instance, if you have 3 AI mining an asteroid field for you and the net income they generate is greater than your expenses then you no longer have to work and will gain income passively. If this happens then the player can be considered rich since working is no longer necessary.
Yep, I would really dislike getting to this point fast.
Your employees should be NPC that require a wage (or a piece of the cake). But you have to offer them something, or why wouldn't they just work for themselves? Perhaps you can offer them protection by hiring patrols as well.
So the piece of their sales they give to you would be protection money + a small bit of profit.

I do not want to play a game that behaves like X3 in this aspect, where you buy a ship for a one-time cost and can use it indefinitely, without having to pay the pilot wages or whatnot.
Beware of he who would deny you access to information, for in his heart he dreams himself your master.
Post

Re: Let's talk about AI - Just for fun

#8
BFett wrote:I would define rich as having a passive income that is greater than your working income plus your expenses. For instance, if you have 3 AI mining an asteroid field for you and the net income they generate is greater than your expenses then you no longer have to work and will gain income passively. If this happens then the player can be considered rich since working is no longer necessary.

I can see that as a definition of rich. It's nice and self contained and could be modified by ambition.

Online Now

Users browsing this forum: No registered users and 2 guests

cron