Isometric combat system suggestions

Started by
2 comments, last by LorenzoGatti 8 years, 8 months ago

I'm currently working on a isometric Diablo style game and I want to start implementing the combat. The combat the basic magic, melee and ranged variety with players being able to add modifiers to attacks. While I have the image in my head, I cant figure out a sound implementation method. I have some ideas and would like to hear peoples opinions on them.The "engine" I've built is Entity-Component system.

The implementation for ranged and magic is a lot more clear in my head: create entity with collision, movement and any special (timers, AI etc.) components. My collision component stores function pointers to resolver functions that just apply different effects (heal, damage etc.), so when collision does happen I just go through the vector and call them one by one. If its a special projectile, like a bomb, it would trigger a different function that creates an explosion entity.

My problem with melee is that movement of the weapon. Should I just define a set path of motion for the entity that is create and have it follow the path or somehow tie it into the animation? Aside from that it should be the same, right?

I know this is very hand-wavy and unclear, but I've been struggling with it for a week. If anyone can offer advice, suggestions or a specific methodology it would be great.

Advertisement

Should I just define a set path of motion for the entity that is create and have it follow the path or somehow tie it into the animation? Aside from that it should be the same, right?

You should tie it to the animation. When I create animations for a character, I have special bones (marked by a naming convention) where I connect items ingame. So, in game you update the animation of the character first, then you get the position of these special bones and move/rotate your linked item there.

Here's some simple pseudo-code to handle the dependencies:


void entityUpdate( tick) {

  // check first, if entities has been updated already
  if(tick==m_lastTick) {
     // done
     return;
  }

  // remember last tick/time
  m_lastTick = tick;

  // linked to other object ?
  if(isLinkedToOther) {
    // update parent first
    getLinkedToOjbect().entityUpdate(tick);
  
    // move this item to orientation of parent object
    setTransform( getLinkedToObject().getTransformForBone(LEFT_HAND_BONE));
  }

  .. do other stuff
}


Should I just define a set path of motion for the entity that is create and have it follow the path or somehow tie it into the animation? Aside from that it should be the same, right?

You should tie it to the animation. When I create animations for a character, I have special bones (marked by a naming convention) where I connect items ingame. So, in game you update the animation of the character first, then you get the position of these special bones and move/rotate your linked item there.

I'm probably going to be using sprite based animation instead of 3D. I guess I going define bind-points on each frame and use those, right?


I'm probably going to be using sprite based animation instead of 3D. I guess I going define bind-points on each frame and use those, right?

You might need different character animations for different weapon strikes, even if you draw the weapon itself separately.

For example, a wide swing from left to right might be suitable for any polearm, but not for two-handed swords (hands are necessarily much closer) or one-handed shorter weapons like swords and axes (the other hand is swinging away for balance, holding a shield, etc.).

Omae Wa Mou Shindeiru

This topic is closed to new replies.

Advertisement