For this project, we wanted to bring peer to peer technology akin to BitTorrent into a game. P2P is run entirely on the processing power of clients. There is no central server which commands everyone around, but rather a network of peers.

How it works

Each client playing the game helps process physics and collisions. It works by an voting system: three clients will process a certain call, and a fourth will choose the median result. This way, hackers cannot take over the system unless they control all clients.

By having no dedicated server hosting the game, we can offload a lot of pressure. The game can scale way bigger, and when more players connect, there is more power available for the game.

For the sake of the demo, we created a small tank game. Players can move around and shoot others.

Challenges I ran into / Accomplishments that I'm proud of

There were a bunch of optimizations that we needed to write in order to get peer to peer networking. We used WebRTC, a framework that allows javascript clients to talk directly to each other. Rather than making calls to a server, clients instead make calls to other clients, which then use the voting-system to find the next point.

What I learned

In this project, I learned how torrents work and are structured. I also learned WebRTC, as well as Three.js for the graphics.

What's next for tank

I'm hoping to release it so anyone can hop and join the game whenever they want, just by visitng the site.

Built With

Share this project: