Overview:
This is my One-Day project, Twitch chat-based interactive aquarium designed using Unity, a powerful cross-platform game engine. The application connects to a specific Twitch channel’s chat and creates an interactive fish avatar for each active chat participant, making them part of a lively, virtual aquarium. This system was designed to enhance audience engagement during live Twitch streams and foster a stronger sense of community and interactivity among viewers.
Technical Details:
Architecture and Design:
The application is designed using Unity, a cross-platform game engine used to develop video games for PC, consoles, mobile devices and websites. The design involves a 2D environment filled with animated fish sprites that represent chat users on Twitch. The interactions are driven by messages sent via Twitch’s chat using the Internet Relay Chat (IRC) protocol.
Unity Game Development:
The fish avatars are created from a pool of various fish sprites which are assigned to the users randomly. To make the environment more dynamic and avoid fish overlapping, a collision detection mechanism is implemented for fish sprites, using Unity’s physics system.
Chat integration with Twitch:
The application uses WebSocketSharp, a WebSocket client library in C#, to establish a connection to Twitch’s IRC server and listen for chat messages from the audience. Upon detection of a message from a new user, a fish avatar is instantiated in the aquarium representing that user.
Configuration Handling:
To accommodate a variety of usage scenarios, all personal connection settings are extracted and made configurable via an external text file. This file is read at startup and can be modified to change connection details, such as OAuth tokens, bot username, and channel name. If the configuration file is missing or contains placeholder data, an appropriate error message is displayed on a Canvas in the Unity scene.
Error Handling and Debugging:
To handle exceptions and ensure smooth functioning of the game, error handling routines are integrated within the code. Log messages provide detailed insight into the system’s operation which greatly aid debugging efforts.
Distribution:
The completed Unity project is built into an executable and shared online via platforms like GitHub and itch.io, thereby making it easily accessible for users to download, use and potentially modify.
The project can be downloaded from here: https://blindxfish.itch.io/twitchfishes