# Logic & Gameplay

#### NEW RESOURCE

<table data-card-size="large" data-view="cards"><thead><tr><th></th><th data-hidden data-card-target data-type="content-ref"></th><th data-hidden data-card-cover data-type="files"></th></tr></thead><tbody><tr><td><img src="/files/mhAZzhUSwxybKsGhre0Y" alt="" data-size="line">  <a href="/pages/jjGVKpQ4d8fBFydV7CYR"><strong>Begin</strong></a> <strong>Game Maker</strong></td><td><a href="/pages/jjGVKpQ4d8fBFydV7CYR">/pages/jjGVKpQ4d8fBFydV7CYR</a></td><td><a href="/files/ioyb35QFV7uxYGEv4TIf">/files/ioyb35QFV7uxYGEv4TIf</a></td></tr><tr><td><p>Learn faster with a <em><strong>NEW</strong></em> 1 hour series</p><ul><li>Self-paced videos</li><li>Hands-on practice</li><li>Detailed documentation</li><li>Forum discussions for support</li><li>Relevant bonus resources</li></ul></td><td><a href="/pages/jjGVKpQ4d8fBFydV7CYR">/pages/jjGVKpQ4d8fBFydV7CYR</a></td><td></td></tr></tbody></table>

***

## Logic Systems & Uses

Logic in our no-code Game Maker is all about creating a system of communication that provides interactive possibilities so players can choose a flow of cause & effect.

Logic can be linear with a single path of events for players or branching with many possibilities. It can range from simple to a complex chain of events depending on the desired gameplay.

### Object Logic

{% tabs %}
{% tab title="About" %}
{% hint style="info" %}
An **object** is a unique *instance* of an **asset** placed in your Experience. Choose an Asset and place as many objects with it as you like, then apply logic to bring it to life and make in interactive.
{% endhint %}

### About Object Logic

<table data-card-size="large" data-view="cards"><thead><tr><th></th></tr></thead><tbody><tr><td><a href="/pages/UfuvOiV2urztB4lTDt2p"><strong>Behaviours</strong></a> govern the core actions of game objects.</td></tr><tr><td><a href="/pages/VonuKRJlsyZELqrtBj8t"><strong>Components</strong></a> add characteristics to deepen an object's interactive potential.</td></tr></tbody></table>

<table data-view="cards"><thead><tr><th></th></tr></thead><tbody><tr><td>Behaviours and components send and receive <a href="/pages/MnW9sT3OR0dxJGkvOPuu"><strong>Messages</strong></a> to trigger logic with other objects, Quests, and Game Rules.</td></tr><tr><td><p><a href="/pages/0IZF49XXihK3Mt7RXl3i"><strong>Tags</strong></a> are identity labels for objects used to:</p><ul><li>control where messages are sent to trigger logic</li><li>specify objects that may be detected</li></ul></td></tr><tr><td><p>An object may have:</p><ul><li>One <strong>Behaviour</strong></li><li>Many <strong>Components</strong></li><li>Multiple <strong>Tags</strong></li></ul></td></tr></tbody></table>

{% hint style="info" %}
**SELF-COMMUNICATION**

Set an object's **Broadcast Type** to *Self* to receive the message it will send.
{% endhint %}
{% endtab %}

{% tab title="Flexible Utility" %}

### Make Any Asset Interactive

Assets have flexible utility depending on the interactive logic set up via Game Maker. These are the objects that populate your Experience.

You can find NFT assets to purchase in the Marketplace, or you can create custom assets with VoxEdit. Both types can be used in your own Experiences.

**Example:**

{% embed url="<https://twitter.com/TomVoxel/status/1585968103619690496?s=20>" %}
[**Video by TomVoxel**](https://twitter.com/TomVoxel/status/1585968103619690496?s=20)
{% endembed %}
{% endtab %}

{% tab title="External Integrations" %}

### Display Videos & 2D Image NFTs

{% hint style="warning" %}
Uploading custom content for use with Video and Audio Streaming behaviours is limited to The Sandbox and select partners. These features are in development for public use.\*
{% endhint %}

[**Frame Assets**](/en/creator/voxedit/docs/modeler/create-frame-assets.md) assets made in VoxEdit can be used for displaying:

* 2D image NFTs (JPEG, PNG, GIF, and WEBP on Ethereum and Polygon blockchains) using the [**NFT Image Display**](/en/creator/game-maker/docs/components/nft/nft-image-display.md) component
* premade images provided by The Sandbox with the [**Image Display**](/en/creator/game-maker/docs/components/nft/image-display.md) component
* videos (using video streaming\*)

### **Open NFT Marketplace Information**

The [**NFT Details Display**](/en/creator/game-maker/docs/components/nft/nft-details-display.md) component can be can be set to open for any NFT made for The Sandbox in VoxEdit or any external NFT displayed in a frame asset. Visitors can be redirected to The Sandbox or OpenSea marketplaces via browser.

**Example projects using NFT information:**

* Build a virtual shop for players to buy your NFTs
* Showcase your NFT collections in a gallery, virtual home setting, etc.

<div><figure><img src="/files/3USuy0Er7hCnjSYIDoG1" alt=""><figcaption><p>Display your external NFTs on a frame asset with details and a Marketplace link.</p></figcaption></figure> <figure><img src="/files/OKKpl0Y6hmL8eNHIKlwZ" alt="" width="563"><figcaption><p>Tip: If you own an Avatar from a participating external collection, host your social hub event with it equipped while it's on display!</p></figcaption></figure></div>
{% endtab %}
{% endtabs %}

### Global Logic

{% tabs %}
{% tab title="About" %}
{% hint style="info" %}
Global logic applies to the whole Experience, and it can communicate with object logic, which is more granular and customized.
{% endhint %}

### About Global Logic

<table data-card-size="large" data-view="cards"><thead><tr><th></th></tr></thead><tbody><tr><td><strong>Quests</strong><br><a href="/pages/J4ByurEhXfskskE6Uosc"><strong>Objectives</strong></a> inform and guide players through your game's flow using an attractive user interface (for single and multiplayer games).</td></tr><tr><td><strong>Player Settings</strong><br><a href="/pages/dwklrmeJJDt7o3yu7RlG"><strong>Spawn Point behaviour</strong> </a>allows you to choose a custom avatar, set starter equipment, and apply some components to players (via <a href="/pages/dwklrmeJJDt7o3yu7RlG#avatars-feature-components"><strong>Avatar's Feature</strong></a>).</td></tr><tr><td><p><strong>Global Settings</strong></p><p>The <a href="/pages/Aqp8LzUVw7V6eG2U7fuS"><strong>Gameplay</strong></a> menu includes settings that may affect all players, such as:</p><ul><li><a href="/pages/0QRji0ImFYbtgTbszoko"><strong>Game Rules</strong></a> - for global, player, and team mechanics</li><li><a href="/pages/Aqp8LzUVw7V6eG2U7fuS#start-screen"><strong>Start Screen</strong></a> - pre-game screen</li><li><a href="/pages/Aqp8LzUVw7V6eG2U7fuS#camera"><strong>Camera</strong></a> - position and angle (throughout gameplay)</li><li><a href="/pages/Aqp8LzUVw7V6eG2U7fuS#ambiance"><strong>Ambiance</strong></a> - music/sound, and global light (<a href="/pages/relVvVlPmEts3TF1UdlJ"><strong>Weather Switcher</strong></a> behavior may be set to override)</li><li><a href="/pages/Aqp8LzUVw7V6eG2U7fuS#parameters"><strong>Parameters</strong></a> - toggle on/off global avatar mechanics (e.g., swimming)</li></ul></td></tr></tbody></table>
{% endtab %}
{% endtabs %}

***

## Cause & Effect

**Messages** are an essential method of communication in Game Maker. There are many simple ways to send a Message using logic and trigger something to happen. Use **Tags** on objects to direct Messages specifically.

{% tabs %}
{% tab title="Broadcast" %}

### Broadcast

Send a message on start of the Experience or when triggered, once or repeatedly.

**Example:**&#x20;

* Add a [**Message Broadcaster**](/en/creator/game-maker/docs/behaviours/basic-logic/message-broadcaster.md) behaviour to a logic actor or object and set desired parameters.&#x20;
  {% endtab %}

{% tab title="Detect" %}

### **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.

**Examples:**

* Add a [**Speaker**](/en/creator/game-maker/docs/components/actions/speaker.md) component or [Trigger Volume](/en/creator/game-maker/docs/components/triggers/trigger-volume.md) 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**](/en/creator/game-maker/docs/behaviours/visual/animated-decoration.md) behaviour.
  {% endtab %}

{% tab title="Destroy" %}

### **Object Destruction**

Send a message or drop (spawn) a new object (e.g. loot, smaller enemies, etc).

**Example (direct):**

* **Send Message** - Add a [**Health** ](/en/creator/game-maker/docs/components/status/health.md)component to the object that will be destroyed. Set a **Message sent on death**. Optionally, you can trigger this with an **Instant death message**.

**Example (indirect):**

* **Drop (spawn) object** - Add a [**Drop**](/en/creator/game-maker/docs/components/actions/drop.md) component to the object that will be destroyed. Choose **Behavior** (default asset settings) or [**Preset** ](/en/creator/game-maker/docs/build-menus/side-bar/presets.md)(custom settings for one or more objects to spawn). Select the asset or preset to spawn.&#x20;
  * Other objects nearby with a [**Speaker**](/en/creator/game-maker/docs/components/actions/speaker.md) component can detect a tag that is included in your spawned object.
  * A spawned object, such as a [**Message Broadcaster**](/en/creator/game-maker/docs/behaviours/basic-logic/message-broadcaster.md), could instantly send a message.
    {% endtab %}

{% tab title="Collect" %}

### **Object Collection**

Can be set as collectible by one player or every player, send a message, and/or play a sound.

**Examples:**

* **Singleplayer** - Add a [**Collectable** ](/en/creator/game-maker/docs/components/actions/collectable.md)component to an object and set a message to send.
* **Multiplayer** - Add a [**Collectable**](/en/creator/game-maker/docs/components/actions/collectable.md) component to an object and set a message to send. Then choose the **Global** setting:
  * True - One instance of the object can be collected in the Experience
  * False - One instance of the object per player can be collected in the Experience
    {% endtab %}

{% tab title="Interact" %}

### **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
* Turn on a machine or platform
* Play video or audio
* Start a timed parkour race or other challenge
* Trigger a blacksmith to "make" and spawn a special item
* Set off a blast with dynamite
* Trigger a seasonal change, restore a wasteland, etc
* Talk to an non-player character (NPC)
* Begin a new quest
* "Use" a magical potion or spell at the right moment in the story
* View NFT information for The Sandbox assets or an external PFP NFT on display (includes a marketplace link)
* Make blocks or assets appear or disappear
* Collect or pick up an item
* Trigger a complex sequence of logic
  {% endtab %}

{% tab title="Quest" %}

### **Quests**

Can send a message when completed.

**Example:**

* Create a [**Quest/Objective**](/en/creator/game-maker/docs/objectives.md). In the **Action After Completion** dropdown, choose **Send Message**. Use the dropdown below this to select an existing message or create a new one.
  {% endtab %}

{% tab title="Rules" %}

### Rules

Can receive a message, carry out actions (which can apply to variables you create), and send a message upon completion. This may trigger objects or other rules.

**Examples:**

* Collecting an object can trigger a variable to increase to count a total number of resources represented by the object. This value can be updated with a [Math Rule](https://docs.sandbox.game/en/creators/game-maker/docs/game-rules/math#math) displayed in the player HUD using the [Game Screen](https://docs.sandbox.game/en/creators/game-maker/docs/game-rules/game-screen) rules.
* A [Key or Mouse Input](https://docs.sandbox.game/en/creators/game-maker/docs/game-rules/triggers) rule can be used to trigger an [Asset Spawner](/en/creator/game-maker/docs/behaviours/modifiers/asset-spawner.md) to spawn objects with [Projectile](/en/creator/game-maker/docs/behaviours/movement/projectile.md) behavior to shoot at targets.
  {% endtab %}
  {% endtabs %}

{% hint style="info" %}
**SWITCH OBJECT PHYSICS DURING PLAY**

Send a message to an object with [**Actor Property Switcher**](/en/creator/game-maker/docs/behaviours/modifiers/actor-property-switcher.md) behaviour to change the visibility and/or collisions of  other objects in range.
{% endhint %}

{% hint style="info" %}
**SEQUENCES & LOOPS**

Use [**Timed Events**](/en/creator/game-maker/docs/behaviours/basic-logic/timed-events.md) behaviour for repeatable sequences, such as weather cycles.
{% endhint %}

{% hint style="info" %}
**COLLABORATION**

Use [**Crowd Event**](/en/creator/game-maker/docs/behaviours/basic-logic/crowd-event.md) behaviour to progress toward a collaborative goal with emotes or messages, finishing with a success or failure message.
{% endhint %}

## Life & Death

<div align="left"><figure><img src="https://lh5.googleusercontent.com/WnlStOqnB0405b502H0TCZUVmaO7PpWgrLMv3UFC6G-6gt6ta_VZVU6PjEhtjG8iwpWiNS6QD_sql2fjnFQgaoedsLc0A_PG1Yf1kUY-BK9Q4rzxS9XYiz9Jk08YC6-w3ccwfUNkezafD8jKvG0YCF4bwg=s2048" alt="" width="188"><figcaption><p>Default player health</p></figcaption></figure></div>

{% hint style="info" %}
Multiplayer PVP combat is in development, but PVE is possible now!

Equipment can be worn in multiplayer Experiences, and affects the health of the player wearing it if you leave the default avatar setting (players use their own avatar from their profile settings). Setting a custom avatar that players are forced to use in your game disables stat boosts from equipment, even if the equipment can still be worn for aesthetic.

PowerUps can also affect health. The special messages they send can be found in the message dropdown list of any logic (colored blue). You can send these messages from any logic (not just from PowerUps).
{% endhint %}

{% tabs %}
{% tab title="Equipment Effects" %}

### Equipment Attributes Impact Gameplay

The [**Rarity & Attributes**](/en/creator/basics/assets.md#rarity-and-attributes) of an Asset determines how it may impact gameplay.

<table data-card-size="large" data-view="cards"><thead><tr><th></th></tr></thead><tbody><tr><td><img src="https://lh6.googleusercontent.com/q010Z05k2d6H4068fPhGh91Kdpn0B49nk759Xcw3FAYVjFbHSrcnVpgdPojgSz5zLG55bxZB7QUKXhEZYpfkKzy2mnJIcME60RzK1GNrIXoRr38Mt-K2fj6koSZ22ExOTChPk2iFZDf7C2wWEZk5KhmpvQ=s2048" alt="" data-size="line"> Equipment with a Defense Attribute increases the player's maximum health.</td></tr><tr><td><img src="https://lh3.googleusercontent.com/Z7S4dXSNp0p8xH9Jr75S_hkzn_A1Vw5xviR6pGvYoKY3crYKoTw65sUV3MY6Zi42WjXBkQ23BmKQ35egBnkE6aLTQ5G7124sSQ0dkrobzaL-Tn1msr8E3ACDncYvAv0ohMVhAHB6Sfl8ivu85WN3jBL8VA=s2048" alt="" data-size="line"> Equipment with a Power Attribute damages enemies more during attacks.</td></tr><tr><td><img src="/files/v5TDYORiACfHkG5fJu75" alt="" data-size="line"> Equipment with a Speed Attribute increases the players movement speed.</td></tr></tbody></table>

{% hint style="info" %}
In [**Spawn Point**](/en/creator/game-maker/docs/behaviours/basic-logic/spawn-point-and-avatars-feature.md) behavior (applied to the Avatar's Portal asset):

* Set starter equipment (unique to spawn point)
* Choose to allow players to use their own NFT equipment in your Experience&#x20;
  {% endhint %}
  {% endtab %}

{% tab title="Damage & Recovery" %}

### **Damage & Recovery**

Impact health of any actor (avatar, NPCs, etc) by specific amounts:

* Blocks set to damage or heal the player via Health component added as the Avatar's Feature in [**Spawn Point**](/en/creator/game-maker/docs/behaviours/basic-logic/spawn-point-and-avatars-feature.md) behavior
* Blocks damage or heal any object via their [**Health**](/en/creator/game-maker/docs/components/status/health.md) component
* Objects with [**Healer**](/en/creator/game-maker/docs/behaviours/npc-ai-pawns/healer.md) behaviour, with specific targets by tag
* [**Health message**](/en/creator/game-maker/docs/components/status/power-up.md) with positive or negative values in the argument sent to the Avatar or other objects from any behaviour or component
  {% endtab %}

{% tab title="Death" %}

### **Avatar Death**

If players aren’t set as invincible, they’ll die when life total is 0, then:

* Respawn to checkpoint with full health, while quests & inventory remain active... unless you build more sophisticated [**Consequences for Death**](/en/creator/game-maker/creative-guides/experience-design-techniques/game-design/risk-and-reward.md#consequences-for-player-death) into your Experience logic
* Game over if Defeat condition is triggered, and if restarted, quests & inventory are cleared of items and the Experience is reset

Customise what happens when the player dies in the Health component added as the Avatar's Feature in [**Spawn Point**](/en/creator/game-maker/docs/behaviours/basic-logic/spawn-point-and-avatars-feature.md) behavior (Death Event settings).

Any object with a [**Health** ](/en/creator/game-maker/docs/components/status/health.md)component can be destroyed if the **Immune to Attacks** parameter is set to false. It can send a Message upon death to trigger other logic in your Experience. You can also add a [**Drop**](/en/creator/game-maker/docs/components/actions/drop.md) component to spawn something when it is destroyed, such as collectible loot!
{% endtab %}
{% endtabs %}

## Transitions: Messages with Arguments

{% hint style="info" %}
You can now create custom messages with arguments.
{% endhint %}

Sending [**Messages with Arguments**](/en/creator/game-maker/docs/using-assets-and-objects/messages.md#messages-with-arguments-1) allow you to transition audio, light, camera, weather, and video\* instead of making an immediate change with a normal message. A parameter to customise the transition will appear when you choose a message with <mark style="color:yellow;">yellow text</mark>.&#x20;

Apply this to add polish to your Experience's [**ambience and effects**](/en/creator/basics/look-feel.md#ambience-and-effects).

## Quests

[**Quests/Objectives** ](/en/creator/game-maker/docs/objectives.md)are one-time-use player objectives that are used to guide players through gameplay, which may include choices that influence game outcomes. There are four main types of quests, but a lot of flexibility for how you may use them.

Add an [**Indicator**](/en/creator/game-maker/docs/components/display/indicator.md) component to objects to direct players with quest icons, which appear depending on the state of the quest and the assignments you make: quest giver, objective, or receiver.

### Quests are Client-Only

With Game Maker 0.10, quests could only track **individual player progression** in singleplayer and multiplayer Experiences. Game Maker 0.11 makes quests compatible with multiplayer \[MP] logic. This means the player source can be included with messages to trigger all new logic possibilities!

[Crowd Event](/en/creator/game-maker/docs/behaviours/basic-logic/crowd-event.md) behaviour can also be used for collective goals. It can be triggered by emotes or messages.

***

## Basics to Create an Experience

There's a lot of depth to creating an Experience that uses logic for interactive play. Below are some general tips for elements that most games may include, with links to documentation for more info.

**Quick Start**

See the Templates tab in Game Maker for content you can download. This includes logic, gameplay, and landscape templates.

**Add Depth**

* Set up [**quests**](/en/creator/game-maker/creative-guides/logic-guide/text-quests-and-icons.md), and direct players to quest items with the [**Indicator** ](/en/creator/game-maker/docs/components/display/indicator.md)component
* Customise the player [**camera settings**](/en/creator/game-maker/docs/build-menus/top-bar/gameplay.md#camera) and modify appearance with [**Post Processing Effects**](/en/creator/game-maker/docs/behaviours/visual/post-process-effects.md) behaviour
* Transition or switch ambient lighting with [**Weather Switcher**](/en/creator/game-maker/docs/behaviours/visual/weather-switcher.md) behaviour
* Use [**Avatar Teleport**](/en/creator/game-maker/docs/components/actions/avatar-teleport.md) and [**Avatar Checkpoint**](/en/creator/game-maker/docs/components/status/avatar-checkpoint.md) components to manage avatar location
* Apply [**visual effects**](/en/creator/game-maker/docs/components/display/visual-fx.md) to objects for player feedback
* Set up teams with [**Spawn Point** ](/en/creator/game-maker/docs/behaviours/basic-logic/spawn-point-and-avatars-feature.md)behavior
* It's recommended to create a 1x1 sized game in singleplayer mode for your first game

**Set Up Global Mechanics**

* Create variables and set up global mechanics using [**Game Rules**](/en/creator/game-maker/docs/game-rules.md)

**Share Your Creation**

* [**Share**](/en/creator/game-maker/docs/manage-experiences.md#manage-experiences) your Experience to the Gallery or [**publish**](/en/creator/game-maker/publish-experiences.md) if you own virtual LAND


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sandbox.game/en/creator/basics/logic-and-gameplay.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
