Live Edit

Introduction

The Live Edit feature in FlatRedBall enables making a change to your game when in edit mode and applying those changes without restarting your application. It enables a variety of types of editing, and this list is continually growing.

Enabling Live Edit

To enable Live Edit in your game:

  1. Click the Editor Settings button. This brings up the Editor Settings tab

  2. Check the option to Enable Live Edit

Once this option is checked, FlatRedBall generates the necessary code to enable Live Edit in your game. This includes a connection between the FlatRedBall Editor and your game, using the port specified in the Port Number text box. Usually you do not need to change this port, but it can be changed if it conflicts with other applications. Once Live Edit is enabled, you can run your game and enable live edit in a number of ways.

  • Run in Edit Mode - You can directly launch your game by clicking the Run in Edit Mode button

  • Alternatively, you can launch your game in the FRB Editor...

    ... and then switch to edit mode

  • Run your game in Visual Studio. FRB automatically detects when the game is running and displays the edit mode button. You can run your game in edit mode even if you didn't launch it through FRB

As shown above, you can tell that your game is in edit mode if it displays a grid. You can switch between Edit and Play mode anytime by toggling the play and edit buttons.

Selecting and Previewing

If in edit mode, the selected level displays in the game. You can change selections and the game will switch what is displayed in realtime.

  • Select a Screen (or Level)

  • Select an entity to view it in game. The game creates a preview screen allowing you to view and edit the entity by itself.

  • Select an object in a Screen or Entity to highlight it

  • Select a state to preview it

  • States can also be previewed by selecting a state in the StateData editor grid to preview it as well

  • Select an object in a screen by clicking on it in game and it will select in the tree view

  • Double-click to punch through and select overlapping objects

Camera Controls

The Camera in Edit mode can be controlled using the following methods:

  • Hold the middle mouse button to pan

  • Hold the CTRL key and press the arrow keys. Holding the arrow keys will continue to pan.

  • Push+hold the left mouse button and move to the edge of the screen

  • Scroll the mouse wheel to zoom in and out

  • Hold the CTRL key and press + or - to zoom in and out

Moving and Changing Object Variables

Changes in FlatRedBall immediately apply if the game is in edit mode. The following edits are supported in Live Edit:

  • Change a value (such as X or Y) in the Variables tab to see the change in your game

  • Push+drag to move objects in the game - the variables will update automatically in Glue to match the new position

  • Drag objects to the edge of the screen to pan the camera if they need to be placed off screen

  • Multiple objects can be selected and moved at once by holding down the CTRL key and clicking each object

  • Pushing the left mouse button in a blank space and dragging results in a rectangle which can be used to select multiple objects

  • Math operations can be used to change numerical values

  • Along with primitive types (such as numerical values), states can also be set on instances

Creating New Objects

Creating a new object in FlatRedBall automatically updates the game with the new object. New objects can be added to levels or entities.

  • New level objects can be added through the Add Object Quick Action

  • Glue also supports Drag+drop to add objects to a level

  • New objects can also be added by selecting their list and using the Quick Action button

  • New objects can be created by using the CTRL+C, CTR+V shortcut in game. This is especially useful when placing multiple objects in game. When pasting a grabbed object, the new object will be placed at the location of the crusor.

  • Objects added to Entities will automatically appear on instances of that entity

Working with Files

FlatRedBall supports adding files at runtime and automatically updating to changes.

  • New files can be added from the file system to Screens or Entities. If these files are then referenced by an object (such as a Sprite), they will be displayed in game.

  • External changes to files are automatically reloaded

  • Changes to TMX files which can create entities and collision will automatically update these objects so they can be tested immediately. For example, painting collision tiles immediately allows testing the new level without restarting.

Last updated