Use this one page guide to learn about Game Maker's logic systems and how they work together for single or multiplayer gameplay. Follow links as needed for more details in our documentation.
A split between [SP] and [MP] logic was introduced with Game Maker 0.8.
This made it possible for players to experience some logic independently and other logic simultaneously with all other players. Synchronised logic includes position and state of objects, environment, global mechanics, etc.
An object may have one of the following logic setups:
In Multiplayer Experiences, there are communication and bandwidth limitations to consider when designing gameplay.
Selecting [SP] or [MP]
Select an object and click on the behaviour or component field in the Properties panel.
When the pop-up window opens, use the dropdown at the top right to select a logic Type: All,[SP] Client Only, or [MP] Synchronised.
Click on the desired logic for your needs, and it will be added to the selected object.
There is no visual indicator in the viewport that an object has [SP] or [MP] logic. Select an object to view its properties.
Game Maker will automatically grey out options you cannot apply.
For example, [MP] and [SP] variants of behaviours and components cannot exist on the same object since they communicate on different layers.
Remove all logic to switch an object to the other type.
Triggering Logic Across Systems
Logic can be a simple or complex chains of events, and it can be linear or branching with options.
There are many simple ways to send a message and trigger something to happen. Messages can also be directed more specifically using filters and tags.
Broadcast
Send a message on start of the Experience or when triggered, once or repeatedly.
Example:
Add a Message Broadcaster behaviour to a logic actor or object and set desired parameters.
Use a message broadcaster as a middle step if two logic elements will not send or receive messages as quickly, consistently, or specifically as you want.
Object/Player Avatar Detection
An object can send a message when an expected tag is detected. It can also be set to play one of its animations. Detection is triggered when:
player avatars are in range
specific tags are in range
specific objects are in range
Examples:
Add a Speaker component and choose what to detect and detection range (avatars, tags, or a specific actor).
To trigger an asset's animation and send a message when an avatar is detected or a message is received, use Animated Decoration behaviour.
The Trigger Volume component can also detect and trigger a message when any tag enters or exits its volume.
Object Destruction
Send a message or drop (spawn) a new object (e.g. loot, smaller enemies, etc) when an object is destroyed from an attack or an instant kill message.
Example (direct):
Send Message - Add a Health component to the object that will be destroyed. Set a Message sent on death. You can trigger this with an Instant death message.
Example (indirect):
Drop (spawn) object - Add a Drop component to the object that will be destroyed. Choose Behavior (default asset settings) or Preset (custom settings for one or more objects to spawn). Select the asset or preset to spawn.
Other objects nearby with a Speaker component can detect a tag that is included in your spawned object.
A spawned object, such as a Message Broadcaster, could instantly send a message.
Object Collection
Can be set as collectible by one player or every player, send a message, and/or play a sound.
Example:
Add a Collectable component to an object and set a message to send.
Object Interaction (E)
Press E to send the “Interact” Message. This can trigger a wide variety of events depending on logic setup.
Examples:
Open a door to access a new area
Toggle on/off logic
Talk to NPCs for a quest
Collect or pick up an item
View NFT info (The Sandbox & external NFTs)
More complex logic sequences
Objectives/Quests
Send a message after receiving confirmation that a quest condition is met and/or after the quest is complete.
Example:
Create an Objective/Quest. In the Action After Completion dropdown, choose Send Message. Use the dropdown below this to select an existing message or create a new one. Any object in your Experience will be able to receive this message.
Game Rules
Most rules can optionally send a message when their logical flow is complete. Some may also be stopped or paused with a message.
Example:
Add a rule to the gridboard, set the Message In, apply any custom settings you like, and set the Message Out. Trigger the Message In and the Message Out will quickly be sent.
Creating Experiences
One Layer of Logic
FULL DESIGN FLEXIBILITY
[SP] means Client Only, and [MP] means Synchronised to all players. Both can be used in single and multiplayer Experiences.
Why use [MP] objects in a singleplayer game?
Some logic would cause conflicts between what is visible and what has collisions in a multiplayer Experience, so in some cases there is only a [MP] version available. [MP] logic works like [SP]logic in a singleplayer Experience.
Performance
[MP] logic DOES NOT reduce gameplay performance in singleplayer games compared to multiplayer games.
Variables (Game Rules)
Local (L) and global (G) variables were introduced with the new Game Rules system with Game Maker 0.9, allowing you to track numbers, time, text, etc. for all players or each individual player. Both (G) and (L) variables work in singleplayer, but global may perform slightly better.
Global and local variables are unrelated to [SP] and [MP] differences. They can be used in a rule triggered by both types of logic.
Logic:
The player picks up the key and takes it to the door.
When the door detects the key nearby, it opens.
Logic:
Interact with Seb to trigger the quest and turn on quest markers.
Collect enough coin objects (money variable in the Shop Ruleset) to buy a drink.
Interact with themachine to get a drink.
Return to Seb to give him the drink, which triggers the quest as complete.
There are two layers of logic that do not communicate with each other, but must be designed to feel seamlessly integrated for players.
Toggle the Multiplayer Simulator at the top right in the Editor to test how the Experience will behave if published as singleplayer or multiplayer.
Two Layers of Logic
DESIGN RESTRICTIONS APPLY
[SP] is Client Only for individual players and [MP] is Synchronised for all players. Both can be used in single and multiplayer Experiences.
Use Objectives for individual player goals. Use Crowd Events for collective goals.
Behaviours and components without [SP] or [MP] in the name are not compatible with multiplayer Experiences yet. They will be ported in the future.
Why use [SP] logic in a multiplayer game?
[SP] logic is necessary in the game world to trigger quests, which track each player's individual progression in your game. Some logic may also only be available as [SP].
Performance
[MP] logic should be used minimally in multiplayer games to add more gameplay potential without reducing the fun. Start by using as much [SP]logic as possible and then add the [MP] layer. You can build the same player experience that performs more efficiently!
Consistency
1️⃣ Consistent Type
An object with [MP] logic may only have other [MP]logic added.
An object with [SP] logic may only have other [SP] logic added.
2️⃣ Consistent Messages
An object with [MP] logic may only send messages to objects with [MP]logic.
An object with [SP] logic may only send messages to objects with [SP] logic.
3️⃣ Consistent Hierarchy
An object with [MP] logic may only be a parent or child of an object with [MP]logic.
An object with [SP] logic may only be a parent or child of an object with [SP] logic.
4️⃣ Consistent Spawn
An object with [MP] logic may only spawn an object or preset with [MP]logic.
An object with [SP] logic may only spawn an object or preset with [SP] logic.
Variables (Game Rules)
Use Global (G) variables to track time, numbers, etc for all players.
Example: all players share the same timer value
Use Local (L) variables to track time, numbers, etc for each player.
Example: each player has a different timer value
To change a local variable (L), the message that triggers the Rule must be sent by a direct player interaction. It may be sent directly or the start of a chain of logic. This ensures the player source is sent to the rule to identify the correct player’s local variable to modify.
Global and local variables are unrelated to [SP] and [MP] differences. They can be used in a rule triggered by both types of logic.
See Multiplayer Logicbelow for more details on additional design considerations.
Logic:
One player picks up the key and takes it to the door.
When the door detects the key nearby, it open for all players.
Logic:
Each player interacts with Seb to trigger dialogue, quest, and quest markers.
Each player collects enough coin objects (money variable in the Shop Ruleset) to buy a drink (all coins must be [MP] and collectable by each player).
Each player interacts with the machine to get a drink.
Each player returns to interact with Seb to "give him the drink." A message is sent to Objectives to complete the quest.
Using a Local Variable (L)
The Shop Ruleset gives coins to only the players who trigger the rule to earn coins. It tracks this value as it changes (earning or spending) for every player individually.
Using a Global Variable (G)
The Shop Ruleset gives coins to all players even if only one player triggers earning them. It tracks this value as it changes (earning or spending).
Only [SP] logic
"Client Only" - for each player to experience at different times
Example:
A player explores gameplay at their own pace and reads Quest dialogue when ready
Only[MP] logic
"Networked" - for all players to experience at the same time
Example:
A door opening or a platform moving is synchronised for all players