What the Fluff

About the project

'The Interacive Cotton Candy Stand'.

What the Fluff is an interactive web-based amusement game built for the Tivoli project, where multiple student groups collaborate to create a shared carnival-like experience. The concept was to build an engaging catch-based game where players control a catcher to catch falling cotton candy, avoid raindrops, and build their stack as high as possible. Three matching colors disappear to keep the game flowing. Players who play through the tivoli earn money and stamps through their performance, which feed into a larger economy managed by the Tivoli Central Bank, but it can also be played as a visitor outside of the tivoli API.

The work was divided between frontend and backend, where I was responsible for frontend.

May 2026

4 weeks

Tech stack

REACT

TYPESCRIPT

TAILWIND

SUPABASE

DENO

Visit site

Technical Approach & Choices

Game Architecture:

The game logic was built around precise collision detection and real-time animation. We implemented a custom game loop using requestAnimationFrame and refs to manage mutable state efficiently without re-renders on every frame. The core mechanic involves checking whether falling items collide with the catcher's collision zone and with the stacked tower, calculating overlap on both axes to determine successful catches.

Game State Management with Custom Hooks:

Rather than routing everything through React state (which would cause expensive re-renders), we used refs for performance-critical data (items falling, stacked items, catcher position) and only called setState when the UI actually needed to update. We built custom hooks to keep concerns separated and make the main component logic simple..

Styling:

We used Tailwind CSS and set up a cohesive color system based on our Figma design, as well as custom CSS variables to match the playful cotton candy theme while maintaining contrast and readability.

Sounds:

Audio feedback on catch, removal, and game-over events using the Web Audio API. Sounds are preloaded and played with proper error handling.

Tivoli API Integration:

The game connects to a centralized Tivoli API to handle user authentication, stamp rewards, and payouts. We used Supabase Edge Functions (Deno backend) to securely exchange tokens and process transactions without exposing secrets to the frontend. Payouts are split equally among team members and tracked in the database.

Challenges & Reflections

Complex Game Loop Design:

Building a performant game loop that handles collision detection, animation, and input simultaneously in React was challenging and I had to learn about imperative, performance-conscious code with refs. The key insight was separating "what drives the animation" (refs, setInterval, requestAnimationFrame) from "what the UI displays" (setState selectively).

Collision Detection Under Pressure:

The three in a row removal logic required careful math to handle overlapping items stacking correctly. And since math is not my strong suit, this was quite a challenge for me. I managed thanks to a lot of help with AI, which gave me confidence that I am able to handle projects even if there are certain parts that I don't feel completely comfortable with.

Team Coordination:

This was my first project dividing frontend and backend completely. I had to trust that my partner's API contract would work as documented, and when integration issues arose, we communicated quickly to figure out which side was wrong.

Tailwind:

Coming from writing custom CSS, Tailwind felt restrictive at first. In the beginning I found it very difficult to understand and to structure it correctly. But as the work went on I felt more and more comfortable with it.

Mobile Input:

I had no idea that touch, mouse and keyboard inputs required different techniques. This was something that I had to look into and learned how differently various control schemes need to be handled behind the scenes. Ultimately, it required a more flexible setup to keep the core game logic separated from how player actions are actually triggered.

What I Learned

  • Building a real-time game taught me to think in frames, deltas, and physics rather than events and state. This mindset shift—thinking about continuous motion rather than discrete changes—changed how I structure interactive code.
  • I learned a lot about TypeScript and became more and more comfortable with the coding language. Very happy to have tried this!
  • The more I worked with it, the more I came to appriciate Tailwind. I found it to be a bit messy in this project, since it was my first time working with it in a bit larger scale, and I managed to confuse myself several times. But I learned a lot and have used it in many smaller projects since, and I realise that the confusion led to an understanding of what not to do.
  • I'm proud of the visual design that I managed, from Figma to complete product, and I'm pleased that I got the oppurtunity to work with sound effects for the first time.