Fighting happens like this: every character in the game has limbs they can use to strike (they can have weapons, or be used bare).
== Weapon damage
When a character strikes, the weapon damage is computed based on the weapon used and the character's skill with it (the weapon may perform some checks or randomization of values of its own, and so do the enchantments on the weapon). This damage is under the form:
For instance, for an ice-enchanted iron katana:
(500,ice) (100,ice&iron) (300,iron)
== Base damage
Damage is then reduced or amplified based on the defender's resistance. This resistance is an association of the form:
For instance, a demon (immune to iron, vulnerable to ice) would have:
So the base damage inflicted by the weapon here is:
(500 * 2)+ (100 * 2 * 0.5) + (300 * 0.5) = 1250
== Inflicted damage
Once the base damage is computed, the actual fight algorithm enters into action.
The first check is the to-hit check: Attacker EQU/2 + RAP versus defender RAP / 2.
Increased concentration and speed help hitting the enemy, increased speed helps evading enemy hits.
The second check is the concentration check, to see if the attacker is being tactical or just bashing without thinking. This check is Attacker EQU versus Attacker BRU.
Increased concentration and low brutality help making good tactical decisions.
If the concentration check succeeds, the attacker attempts a tactical strike by checking Attacker EQU versus the enemy's 2*RAP.
If both checks succeeded, then the attacker inflicts:
10 * base-damage * random(1.0,2.0)
If one of them fails, then the attacker will simply perform a violent attack. These are usually less efficient than tactical attacks, however their strength depends on the attacker's BRU and the defender's STA statistics.
The attacker inflicts a base damage of 1, and then attempts a series of checks of his BRU against the defender's (STA/2 + Armor + Difficulty), where Difficulty starts at 0 and increases by 10 after each successful check. For each success, the attacker inflicts an additional base-damage * random(0.0,1.0), and this goes on until the attacker fails one check.
For violent attacks, brutality increases the damage you inflict greatly, while stability and armor decrease the damage received.
Luck also comes into account at each check. If you fail the normal check, but succeed at the luck one, then it is as if you had succeeded the normal check. If you succeed both luck and normal check, you make a miracle success and get damage bonuses down the line. On the defender's side, any succeeded luck check means immediate failure on the attackers side (no matter what checks he did).
I am currently working on the basic math behind the 4e4 entry gameplay.
There are basically two checks that will be used whenever you need to do something. They are:
- The linear check, which compares the value of an attempt (useful abilities and bonuses) against a difficulty (based on defensive abilities of the target and bonuses). Basically, if you have an attempt of A and a difficulty of D, the probability of success is (A - D + 50) %
- The luck check acts as a short-circuit in several situations. It is based on the hidden luck ability of the player, which can be increased by some items and spells. The initial luck stat is 0, it can increase up to 100. The test is, in fact, a series of Bernouilli attempts of success probability 0.01, one success is enough to pass the check. Therefore, the success table is:
I have decided to enter the GDNet 4E4 contest. I will attempt to create a roguelike game in Objective Caml, probably with ASCII graphics. It will feature Ninjas and Pirates as character classes, as well as Robots and Zombies as character species.
A quick brainstorming led to some "catchy" skill names for the characters, such as "Plundering Aura" or "Scurvynator" pirate skills, "Additional arms" robot special upgrade, "Thousand knives raging lightning storm rush attack technique" ninja technique, and "Spare Parts", "Climactic break-in" and "Vomit Maggots" Zombie attacks. And some more that I won't be mentioning (I have 18 skills for each of RZNP, total 72 skills).
My quick brainstorming also led me to creating four player abilities to replace the traditional "Strength, Dexterity, Intelligence" ones:
Brutality - The ability to deal huge amounts of damage to anything in your path, blindly bashing anything however hostile. You also become (obviously) less stealthy. Whenever you strike someone, your brutality increases (and returns to its initial value when you stop fighting), so a good strategy for Brutality-heavy characters is to always be fighting. Brutality is a main skill for Pirates.
Equanimity - The ability to keep one's concentration during a fight. Equanimity-heavy characters are able to strike with a very high accuracy and inflict high damage. Equanimity decreases as one keeps striking, so a good strategy here is to cease fighting and flee, only to return when one is concentrated again. Equanimity is a main skill for Ninjas.
Rapidity - The ability to move quickly, whether to run, to dodge hits, or to strike with a weapon. Rapidity helps for surprise attacks and for characters that do not want to get hit often. Rapidity is a main skill for Ninjas. Rapidity decreases when tiring actions are performed.
Stability - The ability to withstand hits, and not take too much damage from them. Stability is also required to be able to strike or move under straining situations (such as being hit by multiple opponents). Stability decreases as the character is hit.
Robots have natural Rapidity and Brutality, while Zombies have natural Equanimity and Stability.
Robot characters get bonuses from the many upgrades they can use on themselves (additional arms, increased ability values, and even the possibility to use hundreds of weapons at the same time). Zombie characters get much more resilient as they level up, and will be able to call on hordes of undead for help at the highest levels.
In the end, there are four possible character strategies here:
Pirate Zombie: A nearly indestructible, stupid warrior that, given enough time, will be able to kill just about anyone.
Pirate Robot: A killing machine able to kill anyone with one hit (of its six swords).
Ninja Zombie: A stealthy killer, with a still mind (or whatever zombies have for a mind) and able to relentlessly strike at maximum efficiency.
Ninja Robot: The fastest thing around, this martial artist runs, jumps, turns invisible, slices and dices.
For those of you who don't know me from the #gamedev channel, Shmup2 is the codename for my next PocketPC game. It's way behind the schedule I hoped for and I have to work a lot just to keep up with the milestones.
And on the other hand, we have SFL, acronym for "Some Functional Language", a small language I have to create a compiler for in my Compilers course at the ENS. So far, type-checking only works for non-function objects (that is to say, it's completely useless, since functions are first-order objects here), and recursive functions don't compile to correct intermediary code yet, let alone machine code...
Also to be done, an online highscore system for Darklaga : Cannonball Symphony. Not to forget all the homework in math and computer science and economy... oh my!
I think I'll spend half of my time coding Shmup2, half of my time coding the SFL compiler, and half of my time on IRC... I'll do the IRC part first ;)