How do you store numbers in a Rec Room circuit?

I'm trying to save data in various places in my circuit but it's not clear what my options are. How can I store numbers in my circuit?


There are many ways to store data in rec room circuits. You should first put some thought into what exactly you're storing, what you're trying to achieve with that data, and any associations needed.

Basic storage can be done through flag, ring, and rand stores. That data is useful for tracking some event has occurred, but has no "indexing" capability. Indexing means you can provide some input such as a player or team id and get a different result based on the input provided. We won't talk about that here, I'm just making the distinction so you understand the many data storage options that exist. Also out of scope is leaderboard stats which are allow you to persist dynamic data between room instances.

Here is a link to some examples of storage circuits created in the Rec Room Circuit Simulator Tool: RRCS Circuit Examples. You can see these circuits in action and play with them. The Send Data button chips just alternate between the numbers 1 and 2 so you can see the values being replaced.

Let's discuss each one:

enter image description here

RandStore: Wire all three pins of a random chip to your input. It effectively picks a random number between your number and ... your number so it can only ever be what the input was. This is great for quickly and cheaply storing data. You use this if you want the data to stay the same until a new input is available and you want overwrite the current value. Downside is you cannot reset this store.

enter image description here

RingStore: Wire the output of a combinator back to one of its own inputs. This will remember whatever value was passed to it until reset. If it gets a new value instead of overwriting like the RandStore it adds to the existing value. This is useful for counting how many times an event occurred.

enter image description here

FlagStore: Wire the output of an OR chip back to one of its own inputs. This is a boolean store meaning it doesn't store the actual data, it just remembers that something has happened at least once. Flag stores aren't used very often because the RingStore pretty much does everything a flag store does without keeping track of count or the actual data. They can be used when you want to provide clarity in your design. A common use case would be pairing this with a game state chip to keep track of if the game is running or not. This could be used to control a lobby system for example.

enter image description here

ResetableRandStore: The addition of an OR chip before the Rand Chip allows you to set the value, and wire in a reset condition. The only caveat is it is slightly different from most RR circuits in that if the reset condition and input occur on the same tick this circuit will store the data where a RingStore for example will not.

enter image description here

NonCountingRingStore: This is essentially an anti-pattern in circuitry. It's just here to show you that you can approach problems in different ways, but be careful when it feels like you're trying to force a chip to do something it's just not the best tool for. Compare this to the ResetableRandStore. Yes you can force a combinator to reset each time by resetting the store first then sending input on the next tick. Adding delay to your circuits is almost never advisable unless you have a very specific use case. This means any circuits downstream from this circuit would not resolve in the same tick as the upstream circuits. It also costs more for no benefit.


The Circuit Diagrams page on the community wiki (https://rec-room.fandom.com/wiki/Circuit_Diagrams) includes a couple of options (usually best for data that is not specific to individual players):

  • Pulse to Steady (for storing the last non-zero value): https://rec-room.fandom.com/wiki/Circuit_Diagrams#Pulse_to_Steady

  • Copy Value (ring based and RND based): https://rec-room.fandom.com/wiki/Circuit_Diagrams#Copy_Value

  • RS Latch (for storing Booleans) https://rec-room.fandom.com/wiki/Circuit_Diagrams#RS_Latch

If you want to store per-player data that you need only while a player is in the room, you can use the Set Player Stat and Get Player Stat chips (https://rec-room.fandom.com/wiki/Chips#Set_Player_Stat )

If you want to store per-player data that you want to keep after a player leaves the room, you should use the Set Leaderboard and Get Leaderboard chips (https://rec-room.fandom.com/wiki/Chips#Set_Leaderboard )