AI Ideas for Air-Hockey Simulator
In addition to that, you MUST limit the reaction time, acceleration and speed of the computer paddle. It should take a moment to react (partially accomplished by only sampling the trajectory every X frames), it should have to slow, stop and reaccelerate to change direction of travel as well as slowing to a stop, if desired, prior to contacting the puck, and it should also have a maximum paddle speed. All of this lends to very accurate feel for the computer controlled paddle.
Dave Mark
President and Lead Designer
Intrinsic Algorithm Development
"Reducing the world to mathematical equations!"
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!"
quote: Original post by Timkin
Several people have talked about adding a random factor to the response function of the CPU paddle to ''humanise'' the game play. There is a better way. Add uncertainty into the predictability of the CPU.
The basic idea is that you provide noisy observations on the position of the puck at different times (every frame, every 5th frame, every 20th frame,... whatever interval you choose). The CPU then has to predict the puck velocity and respond to it. How it responds is a tactical procedure. What shot it attempts to play is a strategic procedure.
Anyway, to get back to the filtering. Implement a simple linear Kalman filter to predict the velocity of the puck given observations on position. The output of the filter applied to a linear system is the mean and covariance of a guassian distribution on position and velocity.
I should think that a Kalman filter is overkill for this particular problem, given what Innocuous Fox noted earlier (and the even simpler example of Pong AI posted by another participant. The biggest issue when one is playing air hockey against another person is more the speed of the puck''s movement than anything else, IMO.
I do like the idea of adjusting the AI so that it has to predict over varying number of frames, and as another poster noted it certainly shouldn''t have exact knowledge of the puck''s spin. That might be a good area for the AI to use a bit of fuzzy logic--the AI player would know the puck has "a lot" or "a little" spin, but not precisely how much.
Just some random thoughts there. Neat problem....I don''t know if I''ve ever actually seen an air hockey computer game, now that I think about it.
Ferretman
ferretman@gameai.com
www.gameai.com
From the High, Cold, Snowy Mountains of Colorado
Ferretman
ferretman@gameai.com
From the High Mountains of Colorado
GameAI.Com
quote: Original post by Ferretman
I should think that a Kalman filter is overkill for this particular problem...
A Kalman filter is definitely not overkill in this situation... it''s a simple technique and corresponds to linear least squares estimation of the trajectory. The only reason you do it in a Kalman filter (as opposed a statistical approach) is that it provides the optimal least squares estimate with the minimum of computation (a set of matrix operations).
quote: Original post by Ferretman
I do like the idea of adjusting the AI so that it has to predict over varying number of frames, and as another poster noted it certainly shouldn''t have exact knowledge of the puck''s spin. That might be a good area for the AI to use a bit of fuzzy logic--the AI player would know the puck has "a lot" or "a little" spin, but not precisely how much.
The one thing that people in the game AI field really need to get a grasp on is the difference between uncertainty and vagueness. It seems apparent that many don''t understand the difference.
Uncertainty is a state of knowledge about the world. The world is in a particular state but your knowledge of that is limited and confused by a lack of certainty in that state. This is basically the situation humans find themselves in. If you want to make your AI more human-like then incorporate uncertainty into the AI.
Vagueness on the other hand is a statement about the state of the world. Jack is tall is a ''vague'' statement because it is talking about the degree to which Jack belongs to the set of ''tall'' people. This is not uncertainty held by an external viewer, although ascribing numbers to vagueness is often a subjective matter (although it shouldn''t be technically).
Fuzzy Logic is a method for describing vagueness and definitely NOT a method for describing uncertainty. There are very sound arguments for why Fuzzy Logic does not, can not and should not be used to describe uncertainty.
Using Fuzzy logic in this situation is a fudge and is not appropriate. If you want the AI to have uncertainty, then use an uncertainty representation (like probability theory) If you want the world to be vague, then use Fuzzy Logic.
It seems to me that people should not rely on a few known techniques and try and bend their game to a technique, but rather look at the problem to be solved and find the best solution.
In this game, if you want uncertainty in the knowledge of the state of the puck, use probabilitiy theory. If you want to classify different states of the puck into a few discrete classifications (perhaps for decision making) then use fuzzy logic. The two techniques are used for completely different tasks.
Cheers,
Timkin
I happen to know that I didn''t refer to using a FuSM... just made the comment that the hard numbers can be "fuzzied up a bit" through a +/- randomization. In addition, Ferretman''s reference to "fuzzy" was similar to mine. He simply stated that the computer would have a perception of ranges of spin ("a lot of spin or a little spin"). This is not entirely off base.
Methinks that you have allotted the use of the word "fuzzy" to a specific connotation in your world (maybe it''s that silly Ausie language you chaps speak!) and therefore overreacted a bit. The point that both of us were trying to make is still valid... that the computer should not know EXACTLY what is happening at all times... therefore your uncertainty... or, put another way, the computer has a rather fuzzy view of the world.
Dave Mark
President and Lead Designer
Intrinsic Algorithm Development
"Reducing the world to mathematical equations!"
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!"
quote: Original post by InnocuousFox
OOHHHH... pissing contests are good!
Er, no. I don't see this as a pissing contest. I'm just trying to make a point about something...
quote: Original post by InnocuousFox
In addition, Ferretman's reference to "fuzzy" was similar to mine
Well, Ferretman specifically talked about using Fuzzy logic, whereas you mentioned fuzzification. My last post was in response to the suggestion of using Fuzzy Logic.
quote: Original post by InnocuousFox
the computer should not know EXACTLY what is happening at all times... therefore your uncertainty... or, put another way, the computer has a rather fuzzy view of the world.
No, no, no, no, no!!!
Fuzzy in terms of AI has a VERY specific definition and it has nothing to do with knowledge held about the world. This is one of my biggest gripes with the game industry... they use fuzzy logic in situations where it is quite simply the wrong thing to do... and your use of the word fuzzy led Ferretman to reinforce the idea of using fuzzy logic to represent uncertainty.
In your case Dave it's just a point of terminology. I would say you've used the wrong terminology to describe randomness/uncertainty... and no it's not an Aussie thing, it's an AI thing. In Steve's case it's a suggestion of using Fuzzy Logic to represent uncertainty in the knowledge held about the level of spin of the puck. As I explained in my last post, that's the wrong tool for the job: fuzzy logic is not appropriate for such a task. Probability theory is. If you want the formal reasons why I would be happy to elaborate on them.
I'm sorry if I came across badly in my last post. That wasn't the intention, although I will admit that a little of my ire at the misuse of AI techniques arose and that obviously came across in my post. My apologies to all concerned.
Cheers,
Timkin
[edited by - Timkin on June 11, 2002 1:47:00 AM]
The thing is Timkin, if developers use what they call ''fuzzy logic'' in their games and it works, then... it works. In the commercial world that''s all that matters. It''s not misuse if it works, whatever people want to call it,, and however much you think it''s fudged. Bosses don''t care about elegance and formal theory, they just want to see results.
Steve: I have actually seen airhockey on the PC. It was networked too. I saw it about 4 years ago, it came as part of some obscure compendium of windows games. It was a pretty awful piece of coding though if my memory serves me right.
Stimulate
quote: Original post by fup
The thing is Timkin, if developers use what they call ''fuzzy logic'' in their games and it works, then... it works.
But how much time and effort is wasted trying to get the spanner to work on the round nut, or the screw? Choosing the right tool for the job makes things a hell of a lot easier, makes the results a lot better, saves time and saves money... and it''s really these last two that publishers care about. It should be the first two that programmers are concerned about... but they seem to forego these in favour of using a ''buzz word'' technique as I call them (Fuzzy logic, GA, neural network), regardless of how inappropriate it is for the task.
BTW: As to what ''works'', I''d say that something that implements fuzzy logic to represent uncertainty doesn''t work... it''s just that the programmer keeps adding fudges until it looks like it works. I could give other examples as well (not directed at specific people/organisations)... the use of GAs for learning, when they''re a blind search algorithm... the use of neural networks for decision making, when they''re a classification (or function approximation) algorithm... the list goes on.
(rant on)
Too many people post to these forums saying I have problem A and I want to get neural network B (or fuzzy logic C) algorithm to solve it. This is not the way to go about doing AI, developing games, doing science or any problem solving scenario! Look at the problem and find the RIGHT solution to it. In the end it will save you time, money, effort and heartache!
So, when I suggest the right tool for the job (and I know it''s right because I would generally be considered an expert - or close to it - on uncertainty and belief revision) and someone says it''s overkill and suggests a spanner for a round nut, I think that''s not only inappropriate but also the wrong message to get across to people trying to develop AI for games. Just my opinion of course and I''m sure the industry will keep its head in the sand and continue to tighten screws with spanners regardless of what I think.
(rant off)
Cheers,
Timkin
Enough said on my part. I won''t post any more to this thread except to answer questions as I don''t think I''m going to convince the world it''s wrong and I''m right!
Cheers,
Timkin
Thanks for all the responses guys, you''ve definitely given me some things to think about...
The consensus - as far as I can tell, is that some form of predictive system is required - the system will observe certain values about the puck and use these to generate a predicted position and then determine (in some way) the best shot to play, and the movement of the puck required to play that shot.
This breaks down into two areas - the predictive system and the shot generator.
Timkin, I''ve done a little research on Kalman filters and have managed to confuse the hell out of myself! Can you point me at, or give me a quick overview on what they are, how they work and so on... My stats background is a little rusty - so use little words please
I''m a little unclear as to what you''re suggesting as well... It sounds like you''re talking about providing noisy observations to a perfect prediction system - is this correct? I assume you''re referring to velocity as an observation, albeit a derivative of perfect observations of location... So how do you introduce the noise?
I''d be inclined to make use of the spin-factor to increase the uncertainty of the system as well. Perhaps just considering direction of spin and leaving considerations of speed of spin completely uncertain.
I guess I can leave the shot generation for the moment... If I can make the system consistantly play one class of shots (direct attacks probably) then adding additional shots can be considered and added later...
cheers,
Adam...
1) That there is a vast and very real difference between the world of academia and the world of commerce. It is usually the case that a person working in one world cannot understand the motives of a person working in the other.
2) That so called ''esoteric'' techniques such as fuzzy logic, GA''s, and neural nets are frequently misunderstood by games developers/programmers. They seem to have little idea of their capabilities and shortfalls and so they are either often proffered as a solution where they are innapropriate or dismissed as a solution when they *are* appropriate. I''m sure you have seen this sort of thing time and time again.
I don''t think people discount what you have to say, I certainly don''t and I''m sure many regulars don''t either. So keep posting!
Stimulate