We noticed that there was a lack of extensions and integration for the game Minecraft. This inspired us to create a project that allows a Twitch extension to interact directly with the game.
What it does
This extension allows viewers to send "Conflux Cubes" to the streamer using bits in our extension. A Conflux Cube is a new block in the game which causes a randomized effect to happen when the streamer interacts with it. The viewer may also provide a custom message that will be sent along with the Conflux Cube, and this message will be displayed in the in-game chat.
The cubes come in several variants which have different pools of potential effects. The events and variants are designed using a data driven system. This system allows the streamer and their communities to create their own custom variants and effects which can be made available through the extension.
How we built it
We used React and Bootstrap to create the front end of our Twitch extension. We used these libraries due to our past experience and familiarity with them. The front end extension is powered by data received from our Extension Backend Server which is hosted on EC2, and our S3 bucket.
The Extension Backend Server is written in Java and makes use of the Spark web framework. We went with Java because it is a language that our team is comfortable with. We chose the Spark framework because it has proven to be very performant and we have used it for web applications in the past with great results. The Extension Backend Server is running on EC2, and uploads image sprites to our S3 bucket so they can be accessed in the front end of the extension.
The game mod was also written in Java and uses the Minecraft Forge API. We used Java and MinecraftForge because they are the standard tools for modding Minecraft, and allow us to offer compatibility with mods that streamers are already using. The game mod generates data about the current cube variants and effects that are available, and sends them to the Extension Backend Server. The mod also does periodic checks with the backend server to see if there are any pending cubes for delivery.
Challenges we ran into
One of our biggest challenges was designing a system that could facilitate all of the network communication and data transfer in a secure and efficient way. The mod can be installed in a single player and multiplayer environment, meaning that we needed something that could account for multiple streamers using our extension on the same game instance. In Minecraft the server is responsible for controlling the actual content of the game meaning that the server would need to communicate with our Extension Backend Server on the behalf of the streamer, however we didn't want the streamer to give their extension API key to a potentially untrusted server. To solve this issue we had the streamer's game client ask our backend server for a JWT containing the streamer ID, set with a short expiration date. This token is then sent to the game server which uses the JWT to validate it's requests to the needed endpoints on behalf of the streamer.
Accomplishments that we're proud of
We are proud to have completed this extension before the end date of the hackathon. We started our submission on the 5th of February, which is fairly late into the event. Being able to take a concept and bring it to a production ready state while also meeting a deadline is a big accomplishment for independent developers like us.
What we learned
One of the things we learned about was the various tools available for image compression. We use several images in our extension and noticed that these could take a while to load. After looking into various compression tools we found Zopfli which was able to significantly compress the assets we use without reducing the quality. We were also able to use Zopfli on the mod assets which reduced our images by 94.3% total.
We also learned that we have the skill set required to create extensions with fairly complex game integration. By proving this to ourselves we are now able to consider working on similar projects in the future.
What's next for Conflux Cubes
We are planning to continue working on this extension, and providing updates to the mod to include more effects and content for the streamers to work with. The mod for our extension also has an addon system, however this system has not been fully documented and there are no projects or examples that make use of this capability. We are hoping to work with the CurseForge team to create a category on their site for these addons (#purplemods). We are also planning to use this addon system to release optional (free) content that ties in with holidays like Halloween, and potentially events such as UHC.
We are also planning to investigate and implement other AWS such as Cloudfront to further improve our extension and other projects.