What do you mean by gameplay?
The concept of the Editor is simple in that it needs to give you access to entities and logic to create compelling gameplay. Within this section we will be looking at how we can use data to execute logic and be able to store variables that track the changes and state of your game. Deep down this is a core requirement to actually create any gameplay if you want to enter the mass market. The concepts taught in this Quick Start should be expanded on.
To begin, one of the main ways that we store variables on the designer end of the Editor is through a system called Game Tokens and these will be the basis of this exercise. The writing will be housed inside of Flow Graph as well as we will be saving to disk through an .xml file to show the flexibility of the system.
These types of elements will be covered in this Quick Start which allows for you to start piecing Entities together to create compelling gameplay mechanics.
Setting Up Our DisplayMessage Node and Input
You need to follow these below mentioned steps to begin printing information to the viewport and input to control an entity:
- To determine where the player spawns, add a Spawnpoint Entity and add a Flow Graph named gameplayQuickstart.
- Connect Game:Start's Output to the Spawn input of the SpawnPoint entity.
- Add both a Primitive Box Brush and a Proximity Trigger to the scene. The box will be used as a platform or destination to walk to for reference after spawn.
Select the Proximity trigger, go to your graph, right click in an empty space and choose Add Selected Entity. Connect the Output of the Game:Start node to the Enable input of the ProximityTrigger node.
- Now that we have standardized where the player will begin we can add a Debug DisplayMessage node to trigger a message of "Success" when the Enter output port fires from the Proximity Trigger.
- When you jump into the game (Ctrl+G) you should notice that you not only start exactly where the origin of the SpawnPoint sits, but also you should see a message in the top left printing out "Success" in white.
- To take this one step more we will connect a Light Entity to an InputKey to enable the light in your scene when connected to a player device (keyboard, controller, VR). Go to Create Object -> Legacy Entities -> Lights -> Light and drag it into the scene.
- To be able to see the light better, change the Diffuse Color to a Green and then increase the Diffuse Multiplier to 150
- Add it to the graph and then add the Debug:InputKey we mentioned earlier.
- Once both are positioned in the graph we can assign the P Key too the input node and then add a Logic:Sequentializer node in the middle of them.
- Finally we will connect the Pressed output node to the In input port of the Sequentializer and then feed the first two Output ports into the Disable and Enable slots of the light.
- Jumping into the game (Ctrl+G) and toggling the P key should show you the light turning Off and On.