Spielerando

Decide which sounds to load at once and which to play as a stream

Shots, jumps and hits must play the instant you press the button, while a long music track must not be loaded whole. Get this split wrong and either the sound lags behind the action or the game eats memory. This entry gives the rule and the memory cost.

Why this works

A sound that must answer a button at once has to be ready in memory, but memory use grows with length, so a long track would cost far too much. Short sounds are therefore prepared ahead and long ones are played as they arrive.

When not to use it

Wrong for a game with only a few seconds of sound in total, where loading everything is simpler. It also fails for long music that must start in time with the action; there load the first part ahead and stream the rest.

In the full entry

  • What to build, step by step
  • Starting values and the reason for each
  • 3 common mistakes and the fix
  • 25 lines of example code with 3 checks that pass
  • How your AI shows you that it works

Say this to your AI

Use the Spielerando entry "Decide which sounds to load at once and which to play as a stream" (read_entry action-audio-preload-or-stream) in my game. Build it step by step, and show me how you checked that it works.

Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP