Much like custom Object Properties, custom Player Properties are a new feature for R2 that can be used to store custom data about players.
How to use custom Player Properties
Unlike Object Properties, which are object-specific, all Player Properties exist for every player in the room. To create a new Player Property, all you have to do is reference it.
You’ll find two new chips in your palette, Player Get and Player Set, and a new event called Player Property Changed. Even in a room with no other custom Player Properties, these are available in an unbound state.
With any of these three options, you’re given a dropdown to select from the existing custom properties in the room. In a fresh room, this list is empty, but a new property can be added with the “Add Property” button.
Here I’m adding the Health property. It’s synced, and the Home Value is set to 100, meaning that each player’s Health will return to 100 whenever the room is Reset.
And that’s it - now all the players in my room have 100 Health, and each player’s Health value is synced for all others. Health is now available in the dropdown anywhere you want to access a property, and will exist in the room until every chip referencing it is gone.
Preconfigured Get/Set Health chips now exist in the palette alongside the unbound version, and there’s a dedicated Player Property Health Changed event. It doesn’t matter which version you use - it’s all the same, and you can configure any property chip or event to change which property it’s looking at.
Editing an existing custom player property
After you’ve selected a property, you’ll notice that the edit button next to the name field becomes available. This lets you access the settings of the selected property, and will change it for the entire room.
Changing a property’s name or settings will reset it for all current players, and may change any chips that are currently bound to it. If you change the type of the property, this will change the type of a port, and is therefore likely to break existing wires.
Player Properties in Inventions
Player Properties are extremely portable. Including any chip or event that references a Player Property in an Invention will create that Player Property in any room the Invention is spawned into. If that Property already exists, the new one will merge with it.
This means that if you’ve got guns, lava pits, health packs and a game manager that all need to affect players’ “Health,” they should all be able to work together.
Conflicts between Player Properties
If there’s a conflict on Invention import - such as two Health (int) properties that have different Home Values or Synced states - the incoming Player Property will be changed to match the Player Property that’s already present in the room, so that they’re able to merge together.
If two Properties have the same name, but different types, you’ll end up with two properties that look similar until you select them. They won’t work together, but neither of your Inventions will completely break.
What’s next?
Next up for Circuits are Messages. These are similar to events, but more flexible, more powerful, and able to target an object directly. Expect a writeup soon!
Over the next couple months, you’ll start to see a bunch of our Made By Rec Room Inventions and template rooms using Player Properties and Messages in consistent ways. This is part of an effort to make sure Inventions can “just work” wherever you spawn them. We’ll be publishing a list of our internal conventions soon, so you’ll be able to make Inventions that are fully compatible with ours.
Bugs or Feedback?
If you have bugs with custom player properties or feedback on this feature please let us know on this thread!
Cheers
~ The RR Team