March 17, 2023
-
2
Min Read

Build on Momento: How we made instant messaging for Acorn Hunt

Learn how we used Momento collection data types to build an in-game chat.
Allen Helton
Headshot of the blog author
by
Allen Helton
,
,
by
Allen Helton
by
Allen Helton
,
,
Caching

Have you ever seen a video on TikTok where the OP made a task look so ridiculously easy you decided to try it yourself? You gather up the materials needed to do it, struggle your way through the first half of it, then realize you’re in over your head because you didn’t see all the preparation that was done beforehand to make it appear so simple?

If that hasn’t happened to you, just wait. TikTok will get you. 

Typically when someone makes a task look extremely easy they have spent hours and hours mastering a skill and building expertise to do so. This is akin to building software. You go into it thinking you know exactly what you want to build, then realize you have 100 other components you need to build to make it work properly. 

Take our game, Acorn Hunt, for example. It’s a game where users work in teams to collect the most acorns in a given time. Sounds like a pretty easy build. Split into teams, and increment an acorn counter. 

I wish!

A game has many hidden pieces that are necessary to make an enjoyable user experience. You have leaderboards, analytics, user profiles, stat tracking, and in-game chat (amongst others).

We recently finished the chat capabilities of Acorn Hunt. Check out the demo below as I walk through how we used all five cache types (dictionaries, sets, lists, sorted sets, and single cache items) to build it.

Key Takeaways

  • In-game chat and other session-based data are ephemeral, or short lived, which is a perfect use case for Momento Cache, as data expires automatically.
  • Momento Cache offers multiple collection data types that address use cases like ordering data, deduplication, and object stores.
  • WebSockets can be used for push notifications, which allow the server to notify browsers when something happens, like when a new message is sent.

Interested in trying it yourself? Acorn Hunt is open source and follows all of Momento’s development best practices with the Node.js SDK. All you need to get started is to sign up for a free auth token!

Allen Helton
by
Allen Helton
,
,
by
Allen Helton
by
green squirrel logo for momento
by
Allen Helton
,
,
Author
Allen Helton

Allen is an Ecosystem Engineer at Momento. He comes from over a decade of experience working in the public sector tech industry where he played a key role in advancing the adoption of modern technology in the space. Allen drives API-first development and pushes for best-in-class developer experience for customers. When he's not talking about serverless, you can find Allen tending to his homestead. Between feeding the chickens, working in the garden, or building fences, Allen is always outside learning something new and teaching his kids some lessons along the way.

Author
Author
Open