Is there a limit on attack/defence points and level?
In principle one ultrasimple way to go is to write, if AP is the attack points of the attacker, DP is the defence points of the defender, LA is the level of the attacker and LB is the level of the defender,
BasicAttackValue = (AP+LA) - (DP+LB)
So this formula scales linearly with level and attack/defence point values. I have no idea how you intend on 'levelling up' but this allows you to implement a simple way of scaling all of those variables.
Now if health is then capped out at 100 the easiest way to balance this is by just 'normalising' it by dividing the whole thing by some constant that balances the overall damage dealt in the game to some reasonable level that you think is appropriate.
So you end up with,
HPLost = (AP + LA - (DP + LB))/NormalConst
Now, an alternative strategy is one involving randomisation, where you generate random 'attack roll' and a 'defence roll' values. For example, in a near D&D-esque strategy you may write:
Attacker rolls to generate a number between 1 & 20, call it r1. Defender rolls the same 'die', generating r2.
IF r1 > r2 damage is dealt.
(you can also add a critical hit criterion here based on r1 = 19 or 20 or a critical failure in r2?)
To generate damage you could write something simple like Damage = (AP - DP). If you want to add levelling in as a modifier you could say Damage = (AP - DP) + (LA - LB) which is the same statement used above in the first example. Again consider a normalisation constant in this calculation for balance.
ELSE
so if we're here then the attack roll was less than or equal to defence so no damage is dealt, the next round (or other general effects from your attack may still be dealt?) can continue.
End If.
Of course this may not actually be appropriate to your levelling system. More detail is needed, but this is just a toy strategy for you to work with. For example you could consider adding direct modifiers to the attack and defence rolls based on level or the number of AP/DP.
/latenightbrainfart.
EDIT: preferable to writing a whole new post
