Twitch.tv Arena Battler
Solo gamejam (for IMT2581 Rapid Prototyping course at NTNU Gjøvik). My main goal was to create a game integrated with Twitch.tv such that the game could be streamed, and users would join and engage in the game from the twitch chat.
Repository can be reached at: https://gitlab.com/akerholten/gamejamtwitchgame
Some more information from a project report can be seen below:
Prototyping Report
Project date: 02. November 2018 - 04. November 2018
Development Environment:
- Unity
- Gitlab w/LFS
- GraphicsGale
- Twitch (IRC)
Description
My project was to somehow make an integration of twitch into a game, so that people could join via twitch chat and have their own character placed in the game in an arena-like environment. So I got some inspiration from Hero Line Wars (starcraft 2 mod) and also Age of War (simple browser game). Where people get income and spawn units that work to control the center of the map, and by eliminating the enemy base or team they win the game. So the initial thought was that players would be assigned to a team (red vs blue in this case), and then get income to be able to continuously spawn units against the enemy team, until one team stands victorious when the enemy base is destroyed. However I never got to that point, so I ended up with it just being an ‘arena’ instead, where people could join in and have their character assigned to a random team, and by winning rounds or killing people they would get gold they could spend to upgrade their character.
Even though the game lacked some in-depth mechanics I wanted to add to make it more interactive, like using skills on cooldown and such, it was still a quite interesting task in my opinion. I also had some friends join in on the stream and join in to play, I think they found it quite cool to see like their “own” character fight in a brawl-like environment even though it was not really that interactive except for being able to upgrade the character in certain directions.
I had expectations of going into this that it wouldn’t be easy to make it too interactive with a twitch game either. There are a lot of concerns to consider, like how the stream has some delay to players (so when interacting, it is actually happening for example a 5-10 sec delay until they see the actual action on stream). So this was also why I went with this direction with the game, making it simple, yet entertaining to some degree to watch the characters smash against each-other in the arena.
Also, because I am not really an artist, creating assets was a bit rough (I honestly think I prefer 3d modelling than making 2d sprites, it just feels a bit weird, and I’m not good at drawing), so I didn’t like the outcome of how the game looks. But that wasn’t the main part of the task either, the main part was to program a game with twitch-integration, not create beautiful looking assets for this game, so I am satisfied enough with the outcome and with the placeholder assets.
![](hero.png)
My raw personal notes
Contribution
First day I started out with looking into how to make a twitch client that could get into a channel and receive and send messages. So I worked with that, setting up a TcpClient that connects to Twitch’s IRC server for their chat. It was actually more straight forward than I thought it would be initially, they have pretty good documentation and especially for bots as there is a lot of people creating bots for Twitch. However there was some hiccups along the way as the client becoming null at certain times that I didn’t understand until later (because whenever I wrote code and Unity reloads the new files it makes some hiccups for asynchronous processes, which is what the TcpClient was). And in general the documentation was mostly for making it with nodejs and stuff, which is what most bots use. But it worked out pretty well, and as I was gonna stream this and also have this in a repo, I made sure to set it up with an Oauth, and to have that token in my environment variables. So it loads when I run the program, and that my password or oauth-token isn’t stored in plain text anywhere else than my environment variables. Also this twitch connection with oauth received a lot of privileges, like I could whisper people in chat, see who is in the channel, I could also ban/timeout people. However I never ended up using all those utilities, but I definitely see cases where they are needed. Also I tried to make sure so the bot wouldn’t write in chat or whispers too often, as I realized it could be seen as spam, and cause twitch to timeout my bot for maybe 8-hours or so. Further on this day I worked with some assets, creating some simple 2d sprites with GraphicsGale. (Not too happy with the outcome of these sprites, but I am not an artist, and just wanted something simple that would work for this game, so for that I was satisfied enough). Further on was mostly working on a lot of game logic, setting up so that I could receive the users and commands people posted in to twitch chat, and placing people in a queue to join a team for a battle.
Second day I had some gameplay going already, but I didn’t have a continuous game-play loop, so that was the first thing I wanted to make. So I did some UI to display information to the users, timer till next round, and displaying who is in queue, etc. I got this gameplay loop going up pretty quick, and was pretty happy with having this quite early, so that I then could work on the things I wanted to add and make, knowing that I already had this game-play loop was pretty nice. Furthermore, I did some work on animation, and had some hiccups here and there, as I hadn’t worked much with this before. I had earlier on worked with using state-machine for AI, but not for animation, so I had to read up a bit and used some time on this. But it was quite nice to learn about these tools in unity as like stated I hadn’t used them so much before. Lastly this day I added in the character stats, and the shop for the players. So that they earned gold while playing and could be able to buy upgrades using commands via twitch chat (for example one could do “!upgrade attackspeed”, and then the attackspeed would improve, in exchange for gold that they earned during playing). As this was a jam the whole command system with twitch was a bit too hardcoded for my liking, but the goal for me was to make it work for exactly this here, and to see how I would do these things. So even though the whole code-structure for getting the commands users sent from twitch got a bit messy, I at least got it to work for this. However had I done it again I would probably approach it a bit differently to make it more clean.
Last day was mostly spent polishing a bit of features I know that didn’t work too much as intended, creating more commands so that people could do for example “!help” or “!shop” to receive some more information. Also some general polishing for the game, like animations were some times too quick, and they seemed to be in-sync with the enemy they were attacking, which was weird behaviour, so most of the day went to this. I also did some more UI improvements, like on how health-bars above characters was displayed.
Reflection
The good
- Twitch-integration went pretty smooth - Quite happy with how easily it was to get into getting a twitch-client setup and running for receiving packets from twitch’s irc channel. Also the commands and possibilities available was very well documented so it was easy to understand how things was supposed to be done to work.
- Happy with the outcome as my first solo-jam - As this was my first solo-jam (apart from Graphics-exam last semester), I am quite happy with the result and the amount of things I got setup without too much struggle. I guess after now having worked some with Unity this semester the workflow starts to get a lot better.
- Fun to invite friends to join in and be “play-testers” - As the whole gameplay was happening through my twitch stream, it was quite simple just to ask some friends if they wanted to join in and try to “play-test” what I was making, and that way getting quite immediate feedback on things that I maybe didn’t see myself. So for getting some different eyes on the game this was pretty nice and easy for this jam.
- Learned more about how animation and sprites are working in Unity - As I haven’t done much of this in previous jams, it was nice to get into how these concepts work in Unity.
- Had the core gameplay loop pretty early in the jam - Pretty happy with having the core gameplay loop pretty early in for the jam, so I think I scoped pretty decent for what I wanted to achieve. As this made me see improvements I had to make early and how I would have to approach further work.
The bad
- The game does not look so well - My main focus was working on the gameplay and twitch integration, so I am not really that happy with the looks of my game when it comes to the sprites and animation.
- Maybe not as interactive as I hoped to achieve - I wanted to be able to make it so people could do certain commands to interact on each round with like using abilities with a cooldown. However I never got to that point, and which also is probably a lot because it was a solo-jam and I had to do all by myself. Had I had more time I would’ve added more characters and more interactions for people that played through chat.
- Quite hard to work on a jam all by yourself - At the same time I am happy with the amount of work and what I managed to achieve with this solo-jam; I gotta admit that it can be a bit rough working solo on projects like this. Having to solely rely on yourself to find solutions to problems and manage scope and what things that need to be worked on can be a bit messy. (Found out midway I needed to sort all my thoughts, and wrote a huge list of to-do’s where I tried to sort out what was most urgent) Which worked out well, but yet again, I often ended up feeling I wanted to do so many things at the same time, and solely relying on yourself to work on every single module can be hard.
- Did not utilize twitch integration to its full potential - As I had the client setup with oauth and everything I could do a lot of nice stuff with it. Like I could make the bot set channel info, I could do alot of moderation of the channel (timeout/ban, delete messages/spam, set restrictions to chat, etc), see who is in the channel, list subscribers, and a lot more. However I never got to that point, but I had the core functionality which was receiving messages and sending messages in the channel.
Things that I would do differently are
- Planning the setup of the game in a bit more detail - This jam was mostly solved with the “barbaric” approach, just having an idea and straight jumping into working with the different modules I felt and thought I needed for the game. Whilst this got the work done, a lot of things needed refactoring, and I think I could’ve made a lot of modules more clean with some better planning.
- Take more breaks - At least on the second day I think I worked almost the whole day with not that many breaks, and that caused some issues. First of all working for many hours gives a quite mess and makes it a bit hard to conquer logical problems, so it made my workflow a bit slower. It also probably made it so some of the code I produced was a bit bad structured and not that clean as it could be. Furthermore it caused me to be a bit burnt out on the last day, so I did not get that much done on the last day.
- Look more into how to make better sprites for 2d games - As stated earlier I was not too happy with the outcome of how my game ended up looking, for later work I would like to spend some more time on making models and making them at least a bit more advanced and better than what mine were at this jam.
What was different from previous game jam
- Smaller scope - Definitely a smaller and simpler scope than my previous jam where we worked on somewhat simple-reflex agents for a “reactive”-AI system. So with the smaller scope I felt I got the core in a lot earlier and was suitable for a solo-jam.
- Did not hit as many “brick-walls" as last jam - As stated, last jam was more complex in terms of working with a state-machine AI, and was a suitable project for a jam with two people, but as this jam was a solo-jam and getting stuck at a certain part of the project can be quite hard to encounter I was happy with not hitting that many or big “brick”-walls that would stop progress.
Learning reflection
As for the whole jam I am quite happy with the learning outcome, even though I probably could’ve gotten more in-depth in some modules. Like the tools I used for creating the 2d sprites, I probably could use some more time on how I could create some better-looking sprites and animations. But as it was one of the first times I was working with that I am happy for just learning how to use the tools. Also it was really interesting and fun to work with the twitch-integration for the Unity-game, at least because it also went so smooth to get it to work quite quickly. In general I feel that I got to touch a lot of concepts, some I had worked a bit with before and some I had worked with less, and it was nice to work a bit with all of these concepts and put it into work to make something solely on my own, so I’m quite happy with the result. Even though for example a group jam there would be more time to go more in-depth in each module and learn to master the different tools better.
Conclusion
Overall happy with the result I achieved with this solo-jam, like stated earlier, this was one of my first solo-jams. So being able to have an idea and execute it to somewhat degree as I intended to was quite nice. And also I have a general interest in twitch and twitch-plays games so it was really fun to try and make one on my own.