Skip to content

hathora/bullet-mania

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

193 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bullet Mania

Hathora presents Bullet Mania

Overview

Multiplayer 2D shooter demo made using:

Assets from Kenney

Additional implementations of the game client are also available for the following engines:

Try it

The game is playable at https://bullet-mania.vercel.app

Lobby Gameplay
A screenshot of the completed top-down shooter lobby. A screenshot of the completed top-down shooter game in action.

Instructions:

  • WASD to move
  • Mouse to aim and shoot
  • Spacebar to dash
  • R to reload
  • Once you are in a game, share the URL to allow others to join

Architecture

Fully server authoritative game:

  • Client sends user inputs to server
  • Server processes the inputs and runs game simulation (at 20fps)
  • Server broadcasts state snapshots to clients (at 20fps)
  • Client interpolates the state snapshots and renders the game UI (at 60fps)
  • No prediction on the client side

Room based architecture:

  • One player creates a game session and gets back a roomId
  • They send the roomId to others
  • Others can join the same session with this roomId

Running locally

To run locally:

HATHORA_APP_ID=<appId> HATHORA_APP_SECRET=<appSecret> DEVELOPER_TOKEN=<appToken> 
  • Start server: inside server directory run npm start (remember to npm install first)
  • Start client: inside client directory run npm start (remember to npm install first)

Deploying

Server:

  • Run hathora-cloud deploy --appId <appId> --roomsPerProcess 1 --planName tiny --transportType tls --containerPort 4000 --env '[{"name": "DEVELOPER_TOKEN", "value": "<developerToken>"}]'

Client:

  • cd to common and run npm install && npx tsc
  • Then cd to client and npm run build
  • Now you can deploy dist to any CDN like Vercel or Netlify

Releases

No releases published

Packages

 
 
 

Contributors