Leveling up

Learn how to spend experience points to increase the level of the player, character, entity, or any other entity that can be leveled up.

In this part of the tutorial, you will learn how to spend experience points to increase the level of the player, character, entity, or any other entity that can be leveled up.

Storing the current level

As you did in the previous part of the tutorial, it is necessary to create pools to store anything:

  1. Add a new pool by selecting the component from the toolbar or using the keyboard shortcut “p”.
  2. Place it in the canvas to the right of the “XP” pool.
The model with the Level pool placed at the right end, after the Level Up converter.The model with the Level pool placed at the right end, after the Level Up converter.
  1. Type “Level” into the label at the top of the Properties panel and press “Enter” or click anywhere in the window.
The Level pool selected on the canvas, with its name Level shown under it.The Level pool selected on the canvas, with its name Level shown under it.
  1. With the “Level” pool selected, type “1” in the Initial quantity box of the Properties panel. This will cause the diagram or the player, in this case, to always start from level 1.
The Level pool selected: the panel shows Trigger set to Passive, Direction Pull, the resource Level, Initial quantity 1 and an unlimited CapacityThe Level pool selected: the panel shows Trigger set to Passive, Direction Pull, the resource Level, Initial quantity 1 and an unlimited Capacity
Warning

Make sure that the resources in the Level Pool are set to 1. If the pool starts with 0 resources, the player’s level is initialized with 0 and we wont be able to compute the level progression formula.

Note

Tip: while you Play, a Pool shows how many resources it holds as a number inside its circle.

Using XP to level up

Whenever a player has 100 XP, they can use them to level up. In this situation, the XP resource will be transformed into a Level resource. Converters transform one type of Resource into another. You can use this to your advantage and convert the XP Points into a Player Level.

  1. Click the Converter icon in the toolbar or use the keyboard shortcut “v”.
The toolbar with the Converter button outlined in red.
  1. Click on the canvas between the “XP” and “Level” pools to place the converter in the diagram.
The Level Up converter selected on the canvas between the XP and Level pools.The Level Up converter selected on the canvas between the XP and Level pools.
  1. Click the name at the top of the Properties panel and type “Level Up”.
The Properties panel of a Converter named Level Up: the five Trigger buttons with Auto selected, then Conversion and the Resources menu.
  1. Hit “Enter” or click anywhere to confirm.

For converters to work, it is necessary to have at least one Resource Connection as input and only one output Resource Connection. The converter will transform 100 XP into 1 level every time the player has at least 100 XP.

Let’s connect the converter to the “XP” and “Level” pools:

  1. Select a Resource Connection (or use the shortcut “c”) from the toolbar.
The toolbar with the Resource Connection button outlined in red.
  1. Click on the “XP” pool to start the connection.
The XP pool selected, with the start of the connection to the converter beside it.The XP pool selected, with the start of the connection to the converter beside it.
  1. Click on the Converter to finish the connection.
The resource connection from the XP pool to the Level Up converter, selected, labelled Spend 100 Points.The resource connection from the XP pool to the Level Up converter, selected, labelled Spend 100 Points.
  1. To define the XP cost for the conversion, type “100” in the amount box under Type (number) and hit Enter to confirm.
The Spend connection selected between XP and Level Up: the panel shows the amount 100 as a formula, the interval 1 and the Flow transfer, and the connection reads Spend 100 PointsThe Spend connection selected between XP and Level Up: the panel shows the amount 100 as a formula, the interval 1 and the Flow transfer, and the connection reads Spend 100 Points
  1. Select another Resource Connection (or use the shortcut “c”) from the toolbar.
  1. Click on the Converter to start the connection.
The Level Up converter selected, where the second resource connection starts.The Level Up converter selected, where the second resource connection starts.
  1. Click on the “Level” pool to finish the connection.
The resource connection from the converter to the Level pool, selected, labelled Gain 1 Level.The resource connection from the converter to the Level pool, selected, labelled Gain 1 Level.
  1. As every time the player levels up, their level increases by 1, the formula of the Resource Connection does not need to be changed. The formula in the Resource Connection in the output of the converter defines how many resources will the XP be converted.
  2. Press “Play” and analyze how the diagram is behaving. Why is the player not leveling up even if they have more than 100 XP? This is because the conversion needs a trigger.
After three steps the XP pool holds 150, yet the Level Up converter has no lightning bolt, so it is Passive and nothing convertsAfter three steps the XP pool holds 150, yet the Level Up converter has no lightning bolt, so it is Passive and nothing converts
Important

By default, Converters work in whole numbers: a decimal amount on their connections is rounded. Avoid decimal values as input for them, unless you switch on Allow decimals on the connection.

If resources are not flowing from one node to another, then one of these nodes needs to be triggered. In this example, the converter is not working, so you need to set a trigger:

  1. Select the converter “Level Up” in the canvas.
  2. Click Auto in the Trigger row of the Properties panel. You will see the converter now has a lightning bolt on top.
The Properties panel of the Level Up Converter with the Auto trigger selected.
  1. Press “Play”. You will see that once the player has at least 100 XP, these points will be converted into one level.
The XP pool, the Level Up converter with a lightning bolt on top, and the Level pool.The XP pool, the Level Up converter with a lightning bolt on top, and the Level pool.