Game Data Generator
This tool was designed to help users to easily create entire player and monsters incremental levels data, like experience, attributes, exp. given by kills, etc.
This tool (also for now) works under the command line, you will need to create a small script to provide the data and then run the tool execution through Node JS.
You can find the tool on GitHub or just install it through NPM:
- GitHub: https://github.com/damian-pastorini/game-data-generator
- NPM: https://www.npmjs.com/package/@reldens/game-data-generator
npm i @reldens/game-data-generator
Once you install it, you can use the tool in multiple ways:
1 - To generate the levels experience incremental for players
2 - To generate the monsters drop experince according to the players levels
3 - To generate the attributes incremental values per level, variant type (this scripst referes to variants as "monsters", but actually it could be used for players class paths as well), and type (this refers to melee, mage, archers, anything)
Note: make sure to have a "generated" folder created previously to start generating the data (I will fix this in the following versions).
The player experience generator
This will give us a levels list with the the required experince per level:
const { PlayersExperiencePerLevel } = require('../lib/generator/players-experience-per-level'); const playersExperiencePerLevel = new PlayersExperiencePerLevel({ startExp: 10, // experience required to reach level 2 from level 1 baseGrowthFactor: 2, // initial growth per level baseGrowthFactorPerLevel: {'5': 1.5, '10': 1.35, '15': 1.271, '20': 1.1, '40': 1}, // growth factor per level maxLevel: 100, // how many levels growthIncrease: 0.005, // increase in growth factor per level }); playersExperiencePerLevel.generate();
As you can see in the example above the parameters we can pass to this are pretty simple:
- maxLevel: this is the top level the player can reach.
- startExp: this is the experience required to reach level 2 from level 1.
- baseGrowthFactor: from here the experience required per level will be multiplied by this number, so in the example above you will get 10, 20, 30, up to the first level available in the following parameter.
- baseGrowthFactorPerLevel: this is the multiplier that will be applied starting on the level key provided, so instead of multiply the levels by 2, as for level 5 the following will be multiplied by 1.5 until the next level key (if there's any), in the example starting on level 10 the experience will be multiplied by 1.35 and so on. The main reason to keep decreasing the factor is to avoid getting something like 999999999999999999999999 at level 100.
let test = 10; for (let i=1; i<=100; i++) { test = test * 2; } // at this point test = 1.2676506002282294e+31
- growthIncrease: this is the value that will be sum up per level, so you can see the increment in the experience, in the example: between level 1 and level 2 you may not note any visible difference between startingExp = 10 and level 2 exp. been 10 multiplied by 2.005, which will be rounded and the decimals in exp. dropped, but in the bigger levels you will see how a small number will quickly high up the following.
In this link you can see the example output: https://github.com/damian-pastorini/game-data-generator/blob/master/examples/players-experience-per-level.json
The monsters experience generator
By the monsters experience I'm refering on how much experience a monster should give after the battle.
Since you won't have a single monster in the game, here you can include "variations", with this you can setup different monsters to give different values of experience, for example:
- monsterA will be the easiest to battle and would give you at level 1 a 8% of the level experience.
- monsterB will be a bit more difficult variant (let's it's an aggressive enemy), and will give you 9% of experience (since it took longer to kill it, the amount of experience will be bigger).
- boss, this will be highly difficult enemies but will drop 15% of experience.
Let's see the example script:
const { MonstersExperiencePerLevel } = require('../lib/generator/monsters-experience-per-level'); const playerLevels = require('./players-experience-per-level.json'); const monstersExperiencePerLevel = new MonstersExperiencePerLevel({ levelsExperienceByKey: playerLevels, variations: { monsterA: 8, monsterB: 9, bossExtra: 15 }, decrementProportionPerLevel: { '5': 0.8, '10': 0.42, '15': 0.4, '20': 0.26, '25': 0.15, '30': 0.1, '35': 0.08, '40': 0.0025 } }); monstersExperiencePerLevel.generate();
Here we need 3 main parameteres:
- levelsExperienceByKey: this is the direct output of the players experience generator, this script will apply the monster variant proportion on the required experience per level. For example, at level 1, monster A will give 8% rounded up, which will be 1 exp point, and you will require to kill the monster 10 times to pass to the next level.
- variations: this is the proportion each monster type will give.
- decrementProportionPerLevel: this behaves similar to the player experience grow factor but in the opposite way, because we need to increase the difficulty in every level, the same monster A won't give 8% anymore at level 20 lets say, otherwise you will kill 10 monsters per level until reach the top level and end the game play in record time. To avoid that, a monster that's giving 8% at level 1 then at level 10 will give 8% - (5 x 0.8) > this is *0.8 per level since level 5 where the 0.8 is been applied.
The attributes generator
In Reldens you can define the player and the NPC attributes (for the ones that are Enemy type), some examples will be: HP, MP, Attack points, Magic points, etc.
With this script you will get the incremented values per "level" according to the attributes "template base" for each "template type" and each "variation".
- The first parameter you can pass is the "maxLevel", but I've set a default = 100.
- Then, by "template base" I'm refering to the initial template that will contain the list of attributes with their initial values:
templateBase: { hp: 10, atk: 10, def: 10, speed: 10, mAtk: 10, mDef: 10, dodge: 10, aim: 10 },
- And by "template type" I'm refering to the different percentages that will be applied to each attribute calculation, for example:
typeTemplates: { melee: { hp: {min: 10, max: 20}, atk: {min: 10, max: 20}, def: {min: 10, max: 20}, speed: {min: 1, max: 2}, mAtk: {min: 1, max: 2}, mDef: {min: 1, max: 2}, dodge: {min: 1, max: 4}, aim: {min: 1, max: 2} }, mage: { hp: {min: 5, max: 10}, atk: {min: 1, max: 2}, def: {min: 1, max: 2}, speed: {min: 1, max: 4}, mAtk: {min: 10, max: 20}, mDef: {min: 10, max: 20}, dodge: {min: 1, max: 2}, aim: {min: 5, max: 10} },
Here you can see the "melee" type template is focused on increase the attributes that are more related to resistance and attack (HP, atk, def, having these the higher max values), where a "mage" is focused on increase the magic attack and magic defense.
Like these you can prepare different templates to generate different class paths or monsters types.
But this doesn't end up there, at the same time you can have different "variations" to which apply these templates, and with that increase their values differently.
For example:
typesVariations: { monsterA: {min: 1, max: 1.5}, monsterB: {min: 1.5, max: 1.8}, boss: {min: 2.5, max: 3.5}, playerClassPathSorcer: {min: 1.5, max: 1.7} }
The generator will loop over the "levels", then over the variations, then over the type templates, then over each template type attribute.
In the last loop, it will get a random value from the variation and from the template type attribute to calculate the increment per level.
Here's how the sample script looks like:
const { AttributesPerLevel } = require('../lib/generator/attributes-per-level'); let attributesPerLevel = new AttributesPerLevel({ templateBase: { hp: 10, atk: 10, def: 10, speed: 10, mAtk: 10, mDef: 10, dodge: 10, aim: 10 }, typeTemplates: { melee: { hp: {min: 10, max: 20}, atk: {min: 10, max: 20}, def: {min: 10, max: 20}, speed: {min: 1, max: 2}, mAtk: {min: 1, max: 2}, mDef: {min: 1, max: 2}, dodge: {min: 1, max: 4}, aim: {min: 1, max: 2} }, mage: { hp: {min: 5, max: 10}, atk: {min: 1, max: 2}, def: {min: 1, max: 2}, speed: {min: 1, max: 4}, mAtk: {min: 10, max: 20}, mDef: {min: 10, max: 20}, dodge: {min: 1, max: 2}, aim: {min: 5, max: 10} }, archer: { hp: {min: 5, max: 10}, atk: {min: 5, max: 10}, def: {min: 1, max: 4}, speed: {min: 5, max: 10}, mAtk: {min: 1, max: 2}, mDef: {min: 1, max: 2}, dodge: {min: 7, max: 20}, aim: {min: 7, max: 20} } }, typesVariations: { monsterA: {min: 1, max: 1.5}, monsterB: {min: 1.5, max: 1.8}, boss: {min: 2.5, max: 3.5} } }); attributesPerLevel.generate();