Saturday, July 26, 2014

JRPG Combat

I'm finally knee-deep in the combat section of my next book "How to make an RPG". The book takes the reader from nothing to an old school Final Fantasy 6 like game. This is a bigger task than I first anticipated but things are going well!


Adding combat, still struggling to find a good gif solution on mac. Note: All art assets are placeholder.




In the last post I had a Combat Table of Contents like this:
  1. Intro
  2. Stats
  3. Levels
  4. Party
  5. Equipment 
It's currently like this:
  1. Intro
  2. Stats
  3. Levels
  4. Party
  5. Equipment 
  6. Combat Flow - creating an event queue
  7. Combat State - basic layout for the combat state
  8.  Combat Action - putting the last two pieces together with animations and more UI
Each section of my book ends with a little game. In the combat section you'll start off in small room like below (this is all horrible placeholder art). Once I have all the examples functional I'll hire and artist to make things prettier.
You can talk to the NPCs and recruit them to your party. The chests are full of equipment you can equip for your party members.

It's all pretty similar to the Final Fantasy or Dragon Quest games.

Once you're tooled up you can enter the big door at the top (my excellent programmer art skills have used many small doors to make one big door.) Then you get into combat.


Note that the enemy sprite has been stolen from FF6, that is also placeholder. As well as the background; I don't even know where I found that. This is where I am at the moment, combat is entered, the first party member is prompted to take an action and I need to finish implementing the Selector state to let you choose which enemy to hit.


There's a lot of detail involved in JRPG combat, the base is the event queue which controls when  events take place (attacks, spells, player command prompts etc) but there's also a lot of state information for each character :

  • Are they casting a spell?, 
  • What animation should they be playing?, 
  • Did they just die? 
  • etc 

Then there are animations and special effects. Also a way is required to select enemies and allies in order to direct an attack or spell. There's also loot and exp tracking. The general UI flow;  presenting players with a party member's combat commands or displaying the inventory. There's a lot to cover!

The next immediate tasks are selecting an enemy to attack, adding the add event to the event queue and having it play out. Then doing a very simple attack calculation and applying it to the enemy. Then fleeing, then items, a more complicated attack calculation and finishing up with some simple enemy AI.

No comments: