Archived

This topic is now archived and is closed to further replies.

How to represent abnormal states in RPG/SLG type games?

This topic is 5046 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I would like to ask you guys here how to represent different abnormal status occured in RPG/SLG type games? There seems to be a lot of possibilities such as hardcoding all the abnormal status in the player template. Another method I can think of is using an array to store all the index into a look up table. Both of them have good and bad sides. Hardcoding is easy to understand in the source code but everything is fixed. Index into a look up table is easy to maintain a change in game rule but a bit difficult to map those indexes. Or there are any other common practice that used? Thanks for your kind patience.

Share this post


Link to post
Share on other sites
do you mean the status effects like "poisoned", "stunned", and such? i''d make it a index into an array of "status" objects somewhere, where each of those has a duration and effect script. so the "poisoned" one would last for 10 turns, and take 2 HP per turn, or something. i don''t understand what you mean by difficulty "to map those indices"?

of course that might be overkill if you only plan on having certain effects, the number of which you know before writing any code (i.e. the standard "dead", "poisoned", "stunned", etc from all the old RPGs)...

Share this post


Link to post
Share on other sites
Thanks for the above opinion. This is what I am looking for.

Besides, how to let game and level designers to match those indexes with those scripts in database (may be just a file) and in the game interface?

What I come up with is, create a tool to map the index and the self description strings hardcoded in the status program. Is this is common practice?

Share this post


Link to post
Share on other sites
Why map indicies at all? You could use an std::map that associates strings->strings such as the name of a status to the script file for it. If there was a global list that maps the statuses to their scripts, each player could have an std::set that stores the strings of which statuses the character has and you could iterate through them looking each up in the map and then running that script.

Share this post


Link to post
Share on other sites
A more direct approach might be to have a abstract superclass called Status, which has a virtual method like this:

void Status::ActOn(Target);

then when a character aquires a state, you create an instance of a derived class:

class Poisoned : public Status {...}

and its constructor recieves the parameters of this instance of poisoning. Then the pointer to a list of status pointers in the character class.

this will be fast running (w.r.t. scripted solution), and expandable, but it will be hard to deal with things like inter-status relationships (like, stunned and berzerk cancel each other out)

George D. Filiotis

I am a signature virus. Please add me to your signature so that I may multiply.

Share this post


Link to post
Share on other sites