Download Media Create Donate Forums

2010/09/03

Experience and Leveling Up

I'm on a code spree; v0.09 might come soon.

The major addition I wanted to do for v0.09 is XP and Levels. I plan to use a very simple system to start: xp granted by killing a creature equals the creature's level. So a level 5 creature gives 5 xp. This is reasonable; creature difficulty also scales linearly.

Then comes the philosophical question: how much XP to gain levels? I think I found the correct answer: "Depends on how much content there is". Basically I'm going to playtest the game, and when it feels like I should be gaining a level I'll find a nearby XP cutoff point. This point will change as I add more of the game world to explore.

The important code for XP will be on the Character menu. Each level gained (2 through 9) the player can increase one core attribute (physical, magical, offense, defense). Anytime the character menu is open and not all points have been spent I need to display [+] buttons for spending those points.

I've decided to not bother adding a respec/reset button. It's easy enough to do out of game: edit the save game file and set build=1,1,1,1. Then when you load your game you can reassign your points.

Finally I need to enforce requirements checks when equipping items. This should be easy, as I think MenuInventory already has a reference to the player's StatBlock.

[--update--]
XP, leveling, attribute upgrading, and item requirements checks added. Please let me know on the forums if you test this.

Here's what I did for now, for the XP requirements. I want the number of creatures to be killed (thus, time spent at each level) to increase logarithmically (20,50,100,200,500,1000,2000,5000). So the scale looks like this:

  • 20 lvl 1 kills to 2: 20 xp
  • 50 lvl 2 kills to 3: 100 xp (120 total)
  • 100 lvl 3 kills to 4: 300 xp (420 total)
  • 200 lvl 4 kills to 5: 800 xp (1220 total)
  • 500 lvl 5 kills to 6: 2500 xp (3720 total)
  • 1000 lvl 6 kills to 7: 6000 xp (9720 total)
  • 2000 lvl 7 kills to 8: 14000 xp (23720 total)
  • 5000 lvl 8 kills to 9: 40000 xp (63720 total)

How long does it take in a hack & slash to kill 10,000 creatures? I have no clue, really. Sounds like hours of gameplay though. I timed myself getting to level 4:

  • 3 minutes to reach level 2
  • 6 minutes to reach level 3
  • 15 minutes to reach level 4

The number of kills required approximately doubles each level, and as expected the grinding time doubles also. Projecting the rest of the levels:

  • 30 minutes to reach level 5
  • 1 hour to reach level 6
  • 2 hours to reach level 7
  • 4 hours to reach level 8
  • 8 hours to reach level 9

Total 16 hours of gameplay (not counting quests, trips to town, etc). That's a pretty solid number. I'd need a good collection of maps to make 16 hours work.