Improbable Icon

Boolean Flags in Schema; good or bad?


This is a best practices question with regards to which data could be in a schema.

For my game, I want VFX when a ship is in warp. Currently I solve that with a boolean is_in_warp in one of my schema files, and perform an action when that value changes. I have considered using events for this but events can go missing and a ship may be stuck with its warp animation, while a boolean flag always has a fixed value (true or false).

Is this a bad solution from a data perspective? Will this increase traffic compared to the event solution, or is this a solution good enough?


Look good to me, since is_in_warp is a property it should be on the persistant layer, so if new player come it should have the correct state.

As you said event can fail, and command isn’t the way to go here.

Also I don’t think a bool will hit the network, but if you want to store more informations about the state of your ship think about an enum or a bit flag it should be more efficient than using multiples boolean :smile:


I always like persisted data so bool flag is the way to go. Normally I would also throw in an event to kick of changes but spatial already does that for value changes.

Since it’s a long lasting state and not just a one off action, the flag makes sense and as @Jackblue says, Enums are even better because you can transition states.