Inspiration

I'm a live coder and sometimes I also like to play video games. As usual I like to offer my community some interaction in my stream. As I want to play Valheim, I started to develop a mod so that my viewers can interact with me directly in game. I made a first version without a graphical interface, with a nodejs server that handled the connection to Twitch and that communicated with the mod in Websocket. It was not easy at all for the end user to install and configure it. After one of my viewers told me about the Twitch Channel Points Hackathon I decided to make a new version by integrating everything in the mod and offering a GUI to configure anything directly in game.

Fun fact, I spent more than 150 hours coding this mod and less than 80 playing the game...

What it does

  • In game Twitch authentication.
  • Create managed reward in game. (Edit is planned)
  • Auto enable/disable managed reward when the game start/stop/quit.
  • Viewers can :
    • Print a message in the HUD (center or top left).
    • Send a message to the broadcaster via Hugin (the crow in the tutorial).
    • Change weather for a predefined duration.
    • Start events for a predefined duration (ex.: blobs horde).
    • Spawn different entity (more or less aggressive, Troll, Boar, etc..) configurable in game by the broadcaster.

How we built it

By turning a lot of coffee into lines of code. More seriously I started to learn Unity and C# for this project. Unfortunately Valheim doesn't provide modding out of the box so I also had to dive into the world of BepInEx and HarmonyX. Another important ingredient is my community. The whole project was done live on my Twitch channel with the daily support of my viewers. Only happiness ❤

Challenges we ran into

If you watch my replay you will see that every day was a challenge.

First I had to setup a build for Valheim modding (almost no documentation) with a language I didn't know, dealing with different versions of Unity/Mono/.Net etc..

Then I had to figure out how to integrate a custom UI. I first tried to code the interface directly in C# but I quickly realized that it's a huge task. So I found a solution to make my interface directly in Unity and export my prefab as a DLL that I could embed in my mod.

The next challenge was to find a WebSocket library that works in my particular setup. After several tries I finally found my happiness and I could start to code my own Twitch Auth lib.

Last but not least I had to find the in-game actions and make it work together. Be able to configure actions, channel points and save state between game sessions.

Accomplishments that we're proud of

The whole project was a challenge and I am very proud to have overcome all the steps with the help of my community without whom I would never have gotten this far!

What we learned

I've already worked quite a bit with the Twitch API for different projects in JavaScript (my 🦄 language) using lib. This time I created my own authentication lib, the Helix client as well as the PubSub client. I also got a good base in C# and Unity3D. I also learned that making a video takes a lot of time so next time I'll take it sooner.

What's next for Valheim Twitch Mod

  • Take advantage of other Twitch events like raids, sub, gifts, etc...
  • Integrate quests proposed by the audience such as picking 100 flowers in less than 15 minutes under the pressure of 15 trolls.
  • Since I published the mod on Nexus & Thunderstore I have a lot of feedback and requests to add interactions. I'm looking forward to see how far we can go.

P.S.: Sorry for the poor English this text is translated with www.DeepL.com/Translator (free version)

Built With

+ 48 more
Share this project:

Updates

posted an update

Hello :)

ValheimTwitch v1.5.0 is out !!!

Features

  • Add settings panel
  • Add shortcuts (#17) (63f7cf4)
    • Whistle tamed creature (default H)
    • Enable/Disable rewards (default T)

Bug Fixes

  • Tamed creature faction (#23) (ff98724) (#21) (#18)
  • Reward form setup (#22) (f11d403)
  • Undefined tamed property (#14) (ac26ec8)

Log in or sign up for Devpost to join the conversation.

posted an update

Hello :)

ValheimTwitch v1.4.0 is out !!!

Features:

  • Player heal and puke
  • Spawn boss (not tameable)
  • Spawn Tamed creature which takes the name of the viewer
  • Show Hugin intro only once per game session
  • Switch to edit action right after creation
  • Disable reward at creation
  • Update version notification

Bug Fixes:

  • Check channel points availability
  • Clear add new reward form before open
  • Deletes a reward when it no longer exists
  • Reward form toggle not taken into account

Peace !

Log in or sign up for Devpost to join the conversation.