Been spending way too long tuning input buffering for a melee action game and I'm starting to question every decision I've made.
The basic idea is simple enough: if the player presses an attack button slightly before the current action allows it (like near the end of an animation), you buffer that input and execute it as soon as the window opens. Without it, anything that isn't frame-perfect feels unresponsive. Fine. But the tuning is where I keep going in circles.
My current setup is roughly:
// on input received:
bufferedAction = inputAction;
bufferTimer = BUFFER_WINDOW; // currently 150ms
// in update:
if (bufferTimer > 0 && canAcceptInput()) {
executeAction(bufferedAction);
bufferedAction = null;
bufferTimer = 0;
}
bufferTimer -= deltaTime;
150ms feels okay but I've seen recommendations ranging from 100ms to 200ms depending on genre. Fighting game players swear by shorter windows because long buffers cause ghost inputs, where you accidentally queue an action you never consciously intended. But on a controller with any latency, short windows mean players feel like their inputs are getting dropped.
A few things I haven't solved cleanly:
- Priority conflicts — what happens when a dodge and an attack are both buffered? I'm currently just taking the most recent, which feels wrong in practice.
- Clearing the buffer correctly — should entering a hit reaction clear it? A locked cinematic state? I'm not consistent and it shows.
- Per-action vs. global buffer — some systems use separate windows per action type. Is that actually worth the added complexity or is it overkill for a non-fighting game?
Curious what people have actually shipped. Is 150ms a reasonable baseline for third-person melee, or am I in the wrong ballpark entirely? And if you've solved the priority conflict thing cleanly, I'd love to hear it.