Custom Object Properties

Introducing a new way to manage objects in-game - Custom Object Properties! These will let you manage things like a barrel’s hit points, a gun’s ammo count, or a pickup’s respawn timer. Examples below of how to use this new feature in your Rooms.

What are object properties?

All objects have many properties, and if you use Circuits, you’re already familiar with them. We’ve put some of those properties into the config menu for you to change and made chips that can Get and Set them.

For example, if you want to know a light’s intensity, you can check the config, or ask it directly with a Light Get Intensity chip:

The Intensity config value and the Light Get Intensity chip access the same property

Think of these as variables that are part of an object - since somewhere, deep in code, that’s what they are! These built-in properties work “behind the scenes” to affect an object’s behavior, meaning if you change the value, something changes about the object (like our light getting brighter, or changing colors).

Okay, so what are CUSTOM object properties?

Custom object properties let you add your own “built-in variables” to any object. You can then set up Circuit logic to do something whenever a property’s value changes. For example, you could give your light a “Battery” property that drains whenever it’s on.

Objects can have multiple properties, and more importantly, multiple objects can have the same property. This makes it easier to set up game systems that can act on any object they come into contact with - without knowing what that object is going to be in advance.

For example, let’s make an exploding barrel, then use a Replicator to make a bunch of them to shoot paintballs at.

This is in Rooms 2!

The exploding barrel’s config menu has a new foldout for “Object Properties.” (At the moment, this only works on objects that have object boards, so you may have to add one).

Using the “Add Property” button, you can create a new Property named Health.

When this property is added to my barrel, a few things happen:

  • A new config menu field appears on the barrel, allowing you to set the starting value for its Health with the Maker Pen.
    • If you need to edit this property later, this is also where you do that.
  • Three new chips appear in the palette: Get, Set, and Has Health.
    • These are stored in Circuits/Objects/Properties.
  • A Health Changed event appears in the barrel’s scope, which passes the new value whenever this barrel’s Health changes.
  • An Object Property Health Changed event appears at room scope. It fires whenever the Health property changes on ANY object and returns the specific object in question and the property’s new value.

Using those new chips and events, you can set up some logic so that the barrel blows up when its Health hits zero. In the image below the explosion emitter fires, then calls Replicator Return to despawn the object.

Inside the barrel’s object board

Then set up a paintball gun to check for, then reduce, Health on any object it hits.

Inside the paint rifle’s object board

Now you can replicate barrels and shoot them ‘til they explode.

unnamed (1) (1)

Getting fancier: building extensible gameplay elements

The real advantage of Custom Object Properties is being able to act on an arbitrary object, without knowing anything about that object in advance. Now I don’t have to have special logic to account for every potential interaction, I can just get a random object reference and ask it: “Hey you, do you have Health? Cool, then I have an instruction for you,” and the object can take over from there.

Let’s add a few more moving parts to see that in action. First, move all of the damage logic into a Function called “Decrement Health by Value”:

Inside the Function Definition for Decrement Health by Value

…and use the new ‘Decrement Health by Value” chip to simplify the gun’s internal logic:

Back inside the rifle’s object board

Then add damage to the explosions themselves, with a random fuse timer, so an exploding barrel can make other barrels explode. (This uses a property for explosion damage like we did for Health.)

Back inside the barrel’s object board

Now we have a fun chain reaction =]

image 1 (5)

From there, you can make a bunch of objects with different amounts of Health. The gun can affect them all, and their explosions can affect each other:

image 2 (2)651x369
These objects have 20, 100, and 500 health respectively

I’ll also make some environmental traps, like this perfectly square lava pit. It drains 50 Health per second from anything that has Health.

image 3 (1)654x348
The lava pit reduces health by 50 per second

And since we made that function earlier, adding each new element takes very little new logic.

Inside the lava pit’s object board

To adjust the balance from here, you only need to configure the objects and change the values of the relevant properties. You don’t have to mess with their internal logic at all, or even understand how they work.

If you’re a Circuiteer making props for your teammates to use, building in this way lets you hand them tidy, sophisticated objects that they can easily tune and tweak, with all of the circuits safely hidden away.

Questions:

Can I put Custom Properties on any object?

Not quite - you can put Custom Properties on any object with an object board. This means you won’t be able to put them in shape containers in Rooms 1 at this time.

Does this also work in Rooms 1?

Yes, you can add Custom Object Properties in Rooms 1, as long as the room is in Beta and the object has a board. We think they’re much more useful in Rooms 2 due to the nature of compound objects (and the limitation above!) but they are not restricted to R2 only.

Can I put Custom Properties on players?

Not yet! But that’s something we’re hoping to add eventually.

Thank you for reading! We’d love to hear your feedback about custom properties in the comments!

2 Likes

Will we be able to put them on regular objects in Rooms1.0 eventually? I know very little about programming but i can’t see why not.

On regular objects in Rooms V1? I wouldnt be too hopeful of that

Currently, circuitboards are required because its the only way recroom can differentiate objects, something I know Rooms V2 is fixing, but I’m not sure if their fix would work in Rooms V1

I sure hope they add this