Advertisement

Pure Decision AI...best method to use

Started by August 15, 2017 10:04 PM
18 comments, last by IADaveMark 7 years, 3 months ago

I'm building an American football simulation(think football manager), and am wondering about the best way of implementing AI based on various inputs which are weighted based on the personality of the NPC...I have a version of Raymond Cattell's16PF model built into the game to be able to use their various personality traits to help guide decisions.

I am going to use this extensively so I need this to be both flexible and able to handle many different scenarios.

For instance, a GM has to be able to decide whether he wants to resign a veteran player for big dollars or try and replace them through the draft. They need to be able to have a coherent system for not only making a decision in a vacuum as a single decision but also making a decision as part of a "plan" as to how to build the team...For instance it makes no sense for a GM to make decisions that don't align with each other in terms of the big picture. I want to be able to have the decisions take in a wide range of variables/personality traits to come up with a decision. 

 

There is no NPC per se...There isn't going to be any animations connected to this, no shooting, following, etc...just decisions which trigger actions. In a situation like a draft, there is one team "on the clock" and 31 other teams behind the scenes working on trying to decide if they want to try and trade up, trade down, etc which can change based on things like who just got picked, the drop off between the highest graded player at their position/group and the next highest graded player in that position/next group, if a player lasts past a certain point, etc...

There needs to be all of these things going on simultaneous for all the teams, obviously the team on the clock is goifn to have to decide whether it wants to make a pick or take any of the offers to move down in the draft from other teams that might want to move up, etc..

So I am planning on making use of something called Behavior Bricks by Padaone Games( bb.padaonegames.com )which is a Behavior Tree but in conversations with others who have worked on AI in major projects like this(EA sports) they said to combine this with a State Machine.

My question is would I be able to do this using just Behavior Bricks or would I need to build the state machine separately?  Is there something else already created for this type of purpose that I could take advantage of?

Ubiquitous answer for a starting point... 

http://intrinsicalgorithm.com/IAonAI/2012/11/ai-architectures-a-culinary-guide-gdmag-article/

Figure that everything you are going to be doing is weighing and scoring the relative value of different numerical inputs, biased by the personalities of the deciders. Straight up utility system is the way to go.

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!"

Advertisement
29 minutes ago, IADaveMark said:

Ubiquitous answer for a starting point... 

http://intrinsicalgorithm.com/IAonAI/2012/11/ai-architectures-a-culinary-guide-gdmag-article/

Figure that everything you are going to be doing is weighing and scoring the relative value of different numerical inputs, biased by the personalities of the deciders. Straight up utility system is the way to go.

Awesome link, thanks!

How would I weigh immediate utility versus long term utility...ie, making a move that might make the team worse in the short run but will free up cap space and give them draft picks in return that they hope can make them better 2-3 years down the line?

 

Ubiquitous answer to all "how would I" questions...

If you were doing this in a pen-and-paper game or a board game, how would you make the decision?

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!"

 

57 minutes ago, IADaveMark said:

Ubiquitous answer to all "how would I" questions...

If you were doing this in a pen-and-paper game or a board game, how would you make the decision?

Well, now that I think about it, probably I should do it the way real GMs do it...they evaluate the team against expectations at the end of the season and then make decisions as to what direction to take the team in.  I probably need to have a "Team State" which then would control the options the GM would consider while making decisions and would allow these decisions to align properly together...

Coming at it from a different angle, there's the concept of 'discounted future rewards', which is a fancy way of saying "the chance of $1000 in a year's time is worth less than the same chance of $1000 today". You typically only want to make a sacrifice in the short term if the long term outcome is significantly better. So if you have some way to numerically measure (or, more likely, estimate) the quality or utility of a certain outcome, you will want to weight future outcomes less positively.

Advertisement

Well that is not necessarily true for football. You have many things at play. Let's say you have a good player but you know he is going to demand top dollar and/or has told you he doesn't want to play there or won't resign there.

Will it make you better by trading this player today? No...but you will at least get some assets back in return instead of letting the player walk for nothing if you trade him now. There is no guarantee you will even get fair value(most times you won't) but something is better than nothing.

Sometimes a good player doesn't fit a scheme for a new coach/GM. He is a good player but not in this scheme. Trading him doesn't necessarily make you better short term, but if he can't do what you ask him to well there isn't much reason to keep him.

Maybe the player clashes with the new coach or GM, and he is going to be a problem...

There are also salary cap related decisions...You can't pay all your good players because you only have limited resources to spend or you end up screwing yourself over really badly for future years...For instance...a very good player wants to be paid like a Top 5 player in the league, but his true value isn't worth that...do you bite the bullet and overpay him or let some other team overpay him? Do you resign an aging vet with 1 more good year left to a 4 year contract knowing you are going to probably replace him with a younger cheaper player before the contract is over, and unless you can negotiate a low $ guaranteed money contract, are going to have a bunch of dead cap money floating around in future years or simply replace him now with a rookie who might not be as good this year but is a lot cheaper and who you expect can fill his shoes by year 2?

There are a myriad of reasons why a team will be willing to let a player walk in FA, not resign an FA, or trade a player for future picks and many times they KNOW they aren't getting fair value back, but do it anyway.

Football  reasoning/decision making is far more complex than these simple utility methods that work in shooter games because there are no guarantees you will be able to get more future value but you also have to be mindful of salary cap restrictions in the meantime and many other variables that come into play.

 

 

Suggesting that the economic and strategic decision-making in football is different than the decision process used in FPS games is... uh... fairly obvious? I would suggest that it hardly bears mentioning. However, comparing it to something like a TBS game like Civ is more accurate and has plenty of overlap in the mentality and methodology. And yes, Civ-style games are almost entirely utility-based (i.e. mathematical modeling of decisions).

As for uncertainty of the payback, it's pretty easy to apply an estimated success rate of payoffs and multiply the payoff amount by that. e.g. I have a 75% chance of this panning out and if it does, I will net $1000 worth of value. Otherwise, it may be $200 worth of value. So what's your average payoff given those factors? That's why it is called "maximization of expected utility".

I know a book you can read that covers mathematical modeling of behavior in game AI. Can't think of the title right now, though...

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!"

Replying to the original poster:

I think you misunderstood me. Pretty much any reward, when postponed to the future, has to be somewhat discounted, because it is not as good as the same reward received today. Things can change between now and the future which make the same reward less useful. So that's just an abstract way of weighing "immediate vs long term" utility, which is what was mentioned above.

In your specific example directly above you're actually comparing 2 quite different outcomes, and it's reasonable for them to be scored differently.

Everything you mention can be modelled with a utility-based system. I don't think a behaviour tree system is a good fit for this sort of problem at all, especially not when you want to factor in the personality scores. Behaviour trees are good for situations when there are is a clear hierarchy of prioritised choices and real-time tasks to be performed based on those choices.

A reasonable approach would be to try and model the outcomes from an 'average' point of view, and then to apply different weightings based on the personality factors you mention. For example, when you say "Will it make you better by trading this player today? No...but you will at least get some assets back in return" - you'd model the estimated benefit of those assets, and they would be compared to the estimated benefits of keeping the player. Those estimates can vary based on the personality of the person doing the assessment.

If you need to perform multiple decisions as part of an overall plan, there are a couple of approaches you'll want to consider:

  • actual planners - they are algorithms that run through various permutations of actions and work out which ones to do, and in which order. They usually assume there is a clear definition of success however, which you are unlikely to have.
  • state-space search (such as A*) - these algorithms are similar to planners but try to find the best route through 'state space'; again, this is usually about trying different hypothetical actions and measuring the expected outcomes.

 

Well, one of the reasons I brought up state machines combined with Behavior Trees was from a response I got on here from a guy who worked with EA Sports designing AI for NCAA Football among other things, but I have quite a few questions regarding implementation that I'd need to understand before going down a route like that...plus as with anything dealing with programming there are almost always multiple ways to achieve the same end result so I thought I'd get other opinions and see which one would make more sense to me...

https://www.quora.com/What-is-the-best-option-for-a-Pure-Decision-AI-in-Unity

 

This topic is closed to new replies.

Advertisement