Reldens - Documentation
Go to websiteCheck our demo!Source GitHub
  • Documentation
  • What is Reldens?
  • Admin Panel
  • System Configuration
  • Contents creation
  • Customize your game
  • Demo server setup - Amazon Linux (2024)
  • Generators and import
  • Installation
  • Known issues
  • How to create a new Room/Scene?
  • Maps Wizard
  • System requirements
  • assets
    • object-sprite
    • player-sprite
    • skill-sprite
  • entities
    • Class Path
    • Item
    • Level Modifiers
    • Level
    • Levels Set
    • Objects
    • Respawn Areas
    • Rooms
    • Skill Types
    • Skill
    • Stats
    • Target Options
  • general
    • Actions
    • Create and configure a player spritesheet
    • Events Manager
    • Operations
    • Plugins
    • Project structure
  • generators
    • Attributes per level generator
    • Enemies experience rewards per level
    • map-composite-file
    • maps-elements
    • Generate multiple maps by loader generator
    • Generate multiple maps with associations by loader generator
    • Generate a single map by elements composite loader
    • Generate a single map by elements object loader
    • Players experience per level generator
  • importers
    • Objects Importer
    • Skills Importer
  • packages
    • tile-map-generator
      • The "composite" approach
      • Tile Map Generator
      • The "objects" approach
Powered by GitBook
On this page
  1. generators

Enemies experience rewards per level

PreviousAttributes per level generatorNextmap-composite-file

Last updated 4 months ago

This generator will create a file with the "experience rewards" by enemies per "variation" and "level".

There you can see how all the attributes below are used for the calculations.

Require parameters:

  • "levelsExperienceByKey" or pass the levels experience file path when executing the command: this generator requires to know ALL the player levels experience data in the same format provided by the "levels generator".

This can be passed as plain JSON in the levelsExperienceByKey configuration, like:

{
    "1": {
        "req": 10,
        "total": 10,
        "growthFactor": 2
    },
    "2": {
        "diff": 10,
        "req": 20,
        "total": 30,
        "growthFactor": 2.005
    },
    //...
}

If you are passing the levels experience file path like players-experience-per-level.json, then you can keep avoid this parameter since it will be included by the generate command, see the following link: https://github.com/damian-pastorini/reldens/blob/master/bin/generate.js#L141

  • "variations": this has to include each variation key for which the experience has to be created with the corresponding value.

{
    monsterA: 8,
    monsterB: 9,
    bossExtra: 15
}

As bigger the value is, the biggest the amount of given experience will be.

  • "decrementProportionPerLevel": this property contains the values used to decrease the proportion of experience given per level, this way high level enemies will give less experience in proportion in order to increase the required kills count and by that making the leveling more difficult.

{
    '5': 0.8,
    '10': 0.42,
    '15': 0.4,
    '20': 0.26,
    '25': 0.15,
    '30': 0.1,
    '35': 0.08,
    '40': 0.0025
}

IMPORTANT: if you are using the MonstersExperiencePerLevel class in your own script, note the levels keys must be passed as "strings".

To use the generator follow these steps:

  • Go to your game folder and create a folder called "generate-data".

  • Save the following content in the file:

{
    "levelsExperienceByKey": {
        "1": {
            "req": 10,
            "total": 10,
            "growthFactor": 2
        },
        "2": {
            "diff": 10,
            "req": 20,
            "total": 30,
            "growthFactor": 2.005
        },
        "3": {
            "diff": 20,
            "req": 40,
            "total": 70,
            "growthFactor": 2.01
        }
    },
    "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
    }
}

This JSON contains the parameters that will be passed to the monsters-experience-per-level generator.

  • Now open a console for the command line in your game folder.

  • Run the following command:

$ npx reldens-generate monsters-experience-per-level ./generate-data/monsters-experience-per-level.json

And if you want to pass the experience by level using the file path, run this command:

$ npx reldens-generate monsters-experience-per-level ./generate-data/monsters-experience-per-level.json ./generate-data/players-experience-per-level.json
  • As result, a new folder called "generated" will be created under your "game" folder, and there you will find a file with the generated data like:

{
    "1": {
        "req": 10,
        "total": 10,
        "growthFactor": 2,
        "monsterA": {
            "decrementProportion": 0,
            "randomVariation": 8,
            "exp": 1,
            "kills": 10
        },
        "monsterB": {
            "decrementProportion": 0,
            "randomVariation": 9,
            "exp": 1,
            "kills": 10
        },
        "bossExtra": {
            "decrementProportion": 0,
            "randomVariation": 15,
            "exp": 2,
            "kills": 5
        }
    },
    "2": {
        "diff": 10,
        "req": 20,
        "total": 30,
        "growthFactor": 2.005,
        "monsterA": {
            "decrementProportion": 0,
            "randomVariation": 8,
            "exp": 2,
            "kills": 10
        },
        "monsterB": {
            "decrementProportion": 0,
            "randomVariation": 9,
            "exp": 2,
            "kills": 10
        },
        "bossExtra": {
            "decrementProportion": 0,
            "randomVariation": 15,
            "exp": 3,
            "kills": 7
        }
    },
// ...

Inside the created folder create a new file named .

The generator code can be found here: https://github.com/damian-pastorini/game-data-generator/blob/master/lib/generator/monsters-experience-per-level.js
"monsters-experience-per-level.json"