I recently graduated from college and joined a job. Corporate Life is not that easy as everyone thinks. I wanted some diversion from my daily routine. Then while surfing the internet I got to know about the Game oasis hackathon. The topic of the hackathon was to create some games using blockchain. This peeked my interest. Then I asked my friend to join me on this hackathon. He also said Yesss. I filled the application on devfolio and got selected .. wow000w. Hack is ON
HACK Day 1
We reached the location ….and. it blew our mind….. SOOOOOO GOOOD…. We were a little late. Some speeches were going on. All the tables were occupied. We asked the organizers for the table. They replied that we can use any room. We occupied one room with a sofa. We read about the bounties and the one that piqued our interest was marlin bounty. Bounty requires us to create a multiplayer game using marlin protocol. We never made any game. We are full-stack developers so we decided to make a game using HTML and CSS. We decided to make the “ Tron Light Cycles game”….
What does Marlin give you?
Speed The Marlin Network can achieve global latencies of <150ms. This enables developers to build high-performance responsive distributed systems (including blockchains and apps).
Scale The Marlin Network can scale to a large number of nodes without compromising on performance. Developers are no longer limited by the fanout capabilities of a single node.
.. At the end of the day, we were able to create an HTML single-player Tron light cycle game. Now we needed to add multiplayer support and connect players using WebSockets.
Day 2 Begins 12:00 am
Marlin protocol setup was done and multiplayer was added. The only thing left was the synchronization.
- Games start at the same time on ever player computer
- Keypress delay due to network latency to be considered.
How we Solved them
- Firstly we used NTP to synchronize time in every player computer. After that, we were starting a new game after every 1min interval.
We attached a timestamp to every keypress which we used to calculate ping on every player computer. We calculate the average of ping and sent keypress over the channel and delayed player his on keypress event by average ping so that keypress event occurs at the same time at every player computer.
Finally over with the main features we want in our game. I made some videos and committed the code on GitHub and submitted the project at last.