Air Hockey - Test

This is my first test after setting up physics and controls. Next step is to code AI for the Blue player. Video demonstrates accurate high speed collision detection.

Looks good.

Very cool, I look forward to playing it! You could even add multiplayer to it, that way you can play against real people!

Yes, looks nice! Are you developing for mobile?

That looks rocksolid ! Really nice :slight_smile:
I’d be very interested to get to know how hard it was to come up with the AI and what approach you took. Make you sure you keep this thread updated about progress on that topic :slight_smile:

Thanks, there is going to be a multiplayer option, mobile is a ???, designing AI is my priority. I’ll try to keep this thread updated, I have seven other projects that I’m working on simultaneously so I’ll post new updates as soon as possible.

First AI test, blue mallet is controlled by CPU. This is a simple AI setup but it needs some more tweaking and position evaluation guides.

price?

Very cool!

That looks really smooth and solid.
Could you maybe give a little more insight of how you approached the AI ? What stuff did you use/look into to get this result so far ? Any walkthroughs for this ? :smile:
I know this is such a wide question. I’m just trying to grasp the scale of something like this, to get to know whether it’s rather generic task for a programmer or quite a challenge for a rather “simple game” from an artist point of view.
Really curious about the development of this :slight_smile:
Been thinking about doing a game like that for a long time !

Great job again, well done !

Thanks for the comments, as I said this is a basic AI setup. This AI is driven by three things: Rules, Priority and game strategy. Rules are simple, stay on your side of the table. Priority is to guard the goal. You can see in my video that after the AI hits the puck he’s returning to guard his goal. Game strategy is simple like stay close to a goal line, ignore rail positions and guard vertical center line. Adding more features can make it stronger or subtract some to make AI a low level player.

So would you say it was a quite complicated matter compared to the stuff you usually do ? Or an average task at its best ? Just interests me, on how something like that AI would be on a programmer difficulty level :slight_smile:
Sry, if I’m being annoying :smile:

Well this was a simple task compared to some other AI requirements. Understanding the problem is a 50% work done, you can’t fix something if you don’t understand what is the problem. On a difficulty level scale 1-10 this would be 2, Pong is probably a level 1 on a difficulty scale.

Ah, that’s a great indicator !
Getting ideas rolling :slight_smile:
Thanks for taking the time to answer all my questions.

I know this was all posted a number of months ago, but how did you get such realistic collisions? I’m working on something very similar and I’m ready to give up after seeing something as beautiful as yours. I have been racking my brain for ages, using scripts and anything I can to try and create a realistic physics environment but to no avail. Any help would be much appreciated.

It looks pretty great in my opinion, though…

I think you should:

1: speed up AI (which is probably going to happen, duh.)
2: make a score menu (which will also happen, of course. duh)
3: Make a second or 2 delay between the spawn of the ‘making a shot’, or gaining a point, or whatever you want to call it, and the spawning of the next puck. I thought at first that the puck teleported to the center for some odd reason, and then realized that you made a point.

Looks fantastic, you should make a playable demo.

Thanks… I don’t think I’ll ever finish this game. I just simply don’t have time to develop this any more. Currently I’m working on Digital Paint and FPS survival demo inspired by Call of Duty World at War.

Make sure your scene is as realistic as possible or 10-15% larger. Scene should never be too large or too small. Paddle and puck must have collision detection set to Continuous Dynamic. Now to set some Physics. Create new physic material for puck and set Dynamic Friction to 0.1 and Dynamic Friction to 0.5, set bounciness to 0.8-0.9 and Friction Combine to minimum (experiment with these values). Puck rigid body drag is set according to your friction settings and paddle rigid body drag is set to your paddle weight, friction and move force. Sleep Velocity and Sleep Angular Velocity is set to 0.001, you don’t want your puck go to sleep. Minimum Penetration Penalty in set according to your scene size, just don’t make it too small. Time settings are just as important as Physics settings. Default Fixed Time Step settings are 0.02 but you should set it to 0.005 or 0.001. Set Maximum Allowed Time to 0.03 or 0.003 (must be larger then Fixed Time Step). Physic and Time settings depends on your processor strength and number of rigid bodies in your scene. Last thing to do is to cast a ray from middle of a puck/paddle in motion direction. Raycast distance should be 15% smaller then collider radius, now if you get raycast then apply force to then puck at paddle raycast direction or paddle hit normal direction.

This is about it, you should experiment with these settings depending on your scene size and collider sizes.