Skip to content
Docs

Your first game

Step-by-step tutorial with the editor 0.4.0: a yard with coins, walls, lava and a goal, tested with the bot, exported to .ggx and played to a win in the launcher.

DescribesEditor 0.4.0 For creating without programming

On this page

In this tutorial you make Coin Yard: a yard with five coins, two walls, a pool of lava and a goal. You write no code. At the end you export it to a .ggx file and play it in the launcher.

Everything you see here was really done with the published editor 0.4.0, with mouse and keyboard, in Simple mode, which is the one it opens in the first time. The screenshots are from that session. The finished project is in the documentacion/ejemplos/patio-de-monedas folder of the site's repository.

1. Create the game#

  1. Open the editor. On the Your games screen, press New game.
  2. At the top, under How it is programmed, leave Rules or code, which is how the dialog opens.
  3. Under 1. Kind of game leave Third person and, under Players, Single player.
  4. Under 2. Template pick Blank: "A floor, a start and a goal. To start from scratch."
  5. Under 3. Game name type Coin Yard. The folder where it will be created appears below.
  6. Press Create and open.
Rules or code, third person, single player, Blank template.

The editor opens in Simple mode. On the left is Place pieces; in the center, the scene with the floor, the start (the green figure) and the goal (the arch); on the right, the Rules, Assistant and Details tabs.

The newly created project. The template already comes with two rules.

The template comes with two rules already made. You can read them in the Rules panel:

  • "When the player falls off the world: play the caida sound."
  • "When the player enters anything tagged "meta": end the game (win)."

In other words: the game can already be won by reaching the goal. Now you make it fun.

2. Place five coins#

  1. In Place pieces, group Gameplay, click Coin.
  2. Click the floor where you want the coin. It is placed.
  3. Repeat four more times: click Coin, click the floor. Spread the coins around the yard.
Five coins. Rule 3 appeared by itself.

When you placed the first coin, the editor added a rule and told you at the bottom right: "A rule was added to make it work. See it under Rules." The rule says: "When the player touches anything tagged "moneda": remove the touched piece, add 1 point and play the moneda sound." It applies to all the coins, because they all carry the tag moneda.

3. Build a wall#

  1. Under Basic shapes, click Box and then the floor, to one side of the yard.
  2. Click the box to select it and open the Details tab, on the right.
  3. Under Size (width, height, length) type 10, 2 and 1. Under Position (center), put 1 in Y so that it rests on the floor.
  4. In Place pieces, scroll down to Material and press Wood.
Details of the selected piece: size 10 × 2 × 1 and the Wood material.

To move it with the mouse, pick the Move tool on the viewport toolbar (or press 2) and drag one of the arrows. The red one moves it along X. The piece jumps half a block at a time, because the grid snap is set to 0.5.

Drag an arrow to move the piece along that axis.

In our session, after dragging it, we put it in its exact place by typing the position in Details: X -7, Z -2.5.

4. Duplicate the wall and group the two#

  1. With the wall selected, press Duplicate on the viewport toolbar (or Ctrl+D). The copy is now selected.
  2. Move the copy to the other side of the yard. We typed X 7, Z 3.
  3. Pick the Select tool (1) and, holding Shift, click the first wall. Now both are selected.
  4. Press Group (Ctrl+G).
Two walls selected with Shift + click.

A group moves as a single thing. A double click selects one piece of the group.

5. Add lava#

  1. In Place pieces, group Gameplay, click Danger zone.
  2. Click the floor, right on the straight path between the start and the goal.
The yard, built. The danger zone brought its rule too.

The lava brought its rule: "When the player touches anything tagged "peligro": play the golpe sound and respawn at the last checkpoint." Since the game has no checkpoints, whoever steps on the lava goes back to the start.

6. Set up the match and add a rule of your own#

In the Rules panel, at the top, is the Match section:

  1. Under Clock pick Countdown: you lose at zero.
  2. Under Final score pick The player's points (highest wins).
  3. Check Show points on screen.
  4. Under Opening message type ¡Junta las monedas y llega a la meta! and, in English, Grab the coins and reach the goal!.

Now your own rule. We want to tell the player when they have all five coins:

  1. Press New rule.
  2. Under When pick the player reaches… points and type 5.
  3. Under Then pick show message and type the text in both languages: ¡Tienes todas! Corre a la meta. and You got them all! Run to the goal..
  4. Press + Action, pick play sound and, below it, victoria.
  5. Check Only once per game.
Your own rule, built by picking options.

The editor writes the whole sentence above the rule: "When the player reaches 5 points: show "You got them all! Run to the goal." and play the victoria sound." At the bottom left, the status bar still says No problems. Everything rules offer is in No-code rules.

7. Test with the bot#

Press Test with bot, at the top. A bot plays the whole match with no screen, on each difficulty and with two seeds: six matches. The Test bot panel opens at the bottom with the result.

In our yard, the first test failed:

The test failed: the bot did not reach the goal in any of the six matches.

The reason can be read on each match, in words: "The bot got stuck on step 1 of 1 (go to zone "meta"): it did not reach the destination (17.1 units short horizontally and 1.5 vertically)." Its only step was to go to the goal. The bot knows how to walk around walls and gaps, but it does not know how to dodge hazards. It went straight for the goal, stepped on the lava, went back to the start, and so on until it ran out of time. See where takes the camera to the spot where it ended up:

See where: the bot ended up next to the start, facing the lava.

The game can be won: you only have to walk around the lava. You have to tell the bot by marking where to go. In the Rules panel, Test bot section:

  1. Click a coin that is to one side of the lava.
  2. Press + Go to selection.
  3. Click another coin, on the goal side, and press + Go to selection again.
Two steps marked. They go before the final goal, which is still the goal zone.

Press Test with bot again (or Run again in the panel):

Test passed: six out of six.

Now it says Test passed 6/6. The score is 2 because the bot went through two coins: it does not need to collect them all to check that the game can be finished. Each match also says "bot steps 2/3": how many steps of its script it counted as done, out of the three it had (the two you marked and the goal). After a test, the editor leaves the bot's path drawn over the scene:

The bot's path, with the Show the bot path in the scene box.

How the bot thinks and which steps you can mark for it: Test bot.

8. Fill in the game card#

The game card is what people see when they open your game, before playing.

  1. Arrange the scene camera the way you want the cover to look: right button to turn, wheel to zoom.
  2. Open the Game card tab, above the viewport.
  3. Fill in Name in Spanish (Patio de monedas), the two descriptions and Author.
  4. Under Cover, press Use the current scene view.
The complete card, with the cover taken from the scene.

Every field is explained in Game card, export and share.

9. Play it yourself#

Press Play (F5). The viewport switches to showing the game, with a green strip at the top that says Playing.

The match starts with the card you just filled in.

Pick the difficulty and press Play. You move with W A S D, jump with Space and turn the camera with the mouse.

Playing inside the editor. At the bottom, the Console logs what happens.

To go back to editing, press Stop and back to editing or Esc. More ways to play (from where the camera looks, watching the bot, picking the difficulty): Playing inside the editor.

10. Export the .ggx#

Press Export. The editor does three things, in order: it validates the game, has the bot play it to the end on each difficulty and writes the file.

The exported game: a single .ggx file.

The file is saved in your user's Green Games/exportados folder, with the name coin-yard.ggx. Ours weighs 24.2 KB. If the game has errors or the bot does not finish it, the editor does not export and tells you why.

11. Open it in the launcher#

  1. Open the Green Games launcher and press Import .ggx.
  2. Pick the file coin-yard.ggx.
The tutorial's game, imported into launcher 0.4.0.
  1. Press Play, pick the difficulty and play. To win you have to reach the goal arch; you walk around the lava or jump over it.
Victory in the launcher, with the game made in this tutorial.

That match is real: launcher 0.4.0 opened the exported file, it was played with the keyboard to the goal and the launcher recorded the win in its history. How importing works and where the game ends up: Import a .ggx.

What you learned#

StepWhat you used
Create the gameNew game: how it is programmed, kind, players, template and name
Build the scenePlace pieces, Details, handles, duplicate and group
Give it rulesPrefabs that bring their rule, the Match settings and New rule
Check that it can be wonTest with bot and the steps you mark for it
Share itGame card and Export

Next#