GoDrawGoDraw

Z-Ordering

Stable

Move one shape forward by changing exactly one number.

Why GoDraw uses fractional indexing to manage stacking order cleanly.

The idea

Every shape sits at some depth in the stack, which one covers which when they overlap. The naive way to track that is to number shapes 1, 2, 3, and so on. But the moment you slip a shape into the middle, you'd have to renumber everything after it. On a shared board, that's a recipe for collisions.

A new index slotted between two neighbors
A fractional index lands between neighbors, no renumbering

How it works

GoDraw uses fractional indexing. Instead of whole-number positions, each shape carries a fractional index, and reordering just picks a new value between two neighbors. Want to drop a shape between the ones at 1 and 2? Give it 1.5. Need another between 1 and 1.5? Use 1.25. There's always room to fit one more in.

Because moving a shape touches only its own index, never its neighbors', the operation is tiny and self-contained.

Why it works this way

That self-contained quality is exactly what collaboration needs. If two people reorder shapes at the same time, each change edits a single independent value, so they merge cleanly instead of fighting over a shared sequence of numbers. One small idea solves both the renumbering chore and the multiplayer conflict at once.

Was this helpful?