Giter Club home page Giter Club logo

bullet-mania's Introduction

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": "<appToken>"}]'

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.