u/Intrepid_Ad_4504

▲ 16 r/Batch

Batch Pong Revisited

https://github.com/IcarusLivesHF/Batch-Pong

Features

I've been working on this for a while, and at this point it's gotten a little ridiculous for a .bat file.

Gameplay

  • 400 × 100 character playfield
  • First to X mode
  • Timed mode
  • 1 player vs CPU
  • 2 player local multiplayer
  • CPU can be replaced with a second human player
  • CPU difficulty slider
  • CPU difficulty affects lookahead, reaction time, paddle speed, miss chance, and aim error
  • CPU rubber-banding based on the score difference
  • Two-point lead required to win in First to X
  • Deuce cap so matches can't go on forever
  • Configurable timed matches
  • Longest rally tracking
  • Rally counter displayed during matches
  • Rally record displayed on the end screen
  • Best scores saved separately by difficulty and time limit

Ball physics

  • Fixed-point integer physics
  • Four decimal places of sub-cell precision
  • Ball speed is independent of frame rate
  • Paddle position affects return angle
  • Paddle movement affects the return through spin
  • Edge hits produce additional boost
  • Spin and edge boost decay over time
  • Rally length permanently increases the minimum ball speed
  • Swept collision detection so fast balls don't just phase through paddles
  • Integer sine/cosine table for angle calculations
  • Ball trajectory is constrained so it can't become perfectly vertical

Visual stuff

  • ANSI/VT rendering
  • Ball trail
  • Seven-cell fading trail
  • Particle effects
  • Dynamic score/HUD
  • Animated menu
  • Studio intro/logo
  • Intro can be disabled
  • Attract/demo mode after sitting in the menu
  • Credits screen
  • Statistics screen
  • Mouse-driven UI
  • Sliders and toggle controls
  • Console automatically configures itself for the game

Audio

  • Background music
  • Multiple music tracks
  • Next-track control
  • Music pause/resume
  • Separate music and SFX volume
  • Music mute toggle
  • Sound effects for gameplay/UI
  • SFX volume can be changed live
  • Preloaded sound effects to avoid spawning a process every time something happens
  • Audio runs separately from the main game loop

Controls

  • W/S or arrow keys for movement
  • Separate controls for both players
  • Mouse support in the menus
  • Toggle ball trail during a match
  • Skip music tracks during a match
  • Pause/resume
  • Configurable music volume while playing

Progression / stats

  • 29 achievements
  • Achievement progress saved
  • Achievement state stored as a bitmask
  • Persistent statistics
  • Best scores
  • Longest rally records
  • Records separated by difficulty/mode where appropriate
  • Achievement/reward-style tracking for different things you do in matches

Other stuff

  • Settings are saved between runs
  • Nothing is installed
  • Nothing runs at startup
  • No internet connection required
  • Runs entirely through Windows cmd.exe
  • Forces the game into a properly configured console window
  • Uses separate processes for input and audio
  • Cleanup of temporary files/processes when the game exits

The entire game is written in Windows Batch.

No external game engines were used.

Overall, it runs great, and I am very happy with it. Enjoy!

u/Intrepid_Ad_4504 — 11 days ago