Advertisement

I like AI

Started by October 28, 2010 06:09 PM
26 comments, last by Tipotas688 14 years ago
Ohh my.

Quote: Original post by InnocuousFox
Your approach was similar to taking a 7 year old ....teach the hapless child calculus at this stage would not be productive for either the student or the teacher.


Tipotas, are you really a hapless 7 year old who just happens to be going to University? Kudos on your work with MinMax; recrusive functions are tricky! Despite what Dave Mark says, it's more linear algebra than calculus. There is some Matrix math, but definately worth doing since it can carry over to all kinds of things non-AI (like 3D rendering).

Quote: Original post by InnocuousFox
The OP isn't "interested in predicting future events based on past behavior." He's interested in writing a simple decision-making agent that needs to look at its own bloody context in the world ... He doesn't even know how to make a context for the agent to look at ... More importantly, he would have no framework for even recognizing, much less recording and analyzing the agents' actions.


The OP (Tipotas688) asked "Hey I have worked on minimax and pathfinding in the past, some of A* as well. What should I try working on next?". Our poor fellow even went on to elaborate that he'd implemented a PacMan AI that could see and had a memory. Sounds to me like he's already got that 'context in the world' thing figured out.

If anything has been confusing the poor lad it's your oft-repeated insistence that he implement a glorifed script engine... err I mean state table.

Quote: Original post by InnocuousFox
Again... there's a lot of math to be learned before calculus.

We're talking about linear algebra Dave. Besides, I'm sure his calculus is adequate given that he's already implemented MinMax.

Quote: Original post by InnocuousFox
You sound like a salesman, by the way.


That's rich, coming from a guy who tags each post with:
- a link to a website where he sells 'AI' expertise.
- a link to buy a copy of his book
- a link to his own forum (where I'm sure he does his best to derive advertising revenue, or promote his own speaking appearances)


Anyway, back to the OP:

Tipotas688, time series analysis is all about finding patterns and trends in past data that can help you make decisions about future events. It's one of those things that can be really simple or really complex, depending on what you want to do. It's also one of those things that hasn't been solved. Wikipedia has a good page on it. The math at Wikipedia is usually pretty formal, but if you Google a specific term you can usually find more clear explanations elsewhere.

A good place to start is linear regression (which you probably already have some experience with). Basically, you have a bunch of points (coordinates of where the player was), and want to find a line that comes close to hitting all of those points-- like estimating a trajectory. It's really simple and can be done in a few lines of code. Non-linear regression allows you to do the same thing, but with more complex curves; instead of figuring out the best line that fits your data, you can figure out the best sine wave, or best zig zag, or whatever.

You don't even need to know what type of curve to use before hand-- Google 'R squared' or 'correlation coefficient'. You can use either number to measure how accurate your regression is. With that you can regress a series of curves to the data and pick that one that has the highest correlation coefficient. I promise that this can all be done in real-time if you're clever about it.

Concepts like a predicition interval can help you judge how how accurate your future prediction will be (as opposed to how accurate it fits the data you already have), and give you a range around that prediction that should 'gaurantee' you've covered your bases. (I use the word gaurantee loosely here)

Imagine that you've been watching the player move towards some goal, and it looks like he's zig-zagging back and forth. Using regression analysis you've modeled the players behaviour (in real-time) and determine that he's about to Zag. You want to know where you should move your AI pieces so as to best block/trap the player. In the real world the player will probably never actually follow your predicted exactly, and so you can use the prediction interval to judge 'where abouts' he's going to be along that predicted path. Place your pieces in such a way as to cover the prediction interval on either side of your regression.. or not. It's up to you-- whatever works best for what you're trying to do. :)
Yeah that's very nice, as I was filling up the state machine, I created a "memory" of where the player attacked a helpless agent and was "seen". So using a radius of the position firstly seen in each of his "attacks" I found the "center" of these radii and told the police agent to investigate there... Suppose a bit similar but without the line part :P

About the above posts: I believe being treated with the knowledge of a 7 year old, sometimes helps because I start things from 0 and if I actually have some knowledge on the matter I advance faster. The thing is that in the past I learnt quite a few things (due to people not suitable to be teachers) partly. In order to cover these holes I try to learn stuff anew in order to fill that incompetence.

That was actually the reason behind this post. I try to find new teachers in the form of books and teach myself how it should have been done in the first place, that's why I still struggle thinking up scenarios that could prove a good addition to what I have already done, that's why I don't know if learning neural networks first is better or if/then logic... So far I really like Mat Buckland's book! It really explains stuff without making my brain leak..!

PS: I already have my Masters degree and a few months in the industry ^_^
Not enough AI knowledge though for what I would have wanted!
Advertisement
Willh, you gave Tipotas688 the suggestion to look into time-series analysis several posts ago, and it looks like he took it to heart and thanked you for the suggestion. Game AI has traditionally found little use for conventional ML techniques, compared to simple, hand-tweaked state machines. There's a lot to be argued about why this is the case, and whether (and how) things should change. Nevertheless, the importance of these "glorified script engines" is unmistakable, so I wouldn't think presenting it as "what to do next" would be at all controversial.

Beyond that, I see a lot of personal grievances being aired here, wrapped loosely in a rather frayed cloak of helpfulness. Let's stop with those.
OK so here is a video of my states, how about it InnocuousFox?

">Link


(Mod note: added html link to post)

[Edited by - InnocuousFox on November 3, 2010 4:19:08 PM]
OK... that's looks pretty decent. I see where you are heading with both the gatherer and the defender. I was kinda waiting for you to get close to the house towards the end to see the defender switch out of protect mode.

One thing that might be a neat switch is to have a limited view horizon for the gatherer. That way, you can go from "search" to "gather" mode. One would be a sort of wander behavior where the other is actually moving to something you see. You could even have a "find food" state that would kick in when the % gets lower. At that point, you would no longer want to pick up grass (or whatever that is) because you are tired. Instead, you would only seek the apples. I'm just suggesting those because you were looking for more states.

This also would tend to have you in the direction of a hierarchical FSM. That is what it sounds like. You have general states which contain other sub-states.

As you add more states, you might want to look into the concept of behavior trees. The end result is similar to a FSM, but the decision logic is pulled out of the states and put into a decision engine. You can find a lot of information on those scattered all over the net. Note, however, that the architecture will be significantly different.

Other than that, you seem to have gotten the hang of it. Well done.

Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play

"Reducing the world to mathematical equations!"

Thanks! :)

Actually there is a different state for look for food when the agent is tired, he just gives some priority to the apples instead of the grass but that's only when he's below 50%. His aim though is not to gather apples just to clean the grass ;)

The defender only goes aggressive if I am pestering the gatherer and he is close to be able to see (actually hear as its not a cone its a radius) then he goes to protect mode as you can see in the video :)

I liked the idea of search to gather with the limited horizon. I might divide the map into pieces and make an A* for him to find him way through treating the player as a wall or something :)
Advertisement
You could also just put walls or other obstacles in there. That would complicate the seek/flee movement somewhat.

Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play

"Reducing the world to mathematical equations!"

Although I was thinking of looking into something else apart from pathfinding.

This topic is closed to new replies.

Advertisement