blog More Game Servers Should have Webhooks

Tags:
fluent-bit games kafka webhook

Webhooks are useful for bridging multiple applications together, and I often wish more apps supported them. One use case that could be a fun place to support webhooks are multiplayer game servers.

Minecraft

I have a group of friends that I know intially through Minecraft. One of the neatest plugins we have, is SDBot a simple plugin for Bucket, that takes certain events in game, and posts them to Discord. It results in messages like this posted to a group chat.

  • 🟢 player joined the game
  • ☠️ player was burned to a crisp while fighting Skeleton
  • ☠️ player was poked to death by a sweet berry bush
  • 🔴 player left the game

Seeing that someone else is online, often makes others want to join in on the fun.

Valheim

Recently the same group has startd Valheim and the server operator has setup something similar

  • I sense the presence of player in Valheim!

This time, they setup something using LoggiFly to parse some of the server logs and send messages. There are a few bugs because the logs do not make a distinction between connection messages or respawning after death.

Logs or Webhooks ?

For a self-hosted server for a friend group, having a connection between inside and outside of the game, adds a bit of extra fun to the experience. If more games supported something like this by default, it could be easier to setup more fun kinds of integrations.

Use Logs?

If game servers standadized on something like logfmt or jsonl then it would be fairly easy to parse data out of the logs. One could imagine a game server running on Linux, and filtering the logs through something like fluent-bit to parse out the logs and do something cool with them. I already use Kafka for several of my other projects, so in my case it would be simple to send everything to Kafka, and then have a small Discord bot or Mastodon bot or something similar to connect the game world with the outside world.

Use Webhooks?

If the game server supported webhooks, could also do similar neat things. While playing Beat Saber in the past, I often thought I would love to have a webhook on song end, that I could post data to and do neat things, like track my personal stats in my personal api

Hytale

Having played a lot of Minecraft in the past, I’m quite curious about Hytale and what they hope to do with the game. Considering that one of their goals is to have a robost API to build mods against, I am certain I will be looking for some kind of ingame event hook api that I can post to webhooks to connect the digital world with the outside world.