Skip to content

non4to/CharacterFiles

Repository files navigation

eRPGfm - Evolutionary RPG File Maker

exemple

The main goal of this project is to practice Evolutionary Algorithms using python. In order to do this, an evolutionary approach will be applied to a specific problem. In this case, the problem to be solved is to determine the combination of atributes of an NPC from a forum rpg so that, such combination of atributes achieves a specific probability of winning a fight agaisnt a given opponent.

In this RPG each character has atributes that are compared when they battle. It is difficult for a Game Master to build a balanced file for an enemy. The idea of this project is to take the burden of the GM, so they can focus on story alone. This code will receive the Player's data (level and atributes), and a probability that states the chances of this enemy winning a fight agaisnt the player. The GM might want to create an easy enemy, so they can give as input 30%. This means this enemy won the Player 30% of the times in X number of fights. The code will output the atributes of such enemy.

SYSTEM

In this system there are for atributes: POWER, PRECISION, DEFENSE and CONSTITUION.

  • POWER -> Used to calculate damage
  • PRECISION -> Used in attack action to define if it connects
  • DEFENSE -> Used in defense action to define if it connects
  • CONSTITUTION -> Character's HP

To define if an attack conects, the following test is done:

(ATTACKER PRECISION + ATTACKER LVL * 3/4 + 3d6) x (DEFENDER DEFENSE + DEFENDER LVL * 3/4 + 10)

If the attacker values are equal or higher than the defender's, then the attack connects and the damage
calculation follows up.

Damage calculation is simple:

SUBTRACT from the DEFENDER'S CONSTITUION THE ATTACKER'S POWER ATTRIBUTE VALUE 

Ex:. If the attacker has 4 POWER and defender has 10 CONSTITUION, and the attack connects,
the defender's HP after damage calculation will be 6. (10 - 4 = 6)

There are rules for character creation:

  • Starting points: 1 (PDR), 1(PRE), 1(DEFE), 3(CON)
  • Each lvl grants 1 point. In lvl 1 -> 1 Point to distribute;
  • Bonus Point depeding on the Race. Here this bonus is considered by the distribution of lvl+1 points. The extra point is the bonus point.

*** During a battle the reference player always attacks first.

TOOLS

- [Python] Main language

HOW TO USE

- git clone repo
- Open input.json and adjust parameters.

    {
    "reference": [POWER:int, PRECISION:int, DEFENSE:int, CONSTITUTION:int], 
    "goal": DESIRED_PERCENTAGE_OF_NPC_WINS:float,
    "battle_number": NUMBER_OF_BATTLES_BETWEEN_REFERENCE_AND_EACH_INDIVIDUAL_OF_POPULATION:int,
    "pop_size": POPULATION_SIZE:int,
    "gen": MAXIMUM_NUMBER_OF_GENERATION:int,
    "elitism": PERCENTAGE_OF_ELITISM_IN_POPULATIONS:float,
    "mut_prob": MUTATION_PERCENTAGE_PROBABILITY:float
    }

- python3 main.py

STATUS

- Finished
- Maybe Future: Apply novelty index to get NPCs with varied builds.

About

Project to create stuff for a forum-based rpg

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages