Jump to content

  • Log In with Google      Sign In   
  • Create Account

How to handle/design RPG event ???


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
20 replies to this topic

#1 Veron2   Members   -  Reputation: 122

Like
Likes
Like

Posted 07 May 2000 - 01:16 PM

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

Sponsor:

#2 baskuenen   Members   -  Reputation: 122

Like
Likes
Like

Posted 07 May 2000 - 01:33 PM

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.

#3 Kylotan   Moderators   -  Reputation: 3338

Like
Likes
Like

Posted 08 May 2000 - 03:13 AM

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

#4 Veron2   Members   -  Reputation: 122

Like
Likes
Like

Posted 08 May 2000 - 12:29 PM

Thank you for your help !! baskuenen !!

#5 Veron2   Members   -  Reputation: 122

Like
Likes
Like

Posted 08 May 2000 - 12:33 PM

and thank you to mr. Kylotan !


#6 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 08 May 2000 - 09:07 PM

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 ?)




#7 Kylotan   Moderators   -  Reputation: 3338

Like
Likes
Like

Posted 09 May 2000 - 05:31 AM

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?

#8 Veron2   Members   -  Reputation: 122

Like
Likes
Like

Posted 10 May 2000 - 12:40 PM


Um...
Other question ...
in RPG games whick information we should keep in file ???

#9 nicba   Members   -  Reputation: 122

Like
Likes
Like

Posted 10 May 2000 - 01:05 PM

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

#10 Veron2   Members   -  Reputation: 122

Like
Likes
Like

Posted 10 May 2000 - 01:28 PM

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)


#11 Kylotan   Moderators   -  Reputation: 3338

Like
Likes
Like

Posted 11 May 2000 - 01:19 AM

Nicba, you won''t want all events to just be triggered on where you are. What about:

  • A wandering minstrel, who could be anywhere between 2 cities, walks over to talk to you,

  • When 2 certain objects are brought together, they summon somebody,

  • When a certain monster dies, a certain item is created


Etc etc.

#12 MadKeithV   Moderators   -  Reputation: 971

Like
Likes
Like

Posted 11 May 2000 - 01:31 AM

I wonder if it would be useful to build a kind-of tool to make flowcharts for stories, that are directly translatable into code?


#pragma DWIM // Do What I Mean!
~ Mad Keith ~
**I use Software Mode**


#13 nicba   Members   -  Reputation: 122

Like
Likes
Like

Posted 11 May 2000 - 01:07 PM

quote:
Original post by Kylotan

Nicba, you won''t want all events to just be triggered on where you are. What about:

  • A wandering minstrel, who could be anywhere between 2 cities, walks over to talk to you,

  • When 2 certain objects are brought together, they summon somebody,

  • When a certain monster dies, a certain item is created


Etc etc.


Hmmm, the wandering minstrel would be in some kind of ''no space'' because the game is broken up into different maps, sort of like ''Baldurs Gate''? Maybe I could make the ''traveling events'' be part of the ''Leave Area'' event in either (or both) of the two cities. Or simply don''t allow events while traveling between cities.

The ''combine two items puzzle'' event is harder. But it could be solved by letting events not only be associated with tiles, but also with objects. So each (important) object has a event which is fired when it is ''activated'' (like a potion getting ''activated'' when you drink it and boost the players mana ect.). These events on the objects would then also have pre-conditions requiring the user to be in possesion or have activated other objects.

Finally the ''kill dragon and release item'' event would not be an event at all. I think its somehow strange when objects just pops up from nowhere when you kill an enemy. Instead I would allow monsters to have inventories when apropiate and leave the contens of these inventories behind for the player to collect.

The reason why I so badly wants to have my event class is that I believe this is the proper Object Oriented way to go. And I also think it would ease the creation of the story and the ''interactivity'' of the game if the developer was not required to think so much in terms of a branching story ''three'' but could instead think in terms of ''events'' with distinct pre- and post-conditions.

Also I think building a world with events would be more intuitive because it could happend from inside the map/world editor. Here you could place and script events in the same way you would place monsters and obstacles, instead of having to write the story in a seperate ''authoring tool''.

Regards

nicba

#14 iwasbiggs   Members   -  Reputation: 122

Like
Likes
Like

Posted 12 May 2000 - 04:58 AM

For event keying, you might just want to have a single variable like:
long story_pos;

Then have defines for key events needed to be completed before the next:
#define TALK_TO_PARENTS 1
#define TALK_TO_VILLAGE 2
#define DEFEAT_BULLY_IN_BAR 3

and when the next objective has been completed:
story_pos++;

just check the story_pos somewhere in the game like when moving to a new room, the code to be executed after the room change might go like this:
if(player.room == BAR){
switch(story_pos){
case DEFEAT_BULLY_IN_BAR:
//blah move bully and have him fight you
story_pos++;
break;
}
}

Edited by - iwasbiggs on May 12, 2000 12:00:00 PM

#15 nicba   Members   -  Reputation: 122

Like
Likes
Like

Posted 12 May 2000 - 05:19 AM

quote:
Original post by iwasbiggs

For event keying, you might just want to have a single variable like:
long story_pos;

Then have defines for key events needed to be completed before the next:
#define TALK_TO_PARENTS 1
#define TALK_TO_VILLAGE 2
#define DEFEAT_BULLY_IN_BAR 3

and when the next objective has been completed:
story_pos++;

.....



It would make an incredible linear game if you implemented it that way. Then you have to do things in the order described by the story_pos and the #defines.

What if your player entered the bar as the first thing (s)he did (before talking to anyone). Then the bully wouldn''t attack you? And if you then left the bar and talked with the parents and the villagers and then re-entered the bar the bully would suddently attack you now?

I think the idea about using some sort of "incrementing counter" to keep track of the story would be too restrictive to create a more non-linear story where the player can go about different goals in the order they wish.

Regards

nicba


#16 iwasbiggs   Members   -  Reputation: 122

Like
Likes
Like

Posted 12 May 2000 - 09:44 PM

point well taken nicba. I also understand the problems with such an event sequencer.
However, depending on the game, linear may be all you need or want.
The single story variable is good for conserving space (instead of an array of 100 event objects) and also it seems that you *should* force the player to do some things before moving on. Otherwise you would have nothing but d&d on the computer (which makes it really hard for the designer to tell a story).

quote:

What if your player entered the bar as the first thing (s)he did (before talking to anyone). Then
the bully wouldn't attack you? And if you then left the bar and talked with the parents and the
villagers and then re-entered the bar the bully would suddently attack you now?



Perhaps you're a bad guy and you talked trash to your parents and the villagers about this 'bully' and now he wants to beat you up where he didn't before?

Of course the single variable storyline would have to be well designed to avoid sensless time wasting (like having to talk to villagers even though what they say will have nothing to do with the next objective).

In a final fantasy game, you often need to talk somebody else in order to 'fight the bully', I wouldn't be surprised if the designers used a hybrid of linear counter and multiple bools or event objects (thus depending on the objective completed you might increase or decrease the story variable).

Edited by - iwasbiggs on May 13, 2000 4:50:56 AM

#17 CodyVa   Members   -  Reputation: 122

Like
Likes
Like

Posted 12 May 2000 - 09:53 PM

How do you do scripts?

like commands maybe
movperson(person, here, there)
Speak(person,string)?
type stuff
with time delays in between?
I dunno.

#18 CodyVa   Members   -  Reputation: 122

Like
Likes
Like

Posted 12 May 2000 - 09:55 PM

Anybody make a flow chart sort of liek program I''ve been asking this group I''m in but they seem to ignore me?

Sort of like tree''s?
with comparison data?

Like compare such and such data
and have all the different scenario''s coming from it
like a tree type structure?
so you can see all the possible outcomes?
that would be really cool.

#19 nicba   Members   -  Reputation: 122

Like
Likes
Like

Posted 13 May 2000 - 06:00 AM

quote:
Original post by iwasbiggs

...and also it seems that you *should* force the player to do some things before moving on. Otherwise you would have nothing but d&d on the computer (which makes it really hard for the designer to tell a story).




I''ve adopted Kylotan''s idea of using pre-conditions to events to make it possible to force player to do something before he can do something else.

But the point about telling a story is good. It might make it easier to tell a really good story if you have more control on the flow of the game.

Maybe you should use a compromise and do event objects associated with tiles for things like traps and such, and a progress counter for the "big picture" storyline. Maybe you could spawn smaller progress counters for sub-quest and keep more than one of these progress counters in memory at once to allow for some quests to run in parallel?

Regards

nicba

#20 nicba   Members   -  Reputation: 122

Like
Likes
Like

Posted 13 May 2000 - 06:07 AM

quote:
Original post by CodyVa

Anybody make a flow chart sort of liek program I''ve been asking this group I''m in but they seem to ignore me?

Sort of like tree''s?
with comparison data?




There''s already plenty regular of flowchart programs out there. Why don''t you just use one of these? Or even draw good old pen and paper?

Or are you thinking of a program where you can import the generated flowchart data in your game somehow? How would you then make a game flexible enough to load its storyline from a datafile?

Regards

nicba





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS