How to Create an RPG Class System#
This guide will show you how to create a multi-dimensional skill tree with branching. The frameworks described build upon the previous Tutorial: Level System and will reference the level system described in the examples.
To illustrate this we will create a simple class system typical of any role playing game (RPG).
The system will consist of three classes: Bard, Mage and Paladin. Each class is defined as a
single archetype with a unique set of skills. The skills in each class will have a complex hierarchy in order to
show how it is possible to create multi-dimensional skill trees.
Pre-requisites#
This guide assumes you have read and understand the following documents:
Mage Class#
The Mage is a magical sorcerer that has a myriad of abilities powered by the four physical elements.
The following table illustrates the set of skills that will be awarded at particular levels and their other skill requirements:
Skill |
Description |
Requires |
|---|---|---|
ice_blast |
Hurl an icy blast at your enemy and deal 10 damage. |
N/A |
fire_grenade |
Send a grenade of hot fire towards your enemy and deal 20 damage across a 5 foot radius. |
N/A |
snare |
Snare your enemy with tree roots for 15 seconds. |
N/A |
ice_blast_advanced |
Hurl an icy blast at your enemy and deal 20 damage. |
level_3, ice_blast |
fire_bomb |
Send a bomb of hot fire towards your enemy and deal 40 damage across a 10 foot radius. |
level_5, fire_grenade |
snare_thick |
Snare your enemy with thick tree roots for 30 seconds. |
level_7, snare |
fire_storm |
Send a storm of hot fire towards your enemy and deal 60 damage across a 25 foot radius. |
level_10, fire_bomb |
This tree can be encoded into JSON to be created with the service as follows:
1 [
2 {
3 uid: "66def31c-c10f-4c22-9ca3-3dd309ca4b98",
4 name: "ice_blast",
5 title: "Ice Blast",
6 description: "Hurl an icy blast at your enemy and deal 10 damage.",
7 icon: "ice_blast.png",
8 requirements: [],
9 data: {
10 damage: 10,
11 cooldown: 1,
12 },
13 },
14 {
15 uid: "fda52e9a-6447-4a61-90c8-9704930d0e8d",
16 name: "fire_grenade",
17 title: "Fire Grenade",
18 description: "Send a grenade of hot fire towards your enemy and deal 20 damage across a 5 foot radius.",
19 icon: "fire_grenade.png",
20 requirements: [],
21 data: {
22 damage: 20,
23 cooldown: 60,
24 radius: 5,
25 },
26 },
27 {
28 uid: "f9cc39da-d45e-457d-a4c9-e9eb6ecb65f7",
29 name: "snare",
30 title: "Root Snare",
31 description: "Snare your enemy with tree roots for 15 seconds.",
32 icon: "root_snare.png",
33 requirements: [],
34 data: {
35 cooldown: 60,
36 snare: 15,
37 },
38 },
39 {
40 uid: "9ca00f56-d813-4335-aa5f-a756ef64d30c",
41 name: "ice_blast_advanced",
42 title: "Advanced Ice Blast",
43 description: "Hurl an icy blast at your enemy and deal 20 damage.",
44 icon: "ice_blast_advanced.png",
45 requirements: [
46 {
47 type: "SkillUnlocked",
48 title: "Ice Blast",
49 description: "Requires Ice Blast.",
50 icon: "ice_blast.png",
51 value: "66def31c-c10f-4c22-9ca3-3dd309ca4b98",
52 },
53 {
54 type: "SkillUnlocked",
55 title: "Level 3",
56 description: "Requires Level 3.",
57 icon: "level3.png",
58 value: "1ea968f3-ca97-4d8c-8c9d-63d183942be0",
59 },
60 ],
61 data: {
62 damage: 20,
63 cooldown: 1,
64 },
65 },
66 {
67 uid: "fec0699d-9e83-489f-a2d1-4916b577d74f",
68 name: "fire_bomb",
69 title: "Fire Bomb",
70 description: "Send a bomb of hot fire towards your enemy and deal 40 damage across a 10 foot radius.",
71 icon: "fire_bomb.png",
72 requirements: [
73 {
74 type: "SkillUnlocked",
75 title: "Fire Grenade",
76 description: "Requires Fire Grenade.",
77 icon: "fire_grenade.png",
78 value: "fda52e9a-6447-4a61-90c8-9704930d0e8d",
79 },
80 {
81 type: "SkillUnlocked",
82 title: "Level 5",
83 description: "Requires Level 5.",
84 icon: "level5.png",
85 value: "e53768f4-df1e-497d-8e75-87beebc0cd23",
86 },
87 ],
88 data: {
89 damage: 40,
90 cooldown: 60,
91 radius: 10,
92 },
93 },
94 {
95 uid: "531db201-0d36-47e6-8356-3607e3b199a2",
96 name: "snare_thick",
97 title: "Thick Root Snare",
98 description: "Snare your enemy with thick tree roots for 30 seconds.",
99 icon: "snare_thick.png",
100 requirements: [
101 {
102 type: "SkillUnlocked",
103 title: "Root Snare",
104 description: "Requires Root Snare.",
105 icon: "root_snare.png",
106 value: "f9cc39da-d45e-457d-a4c9-e9eb6ecb65f7",
107 },
108 {
109 type: "SkillUnlocked",
110 title: "Level 7",
111 description: "Requires Level 7.",
112 icon: "level7.png",
113 value: "fde448ce-5fb2-423b-a3b0-f84d9ce8a1b9",
114 },
115 ],
116 data: {
117 cooldown: 60,
118 snare: 30,
119 },
120 },
121 {
122 uid: "2f8a85a8-4254-4f1a-a65e-e991e1a69c69",
123 name: "fire_storm",
124 title: "Fire Storm",
125 description: "Send a storm of hot fire towards your enemy and deal 60 damage across a 25 foot radius.",
126 icon: "fire_storm.png",
127 requirements: [
128 {
129 type: "SkillUnlocked",
130 title: "Fire Bomb",
131 description: "Requires Fire Bomb.",
132 icon: "fire_bomb.png",
133 value: "fec0699d-9e83-489f-a2d1-4916b577d74f",
134 },
135 {
136 type: "SkillUnlocked",
137 title: "Level 10",
138 description: "Requires Level 10.",
139 icon: "level10.png",
140 value: "d0e030c7-c6c1-489f-9096-2c17285b4961",
141 },
142 ],
143 data: {
144 damage: 65,
145 cooldown: 60,
146 radius: 25,
147 },
148 },
149 ];
The archetype definition will reference the three root skills of ice_blast, fire_grenade and snare.
The system will then discover the remaining skills in the archetype automatically:
1{
2 name: "mage",
3 title: "Mage",
4 description: "The Mage is a powerful sorcerer that controls the four elements.",
5 icon: "mage.png",
6 skills: [
7 "66def31c-c10f-4c22-9ca3-3dd309ca4b98",
8 "fda52e9a-6447-4a61-90c8-9704930d0e8d",
9 "f9cc39da-d45e-457d-a4c9-e9eb6ecb65f7",
10 ],
11 data: undefined,
12}
Paladin Class#
The Paladin is a holy warrior blessed by the Gods with supernatural strength.
The following table illustrates the set of skills that will be awarded at particular levels and their other skill requirements:
Skill |
Description |
Requires |
|---|---|---|
shield |
Protects the user from 10 damage for 5 seconds. |
N/A |
slash |
Slash enemy with your broad sword for 10 damage. |
N/A |
heal |
Heal yourself for 10 hit points. |
N/A |
heavy_shield |
Protects the user from 20 damage for 10 seconds. |
level_3, shield |
hack_n_slash |
Hack and slash your enemy for 15 damage. |
level_5, slash |
heal_advanced |
Heal yourself for 20 hit points. |
level_7, heal |
gods_might |
Deal 20 damage to your opponent while healing yourself for 10 hit points. |
level_10, heal, heavy_shield |
This tree can be encoded into JSON to be created with the service as follows:
1 [
2 {
3 uid: "d3f56fd6-9d00-4401-99de-029d5f92d594",
4 name: "shield",
5 title: "Shield",
6 description: "Protects the user from 10 damage for 5 seconds.",
7 icon: "shield.png",
8 requirements: [],
9 data: {
10 shield: 10,
11 cooldown: 1,
12 duration: 5,
13 },
14 },
15 {
16 uid: "c4348f24-5c9e-4d84-a404-fa19aee752bb",
17 name: "slash",
18 title: "Slash",
19 description: "Slash enemy with your broad sword for 10 damage.",
20 icon: "slash.png",
21 requirements: [],
22 data: {
23 damage: 10,
24 cooldown: 1,
25 },
26 },
27 {
28 uid: "0e7bb2e2-b6bb-47b0-b51e-392279334254",
29 name: "heal",
30 title: "Heal",
31 description: "Heal yourself for 10 hit points.",
32 icon: "heal.png",
33 requirements: [],
34 data: {
35 restore: 10,
36 cooldown: 5,
37 },
38 },
39 {
40 uid: "65ea5c76-dd3f-43fd-8a27-f89f9bbfa2f5",
41 name: "heavy_shield",
42 title: "Heavy Shield",
43 description: "Protects the user from 20 damage for 10 seconds.",
44 icon: "heavy_shield.png",
45 requirements: [
46 {
47 uid: uuid.v4(),
48 type: "SkillUnlocked",
49 title: "Shield",
50 description: "Requires Shield.",
51 icon: "shield.png",
52 value: "d3f56fd6-9d00-4401-99de-029d5f92d594",
53 },
54 {
55 type: "SkillUnlocked",
56 title: "Level 3",
57 description: "Requires Level 3.",
58 icon: "level3.png",
59 value: "1ea968f3-ca97-4d8c-8c9d-63d183942be0",
60 },
61 ],
62 data: {
63 shield: 20,
64 cooldown: 1,
65 duration: 10,
66 },
67 },
68 {
69 uid: "7cfc22ef-418d-48e1-8e9a-147e65759f66",
70 name: "hack_n_slash",
71 title: "Hack 'n Slash",
72 description: "Hack and slash your enemy for 15 damage.",
73 icon: "hack_n_slash.png",
74 requirements: [
75 {
76 uid: uuid.v4(),
77 type: "SkillUnlocked",
78 title: "slash",
79 description: "Requires Slash.",
80 icon: "slash.png",
81 value: "c4348f24-5c9e-4d84-a404-fa19aee752bb",
82 },
83 {
84 type: "SkillUnlocked",
85 title: "Level 5",
86 description: "Requires Level 5.",
87 icon: "level5.png",
88 value: "e53768f4-df1e-497d-8e75-87beebc0cd23",
89 },
90 ],
91 data: {
92 damage: 15,
93 cooldown: 1,
94 },
95 },
96 {
97 uid: "6c8bf035-58db-4a6b-a34e-c3045cd13c8c",
98 name: "heal_advanced",
99 title: "Advanced Heal",
100 description: "Heal yourself for 20 hit points.",
101 icon: "heal_advanced.png",
102 requirements: [
103 {
104 uid: uuid.v4(),
105 type: "SkillUnlocked",
106 title: "Heal",
107 description: "Requires Heal.",
108 icon: "heal.png",
109 value: "0e7bb2e2-b6bb-47b0-b51e-392279334254",
110 },
111 {
112 type: "SkillUnlocked",
113 title: "Level 7",
114 description: "Requires Level 7.",
115 icon: "level7.png",
116 value: "fde448ce-5fb2-423b-a3b0-f84d9ce8a1b9",
117 },
118 ],
119 data: {
120 restore: 20,
121 cooldown: 1,
122 duration: 10,
123 },
124 },
125 {
126 uid: "6c8bf035-58db-4a6b-a34e-c3045cd13c8c",
127 name: "gods_might",
128 title: "God's Might",
129 description: "Deal 15 damage to your opponent while healing yourself for 10 hit points.",
130 icon: "gods_might.png",
131 requirements: [
132 {
133 uid: uuid.v4(),
134 type: "SkillUnlocked",
135 title: "Heal",
136 description: "Requires Heal.",
137 icon: "heal.png",
138 value: "0e7bb2e2-b6bb-47b0-b51e-392279334254",
139 },
140 {
141 uid: uuid.v4(),
142 type: "SkillUnlocked",
143 title: "Hack 'n Slash",
144 description: "Requires Hack 'n Slash.",
145 icon: "hack_n_slash.png",
146 value: "7cfc22ef-418d-48e1-8e9a-147e65759f66",
147 },
148 {
149 type: "SkillUnlocked",
150 title: "Level 7",
151 description: "Requires Level 7.",
152 icon: "level7.png",
153 value: "fde448ce-5fb2-423b-a3b0-f84d9ce8a1b9",
154 },
155 ],
156 data: {
157 damage: 15,
158 cooldown: 10,
159 restore: 10,
160 },
161 },
162 ];
The archetype definition will reference the three root skills of shield, slash and heal.
The system will then discover the remaining skills in the archetype automatically:
1 {
2 name: "paladin",
3 title: "Paladin",
4 description: "The Paladin is a holy warrior blessed by the Gods with supernatural strength.",
5 icon: "paladin.png",
6 skills: [
7 "d3f56fd6-9d00-4401-99de-029d5f92d594",
8 "c4348f24-5c9e-4d84-a404-fa19aee752bb",
9 "0e7bb2e2-b6bb-47b0-b51e-392279334254",
10 ],
11 data: undefined,
12 }
Bard Class#
The Bard is a world-class musician whose songs can heal and uplift even the most tainted of hearts.
The following table illustrates the set of skills that will be awarded at particular levels and their other skill requirements:
Skill |
Description |
Requires |
|---|---|---|
heal_ballad |
Heal all members of your group for 10 hit points. |
N/A |
dexterity_song |
Increase the dexterity of your entire group by 20 for 30 seconds. |
N/A |
heal_song |
Heal all members of your group for 25 hit points. |
level_5, heal_ballad |
This tree can be encoded into JSON to be created with the service as follows:
1 [
2 {
3 uid: "82bfd405-26aa-4f33-9293-c4b638f9f7f4",
4 dateCreated: new Date(),
5 dateModified: new Date(),
6 version: 0,
7 name: "heal_ballad",
8 title: "Ballad of Healing",
9 description: "Heal all members of your group for 10 hit points.",
10 icon: "heal_ballad.png",
11 requirements: [],
12 data: {
13 restore: 10,
14 cooldown: 5,
15 },
16 },
17 {
18 uid: "38893137-1200-47dc-a04f-0a01728ac893",
19 dateCreated: new Date(),
20 dateModified: new Date(),
21 version: 0,
22 name: "dexterity_song",
23 title: "Song of Dexterity",
24 description: "Increase the dexterity of your entire group by 20 for 30 seconds.",
25 icon: "dexterity_song.png",
26 requirements: [],
27 data: {
28 dexterity: 20,
29 cooldown: 1,
30 duration: 30,
31 },
32 },
33 {
34 uid: "9adc9968-5885-4bac-bb54-d97662e3b22e",
35 dateCreated: new Date(),
36 dateModified: new Date(),
37 version: 0,
38 name: "heal_song",
39 title: "Song of Healing",
40 description: "Heal all members of your group for 25 hit points.",
41 icon: "heal_song.png",
42 requirements: [
43 {
44 uid: uuid.v4(),
45 type: "SkillUnlocked",
46 title: "Ballad of Healing",
47 description: "Requires Ballad of Healing.",
48 icon: "heal_ballad.png",
49 value: "82bfd405-26aa-4f33-9293-c4b638f9f7f4",
50 },
51 {
52 type: "SkillUnlocked",
53 title: "Level 5",
54 description: "Requires Level 5.",
55 icon: "level5.png",
56 value: "e53768f4-df1e-497d-8e75-87beebc0cd23",
57 },
58 ],
59 data: {
60 restore: 25,
61 cooldown: 5,
62 },
63 },
64 ];
The archetype definition will reference the three root skills of heal_ballad and dexterity_song.
The system will then discover the remaining skills in the archetype automatically:
1 {
2 name: "bard",
3 title: "Bard",
4 description:
5 "The Bard is a world-class musician whose songs can heal and uplift even the most tainted of hearts.",
6 icon: "bard.png",
7 skills: ["82bfd405-26aa-4f33-9293-c4b638f9f7f4", "38893137-1200-47dc-a04f-0a01728ac893"],
8 data: undefined,
9 }