Advertisement

Volleyball

Started by January 01, 2003 11:51 PM
6 comments, last by Reunion 21 years, 10 months ago
Hello I have one problem: can''t create AI for volleyball. There is a computer player in the game that can jump on the H height and be moved to the left or right with CompV. There is a ball that flys with V_x and V_y and V_y constantly changes ( mg ). Please, help me
As humans, we have learned what a proper arc for a free flying object is. We know it and can anticipate where the object will land. You need to allow the AI to predict with reasonable accuracy where that ball is going to fall so as to move the player into position to play the ball. That''s the first step.

Dave Mark - President and Lead Designer
Intrinsic Algorithm - "Reducing the world to mathematical equations!"
RIPPL Sports - NFL Statistical Analysis and Prediction System

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
Yes, but the best shot will be in a jump. So...how should I do? I forgot to say that in a jump the computer player also can be moved ( to the right or left ). I understand that somewhere the player must jump but how to learn where? That is, in my opinion, the most important question.
Yes, but the best shot will be in a jump. So...how should I do? I forgot to say that in a jump the computer player also can be moved ( to the right or left ). I understand that somewhere the player must jump but how to learn where? That is, in my opinion, the most important question.
For sure that you have to develop the maths part of it, but if I had to do such an AI I will do it in the following way:

- First of all, you need a function to predict the arc of the ball (as InnocuousFox said).

- Then, at each moment, you have to make the following tests:
a) Do the player will be able to shot the ball if he jumps right now?
b) Do the player will be able to shot the ball if he desn't jump?

If the answers are both "no", there is no need to move, since you have no chance of hitting the ball.
If the answers are one "yes" and one "no", then the decision is easy.
The single problem is when both answers are "yes". In such a case, you have to find which is the best shot that the player will achieve if jumping (you need a heuristic function to assess which shot is the best), let's call it BESTJUMPSHOT. Then you have to compute which is the best shot that the player can achieve without jumping: BESTSTANDSHOT. Then, if BESTJUMPSHOT better than BESTSTANDSHOT, the player has to jump.

To compute the best shots, you have to do some math, but I guess that they shouldn't be too complex.

I hope this helps!

[edited by - popolon on January 2, 2003 6:00:41 AM]
to predict the landing spot, can''t you just extrapolate your trajectory, like run through it really fast until the y coord is on the ground or however you have it set up?
Advertisement
Thank you all for your replies.
I thought a little bit and imagined an algorithm:
The screen in my game is divided into two parts: one – for the first player (computer player, CP ), the other – for the second ( human ). So I know when the ball will be on the CP’s side. At this moment I will calculate the ball’s arc. As I know the ball’s speed along the X-axis, I can learn time ( let’s measure OUR time in some units ) needed for the ball to get to the ground. Then in a circle I will take every unit of time and check if CP will be able to get to the ball ( I am going to check time and height ). If he is able I will leave the circle and move CP to the ball. If CP is not able I will check the next unit of time.
...but you''d like the computer players to attempt to return a ball that it has no chance of getting to, otherwise it won''t look very realistic.

Human players of volleyball would probably determine the region of the court that the ball is going to fall into... or even out of court... and determine whether they can make it to that region in time to return the ball, given that the region is one that they should be defending.

You could do a test for each player to assess where they think the ball is going to land (roughly) and each player could decide whether they are defending that region. The reason you might do it this way is that different players might compute different landing sites for the ball because of their position relative to its trajectory. Furthermore, you might want a back player to attempt to dig a ball that a forward is actually going to try and block...

You could set a fixed time to execute different sorts of shots...blocks would be very quick, digs maybe a little longer and spikes (with jumps) even longer. Players could have the ability to react at different speeds, but the faster they react, the quicker they burn their energy. They might recover energy when they''re not moving (or moving slowly). This way, the forward may try to block the ball but miss it, because it flew past too quickly (or maybe they deflect it)... and the back will still try and dig the ball.

Just a few ideas... feel free to chew them around a bit.

Cheers,

Timkin

This topic is closed to new replies.

Advertisement