Excursions into XNA and Combat Simulations

Chris Haukap here. For the past few weeks I have been doing development on Kung Fu Kingdom’s combat prototype. Kung Fu Kingdom is a 2D strategy game set in the far east, complete with the usual assortment of martial arts movie stereotypes.The game will feature dynamic combat sequences that will be intense and fun to watch.

Because the player will not have direct control over their military
units (they will instead issue generalized ‘tasks’ that the units will
individually determine exactly how to implement), it becomes vitally
important that the simulated combat sequences be both fun to watch and just look great. To ensure these combat mechanics work out it
behooves us to fit in as much early prototyping and experimenting as
we can and perform many iterative cycles of design/implement/tweak.
Additionally this process will serve to identify potentially
game-breaking abilities early on (although it is no substitute for
gameplay balancing later in development) and will offer volunteers a
convenient and low commitment way to make valuable contributions to the Kung Fu Kingdom project.

The video below demonstrates what we have so far: opposing factions
doing battle against each other in a very dynamic way. Striking with their swords, dodging, chasing after their enemies and
of course performing special martial-arts moves.

The path finding and general combat was originally programmed by Steven Bilton and gave me a fantastic jumping-off point to dive in and program some special moves. We refer to the individual combatants as ‘agents’ (you will notice two different colors). Each will have basic attack/defense capabilities and can pull off a variety of special moves. The moves you will notice in the video are Grand Slam and Super Knockback.

The Super Knockback ability sends an enemy agent flying backward a
great distance where he may end up in a new skirmish with new enemies. An agent being knocked-back is marked with a ‘X’.

The Grand Slam ability allows an agent to punch the ground below
them causing a shock wave (the blue circle) that does a couple nasty
things to enemy agents:

  • knocks them off their feet (marked by a ‘X’),
  • stuns them (marked by a ‘S’) and
  • deals some damage.

Currently each agent will perform such moves randomly but we of course want to make the enemies smarter about the moves they choose to perform (choosing the move that is optimal for their given situation).

In the video above (toward the end) you may notice an agent in the
upper-right corner of the screen surrounded by enemy agents but
seemingly immune to these enemies’ attacks. This guy seems to have
mastered the art of dodging; weaving into and out of harms way and
between thrusting blades.

What’s going on here is the agent, after being targeted by an
attacker, has a 50/50 chance of dodging. If successful, an adjacent
location (free of occupying friend or foe) is selected to dodge to.
Once the agent has selected their target location, they spend the next
few frames moving there. While in this dodging state, they are
completely invulnerable. Under normal circumstances, the agent
reaches the target dodge location, and the battle commences. However, if the agent is unable to reach the destination (a side effect of being completely surrounded…) the agent never leaves the dodging
state and maintains invulnerability.

This is obviously an unintentional bug and poses problems because it
ties up fifteen or more enemy agents in a fruitless, unending battle.
However, it is interesting because it shows how a bug can lead to design ideas. One elite ninja taking on hundreds of lesser warriors is a
common theme in martial arts movies… and it is always neat to watch.
Perhaps we can leverage this idea and turn our bug into a feature by
putting a limit on exactly how quickly an agent is capable of dodging.
This “dodge speed” could then be adjusted depending on the experience or level of the agent doing the dodging.

You can imagine how interesting this combat sequence will look like
with actual art. I am very excited about the potential this game and
this group have. From what I’ve seen of the design, art & music this
game will prove to be fun to play and the combat fun to watch.

This entry was posted in Article and tagged . Bookmark the permalink.

Leave a Reply