> For the complete documentation index, see [llms.txt](https://rocket-networking.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://rocket-networking.gitbook.io/docs/basics-of-rocket-networking/room-based-multiplayer-auto-state-sharing/smart-entities.md).

# Smart Entities

Smart Entities are an upgraded form of Entities where the shared properties are taken to another level. You don't have to even make a struct. All you have to do is make an instance of oMySmartEntity and add variables to it! And it will be created for everyone else with the same variables shared.

{% hint style="success" %}
Please note that built in variables like x, y, image\_angle are not directly shared but if you put 3 underscores before them and make a new variable they get shared.\
For example create a variable called \_\_\_x and always set it to x on your end. On everyone else's screen this means that the x position will keep getting updated automatically.
{% endhint %}

{% hint style="warning" %}
Please only share strings, numbers, structs and arrays. Other Data structures cannot be shared directly. If you have a ds\_map, you can somehow convert it to a struct and then share that variable.\
\
Nested data can also get complicated so please use this carefully! Make more smart entities if necessary but avoid nesting.
{% endhint %}

This can be used to represent things that the player owns, like a gun, or bullets fired by the player.

\
Similar to our previous \
oMyEntity and oOtherPlayerEntity\
we have\
oMySmartEntity and oOtherPlayerSmartEntity

This means that clients can have Smart Entities that belong to them. Like my client can have aSmart Entity representing a 'Gun'.

```gml
// oMySmartEntity Step Event

___sprite_index = sAssaultRifle
___image_angle = image_angle

ammo_left = 12

```

It will automatically appear on other people's screens as an instance of oOtherPlayerSmartEntity, and the sprite index and image angle will be updated. Also the variable ammo\_left will be created and updated.
