Inspiration

My inspiration came from the classic collaborative storytelling game where a group of people build a narrative together, one sentence or word at a time. I wanted to bring that creative and often hilarious experience to Reddit communities, because with Reddit’s massive and diverse communities, the potential for unexpected, funny, and imaginative storytelling is unmatched. I saw an opportunity to modernize this concept by integrating Giphy, allowing users who are stuck and don't know what to write to be inspired by Giphy's GIFs. My goal was to create a game that is incredibly simple to play but results in unique, unpredictable, and engaging stories that are a direct reflection of a community's personality.

What it does

"Only One Word" is a collaborative storytelling game built for Reddit. It allows users to:

  • Build a Story Together: Players contribute to a shared narrative by adding a single word or punctuation mark at a time.
  • Play in Two Modes: Users can craft a personal story in Solo Mode or join a public game in Multiplayer Mode to collaborate with the entire community.
  • Get Inspired: If a player is stuck, they can click an "inspiration" button to get a random, fun GIF to spark new ideas.
  • Save and Continue: In Solo Mode, players can save their stories, view them later in a personal "My Stories" library, and pick up where they left off.
  • Join a Lobby: The multiplayer experience includes a lobby where users can see all active multiplayer games, how many players are participating, and how long the stories are, making it easy to jump into the action. The game is designed to be a seamless, real-time experience where the story updates automatically as new words are added by players.

How I built it

I built "Only One Word" on a modern, type-safe technology stack, leveraging the Devvit platform for deep integration with Reddit.

  • Platform: Devvit is the core of the application. It handles the hosting, Reddit authentication, and provides essential backend services like a built-in Redis database for all data persistence.
  • Backend: We created a robust API using Express.js on Node.js. This server-side logic manages the core game state, enforces turn-based rules for multiplayer, handles word validation and content filtering, and serves all data to the client.
  • Frontend: The user interface is a dynamic single-page application built with React and TypeScript, ensuring a type-safe and component-driven architecture. I used Vite as the build tool for fast development and optimized production builds.
  • Styling: All styling was done exclusively with Tailwind CSS, following a utility-first approach for a consistent and responsive design. I used shadcn/ui as the primary component library and lucide-react for icons to maintain a clean and modern aesthetic.
  • Architecture: The project is structured as a monorepo with clear separation between the client, server, and shared code. This allows me to share TypeScript types between the frontend and backend, preventing data inconsistencies and making development more reliable.

Challenges I ran into

The biggest challenges I ran into have been:

  • Achieving a Real-Time Feel: I wanted the story to update for all players as soon as a new word was submitted. Instead of the complexity of WebSockets, I implemented an intelligent polling system on the client. The client periodically asks the server for updates, but only fetches new data if the story has actually changed, making it efficient and reliable.
  • Ensuring Fair Multiplayer Gameplay: To prevent a single user from dominating a multiplayer story, I designed a TurnManager on the backend. It enforces a "one contribution per user, per phrase" rule. This was a crucial challenge to solve to ensure the game remained collaborative and fun for everyone.
  • Robust State Management: With multiple players interacting with the same story, having a single source of truth was critical. I established our server-side Redis database as the definitive source for all game state. The client fetches and syncs with this state, but all modifications are securely handled through our backend API, preventing inconsistencies.
  • Content Moderation: Since the game is based on user-generated content, I needed to build a system to filter inappropriate submissions. My solution was a multi-layered validation system on the server that checks for profanity, gibberish, and invalid formatting before a word is ever added to the story.

Accomplishments that I'm proud of

There are certain features that I'm particularly proud of having built, whether because they have been really difficult to debug or because they are at the core of the game structure.

  • A Seamless, Multi-Screen User Experience: I'm proud of having created a fluid user journey, from the home screen to the multiplayer lobby, into the game, and over to the personal "My Stories" page. The interface is intuitive, mobile-first, and feels like a complete application.
  • The Fair-Play Turn System: The turn management system for multiplayer is one of my key accomplishments for this game. It successfully encourages participation from many different users and makes the collaborative experience genuinely communal.
  • The "Inspiration GIF" Feature: This is an idea I believe adds a huge amount of fun and personality to the game. It's a creative solution to a common problem (writer's block) and I hope it will make the game more engaging.
  • A Solid and Scalable Technical Foundation: The clean monorepo architecture, the use of TypeScript for end-to-end type safety, and the clear separation of concerns between the client and server make the project maintainable and easy to extend in the future.

What I learned

In this hackathon weeks I've learned, or I have strongly improved my previous knowledge of:

  • The Power of a Platform like Devvit: I learned how much a specialized platform can accelerate development. Devvit simplified hosting, database and data persistence, allowing me to focus on building the core game logic and user experience.
  • Designing a Resilient Client-Server Relationship: I gained valuable experience in designing an API for a real-time application. I learned the importance of server-side validation and making the server the single source of truth to handle a multi-user environment gracefully.
  • Pragmatic Technical Decisions: I learned that the most complex solution isn't always the best one. Choosing an efficient polling mechanism over WebSockets was a pragmatic decision that allowed me to deliver a real-time feel reliably and quickly.

What's next for Only One Word

I already have many ideas for expanding the "Only One Word" universe:

  • Deeper AI Integration: I plan to implement an AI image generation for key moments in the story, such as at the end of every phrase. I have already obtained the authorization to use Reddit and OpenRouter APIs to use AI text-to-image models for the app.
  • Community Voting and Branching Narratives: I also want to introduce a system where, after a few completed phrases, the community can vote on one of several AI-generated options for how to start the next sentence, creating branching storylines.
  • More Game Modes: I'd like to add themed game modes (e.g., "Sci-Fi," "Fantasy," "Mystery") that start with genre-specific opening phrases and perhaps use a themed word validator.
  • Achievements and Leaderboards: I want to introduce a system to reward players for their contributions, such as "First Word," "Phrase Finisher," or tracking the users who have contributed the most words.
  • Sharing and Exporting Stories: Finally, I think it would be great if users could share a finished story as a shareable image or text file inside (and outside) of Reddit.

Built With

Share this project:

Updates