Catch the Momento team at re:Invent 2024! さらに詳しく.

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.

アレン・ヘルトン
著者

Share

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 (dictionariessetslistssorted 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!

Share