Close Combat system in top down 2d rpg style game.

Hi guys,

I’ve got to the stage in my game development that I am starting to think about fighting!

things I think I need to take into consideration are:

Viewport locked to player character (he’s always dead centre, except when at the edge of the world).
Only 1 playable character but the player can ask friends (certain NPCs) to do things (like walk to location x/y). this is done by clicking on the friend in question then clicking somewhere on the map.
Interaction is context-based by right-clicks (i.e. click on an empty space and the player will walk there, click on an item and the player should pick it up, click an enemy and some sort of combat should happen).
The player will have 2 modes of attack - melee and ranged - and 3 sub modes - “rough up”, “incapacitate” and “kill” (for different intended levels of damage, no guarantee that you won’t kill with a rough-up attack).
Majority of combat will be 1-on-1, but lots-on-1 must be possible as a deterrent for the player to go to certain areas and for specific plot points.

The world is a medieval/fantasy style (yawn, isn’t everything these days??) and as such weapons available are going to basically be Stave, Dagger, Sword, Axe, Hammer, Bow and Crossbow.

I was thinking of a system based on skills with weapons (that get better with use) and balancing them against skills of opponents to work out hits, followed by a strength attribute which would modify a base damage provided by the weapon and finally, giving the player a toughness attribute (that could be increased with “armour”) would modify the amount of damage taken.

A quick code example:

double attackOpponent(Entity me, Entity him) {

  double myHit = Math.random()*100 + me.getHitRating();
  double hisDefence = Math.random()*100 + him.getHitRating();

  double damageBeforeMod, damageAfterMod;

  if (myHit > hisDefence) {

    damageBeforeMod = me.getWeapon().getDamageRating() * me.getStrengthMod();

    damageAfterMod = damageBeforeMod * (1 + 1/him.getToughnessRating());

  }

  return damageAfterMod;

}

BUT is this all a bit over the top for a simple top-down 2d game?

What would your suggestions be for this kind of thing? I did some searching online but it doesn’t seem to be a hotly discussed topic.

(p.s. it’s amazing how writing a post like this suddenly makes the code look really easy!).