Jump to content

  • Log In with Google      Sign In   
  • Create Account


Bayes Networks in games?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
16 replies to this topic

#1 calculemus1988   Members   -  Reputation: 109

Like
0Likes
Like

Posted 20 October 2011 - 06:15 PM

I am learning about Bayes Networks at Stanford's online AI class. I was wondering if there are books that talk about and implement code related to Bayes networks in context of games?

Thanks

Sponsor:

#2 IADaveMark   Moderators   -  Reputation: 2314

Like
2Likes
Like

Posted 21 October 2011 - 07:21 AM

There's not a lot of writing about Bayes in games because there's not a lot of use for Bayes in games. That's unfortunate because it is a really powerful technique. Most of the reason that we don't need to process partial information in the game realm is because, with regard to the game engine and entities, we already have ALL the information. What we can use it for is stuff that is not inherently a part of the game -- the player, for example. There is some use of Bayes to intuit player intent. For example, given a list of criteria about a situation, if the player is holding his sniper rifle, we are undetected by the enemy, we are in cover, and the player starts to move forward, chances are the player is not planning on rushing the enemy -- he wants to pop a melon or two.

That being said, in the book, AI Game Programming Wisdom, there is a great explanation with examples of Bayesian networks by Paul Tozour.
Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC

Professional consultant on game AI, mathematical modeling, simulation modeling
Co-advisor of the GDC AI Summit
Co-founder of the AI Game Programmers Guild
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!"

#3 willh   Members   -  Reputation: 160

Like
0Likes
Like

Posted 21 October 2011 - 01:06 PM

There's not a lot of writing about Bayes in games because there's not a lot of use for Bayes in games.


I disagree. Dave, have you ever played Monopoly for the iPhone? <shudder>

It has 3 difficulty levels. At level 1 (easy) you can offer the computer the list price for a property it owns, and it will sell it. At levels 2 and 3 I'm pretty sure that the computer cheats-- as in the dice are loaded with magical weights that allow the computer to alter its 'luck' level. lol. It doesn't look like EA made any effort to build a 'smarter' opponent and IMO the game seriously suffers because of it.

Bayes would have been perfect for Monopoly.

So, OP, there is plenty of room for improvement in games, provided you're thinking about the right sorts of games.

#4 IADaveMark   Moderators   -  Reputation: 2314

Like
2Likes
Like

Posted 21 October 2011 - 05:20 PM

Like I said, there are game for which it would be a powerful technique. Discerning the results of something stochastic (e.g. Monopoly) is one. I also seem to remember our discussion regarding the very Stratego-like game a few months back where I suggested that Bayes is the way of approaching that. However, in the face of actual perfect knowledge that the computer has, AI programmers don't need to use Bayes when we can just look up the info and fake stupidity. That's not my preferred method... I was just stating that it is often done that way.

A good example would be finding the player when he is hidden. Obviously the computer knows where the player is and can simply feign stupidity. However, that doesn't always lead to convincing error. Using Damián Isla's occupancy maps, however, is a Bayes-like treatment of influence maps. THAT leads to a very realistic approach by the NPCs because it is based on that magic combination of observation, belief, and possibility.
Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC

Professional consultant on game AI, mathematical modeling, simulation modeling
Co-advisor of the GDC AI Summit
Co-founder of the AI Game Programmers Guild
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!"

#5 calculemus1988   Members   -  Reputation: 109

Like
0Likes
Like

Posted 22 October 2011 - 11:01 AM

I am kinda disappointed finding out more and more(I am student by the way) that the jobs available in computer science are not that interesting as I thought. The things we study in theory, the cool stuff, don't have much applications yet. It seems the real world is way way behind in relation to the theory that is developed. I am not like oh I should quit computer science, far from that, I am just saying theory is way way too far from what is actually done in real world and what you get paid for.

#6 willh   Members   -  Reputation: 160

Like
0Likes
Like

Posted 22 October 2011 - 01:59 PM

I am kinda disappointed finding out more and more(I am student by the way) that the jobs available in computer science are not that interesting as I thought. The things we study in theory, the cool stuff, don't have much applications yet. It seems the real world is way way behind in relation to the theory that is developed. I am not like oh I should quit computer science, far from that, I am just saying theory is way way too far from what is actually done in real world and what you get paid for.


Calculemus, about 1% of people get the really cool jobs (like test driving Bugati Verons, reverse engineering fly brains, or designing video games). Everyone else is stuck doing things that your average teenager could care less about.

EA, in terms of a profit model, did the right thing by building a cheap AI. They wasted no money, and the 'Monopoly' brand name sold itself. The lame AI probably didn't affect sales one bit.

Dave is quite right in pointing out that most RTS or FPS games don't require an AI any more complex than a set of scripts. There really isn't much value in building complex AI for for most NPCs.

It has been my experience that if you want to do interesting cutting-edge things you have two options: Work for yourself, or work in academia. Build a game that uses a strong AI as the gimic that gets people to play it. It's never been a better time for the indy developer.

#7 Emergent   Members   -  Reputation: 967

Like
1Likes
Like

Posted 22 October 2011 - 05:09 PM

While it's true that intellectual products like new algorithms don't take huge numbers of people to produce -- so you'll be facing some competition to get these jobs -- I wouldn't totally write off these technologies as useless.

- Android and iOS devices both include speech recognition engines. Witness the much-hyped Siri. As far as I know, Hidden Markov Models are at the heart of most speech recognition algorithms; it's possible that Bayes nets are in use here too. And the speech recognition engines, though impressive, still leave much room for improvement. That means room for competition.

- The government funds a great many contractors that you've never heard of, who are trying to develop both old-fashioned database systems, and fancier statistical analysis tools including semantic networking tools, for understanding intelligence data. I imagine Bayes nets either get used here, or could be used.

- Robotics is very slowly taking off, not just in defense and in a few "silly" consumer applications like the Roomba (though it has some sophisticated competitors that even do SLAM!), but also in warehousing and factory automation, and we're just beginning to see the very leading edge of agricultural robotics. The world won't need a billion roboticists, but it is one more area where these sophistical tools can actually be useful.

I also think that games have a lot to teach these other fields. Sure, they don't need to deal with uncertainty to the same extent, but one thing they do a great job of is producing usable interfaces for interacting with the real world (or simulations thereof). People are beginning to acknowledge, for instance, that Starcraft is a pretty good model for what a good "net-centric warfare" interface should look like. Indeed, it was by explicitly following a strategy of copying Starcraft's UI that Ed Olson and his students won the recent MAGIC robotics competition in Australia. The difference, of course, is that instead of loading a map file you're doing SLAM, and the "fog of war" is real! My point in bringing this up is to say that, although some of these algorithms don't get used in games themselves, they get used in other fields that involve many of the same things as game development.

#8 calculemus1988   Members   -  Reputation: 109

Like
0Likes
Like

Posted 28 October 2011 - 04:45 PM

Thank you guys, I got a good idea about Bayes Nets in games.

In week 3 Machine Learning course, we learn about Neural Networks. So that I don't start a new topic, you guys wanna talk about Neural Nets in games? Are they used and to what degree?

Thanks

#9 IADaveMark   Moderators   -  Reputation: 2314

Like
2Likes
Like

Posted 29 October 2011 - 06:37 AM

Thank you guys, I got a good idea about Bayes Nets in games.

In week 3 Machine Learning course, we learn about Neural Networks. So that I don't start a new topic, you guys wanna talk about Neural Nets in games? Are they used and to what degree?

Thanks

Even the most basic search of this forum's posts will give you the answer(s) about NNs in games. Trust me... we don't want to restart that.
Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC

Professional consultant on game AI, mathematical modeling, simulation modeling
Co-advisor of the GDC AI Summit
Co-founder of the AI Game Programmers Guild
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!"

#10 Daerax   Members   -  Reputation: 1207

Like
-1Likes
Like

Posted 30 October 2011 - 08:45 PM

I am learning about Bayes Networks at Stanford's online AI class. I was wondering if there are books that talk about and implement code related to Bayes networks in context of games?

Thanks


Bayes Networks would be wasted on games. They are slow, inference on them is NP - hard. Building the network structure from data is also NP-hard. So for a decent sized network you gonna be doing something like gibbs sampling to do inference on network a structure that is almost guaranteed to be wrong. For a game the AI will take a long time to get at the distribution and is not worth it. Most of machine learning is either too slow, data intensive or stationary for Game use.

If there would be one machine learning thing that I would actively look into, it would be Decision Trees. Decision trees are brittle so can add variance and do well with little data. You could then augment them as Random forest or boosted trees. I think that would be where I would start.

A close cousin to bayes nets that might be useful to some types of games (arcade shooter, anything requiring movement tracking and prediction) would be a particle filter. Finally, a bared down Reinforcement learning algo may be good for long term play in a strategy or RPG. All of these would be very hard to get right and take a lot of time when a simple markov chain based model or even Finite state machine would have done just as good or better for much less work.

#11 Daerax   Members   -  Reputation: 1207

Like
0Likes
Like

Posted 30 October 2011 - 08:52 PM

While it's true that intellectual products like new algorithms don't take huge numbers of people to produce -- so you'll be facing some competition to get these jobs -- I wouldn't totally write off these technologies as useless.

- Android and iOS devices both include speech recognition engines. Witness the much-hyped Siri. As far as I know, Hidden Markov Models are at the heart of most speech recognition algorithms; it's possible that Bayes nets are in use here too. And the speech recognition engines, though impressive, still leave much room for improvement. That means room for competition.

- The government funds a great many contractors that you've never heard of, who are trying to develop both old-fashioned database systems, and fancier statistical analysis tools including semantic networking tools, for understanding intelligence data. I imagine Bayes nets either get used here, or could be used.

- Robotics is very slowly taking off, not just in defense and in a few "silly" consumer applications like the Roomba (though it has some sophisticated competitors that even do SLAM!), but also in warehousing and factory automation, and we're just beginning to see the very leading edge of agricultural robotics. The world won't need a billion roboticists, but it is one more area where these sophistical tools can actually be useful.

I also think that games have a lot to teach these other fields. Sure, they don't need to deal with uncertainty to the same extent, but one thing they do a great job of is producing usable interfaces for interacting with the real world (or simulations thereof). People are beginning to acknowledge, for instance, that Starcraft is a pretty good model for what a good "net-centric warfare" interface should look like. Indeed, it was by explicitly following a strategy of copying Starcraft's UI that Ed Olson and his students won the recent MAGIC robotics competition in Australia. The difference, of course, is that instead of loading a map file you're doing SLAM, and the "fog of war" is real! My point in bringing this up is to say that, although some of these algorithms don't get used in games themselves, they get used in other fields that involve many of the same things as game development.


You are definitely right about game having a lot to teach other fields.

Robotics usually focus on reinforcement learning type stuff.

Yeah contractors, data scientist are the prime users of bayes nets. They have the resources, expertise and time to build, train and sample from networks (sometimes measured in days). The lack of black box also means that the parameters themselves may have actionable info.

HMM mostly, never heard of bayes nets though Condition random fields gaining in use.

Siri is stupid (not an insult) - I read from someone who worked on it that its mostly keyword matching.

#12 willh   Members   -  Reputation: 160

Like
1Likes
Like

Posted 31 October 2011 - 07:49 AM

1320029118[/url]' post='4878783']


If there would be one machine learning thing that I would actively look into, it would be Decision Trees. Decision trees are brittle so can add variance and do well with little data. You could then augment them as Random forest or boosted trees. I think that would be where I would start.

A close cousin to bayes nets that might be useful to some types of games (arcade shooter, anything requiring movement tracking and prediction) would be a particle filter. Finally, a bared down Reinforcement learning algo may be good for long term play in a strategy or RPG. All of these would be very hard to get right and take a lot of time when a simple markov chain based model or even Finite state machine would have done just as good or better for much less work.


Trees are that little tool that nobody ever talks about. You can derive probability distributions from them, use them for clustering, regression, and classification. They can be built in near real time, and a human can understand their output (it's a decision tree!!!).
I've posted a few screen shots of regression and boosted regression trees. I've even offered to write a tutorial. They lack a cool name maybe... Or the math isnt complex enough to invoke the voodoo factor? Not even one thumbs up though... <sigh>

#13 ApochPiQ   Moderators   -  Reputation: 14291

Like
3Likes
Like

Posted 31 October 2011 - 11:31 AM

If you honestly feel they are that valuable, you should be willing to make the resources available to teach people about them without needing encouragement. Most people won't see the need or interest until after a resource is available which clearly, concisely, and comprehensively illustrates the value of that technique.

Frankly, you shouldn't need our approval or rabid anticipation to do something that you think is worthwhile.

#14 Daerax   Members   -  Reputation: 1207

Like
2Likes
Like

Posted 31 October 2011 - 02:39 PM

If you honestly feel they are that valuable, you should be willing to make the resources available to teach people about them without needing encouragement. Most people won't see the need or interest until after a resource is available which clearly, concisely, and comprehensively illustrates the value of that technique.

Frankly, you shouldn't need our approval or rabid anticipation to do something that you think is worthwhile.


I am short on time or I would volunteer. Someday maybe. But he is right Decision Trees are something that are not payed enough attention to. Random Forest in my use case outperformed neural nets and SVM and are speedy to train.

For games, more than neural or bayes nets or genetic search, decision trees are the one thing out of machine learning I would argue to be most applicable to games in a splash and dash manner. They represent a probability distribution over the data, are not very far from FSM many are used to and with a weighted randomized voting method are close to behaviour trees (although built in an inverse manner - decision trees you start from a list of scenarios and desired ouptuts and it returns a tree, btrees - you start with actions to input states and build the tree - at least for what I can understand of behaviour trees, the game literature terminology is not one I am fluent in)

Here is a fairly clear but basic python example of a decision Tree from Machine Learning An Algorithmic Perspective (I highly recommend the book). http://www-ist.masse...Code/6/dtree.py

#15 willh   Members   -  Reputation: 160

Like
0Likes
Like

Posted 31 October 2011 - 08:54 PM

1320082315[/url]' post='4878944']
If you honestly feel they are that valuable, you should be willing to make the resources available to teach people about them without needing encouragement. Most people won't see the need or interest until after a resource is available which clearly, concisely, and comprehensively illustrates the value of that technique.

Frankly, you shouldn't need our approval or rabid anticipation to do something that you think is worthwhile.


I do think they are worthwhile, and so I use them in my work. It's also why I have suggested them.
Thinking something is a great tool in no way means that one is obliged to write a how-to guide for the uniniatied.

#16 ApochPiQ   Moderators   -  Reputation: 14291

Like
1Likes
Like

Posted 01 November 2011 - 11:36 AM

I'm not trying to suggest you're obligated to do anything; I'm just saying that if you think these are worth teaching people about, why wait for the "thumbs up" as you put it? Just go do it. Unless you're doing it purely for recognition, there should be no reason to hold off.

#17 Normalized   Members   -  Reputation: 105

Like
0Likes
Like

Posted 09 November 2011 - 08:15 AM

For video games, I think decision trees make more sense than Bayesian network. Generally, the outcomes you want in a video game are well defined.

The advantages of decision trees are

1: easy to program

2: designer friendly

3: easy to debug

4: can be used as a Game tree for game theory applications

5: full deterministic because each node only has 1 parent node.
Unlike a Bayesian network where multiple variables can affect the truth-value.


The advantages of Bayesian network seem to be

1: allows independent / conditionally independent nodes

2: allow reasoning about independent nodes

3: Often will have less nodes. However, each node will have more edges. Especially true with joint probability






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS