Skip to content

A unique take on old style of game, taking elements from pong and air hockey, with a flexible, loosely coupled, event driven architecture.

Notifications You must be signed in to change notification settings

Darwarking/Paddle-Whacker

 
 

Repository files navigation

Paddle Whacker

A paddle whacking retro arcade game.

Can play in-browser at itch.io: https://jeffreypersons.itch.io/paddle-whacker

Can download for Android at: https://play.google.com/store/apps/dev?id=8132485239530785081

Background

Tired by the lack of originality found in most 'hit the ball with a paddle' genre of 2d games, Jeff wondered how it could be improved on... Taking those ideas, he came up with Paddle Whacker - a game that blends the vertical-only movement of Pong with an Air-Hockey inspired arena.

After lots of balancing and polishing the game has grown into a fully featured experience playable on both android and browser. Most noteably, features a custom-made AI using prediction based forecasting, touch support and a variety of different difficulty levels, as well as game length and sound settings.

Sample Screenshots

Main menu screen

image

Settings panel in main menu

image

Create game panel in main menu

image

Game play screen

image

Game pause screen

image

Game end screen

image

How the AI works

paddle zones AI behavior is now primarily driven by PaddleZoneIntersection events - triggered when a Ball intersects a PaddleZone (BoxCollider2D encapsulating each paddle, stretched from bottom to top of arena, as shown below).

The last hit zone gives us enough data to decide whether the ball is behind the AI paddle or not, and how to react to it.

Implementation details for nerds:

  • Each frame, Ai is always moving towards or present at paddleTargetY
  • Upon Ball intersecting a PaddleZone, ball entry/exit position/velocity is recorded and event is triggered, received by AI, and used to infer the state of ball relative to paddle as follows:
    • IF ballIncoming (approaching ai from opponents side): PredictBallPosition (target set to projected position)
    • IF ballBehind (passed ai paddle next to goal): TryToHitBallFromHorizontalEdge (target set to avoid ball or hit it on the top/bottom paddle edge, if possible, as based on the projected position)
    • ELSE (all other cases): TrackBall (vertically aligns the paddle with ball y position)

ai trajectory prediction demo

Basically, the ai runs in a seperate coroutine launched (after a response time delay) when its opponent (ie the player) hits the ball, and then approachs the point that the trajectory intersects with the x position of the ai's paddle.

About

A unique take on old style of game, taking elements from pong and air hockey, with a flexible, loosely coupled, event driven architecture.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 96.0%
  • HTML 4.0%