Discord: Kinel#2546

Inspiration

We wanted to create a real-time strategy game that we can all play when we are bored. By making it as a web-based application, we can play the game anywhere, as long as it is hosted on the internet.

What it does

The game starts by having the user enter their username. They are then directed into a lobby where they wait for up to 3 other players to join. After everyone presses the ready button, they are sent into the game and are placed into one of the starting positions represented by different colored hexagons.

The objective of the game is for the player to be the last player standing. Each hexagon produces an amount of units per second ranging from 1 to 15 with these values being randomly generated throughout the board. These values are capped at a random multiple of their production value.

A player can move units from their own hexagon to either a neutral hexagon, another hexagon owned by them, or a hexagon owned by another player. When a player moves their units, it will transfer all the units from the hexagon and will move to the selected hexagon after a period of time that is calculated based on the distance between them. Once the units arrive at a hexagon, one of two events will happen based on the owner. If the hexagon is owned by the player, the units will add together. If the player is trying to capture a neutral or another player's hexagon, the hexagon will become contested and the winner of the contested tile will control the hexagon, with a battle going on in which both sides lose a certain number of units per second.

How we built it

We had a React front-end with a Golang back-end. We used HTTP requests in the login and lobby page, and used socket.io for the real time events and data that happen in the game, such as the updating of tiles and ongoing battles.

Challenges we ran into

The Golang socket.io server was a bit outdated, only supporting v2 when the current socket.io is on v4. Thus, we ran into some difficulties setting up a v2 client on React to interface with this, since it is an older technology. As well as this, we ran into network latency errors when hosting this on the Internet instead of through localhost or LAN, since it was sometimes inconsistent in emitting around 15-20 socket events per second.

Accomplishments that we're proud of

We were able to make a workable demo in the time we had. Two members of our team had no experience in web-dev technologies so it was exciting to see the effort that they have made to learn and contribute to the project.

What we learned

For a lot of our members, it was their first time working with React on the front-end, so it was a good learning experience in that regard. As well as this, our back-end team was using Go for the first time for a large-scale project.

What's next for hex.io

Hopefully we can fix all the bugs and performance issues that we have.

Share this project:

Updates