Rec Room Wiki
Advertisement
Rec Room Wiki
How_To_Rec_Room_-_State_Machines

How To Rec Room - State Machines

YouTube tutorial by Rec Room Inc.

How_to_Rec_Room_-_Doors_and_State_Machines

How to Rec Room - Doors and State Machines

YouTube tutorial by Rec Room Inc.

How_to_Rec_Room_-_Building_an_Elevator

How to Rec Room - Building an Elevator

YouTube tutorial by Rec Room Inc.

Rec_Room_Tutorial_-_Event_sequences_pt._1_-_State_chip_output_pins

Rec Room Tutorial - Event sequences pt. 1 - State chip output pins

YouTube tutorial by Corporal_Joker

Rec_Room_How_To_Maker_Pen_Crash_Course

Rec Room How To Maker Pen Crash Course

YouTube tutorial by AFewGoodTacos. Section about state machines starts at 18:40.

About[]

State Machines are Circuit networks of State Machine chips and State Chips, used to make the management of physical and/or game states easier.

Creation[]

To create a State Machine, first go to the Gadgets tab on the Palette, then go to Other Chips > Next Page, and select the State Machine chip. To create a State, either create a State chip from the Palette, or Select your State Machine, open the Context menu [...], and select "Add State". Note that your first State will need to be Connected to your State Machine chip, as this is how you define your default state. States created from the Context menu will automatically be connected.

Things to keep in mind when setting up a State Machine[]

  • States need to be wired in the order that you need them to move in; i.e. State 1 > State 2 > State 3 > State 1.
  • States must be configured with the Configure tool to change what three values the State Machine Chip will output when it is in that State, the minimum time spent in that State before automatically transitioning to the next, and the name of the State. e.g. State 1 outputs 1, 50, 200, and is active for 4 seconds, while State 2 outputs 1, -50, 0, and is also active for 4 seconds.
  • State Machines need to be wired in a manner such that they will eventually return to the default state.
  • The five output pins on a State Machine chip will output Value 1, 2 and 3 of the current State (on Red, Green, and Blue respectively), the Cyan pin will output the how long the current state has been active (in milliseconds), and Magenta pin will send a 1 for one tick when a State Transition occurs.

Other Things of Note[]

  • The current State in a State Machine is indicated by which State is lit up on the front.
  • States will automatically attempt to transition to the next State.
  • You can specify when one State will transition to the next with a Circuit input, by connecting to the arrows that appear on State connection lines.
  • A State Machine can only have one active State.
  • There are three output pins on States. These are similar to the Output pins on Trigger Zone and Buttons, in that the Red pin will output tick a 1 when transitioning into the State, the Green pin will output a 1 when while in the State, and the Blue pin will tick a 1 when transitioning out of the State.
    • Note: for complex state machines in multiplayer rooms, there is a chance that not all players receive the signal from the Red and/or Blue pin of a State. If it is critical that all players receive a signal, it is better to rely on signals from the Green pin and set a minimum time in the state greater than 0.1.
  • There are two input pins on a State Machine. The Red pin will allow you to turn the State Machine on and off, and the Reset pin will reset the State Machine back to its default state.
Advertisement