Topic:   [Game Design]How would you build an event system for an RPG?   (Read 8550 times)


0 Members and 1 Guest are viewing this topic.

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
[Game Design]How would you build an event system for an RPG?
« on: February 05, 2013, 02:41:18 PM »
For reference, QoM had each map on a separate card. Each card had the same code but edited to have the events for the map. For example, pressing the examine button went through a bunch of if statements for events in the specific map(card). Usually there weren't more than 3 examine events per map(card).
Like, if the player was standing on a treasure chest and you hit examine, it'd be, if player position is on treasure chest, then add gold to inventory and pop up message saying you found a certain amount of gold.

Now what if you had a huge seamless world where it was just one gigantic map?
I suppose you could make an Examine button that runs through all if statements for every single examine event in the world.....
but that would be very long. Especially if you had 100+ tiles you can examine. 100 if statements and each if statement has it's own code.... man finding even a specific event to change would take a while of scrolling.


What would your solution be?

Charlo


  • GMG-er

  • **


  • Posts: 451
Re: [Game Design]How would you build an event system for an RPG?
« Reply #1 on: February 05, 2013, 03:56:19 PM »
In an object-oriented system, each world tile would be an object.  Then you could have an "action" function for that object which describes what it should do when it is "stepped on".

I suppose if every single action is different, you could have an "action" property which points to an instance of one of many "action" objects.  Like the class "levelOneActivateEarthquake" would have a function inside it, and the tile at x: 57, y: 30 has "action = levelOneActivateEarthquake".  Then your code would be something like

Code: [Select]
tile.action.doAction();

There's probably a better way though. 

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: [Game Design]How would you build an event system for an RPG?
« Reply #2 on: February 05, 2013, 04:34:04 PM »
I like this idea of having action objects that all inherit from the same class. Each could have it's own folder and all of it's data would be self-contained. It's still annoying to declare each object though.

Outside of an object oriented language... You'd think there would be some way to create your list of actions without making an endless if/switch statement. Much like how you can add something on the end of an array, for example.
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: [Game Design]How would you build an event system for an RPG?
« Reply #3 on: February 05, 2013, 08:30:22 PM »
Good ideas. Actions.

GMG Kurt


  • GMG-er

  • **


  • Posts: 682

  • Sorry for being such a noob
Re: [Game Design]How would you build an event system for an RPG?
« Reply #4 on: February 05, 2013, 09:03:01 PM »
What's this for, are you creating an Rpg or something of that nature?
Just your average Weekend Warrior.
Yes I know I have bad spelling, it's what makes me such a good programmer!

"Old art, weather magnificent or wretched, is always the raw material of new art. The artist's job, though, is to

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: [Game Design]How would you build an event system for an RPG?
« Reply #5 on: February 05, 2013, 09:15:51 PM »
I figure I can make a lot of cool stuff but content is where I lack.

If I can make a good system for adding content, games will flourish.
And event systems are a good start.

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: [Game Design]How would you build an event system for an RPG?
« Reply #6 on: February 06, 2013, 01:16:11 PM »
Now for example code.
Can you guys write psudeo or specific code implementations of your theoretical event system?

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: [Game Design]How would you build an event system for an RPG?
« Reply #7 on: February 06, 2013, 01:19:17 PM »
Want to move this to the Code Exchange section?
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

Silverwind


  • ^ This guy is amazing.

  • ****


  • Posts: 2805

  • For the glory of my maker
Re: [Game Design]How would you build an event system for an RPG?
« Reply #8 on: March 25, 2013, 06:09:59 AM »
Yeah, I've always found event related routines an irritation. Due to the diverse conditions of event triggers, they don't seem to "fit" in a truly systematic engine. Everything else has a place and an order that's either right or wrong, but events are so versatile.

The trigger for the dialogue event at the beginning of the Roguesoft RPG Engine is checked for execution when the card loads for example, whereas the trigger for the dialogue that appears when the player first gets hit by an enemy is checked every time the enemy lands a hit.

The result of such diverse trigger conditions is bits of event related code scattered everywhere. Very messy!
I survived the spammage of 2007