Jump to content
  • Advertisement

Archived

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

Veron2

How to handle/design RPG event ???

This topic is 6918 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

Hello Everyone I''m newbie here, and I have a problem about event in RPG (i.e. when man talk to man2 and there is something happen, or when man walk to some position there is something happen but once ,or after fighting there is something happen , and all event happen once) if I desing it to state machine I will have a huge thousand states I try to search previos topic here but not found. Please advice me how to design event in RPG ..... how to keep all information about event ?? (words of people,item in ..., ...) Thank you very much .. Veron 2 Veron@rome.com

Share this post


Link to post
Share on other sites
Advertisement
I don''t know in what stage of the project you are, but I''m guessing design stage...

Maybe it''s a good idea to sum all things up you want to use.
In one of my previous games I implemented doors, enemies, objects(equipment) and other events with the folowing structure:

typedef enum
{
ELEMENT_TYPE_DOOR_LEFT,
ELEMENT_TYPE_DOOR_TOP,
ELEMENT_TYPE_DOOR_RIGHT,
ELEMENT_TYPE_DOOR_BOTTOM,
ELEMENT_TYPE_DOOR_ENEMY,
ELEMENT_TYPE_DOOR_EQUIPMENT,
ELEMENT_TYPE_DOOR_EVENT,
...etc...
}
ELEMENT_TYPE;

typedef struct
{
int iRoom;
int iCondition;
ELEMENT_TYPE eType;
int iX;
int iY;
...etc...
}
ELEMENT;

The condition is used if element is valid. For example:
- the player must have a key to open door.
- the player with a level below 10 gets enemy A.
- the player with a level above 10 gets enemy B.


Then I made a large list of "events".
When the player moved, I checked it''s position with those in the list.

Hope this is what you meant,
Bas.

Share this post


Link to post
Share on other sites
Generally your game plot will advance as a result of key ''events''. Is that the kind of thing you are thinking of? You can represent this generally with a load of flags (encapsulated in a ''progress'' or ''events'' class, if you like.)

Perhaps something like this:
bool completed_intro_area;
bool killed_green_dragon;
bool talked_to_bard_and_got_main_quest;
bool found_spell_book;

etc etc. 4 flags allows you to represent 16 states, essentially. If there are certain parts which progress in order, you can use an enum:
enum DragonQuest { NOT_STARTED, STARTED, FOUND_DRAGON, KILLED_DRAGON, RETURNED };

These flags and enums can easily be checked by other events to see whether it is time to fire them or not. When you want to check something that should only happen once, check the flag to see if it''s happened yet. If not, make it happen, and flip the flag so it won''t happen next time.

Individual conversations and mini-scripts you probably want some sort of scripting language for, which is called by your event and loops a line every second or so. That is a little more complex

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Hey you all I have a question .

- Kylotan sorry to this stupid question ,but
if I design a big RPG event then and use
your suggestion then I have many 1000 BOOL
variableS !!! ( although I use enum Dragonquest
it still have a big state)

- baskuenen , I don''t understand your condition
please show your example condition please ....
( when player level 11 what flag tell that meet enemy A or B ?)


Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster

Hey you all I have a question .

- Kylotan sorry to this stupid question ,but
if I design a big RPG event then and use
your suggestion then I have many 1000 BOOL
variableS !!! ( although I use enum Dragonquest
it still have a big state)


Well, if you''re worried about size, then 1000 bools isn''t much compared to your graphics If you''re thinking about complexity... well I doubt you''d need 1000 separate flags. I measure a game''s immensity by comparing it to my all-time favourite, Ultima VII, and I doubt they had more than 100 flags. Lots of stuff doesn''t need a flag, for example when you need a certain item (just check the inventory) or you need to kill a certain creature (just check if the creature is still alive). A common puzzle is the key-door type, and you need no flags for that either. You only need a flag when completion of an event is difficult to find out by some other means.

Either way, when you write your story, you might want to separate out the individual events and number them or something. That way, you can reference events in a predictable way, eg "Event 35: Encounter with Green Dragon. Will not occur if player did not meet Wizard (Event 12)." You will probably want to go back to Event 12 and write in "precondition for Event 35", to help keep track.

How to do this effectively is an interesting question. Perhaps making a flowchart of your game detailing major plot elements would help. Number these 1...n, then separate each sub part out, make a flowchart for that part, number them 1.1 to 1.n, etc etc.

Any other ideas?

Share this post


Link to post
Share on other sites
Hi All!

What about making your events part of the map? And then use a OOP approach to model it. For example you could have a tile class like this:

class Tile {
Terrain terrain; // reference to terrain type
Monster monster; // reference to monster occupying tile
Event event; // reference to event
}

When a character steps in to a tile where event is not a null reference, you do:

if (Tile.event.preConditions() == true) {
tile.event.activate();
}

And the activate method sets off a trap, shows a piece of dialog or a cut-scene or something. And possibly update a quest log, add or remove items from the characters inventory and so on.

The Event class would then be subclassed to give many different event types (ie. TrapEvent, EndOfLevelEvent and so on) which all shared the common method of the base Event class. Or maybe you would just have a single event class capable of doing all kind of events through some scripting.

Well, what do you think?

Regatds

nicba

[Sorry for all the editing of the message, just trying to make my code look better using some HTML tags. It didn't work]

Edited by - nicba on May 10, 2000 8:07:10 PM

Edited by - nicba on May 10, 2000 8:09:36 PM

Share this post


Link to post
Share on other sites
hello again .
nicba when you use
if (Tile.event.preConditions() == true) {
tile.event.activate();
}
Is the eventpreConditions() function
build in concept like Kylotan?
(check BOOL,flag)

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!