Pages

Friday, October 26, 2012

Status Effects, Art and Music

I think I'm finally starting to get back in the groove after my break; I was getting good work done during my last update, but I've really picked up the pace in the last couple of weeks. So here's another status update, and this time it's a big one.

First of all, we now have status effects!


They're visible in the bottom right corner of the main menu, where all the placeholder status icons used to be. As you can see from that screenshot, it's a scrolling window now, meaning you can move the cursor over to it and see however many status effects you're affected by.

Not only that, but I've also re-worked the Summary menu help window to look a little cleaner and function with the newly implemented status effects, giving you some pretty detailed information about what's going on.




This was actually quite a bit of work. If you've ever used RPG Maker, you know it doesn't actually support storing all of this information about status effects anywhere. To get this to work, I've actually implemented a completely different system to handle the game's status effects.

A base class defines all the common features of status effects - applying/reappliyng/removing/etc. , as well as their interface.


Each effect is then represented by a class that inherits that, which can then have whatever behavior I want it to have, and hold whatever information I need it to hold. The fact that I can no longer edit them from VXA's database is a small price for the huge amount of flexibility I get with this.


The following effects were implemented:
  • Flatfooted
  • Prone
  • Fatigued
  • Exhausted
  • Nauseated
  • Asleep
  • Dazed
  • Stunned
  • Fascinated
  • Blinded
  • Deafened
  • Entangled
  • Shaken
  • Panicked
  • Paralyzed
  • Unconcious
  • Dying
  • Dead
  • Haste
  • Slowed
  • Ability Damage (Strength, Constitution, Dexterity, Intelligence, Wisdom and Charisma)
  • Disease (Red Ache, Shakes, Mummy Rot, Mindfire and Cackle Fever)
  • Poisoned (Aranea Venom, Huge Spider Venom, Colossal Spider Venom, Ettercap Venom, Arsenic, Giant Wasp Poison, Phase Spider Venom, Black Lotus Extract, Epic Wyvern Poison, Id Moss, Striped Toadstool, Chaos Mist and Ungol Dust)

These all include most of the various special D&D rules regarding combat behavior while under these effects, such as not being able to Run while Fatigued, and Ability Damage recovering slowly every time you rest.

I haven't implemented every single disease and poison effect in the D&D3.5 SRD because for the most part, I think it's unnecessary (there are dozen and dozens of them). I've included at least one affecting each base ability score, so they all have their own specific purpose. I might add more later if people really think it's necessary, but for now I think a handful of each type should be more than enough.

One other interesting thing to point out, which I realized while developing this whole system for status effects is that in general, the duration for any given effect varies based on how it was caused. Spells, for example, have a duration that's usually based on the caster level of the unit casting it. On top of that, there's other things which can modify it, like Metamagic. So I need some way of saying "by the way, this Haste spell has Extend Spell on it and lasts longer than normal!".

Thankfully, there is an easy way to do this in Ruby, though it requires a little bit of work to setup. Thanks to this post on StackOverflow, I've found out that you can actually model enums as objects in Ruby and use them to represent bitflags. So I can write something like this:


Then all I have to do is pass this around, if say, I want to have a spell with Empower and Maximize on it:


And checking it becomes trivial:


This makes handling all of the various possible ways status effects can behave actually fairly easy. That's about all that's been going on in that front. After wrapping up status effects, I resumed working on the combat system and started filling out all of the previously unimplemented actions. All of the following are now available in combat:


  • Aid Another. Minor change: all Aid actions have been fused into a single action. This means that whenever you "Aid" an ally, they gain both the AC bonus and the attack bonus. Additionally, if they're Asleep or Fascinated, those status effects are removed. This helped me get rid of the clutter from the combat action menu; three different Aid actions was too much.
  • Trip
  • Disarm. Minor change: when a unit is disarmed, their weapon automatically gets returned to their inventory, rather than being dropped on the ground per PnP rules. This means the target can re-equip their weapon after being disarmed, though it will use up their action for that turn.
  • Coup de Grace
  • Feint. Minor change: any unit that attacks the target gets the bonus, not just its user. The effect still disappears as soon as target is hit, regardless of who hit it.
  • Total Defense
  • Run
  • Charge
  • Bull Rush

With status effects available, most of these were fairly straight forward to implement, with a coupe notable exceptions: all the actions that depended on moving in a straight line (so Run, Charge and Bull Rush) required a little more effort.

The problem comes with how I've been handling movement so far. Until now, I've been using a modified version of Dijkstra's Algorithm for path-finding, which works out really well for a tile-based engine like RPG Maker, because a network of tiles can be easily represented as a graph. It's great whenever you need to find the shortest path from A to B, while avoiding any obstacles (i.e. impassable tiles, tiles occupied by enemies, etc.) on the way. It's not very good at straight lines, though.

How would you use it to get the tiles represending a straight line from any given tile to any other tile? The algorithm explores the surrounding tiles in a breadth-first fashion.

The thing about straight lines is that - outside of directly going in one of the 8 directions - it's actually non-trivial to figure out what the "straightest" straight-line path is from any tile to any other tile. So I needed to come up with a way of mapping any straight line, in any direction or angle into actual tiles. Turns out Bresenham's Line Drawing Algorithm is perfect for doing exactly that.



So I wrote a second path-finding algorithm based on that. Given any two tiles, it will find the most optimal way to turn a straight line between those tiles into an actual walk-able path of tiles, then check whether that path can be traversed. The only minor wrinkle in it is that the algorithm was originally created to draw pixels on a screen, and you generally don't care about in what order that happens, so sometimes it gives you the list of points out of order, depending on the slope and direction of the line.

I do very much, however, care about order when walking on tiles in a path, so I've had to make some minor adjustments. Given some fairly simple changes, though, the whole algorithm works out quite well.

Finally, I've made a few changes on the art & design front. First of all, I've simplified a few areas of the game by getting rid of the Grapple mechanics (I think it's unnecessary and most people hardly every use it), the ability to run away from battles (Save often!) and I've halved the range on all ranged weapons.

That last one takes some 'splainin. The thing with RPG Maker that annoys me the most is the incredibly tiny resolution you're limited to. Since I'm essentially making a tile-based SRPG and measuring distances in tiles, this means I have a fixed amount of the game's coordinate space I can ever actually display on screen.

The means that even though some distances make perfect sense in D&D, they're actually really large when you move them to RM. For example: ranged weapons have 3 (roughly) important ranges: 30ft (hand crossbows), 60ft (shortbows) and 100ft (longbows). If you represent each tile as 5x5ft, those turn into ranges of 6, 12 and 20(!) tiles away, respectively.

If you've ever made a map in RMVX or VXA, you know that's a lot of tiles. For the sake of comparison, you can only actually fit a region of 20x15 tiles on screen at any given point. So a longbow would always be able to reach anywhere visible on screen, and then some. That's way too much. I can't ever imagine having combat maps which are big enough for that to actually be relevant. So I've decided to half all of those ranges, bringing them down to 15/30/50 ft - or 3/6/10 tiles, respectively.

I think that's a much more reasonable scale. If you've ever played Final Fantasy Tactics, you'll recall that ranged abilities also had 3 major ranges: 3 tiles (wave fist, most sword skills, other melee ranged abilities), 5~6 tiles (bows, magic) and 8 tiles (guns). I think that's a fairly good scale.

Last, but definitely not least, the game finally has a logo and a title screen, thanks to Archduke on the RPG Maker Web Forums:



Speaking of RMWeb, I've also joined their Game Making Drive. I'll be posting daily updates in the Drive forum thread:



GO TEAM RALPH!

Aaand, that's all folks. Stay tuned for more updates. For now, I'll leave a hint of what I'm working on next:




Monday, October 15, 2012

A Break, more Combat Updates and...Art?

So, in the last couple of months I've taken a bit of time off to sort out various issues that prevented me from having quite enough free time to keep working on the project at the pace I had during the summer.

In the meantime, I took what time I had and decided to use it to go through other games similar to this project and sort of compare notes - see if there's anything I hadn't planned for or had forgotten to address. I did actually end up coming up with quite a lot of extra notes, but I don't want to quite post out here what they are yet until I'm ready to start working on them, which should happen after combat is mostly finished.

That time is mostly over now, thankfully, and I'll be getting back to work on this very soon. In fact, speaking of combat, I have a few extra updates to showcase since the last post I made.

First of all, I've completely overhauled the visuals. It now (hopefully) looks like a proper combat system, rather than a bare-bones tech demo.


There's now a combat log in the bottom right, which displays some basic information about all actions in battle, and the portrait windows should now be easier to read. In addition to cosmetic changes, I've also implemented several of the basic combat mechanics:


Characters can now use most forms of movement, including the basic move action, 5ft steps and the withdraw action. The blue set of tiles displayed is the character's basic movement range, while the yellow set of tiles are the squares they threaten.

Any unit walking within those yellow tiles will trigger an Attack of Opportunity, which has also been fully implemented. Units' threat ranges vary based on what weapons they currently have equipped.

As you can see from the screenshot, attacks have been implemented as well, both in the form of single attacks and full attacks. These all correctly handle two-handed weapons, dual wielding, double weapons and ranged weapons.

I've also implemented a basic targeting system. Each action that can be performed in battle has a particular type of targeting. The targeting system allows actions that target not only single tiles, but area effects in various shapes, such as circles, cones or lines of tiles. This will be more relevant once spells are implemented.

Combat can actually be finished now, so you could say this is the first time the game has an actual proper combat system. Experience is awarded based on the difficulty of each opponent defeated and split between the player's party. Additionally, enemies have their own inventories, and you automatically obtain everything they were carrying at the end of combat.


I've also added a few nice details to make the combat feel smother, such as a damage preview window whenever a player unit targets another unit with a hostile action. This way you have some idea of whether it's worth it to perform a given action before committing to it.

And that's all for now! Next up, I'll be implementing status effects so that actions like bull rushing and tripping are possible, in addition to the obvious applications, such as the ability to poison enemy units or buff allies.

I'm also looking into changing the game's art style into a more grainy, old school 2D western RPG type feel (think Ultima Online), provided I can get the support of an artist willing to put in the work.




I can't say anything for certain about that quite yet, and even if I do make the change, it won't happen for a while, but look forward to further news on that front in the future!