Back to RPGLib again

Hello world!

The last few days, there's been a structure spinning around in my head. It's probably a little too heavyweight for most games, but I think I've seen an interesting way for an RPG-style battle system to work. This is inspired by the RPGLib I tried writing years ago, but streamlines and with some of the issues worked out.

Would appreciate any feedback :)

Basically, rather than ResolveNextName actually running a command, it just stuffs the command and all the resolved parameters for it into a list. Each entry in the event list basically holds an object (the player in this case), an action (the command), and a bunch of parameters.

In this system, FinishTurn loops over any active NPCs, and they also return an action, which is added to the same list.

The list of actions then goes through a number of phases. The actual list of phases is flexible. For the test game I'm building, I've got:

  • turn_start
  • choose_action (for NPCs)
  • choose_target (for NPCs)
  • determine_hit
  • determine_damage
  • apply_damage
  • battle_consequences (check if the character is dead)
  • npc_movement
  • output_phase (display the results)
  • turn_end
  • sync

If a command can be used during combat, it can have scripts which are run on any of those phases, as well as metaphases (such as "after_apply_damage"). Status effects (represented by turnscripts) are also grouped into the same phases. So, for example, if you have a magical item that automatically heals you from an attack that would have been fatal, it could run on the phase "after_apply_damage" to heal you again if your health is below zero; so it happens before the consequences phase.

Equipment/clothes can also have scripts that trigger in a given phase when you're wearing them.

Basically, this means that a status effect or magical item can trigger at any point during the turn, between other effects.

(Note: 'classic' turnscripts that don't have the extra flags will fire during the "sync" phase, mimicking the behaviour of Quest 5.7.x. This lets you use them for stuff like a stacking system, graphical inventory, disabling object links for objects that have gone out of scope, and so on. These things don't need to be run more than once regardless of how many actions the player does.)

In the event that no combat is in progress, the sequence would instead be the simpler:

  • turn_start
  • choose_action
  • npc_movement
  • script
  • turn_end
  • sync

This means that NPCs who aren't in the current room can still move around, and the player can do non-combat actions, but "every turn" turnscripts still run. This also means that ongoing status effects can still run, but it's easy for them to behave differently depending if it's a combat turn or not.

So like when the player attacks an NPC, the engine checks for a determine_hit script to decide if the attack connects or not. It will look for a determine_hit script on the player, any status effects that currently apply too them, the command, and the battlesystem object (which basically does the default, by looking if the command has an accuracy modifier and rolling dice). And it looks for wield_determine_hit scripts on the player's weapon (if applicable), equip_determine_hit on their equipment, and target_determine_hit on the orc (and any status effects on it).

Most of these scripts won't be there. But because they're checked for, making a status effect that kicks in at any of these points is really simple. And because the "default" calculations (for when a specific weapon doesn't do anything weird) are all in the battlesystem object, it's easy to adapt for different rules. You can have a simple battle system, or a more complex one, and have more or fewer phases as necessary. The only hardcoded ones in the library will be script (for non-combat actions), turn_end (for legacy turnscripts), and sync (which is a little bit special because it ignores SuppressTurnScripts())

So… what do you think?


Sounds exciting, I am curious about the test game


The test game that I'm looking at was actually a remake of an existing game; which has something of a cult following, but clearly wasn't developed by someone with programming experience; and it seems that some of the reviews are left by people who have problems with the web player (especially the save/load system) as a result.

It looks like I might not be able to do that now, as the official webpage for the game is a massive forum thread, and it seems that on page ninety-something, someone else has taken over as the official maintainer. Wouldn't want to step on their toes.

Still, I might try to get my RPGlib built.


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums