Inspiration
surviv.io
What it does
Maze Battle Royale
How I built it
- Implemented an XOR-Shift Random Number Generator in JavaScript for fast, seeded RNG
- Determined maze size constants using square roots & information about player count
- Procedurally generated mazes by randomly choosing paths, and using a stack to resolve dead-ends
- Scaled mazes using size constants using a manually implemented nearest neighbor algorithm
Challenges I ran into
- Since JavaScript does not inherently have a seeded random number generator, I needed to write my own
- Previous WebSocket projects showed that Python WebSockets did not have the robustness to handle high-performance games, so I chose to learn a uWebSockets to implement it in C++
- Heroku does not support C++ in their buildpacks, so I tricked the Dyno into using the Node.js buildpack to arbitrarily run pre-compiled executables
Accomplishments that I'm proud of
Developed a custom client-server protocol for the project
Client to Server
0x00
- Create Room
0x01
- Join Game
0x02
- End Game
0x03
- Start Countdown
0x04
- Start Game
0x05
- Update Position (int start_x, int start_y, short degree, bool moving)
0x06
- Start Move (int start_x, int start_y, short degree)
0x07
- Stop Move (int stop_x, int stop_y)
0x08
- Shoot (int start_x, int start_y, short degree)
0x09
- Update Health (char health)
Server to Client
0x00
- Create Room
0x01
- Join Game (char response_code)
0x02
- Disconnect
0x03
- Start Countdown (int seed, int player_id, int player_count)
0x04
- Start Game
0x05
- Update Position (int start_x, int start_y, int degree, bool moving)
0x06
- Start Move Player (short player_id, int start_x, int start_y, short degree)
0x07
- Stop Move (short player_id, int stop_x, int stop_y)
0x08
- Shoot (short player_id, int start_x, int start_y, short degree)
0x09
- Update Health (short player_id, char health)
What I learned
All new framework
What's next for Labyrinth
Art
Built With
- c++
- css
- html5
- javascript
- uwebsocket
Log in or sign up for Devpost to join the conversation.