Mischiefblog
I make apps for other people

Simulation of skill trending

Posted by Chris Jones
On September 23rd, 2005 at 15:35

Permalink | Trackback | Links In |

Comments Off on Simulation of skill trending
Posted in Design Journal, Python

In June, I created mechanics for permitting skill trending through use. Babylona’s recent post about uncapped skills reminded me about this, and since it takes a lot longer to write an MMO to test this than a simple test class, I wrote a quick proof of concept in Python.

So . . . the combat engine isn’t great . . .

========= ROUND 49 ===========
Player: health 36/50 stamina 40/88 mana 11/30 defense 0/0 levels {'Warrior': 58, 'Wizard': 0} recent trends {'Warrior': [5], 'Wizard': [-12]}
Goblin: health 8/45 stamina 7/163 mana 30/30 defense 0/0 levels {'Warrior': 133, 'Wizard': 0} recent trends {'Warrior': [11], 'Wizard': [-23]}
Player hits Goblin with Cleave for 15 damage.
Goblin died.
Player: health 38/50 stamina 13/88 mana 14/30 defense 0/0 levels {'Warrior': 58, 'Wizard': 0} recent trends {'Warrior': [5], 'Wizard': [-12]}
Goblin: health 0/0 stamina 12/163 mana 30/30 defense 0/0 levels {'Warrior': 133, 'Wizard': 0} recent trends {'Warrior': [11], 'Wizard': [-23]}
Player won.

. . . but sometimes the player does win.

Usage

  1. Install Python (preferably, 2.4 or higher).
  2. Unzip the SimpleSkills.zip file into a directory.
  3. From the command line, in the SimpleSkills directory, run Sim.py with the Python interpreter. On my WinXP laptop:
    C:\> cd \temp\SimpleSkills
    C:\SimpleSkills> c:\python24\python Sim.py > test.out
  4. Review the test.out file in your favorite editor.

Rules
There are two combatants: a player and a goblin. There are two classes: Warrior and Wizard. The goblin is a warrior and has no access to Wizard skills, heals, or buffs. The player has access to all skills and buffs and heals.

There are an indeterminate number of rounds: the simulation runs until one of the combatants dies. Each round, each combatant “ticks,” updating stamina, mana, and health. The player attacks, randomly choosing one of the skills. Each skill use is tracked, and influences the skill levels of both Warrior and Wizard.

Tweaking
Feel free to update and modify the code. I’ve put most of the constants in the poorly organized Constants.py file–check to see if you can make combats last for longer or shorter periods of time. If you find any errors, let me know and I’ll correct them (mail me at , or add a comment to this post).

========= ROUND 29 ===========
Player: health 14/50 stamina 11/72 mana 20/30 defense 0/0 levels {'Warrior':
42, 'Wizard': 0} recent trends {'Warrior': [8], 'Wizard': [-18]}
Goblin: health 8/45 stamina 14/104 mana 30/30 defense 0/0 levels {'Warrior':
74, 'Wizard': 0} recent trends {'Warrior': [9], 'Wizard': [-18]}
Player hits Goblin with Thrust for 10 damage.
Goblin died.
Player: health 16/50 stamina 0/72 mana 23/30 defense 0/0 levels {'Warrior':
42, 'Wizard': 0} recent trends {'Warrior': [8], 'Wizard': [-18]}
Goblin: health 0/0 stamina 19/104 mana 30/30 defense 0/0 levels {'Warrior':
74, 'Wizard': 0} recent trends {'Warrior': [9], 'Wizard': [-18]}
Player won.

Comments are closed.