# Proper Text-RPG Monster Generator [closed]

I'm making a text-based RPG in C++ just for fun, and in a way that I can keep adding to it and hopefully give it graphics one day, and I've got a lot of code for everything. My only problem is that I can't come up with a decent way to create enemies that will be fair across the levels and classes. Tweaking the formulas doesn't seem to help. I will give some examples, there are only 10 enemies now, and I'm just wondering if anyone has a better way of going about this that keeps the variety between classes and fairness across levels. Here are a few of the monsters:

    Monster.Name = "Minotaur";
Monster.monsterOption = random1;
Monster.level = Player.level;
Monster.health = 30+(5*Monster.level)+(rand()%7);
Monster.workinghealth = Monster.health;
Monster.attack = 15+(7*Monster.level+(rand()%4));
Monster.defense = 26+(11*Monster.level)+(rand()%4);
Monster.speed = 10+(2*Monster.level)+(rand()%3);
Monster.luck = 2+(1*Monster.level)+(rand()%1);
Monster.accuracy = 90+(rand()%5)-(rand()%10);
Monster.gold = (rand()%120)+(30*Monster.level);

Monster.Name = "Bandit Leader";
Monster.monsterOption = random1;
Monster.level = Player.level;
Monster.health = 20+(2*Monster.level)+(rand()%15);
Monster.workinghealth = Monster.health;
Monster.attack = 20+(7*Monster.level+(rand()%3));
Monster.defense = 20+(10.5*Monster.level)+(rand()%3);
Monster.speed = 20+(4*Monster.level)+(rand()%8);
Monster.luck = 2+(1*Monster.level)+(rand()%1);
Monster.accuracy = 90+(rand()%5)-(rand()%10);
Monster.gold = (rand()%150)+(32*Monster.level);

Monster.Name = "Dragon";
Monster.monsterOption = random1;
Monster.level = Player.level;
Monster.health = 35+(4*Monster.level)+(rand()%10);
Monster.workinghealth = Monster.health;
Monster.attack = 20+(7*Monster.level+(rand()%10));
Monster.defense = 25+(11*Monster.level)+(rand()%10);
Monster.speed = 20+(1*Monster.level)+(rand()%10);
Monster.luck = 2+(1*Monster.level)+(rand()%6);
Monster.accuracy = 90+(rand()%5)-(rand()%10);
Monster.gold = (rand()%100)+(30*Monster.level);


So you can see the formulas aim to keep some degree of randomness between each of the same type of monster, and they should be changed based on your level but not your class, weapons, armor, etc. That is all the information about each kind of monster while there is more information about the player (Armor and weapons added to base defense and attack). Here is an example player from a file I have saved right now:

           SAVED CHARACTER INFORMATION
================================================
| Name:     WarriorRawrry                      |
| Class:    Warrior                            |
| Level:    32                                 |
| Health:   207/241                            |
| Attack:   231                                |
| Defense:  159                                |
| Speed:    159                                |
| Luck:     45                                 |
| Accuracy: 90%                                |
| Exp Pnts: 1228/16000                         |
| Gold:     7183                               |
| Weapon:   Sword of 1000 Truths  +125 attack  |
| Chest:    Blinding Breastplate  +90  defense |
| Legs:     Oblivion Greaves      +88  defense |
| Helmet:   Crown of Death        +64  defense |
| Hands:    Gauntlets of Fate     +54  defense |
| Feet:     Hell's Sabatons       +60  defense |
================================================


Note: That is output from the command line, I just put it in code format to make it easy to read.

So you guys can see what I'm trying to accomplish here, I'm not asking you guys to create math formulas for me, but any ideas on what would be a better way to go about this would be much appreciated.

• There is no way we can answer "what would be a better way" without knowing what you're going for, like what kind of numbers are you after? But even taking a step back because numbers don't mean anything themselves - that is, what happens when an attack 123 monster hits a defense 98 player with 200 health - what gameplay objectives are you going after? I'm assuming, like most RPGs, you want battles to become harder at higher levels, but how - more hits to kill monsters, or taking fewer hits from monsters before dying? – congusbongus Apr 15 '15 at 4:58
• I definitely don't see it the same. I want it to get harder as in you take more hits to kill the monster. Don't worry about what happens in the scenario you described, I just want the opponents attack and defense to be close and balanced with the players "working" attack and defense. For example, if the players base attack plus weapon causes a working attack of 210, a dragon should have an attack of maybe 210-225 while a troll should have an attack of 180-190 or something. so i'm just looking for ideas on how to go about it, I don't provide every detail because I'm just looking for broad ideas – RoryHector Apr 15 '15 at 5:46
• I should add that they have a working attack of 210 and they are the warrior class just for proper comparison. The players stats will change based on their class but the enemies should not – RoryHector Apr 15 '15 at 6:01
• Why not let them change their own attributes/stats. Just assign a point they can re-distribute everytime they level up. – Ace Caserya Apr 15 '15 at 6:27

I think your problem is not program but staff. You need a Beta tester to give you comment on what to pike down or buff up.

If your character has certain unique skill it can also contribute or harm the player.

Also note on some games, it's not actually possible to kill high level monster without a bit of team play.

You can also apply randomness on range of hits and damages but it must have a max or min hit computable.

Take into account the weapons. Most gameplays who can not change monster stats (cause it was already deployed)... depends on ever changing list of arsenal available to characters.

The game experience and know-how should be your main factor in Testing.

How we do it before on our server. (Manually on gameplay)

1.) tweak monsters so it does not attack and not aggressive

2.) Pour Admin buffs (no time expiration) and hit monster to see max damage

3.) do 2.) in combination with other different factors (team play, weapons, armor, etc) mentioned above

4.) Pour Admin curse and hit monster too see min damage apply 3.)

In my experience, what's more difficult is balancing character types. Example Sword versus magic versus range during Player Vs Player. If you do not solve this balance you will end up with just a few type character on your server.

Consider also player able to shift armor and weapons at there will. It's their right to protect themselves or counter-attack according.

The beauty of RPG is you go by your audience experience and feedback. You can only hope your computation might be accurate on certain scenarios but if other players can not adopt, by changing tactics they will leave your server.

An Alternative to balance Players vs Monsters.

1. Assign a total number of stats you can contribute to different stats to a player per certain level.
2. Since monsters won't have and weapons or armor you need to add certain percentage to the total stats of monsters. Say 5% to 50%. Assuming monsters do not level up.
3. Let your players do the assigning of stats.
• I like your answer and I agree, but my concern before I start tightening ranges, adding damage multipliers to lengthen or shorten battles, etc, is that I think it would be a good idea to have a reliable way to directly decide their attack and defense where it won't need much manipulating after creation. I can build a huge chunk of balancing code, but I just feel that would complicate things when it's possible to get something decently balanced from the start. – RoryHector Apr 15 '15 at 5:56
• How you set your parameters in testing your stats is up to you. But if you leave finite parameters on your game without adaptability of the opposition, your game might not be interesting enough. Made some edits. – Ace Caserya Apr 15 '15 at 6:18
• An example of what you are asking for is like this link rode.doddlercon.com/db/calc for this game ratemyserver.net – Ace Caserya Apr 15 '15 at 6:54

Make some playtests around what equipment/stats will have a certain player on average on certain level.

Create a monster roster with monsters valid on certain levels, I mean, Minotaur is never always a player level, but instead create a Minotaur that has level 2, Orc with level 3, Dragon with level 19 etc.

When you are generating encounters for player, check his level and randomly choose an enemy ranging from his level-5 upto level+5 or something like that.

This way you can balance foes easier, fine tuning for example Dragon values so it will be challenging for character level 16, usual enemy for level 19, and pushover for level 24.

Also always keep same scaling on monsters and players, for example in Final Fantasy series (older ones like 5,6,7,8 etc) characters are scalling exponentially, so does enemies. In Dunegons & Dragons v5 for example characters and enemies are scalling lineary with very slow curve. You must choose one and be consistent.