How to build RPG battle systems
gameattic
Member Posts: 17
Hey everyone, just wondering if anyone has started prototyping battle systems for rpgs such as turn based ones ala final fantasy and action ones like secret of mana
and if they have tips and tricks for implementing this. It seems alot of people want to create rpgs but im sure there are others like me who dont really know how to implement and rpg battle system.
any suggestions are welcome even if they haven't been tested
thanx!
and if they have tips and tricks for implementing this. It seems alot of people want to create rpgs but im sure there are others like me who dont really know how to implement and rpg battle system.
any suggestions are welcome even if they haven't been tested
thanx!
Comments
Well, at this time, given what has already been said in your other thread:
http://gamesalad.com/forums/topic.php?id=2763
I would say that currently, I would define a generic creature actor that you can populate with various attributes (i.e. characteristics such as strength, resistances, modifiers, movement/speed, body item slots, etc.). If there are generic behaviors/rules (i.e. hit tests/saves, stat checks, etc.) you can think of, stick them in this actor too. Reason being, once you have a lot of that in a generic actor, you can copy it for each specific player type, NPC, beast and change the attributes accordingly. So keep that in mind if you attempt an RPG.
Since actors cannot currently message each other (i.e. pass instructions to or query each other), you will need a whole slew of game level attributes to pass values between actors who interact with each other (such as a fight, buy/sell, whatever). The game attributes will be a middleman (which really adds complexity). This may require multiple sets of some game attributes for many-to-one fight scenarios or limiting the fighting to one-on-one.
When outfitting a player from the start, in a shop, or finding loot, you will likely need to store in actor attributes the item strength/value used to determine its effectiveness (i.e. hit possibility for weapons, restore amount for potions, etc.), its speed (i.e. swing speed, cast speed if the item can do magic, consumption speed, whatever), its name (if you want to allow character inspection), any modifiers (but I would limit this and roll it up into the strength/value attribute to make things easier). You'll probably run into some more items to add. You cannot really just store an item ID in an actor item slot and keep the item's characteristics within itself because the actor possessing the item would have no way to query the item's stats (unless you use some sort of communications semaphore/lock...see example below). Easier to store things in the actor possessing the item (which is related to the actor coming into possession of items in the first place). Without some arrays (preferably associative/key-value) to store traits/characteristics, items, etc., things get a bit unwieldly.
Oddly enough, I think action combat would be easier. You could use the timers quite a bit to allow attacks based on attack speeds of the actor and/or their weapons/spells. You would probably tie the weapon actor (for testing collision) to the actor who is wielding it. You could spawn spell area-of-effect actors to determine who gets affected.
Turn based combat would be, at first thought, probably rather hard to implement unless you do some crazy logic like make interactions based upon discreet sub-scenes in a scene and each actor in the sub-scene registers (i.e. manually set in scene design) in a set of game attributes. These attributes would contain unique sequential values that could be used with a "game.timer%number_of_actors_in_sub_scene" and each actor can attack on their time slice or something. This would be hard to tie into weapon speed/cast speed (it would make it quite a bit more complex). You would think you could define some game level semaphore/lock attributes that each actor could claim when attack starts and release upon attack completion but I have had timing issues with trying to share a lock/semaphore amongst multiple actors. I don't think contention is manageable in the GS execution pipeline. A character using its own attribute(s) to keep track of its own state works but lock attributes shared amongst multiple actors seems to be iffy at best currently. Once thing I wanted to retry (but my first test was a messy tacked on test) would be lock attribute(s) that increment upon each action (i.e. if it contains 1, its default value, beast starts attack, when beast finishes attack, set it to 2, when 2, the player knows it can attack, when player is done attacking, set it back to 1 or something similar...this of course would get more complicated if more than one-on-one fights were allowed - that would add more numbered states or an additional lock attribute per beast encountered in the battle).
I think some additional game level attributes would be used to control game state such as "InFight", "CollectingLoot", etc. that would be triggered by collisions. The values would then let the actors know what to do next.
Additional thought: to vary beasts up a bit, they could spawn their own weapons from a random list of a few weapons they would like carry. This would be akin to how spells are handles but the spells could vary with each use rather than once likely for a weapon per actor instance.
I'm sure if you sat down and really thought about it, you could come up with some reliable mechanisms probably even better than what I have quickly thrown about in this post.
The key thing is to make sure it is doable before proceeding with the artsy stuff. ;-)
awesome post really got me thinking as to how to implement something like this in reality and not just in my head yeah i think you're totally right about figuring out if its doable first before doing all the work on the art and graphics.
I hope others are working through these problems as well as i'm sure many are wanting to build rpg's for the iphone like me.