Friday, March 7, 2014

The Cycle Begins Again #2: Character Leveling

Despite not making an entry since the beginning of the project, I've made a large amount of progress! To start, I have finished the basic player sprites, and have moved on to the rough draft of the enemy sprites. In other great news, I got in contact with Tyler, who will be doing a good chunk of my graphics for the game (which I am really excited about- he's great with taking concepts and fleshing them out into pictures!) We talked for a couple of hours the other day, got a lot of details ironed out about gameplay, game style, character movement, the artwork... But much of what we talked about will come in another blog entry after he finishes a draft of some of his work, which will allow me to give better information on it.
I didn't mean to move into character leveling so soon, but I was bored in class one day and didn't have access to my laptop.Keep in mind- these ideas are preliminary, and only beginning to flesh out. If you have input, let me know!

Leveling - Experience
I decided to make the leveling system experience-based in addition to stage-based. Experience will be awarded through standard means- you kill baddies, you get the XP. Every level will start the PC at 0 XP. The reason I decided to reset the XP after every level was merely for coding purposes: if I am to code an experience bar, I will have to do fewer calculations to get everything to display properly. The amount of experience needed to level will be a decision I make later, but I will likely set it to a percentage of a base value, a trend you will see a lot in my leveling system as I explain the PC's stats. A code example labeled "Level Up Code Example" at the bottom of this entry will give the programmers here a better idea of where I'm going with this.
In addition to getting experience and levels from defeating enemies, the PC will also gain a level at the end of each stage (four stages in total, which will be detailed in just a little bit.) This level will not affect the XP of the PC- rather, it will just increment all of the stats talked about below and give the player a stat point to spend on one of the four categories. The reason I am giving levels at the end of the stage is so players who do now wish to kill every enemy will still gain some strength before moving on to harder levels.
Leveling - Character Stats
The other part of PC leveling that needs to be discussed are the stats: Strength, Magic, Dexterity, and Vitality. The way these stats (and their sub-stats) work is each will have a "base value" set to 1, because the PC starts out at level 1. When the PC gains a level, or when the PC completes a stage, the base value of every stat will increase by 1. Additionally, when the PC gains a level or completes a stage, the player will gain one skill point he may choose to spend in one of the four categories. As you read through the information below, keep in mind it would be possible to overload one stat and make, for instance, a character that kills everything in one hit. Conversely, that character will likely die very quickly as well.One other note I would like to make is that the stats, how they are affected by leveling, and the sub-stats contained by the four parent stats have been changed numerous times in the last couple days as I consider different ways to balance them. Input, as always, is appreciated.

  • Strength: Strength will affect the melee damage done by the player, as well as the armor rating of the player. 
    • Melee Attacks: Melee attacks will do more damage than basic ranged magic attacks because it is more dangerous being up close and personal. Melee damage will scale by a percentage based on the base attack value. When a point is put into Strength, the base value will increase by 1, and the bonus damage will be increased by a small amount, like 25%. So, if a level 3 player has put all his points in strength, he will have a base value of 6 (3 for being level 3, 1 point that is given as a freebie at the start of the game, and 2 for leveling up), and his damage will be 10 (6*175%, 25% for each point spent in Strength... notice I'm rounding down). If I have time at the end of the project, I would like to add in special abilities, namely an Area of Effect attack like Whirlwind or a knockback attack.
    • Speed: Speed determines how fast the character will move. Unlike melee attacks, speed will not be rounded, because in Action Script 3, the language I am coding in, changing a speed value by even 1 is a very noticeable difference. Like melee attacks, base speed will increase by a small amount every level, and when the player chooses to put a point in Strength, the character's overall speed will be increased by a small amount.
  • Magic: Magic has two forms of use- a basic magic attack that acts as a mid-range attack and a spell-casting component based on mana.
    • Magic Attacks: Magic attacks will allow the player to attack from a distance, at the sacrifice of a higher damage yielded from leveling strength. Like melee attacks, putting a point into magic attacks will increase the base value of its damage by 1 and scale the damage by a small percent. Magic will be rounded down to the nearest whole number.
    • Mana Pool: Putting a point into Magic will increase the maximum mana a player can pool, which is used to cast special spells. This will not be scaled by a percent. 1 point into magic may increase the mana pool by 5 or 10 per level.
    • Spells: By investing in magic, the player is sacrificing direct damage for ranged attacks and special abilities. Magic will allow the player to cast a few different spells that will draw mana from the mana pool. The spells category is probably the least fleshed out concept so far, as this is technically an optional addition to the game. The difficulty of this section is the addition of sprites I would need to create in the already limited amount of time I have. My plan is for every x number of points in the Magic stat, the player can choose a new spell to learn from a small selection.
  • Armor: Armor has two different components that reduce damage when leveled up.
    • Armor Class: Armor class will directly reduce incoming damage when the player is hit. This effect is passive- it always works, and it always on. Armor class is the only sub-stat that starts at a base value of 0 (meaning damage is not reduced when the player is hit), and only gains value when the player invests a skill point in it after leveling up. The way AC works is if the enemy hits the player for 8 damage vs the PC's AC of 3, the PC only takes 5 damage.
    • Chance to Block: The player will have a defensive option to block while in combat. Toggling the block feature activates the ability for a short time, rendering the PC unable to attack for a short time while he "focuses on defending" (probably a 1 - 2 seconds.) While toggled, the player will have a chance to block 100% of the damage from incoming attacks. The block feature is The Cycle Begins Again's escape function, kind of like a teleport. Chance to block will start out around 10%, and will probably increase by 5-10% / level (I may make it 10% at first, and between 50% and 75% make it a 5% increase / level, make a 75% chance to block the cap.) After a little research, it looks like AS3 provides multiple ways to produce random numbers... I'll have to do a little research and see if there are any differences between methods.
  • Vitality: Vitality will make the player live longer, and regenerate mana and HP faster.
    • Hit Points: Hit points, like any game, is the amount of damage the player can take before dying (and, as Tyler pointed out the other day during our planning session, I have no idea what I am doing for lives). I think I am going to keep hit points as a whole number, rather than play around with decimal places, just to keep it nice a clean (again, note that I am rounding the damage done). Hit points will have a base value and will increase by a constant rather than a percentage (this may change). If the player has 10 hit points and levels up, they would gain an additional 10 hit points for leveling, then another 10 for a total of 30 HP if they chose to put their skill point in Vitality.
    • HP Regeneration: HP regeneration will be the rate a player recovers HP after taking damage. I will probably put a timer on it so it takes 5 seconds to start regenerating after taking damage. HP regeneration will be a bit more tricky code-wise, so the compromise I have come up with involves a couple extra variables, and will involve research in timers for AS3. Until I have a little more solid idea of how I am going to do the coding for the HP Regen, I am going to hold off on details
    • Mana Regeneration: Mana regeneration is the rate the player recovers mana after casting a spell. Unlike HP regen, I probably will not link mana regen to a timer, so as soon as a player casts a spell his mana will begin regenerating. Mana regen follows the same coding concept as HP regen, so like I said before, I'm not going to get into it right now.

I've got a bit of a concept for the Char Stats screen as well, but that is pretty far off and a low priority right now. I found out I can rent the Adobe Flash software for $20 / month, so I will probably invest in that for at least a couple of months, which will buy me some extra time to work on the project from home, rather than only in-class time (which would simply not be enough for this project.)

                                                                                                                                                      
Question from Anon:Interesting behind the scenes! Not sure the magic has a purpose yet. is it worth it or just a detour?
Answer:Let's do some pretend numbers here: If the screen size = 10 units, and melee attack let's you hit an enemy from no further than 1 unit away, a basic magic attack may allow you to attack your opponent from 5 units away, allowing the player to "kite" their opponents (aka shoot, run backwards, shoot, run, etc...)
The other thing the magic category will have is its spell selection, which will give the player some AoE capabilities, as well as stun, or DPS spells to fight bosses. So even though a basic magic attack has a lower dps value vs a melee attack, the idea is for it to make up a bit of the firepower through the use of spells.
                                                                                                                                                      

Level Up Code Example
Unfinished code segment. This would likely be a method call as well, but this is the concept I'm going for! The language used below is ActionScript 3.0
final var BASEXP:int = 1000; (This is the base XP value, which doesn't change)
var levelUpXP:int = BASEXP; (levelUpXP is the value the player must hit to ding!)
var playerXP:int = 0; (The amount of XP the player currently has)
var levelIncrement:float = 1.00; (The percentage we will scale the levelUpXP by to make levels more difficult to attain)

So, to put some fake numbers in to give a better insight: 1) if our PC's experience exceeds the amount needed to level, then 2) set our PC's XP back to zero, 3) make the level XP cap 50% higher, and 4) set the value of the level XP cap to the proper amount.

1. if (playerXP >= levelUpXP) {
2.  playerXP = 0;
3.  levelIncrement += .5;
4.  levelUpXP = BASEXP * levelIncrement;
}

If the player was leveling from level 1 to level 2, then his XP would be set back to zero, levelIncrement would be 1.50, and levelUpXP = 1000(BASEXP) * 1.50 = 1500. The PC would need to get 1500 XP to go from level 2 to level 3, and would need an additional 500 XP every level under this code block.


1 comment:

  1. It sounds pretty good C0ffee! Can't wait to see more :)

    ReplyDelete