AI Ideas for Air-Hockey Simulator
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
Wouldn't it just be a modified Pong AI?
Apologies to anyone who read my response before I editted it... Just done some digging around looking at Pong AI and I can ask questions a little (!) more intelligently now
From what I've seen, all the Pong alorithms appear to be defensive - which isn't going to make for a fun air-hockey simulation. They also appear to assume one-dimensional movement which isn't the case in my system.
However, the various resources I've found (mostly here on the Forum) have given me a couple of ideas to work with.
Has anyone seen any examples, or would anyone have any suggestions on how Pong-style AI might be extended to a more complex game (such as air-hockey - or table-football which is the next project ) ? How do people generally approach problems such as this, where in the real world a game is based more heavily on reaction time and physical factors (like how hard you hit something)? It seems to me that it's relatively easy to write AI systems with complete knowledge, but which would be unbeatable - even if real-world limits on bat-movement and the like are imposed. So how do you go about toning down the intelligence of a system?
My apologies if any of the above sound like newbie questions - I haven't really tried writing AI systems for games before...
cheers,
Adam...
[edited by - AJFleming on June 10, 2002 5:22:08 PM]
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!"
thanks for your comments.
One problem that I can see though - each shot type (straight, single deflection, double deflection etc) would have an infinite number of possible strokes to effect it - especially since the physics model of this system (kind of) takes account of spin during collisions. I guess some kind of stroke-generation engine would be required in order to make the system work. This would allow for further "humanisation" though - if different strokes could be characterised as "easy" "hard" "agressive" etc...
Hmmm, have to give this some more thought...
cheers,
Adam...
Step 1: What is the path of the puck?
Step 2: What sort of shot should I take?
Step 3: Calculate the intercept point of the puck path and the stroke path in order to generate the proper angle, spin, etc.
Step 4: Fuzzify step 3 in order to humanize the outcome.
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!"
if(ball.x>paddle.x)
movePaddleRight();
else
if(ball.x movePaddleLeft();
it is only unbeatable if the paddle can move as fast as the ball, ussually there is some "trick" shot in which you move the paddle as it collides to cause the ball to have greater velocity. done enough times and the cpu cant keep up. you can improve this by allow slower reaction time (ie the cpu waits longer before moving the paddle), slower paddle speed, randomness in cpud movement (ie sometimes the cpu overshoots the ball and must adjust).
ai is just the mimicing of something just like physics in games. it dont always need complex algorithms. heck gravity is a complex reaction of forces on mnay objects dependent on mass, distance, etc. in games, its reduced to a simple constant since its a suitable replacement. not all things can be simplified as nicly, but most can be simplfied with acceptable results.
"I''ve never seen that. I''ve never seen anybody drive their garbage down to the side of the street and bang the hell out of it with a stick. I''ve never seen that."
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.
Once you have these, you can use the prediction step of the algorithm to predict the position and velocity at any future time. In the absence of observations (during prediction) the uncertainty in the predicted posterior distribution will be proportional to the prediction time interval... so the longer ahead of time the prediction, the more uncertainty. The closer the puck gets to the paddle, the better able the system is to predict the point at which the puck will cross a certain point.
You can use the predictions to plan shots. The earliest predictions will give a feel for where the puck is going to end up and with what trajectory. Given the uncertainty in speed, direction and position of puck, there might be a couple of different return shots that are appropriate. A choice could be made based on the ''set up time'' for the shot, which would be inversely proportional to the speed of the puck. Or perhaps on some other constraint that enabled the system to respond quickly in defensive situations (where the puck is coming in fast), or set up a complex shot if more time allowed (where the puck is coming in slow).
This would then approximate how humans play games like air hockey.
If you need advice on implementing a kalman filter, just holler.
Cheers,
Timkin