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#
- Open the editor. On the Your games screen, press New game.
- At the top, under How it is programmed, leave Rules or code, which is how the dialog opens.
- Under 1. Kind of game leave Third person and, under Players, Single player.
- Under 2. Template pick Blank: "A floor, a start and a goal. To start from scratch."
- Under 3. Game name type
Coin Yard. The folder where it will be created appears below. - Press Create and open.
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 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#
- In Place pieces, group Gameplay, click Coin.
- Click the floor where you want the coin. It is placed.
- Repeat four more times: click Coin, click the floor. Spread the coins around the yard.
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#
- Under Basic shapes, click Box and then the floor, to one side of the yard.
- Click the box to select it and open the Details tab, on the right.
- Under Size (width, height, length) type
10,2and1. Under Position (center), put1in Y so that it rests on the floor. - In Place pieces, scroll down to Material and press Wood.
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.
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#
- With the wall selected, press Duplicate on the viewport toolbar (or Ctrl+D). The copy is now selected.
- Move the copy to the other side of the yard. We typed X
7, Z3. - Pick the Select tool (1) and, holding Shift, click the first wall. Now both are selected.
- Press Group (Ctrl+G).
A group moves as a single thing. A double click selects one piece of the group.
5. Add lava#
- In Place pieces, group Gameplay, click Danger zone.
- Click the floor, right on the straight path between the start and the goal.
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:
- Under Clock pick Countdown: you lose at zero.
- Under Final score pick The player's points (highest wins).
- Check Show points on screen.
- 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:
- Press New rule.
- Under When pick the player reaches… points and type
5. - Under Then pick show message and type the text in both languages:
¡Tienes todas! Corre a la meta.andYou got them all! Run to the goal.. - Press + Action, pick play sound and, below it, victoria.
- Check Only once per game.
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 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:
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:
- Click a coin that is to one side of the lava.
- Press + Go to selection.
- Click another coin, on the goal side, and press + Go to selection again.
Press Test with bot again (or Run again in the panel):
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:
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.
- Arrange the scene camera the way you want the cover to look: right button to turn, wheel to zoom.
- Open the Game card tab, above the viewport.
- Fill in Name in Spanish (
Patio de monedas), the two descriptions and Author. - Under Cover, press Use the current scene view.
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.
Pick the difficulty and press Play. You move with W A S D, jump with Space and turn the camera with the mouse.
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 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#
- Open the Green Games launcher and press Import .ggx.
- Pick the file
coin-yard.ggx.
- 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.
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#
| Step | What you used |
|---|---|
| Create the game | New game: how it is programmed, kind, players, template and name |
| Build the scene | Place pieces, Details, handles, duplicate and group |
| Give it rules | Prefabs that bring their rule, the Match settings and New rule |
| Check that it can be won | Test with bot and the steps you mark for it |
| Share it | Game card and Export |
Next#
- Kinds of game: first person, 2D platformer, top-down, isometric, hybrid and open world.
- Blocks mode: another way of giving a game its logic, by snapping blocks together.
- Your second game: an isometric room: another tutorial, on an example that already comes with code.
- AI assistant: ask for changes by typing.