Follow our step-by-step guides below to jump into your game design process
or scroll down to dive right into digital game coding steps!
BRAINSTORM
PLAYTEST
GAME NITE
Let's explore a digital game mechanic...
LUCK
01 Build a Random Number Generator in GDevelop
Just like in desktop games, luck can be a powerful mechanic in all types of digital games. Use this to make things happen randomly, like rolling a die. Check out steps below to create a random number generator (RNG) with us below.
WHAT WE ARE BUILDING
A functioning RNG that can simplify parsing random numbers vs just using a generic rand function. A class that handles all your random number queries with simple commands vs manually asking for them each time.
Use this to generate a loot table system to create random drops based on %s
Not sure where to start?
Grab our sample code for steps below at GitHub!
- Open GDevelop and click on "Create a New Project"
- Choose "Empty Project" to start from scratch
- PRO TIP - keep seperate tabs open to jump back and forth between steps and GDevelop
- Click on the "Objects" tab on the right and then click "+ Add a new object"
- Choose "Text" from the list of object types
- Name your text object, such as RandomNumberText, and adjust the text size and font as necessary
- Drag and drop the text object onto your scene to place it
- Click on the "Objects" tab on the right and then click "+ Add a new object"
- Choose "Text" from the list of object types
- Name your instructions text object, such as "InstructionText", and adjust the text size and font as necessary
- Set the initial value to "Press Spacebar to roll D6"
- Drag and drop the text object onto your scene to place it
- Switch to the Events tab at the top of the screen to begin adding logic to your game
- Click on "Add a new event" and select the event to trigger the random number generation. Let's use a "Key Press" event to trigger the action.
- In the Conditions section, click on "Add a condition"
- Search for Key Pressed and select it
- Set the key to "Space"
- In the Actions section of the same event, click on "Add an Action."
- Select "RandomNumberText" from the Objects tab
- Select "Text" in the actions menu
- In the text field, write the expression: ToString(RandomInRange(1, 6))
- When the spacebar is pressed this will generate a random number between 1 and 6 and convert it to text format so that it can be displayed as text in the "RandomNumberText" Object
- Click on the play icon to preview the scene
- When you press the spacebar, the text object should update to display a new random d6 roll each time
- Click on the "Objects" tab on the right and then click "+ Add a new object"
- Choose "Button" from the list of object types
- Name your Button something like "RollD100Button" and adjust the text size and font as necessary
- Set the initial text to "Roll D100"
- Drag and drop the text object onto your scene to place it
- Switch to the Events tab at the top of the screen to begin adding logic to your game
- Click on "Add a new event" and select the event to trigger the random number generation. Let's use a "Button Press" event to trigger the action.
- In the Conditions section, click on "Add a condition"
- Select the "RollD100Button" Object in the Objects tab
- Select the "is pressed" action in the middle conditions menu and click ok to save the condition
- In the Actions section of the same event, click on "Add an Action."
- Select "RandomNumberText" from the Objects tab (We will use the same text to show the number)
- Select "Text" in the actions menu
- In the text field, write the expression: ToString(RandomInRange(1, 100))
- When the spacebar is pressed this will generate a random number between 1 and 100 and convert it to text format so that it can be displayed as text in the "RandomNumberText" Object
- You can change the range of the random number by adjusting the parameters in RandomInRange(1,6)
- You can also trigger the random number generation with other events, like clicking a button or after a certain amount of time passes
02 Using RNG
Check out some ways to use RNG in a game context and explore how to manipulate and tune things quickly.
Check out steps below to use and explore RNG in your game
- You can jump into one of our game templates to see how RNG used in a game
- PRO TIP - feel free to grab and reuse templates to learn and get you on your way!
- Check out GDevelop Documentation wiki here
- GDevelop RNG tutorial on YouTube
Explore another digital game mechanic...
CHOICE
03 Build a simple Decision Tree
Choice is in almost all games both desktop and digital
What step to do next?
Which direction to go?
What tool to use? What to wager?
Almost everything come down to player choice!
Let's explore the choice mechanic through a simple decision tree
Check out steps below to build a Decision Tree in GDevelop
Not sure where to start?
Grab our sample code for steps below at GitHub!
- Open GDevelop and click on "Create a New Project."
- Choose any template or select "Empty Project" to start from scratch.
- PRO TIP - Add to an existing project or start new to explore mechanics in different contexts
- Click on the "Objects" tab on the right and then click "+ Add a new object"
- Choose "Button" from the list of object types
- Name your Button "PlayerChoice1" and adjust the text size and font as necessary
- Set the initial text to "Go To Town"
- Drag and drop the text object onto your scene to place it
- Repeat this two more times naming the new buttons "PlayerChoice2" with the initial value of "Run Away" and "PlayerChoice3" with the inital value of "Go To Sleep"
- q
- q
- q
- q
- Click on the play icon to preview the scene.
- When you press the spacebar, the text object should update to display a new random number each time.
- PRO TIP - Check your game along the way to ensure things work the way you expect
- You can change the range of the random number by adjusting the parameters in RandomInRange(1, 100).
- You can also trigger the random number generation with other events, like clicking a button or after a certain amount of time passes.
- PRO TIP - Adjust the numbers and replay a few rounds to see which range is best for your game
04 Using a Decision Tree
Here we will take you through some ways to explore the choice mechanic using your simple decision tree
- You can change the range of the random number by adjusting the parameters in RandomInRange(1, 100).
- You can also trigger the random number generation with other events, like clicking a button or after a certain amount of time passes.
Combine game mechanics
LUCK AND CHOICE
05 Add luck to your decisions
Let's modify our decision tree to add a little luck to the equation. Recombine mechanics in many ways for endless gameplay possibilities.
Check out steps below to combine luck into decision tree in GDevelop
Not sure where to start?
Grab our sample code for steps below at GitHub!
- Open GDevelop and click on "Open a Project."
- Open the project you worked on in the previous tutorial for a Choice Tree
- a
- Click on the play icon to preview the scene.
- When you press the spacebar, the text object should update to display a new random number each time.
- You can change the range of the random number by adjusting the parameters in RandomInRange(1, 100).
- You can also trigger the random number generation with other events, like clicking a button or after a certain amount of time passes.
06 Your turn
Consider how you will include luck and choice in your game?
How will you include luck in your game?
What choices are made in your game?
How does luck work in your favorite games?
What are some examples of Choice in your favorite game?
How might a RNG be incorporated into your game?
Can you think of different ways to integrate randomness into a decision tree?
Get inspired
Check out these games to modify or recreate to explore more ways to use RNG in games:
Build an experience
Use these a template to kickstart your game...add elements and try manipulating RNG to introduce luck into your game.
Share with us
Connect with our Brand page inside GDevelop and save your game here:
URL TBD