Dragon Star
Build Dragon Star, a Gacha RPC game!
Table of Contents
New Project
This is a example showing how to use our SDK to create a RPC game called Dragon Star with the Gacha game design.
First of all, use the CLI to quickly scaffold the project structure: python3 he-cli.py

Then let's navigate into the newly-created directory and see what do we have in the repository

The "models" folder is where your data class, data model, and data items will be.
The "sdk" folder contains a set of tools and models that you can easily use.
Create Dragons
The center of the Gacha RPG game is drawing items and using them to compete with other players. In Dragon Start, players can obtain dragons of five tiers (denoted by 'C' 'U' 'R' 'SR' and 'SSR'), and couple dragons with riders or equip with items to enhance their power. Let's see how to develop the backend of this game using Hyperedge' SDK.
Data Class
First of all let's create the data class for the dragon that stores all the necessary static attributes:
Here, we define these fields for the dragon data class:
name
shortDescription
Description
Affinity, which can be 'Elemental', 'Bio', 'Techno', 'Psycho', and 'Aether'
Element, can be 'Fire', 'Geo', 'Water', 'Electro', and 'Metal'
Tier, which can be 'C', 'U', 'R', 'SR', and 'SSR'
EquipSlots, which defines a list of slots that player can place different types of items, such as element stone and weapons
Clonable, which set the permission of cloning a dragon
Retirement, which defines the reward when player decides to retire a dragon
Data Model
We will create the dataclasses referenced by Dragon later. Now, let's continue and create the dragon data model, where we want to put in more dynamic attributes that can change during gameplay, using:
Data Items
Now we're ready to create some concrete dragons, of different tier, affinity, and element. Gasp!
Let's start with creating some tier C dragons.
Let's define five kinds of pretty basic Tier C dragons :
and create a script to dynamically assign them the "C" tier and an experience ladder, using Hyperedge's define() function (which performs field and id validation for you):
Here's the DragonLadder stores the experience ladder of the dragon. It's created using the ProgressionLadder class from Hyperedge's SDK.
Want to add something more interesting? Let's create some Tier U dragons with weapon slots and magic stone slots on them:
Refer to the dragon star repo to see all our full example and how other dragon items are created.
(TL;DR:
tier C: basic dragons
tier U: metal dragon, engineered dragons, elemental dragon, Bubble Dragon, Skull Dragon, Future Dragon ...
tier S: 9 sons
tier SR: Chinese dragon, legendary dragon tier
tier SSR: Conceptual Dragon)
Create Auxiliary Items
Now let's create more dataclasses that are referenced in the Dragon data class -- AffinityData, ElementData, TierData, and DragonEquipSlotData. They're all static data. Having ElementData and DragonEquipSlotData, we can also create Equippable items eventually.
Let's get started. Using the same approach as how we created Dragon, use:
As they're all static data, we don't need to create any data models. And from here, we can use the define() method from Hyperedge's CLI to create data class items as such:
Affinity
Element
Tier
Equipment slots
Equippable items
Now we can use create equippable items that can be equipped on the dragons, including element stones and weapons:
And let's create some element stone items using what we've just made, with a craft rule that player can craft a higher level magic stone with three lower levels ones. You can implement this using the CraftRule class provided by Hyperedge's SDK.
Create Riders and Buildings
Two more key entities in Dragon Star are riders and buildings.
Riders
Riders are character to couple with dragon, follow the same approach to create rider data class and data model.
Buildings
Buildings are places that can produce resources and unlock new functionalities, for example mine is basically an energy system that produces gold/iron over time; incubator is where dragon is raised; and market is where players can purchase resourcse. As there's only one slot for each type of building, let's do it in this way
And then create building items as:
Create Game Mechanics and Logic
Now we've defined most of the data models that construct this game and added a couple of items, let's create a few more classes for game mechanics, including currency, experience, and achievement. Then we'll fill in some of the concrete game logic, include upgrading and claiming achievement etc.
Currency
One system that most games have is the currency system, and it's common for Gacha games to have multiple currencies used for purchasing different resources. As an example, let's try to create two currencies in Dragon Star:
Experience
Our previous code indicates that rider, dragon, and equipments have a experience attribute and can be upgraded. Now let's create the data classes used for storing the experience levels.
Now we can create some Dragon Experience Material Items of different tiers and affinities that can increment a dragon's experience.
In this same way, we can create Experience Material Items for equippments and riders:
Achievement
Another important system we're missing right now is the achievement system. Let's create the achievement data class and data model first:
More importantly, let's create the handler of claiming an achievement demonstrating how you can implement game logics using Hyperedge's SDK. Let's create another folder called "Logic", navigate into it, and create a function handler called ClaimAchievementReward, using Hyperedge's Handler class (which enforces a consistent formating).
In the function body, we checked whether user has unlocked a given achievement that hasn't been claimed it before. If so, we grant the achievement to the user.
Upgrading
Following the same approach, we can create handlers for upgrading dragons, equipments, and buildings:
Refer to the dragon star repo to see all our full example and other game logics are implemented, including crafting equipments, equipping the dragon, claiming quest and battlepass rewards, cloning and retiring dragon.
Export and Run Server
Last but not least, let's talk about how to deploy all of your code to Hyperedge's servers and get it running.
First of all, run
to see all the created data classes and models you've created.
[screenshot of terminal ... ]
And then please use these commands sequentially to export, release, build, and run the app!
Using the version number, we've provided you a version management system for your releases and builds. Please make sure the version numbers you supply here match.
[screenshot of running app .. ]
Last words
Congratulations and Thank You for following this tutorial all the way to the end. We hope it helps you understand Hyperedge's tool, and will make game development process easier and more enjoyable.
If you have any questions or need further assistance, please feel free to contact us at [email protected] or visit our support page at HyperEdgeLabs.
Last updated