Documentation

Demo - RPG - Open Dev Kit Documentation

Open Dev Kit Documentation :: Demo - RPG

Role-playing game utilizing OpenGL and Jolt physics. Work toward completing a quest, battle monsters in real-time and interact with a story.

How it Works

  • Game Initialization
      Upon starting the game, the Start function is triggered. This initializes the StartingMap Scene and the player's starting location via the Scene Add function, which derives this data from the gSettings variable that can be accessed via the Tools > Game Settings menu.
      The opening cinematic sequence with the dialog boxes and the music is triggered by the Opened Scene Event of the StartingMap Scene. This event is designed to execute whenever a Scene is loaded.
  • Player Controls
      During that cinematic sequence, which Keybinds are usable or not is determined by the Enable/Disable Game Input and Lock/Unlock Game Input functions. The Interface Keybinds is used for interaction with message boxes during dialog cutscenes while RegularGame is used for the actual gameplay. By clicking Tools > Keybinds, you can view and edit them.
  • Active Scenes
      The RPG demo has an ActiveScene class, which is essentially a system to dynamically manage and switch between different UI and gameplay elements, or transitioning between different parts of the game without unloading other content. This is achieved using the SceneAdd and SceneRemove functions.
      • SceneAdd adds a Scene to the current list of active Scenes and defines how the Scene interacts (overlay or parallel), and even determines input behavior when the Scene is active,
      • while SceneRemove removes a specific Scene from the active list, while also automatically shifting interaction focus to the next available Scene (useful for closing UI elements/menus and transitioning back to gameplay).

Creating a New Item

Follow these steps to add a new item to the demo:

  1. Create the New Item:
    1. Click Tools > Items to open the menu containing properties belonging to the Item class.
    2. Click the Create Item icon and specify a name for the new item.
  2. Configure Properties:
    1. After it is created, you will need to give it functionality by setting up its properties depending on what kind of item it is.
    2. If it's a weapon, make sure its Equipment Type is set to Weapon and appropriately set other relevant properties.
    3. For healing items, Equipment Type should be set to HotKey, with its Stat Consume parameters set accordingly.
    4. If you want things to happen when that item is consumed, open the Use Event which executes when the specific item is used and set up a script there.
  3. Giving the Item to Actors:
    1. Now that the item's been set up, you can give it to actors with the Add/Remove Item function.
    2. It can also be used in combination with Equip Item if you want the actor to instantly equip it to their slot.
  4. Test the Game:
      Run the project to verify the new item can be added to actors' inventory and works as expected.

Creating a New Enemy

Follow these steps to add a new enemy to the demo:

  1. Create the New Enemy Graphic:
    1. Open Tools > Resources and double-click the Body Sprite Resource.
    2. Select an empty tile, and click the Import Images/Models icon or the Import Animation Frames one right next to it if you have multiple images forming an animation sequence.
    3. Now click the Add Box Collision icon ("Shared with whole Tile") to add a new collision box to the sequencer. Set up its size and line it up with the graphic.
    4. Follow the same procedure for the "Attacking" pose as well, if you want a different animation sequence to play when the enemy is attacking another.
  2. Set up the New Enemy:
    1. Load the Scene Resource you want to place the enemy in.
    2. On the Objects panel, double-click the Character object to create an object based off of the Character class.
    3. While the newly created object is selected, head down on its Properties panel until you find the Layers property. Add a new layer to it by clicking + once beside it.
    4. Set the Sprite value to the sprite resource you created/imported the new enemy's graphic in, and the Tile to which tile you created it on. The count starts from 0, so if you created it on the 3rd tile, its # would be 4.
    5. Since this is supposed to be an enemy, set the Team property to Bad.
    6. Make sure to also set up its Statistics and enable AI by ticking AI Enabled at the bottom.
    7. It also needs a weapon in order to be able to attack. This can be done with the Equip Item function, preferably executed via the actor's Created Event.
  3. Test the Game:
      Run the project to verify the new enemy shows up and behaves as expected.

Creating a New Map/Scene

Follow these steps to add a new scene to the demo:

  1. Create the New Scene:
    1. On the Project panel, click the Create Scene icon, give it a name and create it.
    2. Select the Tiles and begin drawing the map using the provided tools (pencil, rectangle etc.).
    3. Click on the imported square image to select it, and then click anywhere on the sequencer to place it. You can confirm you have added it by seeing a new entry on the timeline sequencer located right below the sprite sequencer.
  2. Moving in/out of the Scene:
    1. Moving actors and objects between Scenes is done using the Relocate function. To make a connection from one Scene to another, you can use the Collision Actor Started Event of an actor.
    2. You can find two such examples on the StartingMap and Forest Scenes in the RPG demo. They look like blue rectangular zones.
    3. By coming in contact with the player, a Relocate function executed within their Collision Actor Started Event repositions the player from one map to another. They can be visualized in the editor thanks to a 3D model cube from the Misc Sprite Resource being set as their 1st layer, but are invisible in the actual gameplay due to their Visible property being unchecked.
    4. Copy+paste this actor and head into their Collision Actor Started Event to edit the script and have the player go to the new map.
    5. From the existing script you need only keep the first two branches which essentially check if the actor colliding with them is the player, and the Relocate function found at the very end.
    6. Change the Scene parameter to the new one you created. You can now also copy and paste this to the new Scene and edit the Event to also have a way back.
  3. Test the Game:
      Run the project to verify the new Scene looks fine and works as expected.

If you think anything is missing, please feel free to: submit documentation feedback on this page