Skip to content

Nifty little multiplayer game in which you run around and throw balls at each other. Implemented in three.js, physi.js (ammo.js, bullet), node.js, socket.io, the usual H5BP/jQuery etc and a bit of my own elbow grease.

License

Notifications You must be signed in to change notification settings

kfitzgerald/webgl-ball-game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WebGL Ball Throwing Game

My fun little prototype of a fairly simple WebGL game that uses a whole pile of new-fangle tech like WebGL, Web Workers, Web Sockets, Pointer Lock and physics!

This thing is frankenstein'ed together from various examples, tidbits, blogs and github repositories from far and wide. It's basically the culmination of things I've been poking at for the last few years.

Art inspired by Tim Reynolds (@turnislefthome, http://www.turnislefthome.com)

Hope you enjoy, build upon, and hack this thing.

Btw, the code that's in this repo is a pile of garbage and contains various tangents and ideas from the last year or two.

Demo

Check it out: http://games.soarcetech.com/balls/

Setup

  1. Download or clone this repository
  2. Install node.js (http://nodejs.org/)
  3. In the project root, install dependencies, e.g. npm install
  4. Run the server: node .
  5. Load up Google Chrome and visit localhost:3000

You can specify a different port when running, e.g. node . 8080

Stop the server with CTRL+C

If you really want it to run and restart on crash, try this:

while true; do echo 'Hit CTRL+C TO KILL'; node . ; sleep 1; done

Caveats

Since this is purely just a prototype of a game, there's absolutely no:

  • Performance: movement is reported on a set interval, and is not optimal. Many clients in the server tends to flood the server out and lag everything out.
  • Security: clients can hack and do naughty things
  • Clients handle their own balls, so clients report their own hits.
  • Consistency: physics are not synchronized on the server/clients. They could be, but this example lacks this for now. Check out Jonas Gehring's blog post on how this might be possible some day: http://www.jjoe64.com/2013/07/physijs-and-threejs-on-nodejs.html
  • Clients report the position and angle when firing balls. In theory, the ball will follow a pretty consistent path, but can vary a bit from client to client.

Features

Libraries and Misc

Credits

About

Nifty little multiplayer game in which you run around and throw balls at each other. Implemented in three.js, physi.js (ammo.js, bullet), node.js, socket.io, the usual H5BP/jQuery etc and a bit of my own elbow grease.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages