DEV Community

SultanOfNiyyat
SultanOfNiyyat

Posted on

Building an eat-and-grow ball game in Unity: sizes, pouring piles and fair timers

I'm a solo developer and I recently shipped Gobbly.io, a casual game for iPhone and Android where you roll a hungry ball around a map, eat the items on a goal list before the timer runs out, and grow as you eat. It's built in Unity 2022.3. Here are a few design and technical decisions that made the biggest difference.

Size classes instead of physics checks

Every item has a size class from 1 to 10: the smallest ball size that can eat it. The ball starts each level at Size 1, and each eaten item adds XP equal to its class. The rule is a plain integer compare (item.class <= ball.size), which is cheap, predictable and easy to explain to players. Items that are too big simply act as walls the ball slides along.

The ball radius grows by a fixed factor per size (0.45 m x 1.28^(size-1)), and the camera zooms out with it, so the ball looks equally fast at every size.

Piles that pour into the ball

The most satisfying moment turned out to be tall stacks and heaps of food. Only the bottom piece of a column is edible, one piece every 45 ms, and the rest slides down into the ball. You just sit next to a pile and watch it pour in. That one feature did more for the feel than any particle effect.

Levels from a seed, sized by food, not by time

Levels are generated at runtime from the level number, so the same number always gives the same layout. Each level holds a set amount of food (measured in XP), the map grows until it holds it, and the timer is derived from that amount. That way no level is over in under a minute, difficulty grows steadily, and a bot can play hundreds of levels to check win rates after every change.

Cheap phones get cheap shadows

Phones with 3 GB of memory or more get real shadows; smaller phones get soft round blob shadows. A release gate in the build pipeline blocks a store build if that rule is broken.

Offline first

Everything gameplay-related runs on the device, so every level works in airplane mode. Only ads, purchases and cloud save need a connection.

If you want to see how it plays, or read the player-facing FAQ, it's here: https://sultanofniyyat.github.io/gobbly-io/

Happy to answer questions about any of this in the comments.

Top comments (0)