NOVEMBER 18, 2024
ENRISTA ILO
Collaborators: Christine Lam, Jie Ji, and Mahdi Ali-Raihan
https://github.com/asder8215/ESP32-SpaceTeam
<aside> đź”– Module 3 requires students to work in groups of 4 to work with the ESPNOW communication protocol to build a new multiplayer feature to the Spaceteam game.
</aside>
Our team introduced new mechanics that emphasized personalization and competition in SpaceTeam, originally a team-based collaborative game. We transformed the game into a versus-style team-based collaborative experience. This shift in design enhances the gameplay by fostering both teamwork within teams and a competitive edge between them.
We implemented a name screen, room number screen, team screen, and end screen to create a more personalized experience for players. These features allow participants to customize their username and join private matches with friends, using room codes as a unique way to connect. Players are also allowed to choose teams. Instead of random matchmaking, our approach leverages private room-based matchmaking, ensuring a controlled and intimate multiplayer experience. Each room supports up to four players, divided into two teams.
Building on top of Professor Tseng’s provided code, we introduced modifications to enhance the dynamics:
Our vision was to retain the chaotic fun of SpaceTeam while elevating it with features that offer players more control over their gaming experience and the thrill of competition.
We allowed players to personalize their experience by entering a three-letter name, selecting a room number, and choosing their team. These additions ensure that players can easily identify their friends in the game and join private matches. Given the limited interface of the ESP32, our team utilized short and long button presses. Short presses were defined as <500 ms and long presses were defined as >3000 ms.
On the Name Screen, players use the left button for cycling through characters and the right button to switch character positions (short press) or confirm their name (long press). Similarly, the Room Screen allows players to set a room number. Players use the left button for cycling through digits (short press) and the right to switch character positions (short press) or confirm their room number (long press). On the Team Screen, players toggle between teams (Team A or Team B) using the left button, set their ready status (right button, short press), and start the game only when all players are ready (right button, long press). Each screen maintains a consistent structure for interaction, ensuring smooth transitions and ease of use.
Once the game begins, the Game Screen provides players with two main actions: choosing command options via short presses of the left and right buttons. Notifications of these choices are sent to other ESP32s in the room, ensuring synchronized gameplay. After the game ends, the End Screen allows players to either rematch or quit, returning them to the Team or Name Screens respectively.
I primarily worked on the End Screen. This screen manages the transition after a team wins by using button inputs and state management. The WinState
enum tracks the winning team, while handleWinScreen
processes player actions—rematch (left button) or quit (right button). A rematch resets the game to the Team Screen, updates the player list, and sends notifications to connected ESP32s, while quitting clears player data and returns to the Name Screen. The drawWinScreen
function dynamically displays the winning team ("Team A" or "Team B"), along with "Rematch?" and "Quit?" options, ensuring all text is centered for a clean UI. Supporting functions handle updates, leaving requests, and data resets, creating a seamless flow between game states.