Implementing chat integration in Hive Time
Scroll or press Space to continue...
Who am I?
My name is Cheese, and I wear many hats. The ones that are relevant today are:
- Game developer
- Community organiser/manager
You can find me on Twitter as @ValiantCheese or on irc.freenode.net as Cheeseness.
I've worked on some games you might have heard of
And others you might not have heard of
Today we'll be talking about Hive Time
Hive Time is a bee-themed management sim/base builder. You might like it.
A disclaimer
As always, every developer and every project has its own context and identity.
What's discussed here is not advice, but perspectives shared in the hopes that it can help you discover or navigate the best fit for your own work.
Chat integration in Hive Time
Today we'll be looking at the following aspects of "chat integration" and how it relates to Hive Time:
- Inspirations
- Chat engagement
- Implementation goals
- Protocols
- Implementation
- Cutting room floor
Inspirations
Hive Time's chat integration draws inspiration from the following games:
Inspirations - Hand of Fate 2
Hand of Fate 2's integration options focus on choice/outcome voting, but also allow endless mode bosses to be named after active chat users.
- Encounter choice voting
- Chance gambit voting
- Periodic gift voting
- Endless adventure voting
- Endless Boss names
- Dev commands
Inspirations - Overland
Overland's integration options focus primarily on presenting chat participants as survivors, but also allows voting on destinations.
- Survivor names
- Survivor dialogue
- Destination voting
Chat engagement
These features can be mapped along two axes.
- Features that increase the viewer's sense of ownership over the player's experience of playing
- Features that increase the viewer's sense of ownership over their own experience of viewing
Chat engagement - visualisation
These axes seem to have loosely inverted depth in many cases!
Implementation goals
For Hive Time, I wanted to have a mix of features that could provide value along both axes.
- Event choice voting
- Periodic gift voting
- Special bee names
- Special bee dialogue
- Special bee commands
- Dev commands
Implementation goals - visualisation
Chat bees decrease the passiveness of viewing. Event and gift voting affect gameplay, but an individual vote feels less impactful than a bee.
Implementation goals - further concerns
There were a few extra things I wanted to keep in mind for giving the best experiences for players and viewers.
- Allow all chat features to be toggled individually
- Provide optional whitelist to limit interaction to specific chat users
- Provide optional blacklist to limit interaction from specific chat users
- Ignore inactive chat users
- Give visual feedback on votes/interaction
- Commands/voting outcomes shouldn't interrupt events
Protocols
Most streaming platforms offer their own APIs. As a solo developer who doesn't want to be tied to one platform, an open standard makes more sense.
- There is no standardised common streaming platform chat API
- Not all streaming platforms have a chat API
- Not all streaming platforms have chat
- Open standards make more sense for me as a solo developer who doesn't want to be tied to a platform
Protocols - IRC
IRC is an older protocol with a few advantages. The client protocol is defined in RFC 1459, and updated in RFC 2812.
- Established/mature
- Widely available infrastructure
- Can be self-hosted
- Is fairly simple
- Twitch exposes an IRC-compatible interface
Implementation
Hive Time's chat handler implements a partially functional IRC client, implementing 8 commands out of around 60.
- NICK
- JOIN
- PART
- USER
- QUIT
- PRIVMSG
- PING/PONG
- Nickname is already in use/Nickname collision KILL
It is also read only (so as to not need to bother with authentication).
Implementation - architecture
It's magic!
Implementation - architecture
It's not magic!
Implementation - voting
Gift options use numeric identifiers while event choices use alphabetical identifiers in case they happen concurrently.
- #2 (votes for second gift voting option)
- #B (votes for right event choice)
Voting uses a # prefix so as to not be confused with commands (which use !).
Implementation - bee commands
Once a chat participant is assigned a bee, they may issue commands to adjust the size, shape, role, and hat of their bee.
- !eat_me
- !next_hat
- !next_role
- !drink_me
- !prev_hat
- !prev_role
- !thicker
- !die
- !help
- !slimmer
Their non-command messages are automatically relayed in-game via speech bubbles coming from their bee.
Implementation - dev commands
A number of developer-only commands expose options for adjusting player population or resources, as well as triggering any event or effect content within the game.
- !give 50 wax
- !take 50 wax
- !event bear attack
- !spawn beesitter 50
- !kill beesitter 50
- !effect big_fireworks
- !spawn me
- !say_bee me hello
- !say Big hello
- ! Quick hello
- !music YamParty
- !queen Wave1
- !gift_vote
- !upside_down
Implementation - command definitions
To keep things scalable and easy to integrate, I wrote a structure for declaring commands that defines the expected format and function to be called.
!eat_me chat bee command definition:
"eat_me": {"func": "resize_bee", "format": [], "default_values": [1.5], "pass_user": true}
!give dev command definition:
"give": {"func": "give_resource", "format": [TYPE_INT, TYPE_STRING]}
Implementation - dev bees
As something special for my collaborators, I added unique bees, which will be used when the !spawn me command is invoked by a known dev.
Cutting room floor
There were a number of additional features/functionality I considered, but wasn't happy with or didn't have time for:
- Conga bee command
- Sleep bee command
- Animate bee command
- Meta-aware events
- Word filters
- Fully complient IRC client
- Customisable vote/command prefixes
- Moderator commands/lists
- Send IRC message when voting starts
- Better feedback on connection state
Further Reading
I've tried to write about, stream, or otherwise document every aspect of Hive Time's development. If you're hungry for more, read on.
Thanks for listening to me waffle about Hive Time's chat integration!
Hive Time and more can be found on my Itch.io page
More musings on development can be found on my Patreon page
More of my writing about games, and game-adjacent culture can be found at CheeseTalks.net
This presentation was created using Stack