Rocket Networking Docs🚀
  • About this Documentation
  • Basics of Rocket Networking
    • Room based multiplayer (Auto State Sharing)
      • Clients and clientId
      • Entities
      • Smart Entities
    • Single Message Sharing
    • Persistent Objects on the Server
    • Easy Matchmaking
    • Discord Server Integration
    • Database for your Account
    • Server Side Scripting
    • Global Multiplayer(Cross play)
  • Rocket Networking Code
    • Connecting and Disconnecting
      • ConnectToServer()
      • callback_ConnectToServer()
      • DisconnectFromServer()
      • callback_DisconnectFromServer()
    • Rooms
      • ChangeRoom( new_room_name )
      • callback_ChangeRoom()
      • LeaveRoom()
      • callback_LeaveRoom()
      • ShowAllClientsInRoom(room_name ) and callback_ShowAllClientsInRoom()
      • ShowAllRooms() and callback_ShowAllRooms()
    • Private Messaging
      • SendEventToClient
      • callback_ReceivedEvent
      • SendMessageToClient
      • callback_ReceivedMessage
    • Persistent Objects
      • CreatePersistentObject(roomId , persistentObjectStruct)
      • callback_CreatedPersistentObject()
      • EditPersistentObject(persistentObjectId , new_persistentObjectStruct)
      • DestroyPersistentObject(persistentObjectId)
      • ShowPersistentObjectsInRoom(room_name)
      • callback_ShowAllPersistentObjectsInRoom(array_of_persistent_objects)
    • Database Functions
      • SetSimpleData()
      • callback_SetSimpleData()
      • ReadSimpleData()
      • callback_ReadSimpleData()
      • AddToSimpleData()
      • callback_AddToSimpleData()
      • DeleteSimpleData()
    • Discord Integration
      • SendDiscordMessage()
      • callback_DiscordMessageReceived()
    • AI Functions
      • CallSimpleAI
      • callback_CallSimpleAI
      • CallGeneralAI
      • callback_CallGeneralAI
  • KickPlayer(client_id)
  • ViewServerActivity()
    • callback_ViewServerActivity()
  • oBrain - ping and pseudoHost
  • Admin Callbacks
  • API
    • Database
    • AI
  • Server Side Scripting
    • Basics
    • Understand the heirarchy on the server
    • Create a Persistent Object from Server
    • Important Scripts
      • "step" Script format
      • "client_sent_event" Script format
      • "game_server_created" Script format
    • Send Event to a Client from Server
    • Database Functions on Server
    • AI Functions on the Server
Powered by GitBook
On this page
  1. Basics of Rocket Networking
  2. Room based multiplayer (Auto State Sharing)

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.

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.

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.

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'.

// 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.

PreviousEntitiesNextSingle Message Sharing

Last updated 1 year ago