Hey there,
this question came to my mind a few days ago and i want to hear some of you guys, who maybe already made something like this.
So first of all, what do i mean by “Event System”?
I mean a system that somehow handles all gameplay driven and changing events in the game world.
I will give you a small example:
Imagine you have a little adventure game like the legend of zelda. Now you come into a town and speak with the NPCs. They are telling you that
a certain wood bridge in the north is leading to a temple, but it is not save.
You, as the mighty hero, are still trying to cross this bridge and now the event comes in:
As soon as you hit the bridge, it falls apart. This will have an effect on all NPCs in that town, because they are now telling you that the bridge broke and now one can pass anymore.
Another one of these “events” could be, that you fought some mighty enemy and the battle blocked a road by letting stones fall down from a near mountain. Now you can’t cross the road anymore
until somethine else, later in the game, happens.
Now i’m asking myself how i would handle these kinds of things. I could just create a class for them and set some meshs and animation or something, combined with a bool for “happened” or not.
But this doesn’t seem like a good idea.
Then i thought about an EventManager. Maybe a UObject in the GameState class that uses interfaces to let the events register themselves at begin play.
I also want to have a good way to save the state of these events. If i save the game and reload it, i want to have the events that already happend to be saved and reloaded.
Getting all actors of class + saving the bool would be an option, but still not a good one in my eyes.
Letting the EventManager go through the registered events and set their bool to the saved one would be a better approach i guess, but i’m still not certain about it.
Maybe this is all totaly wrong what i am trying to do, so it would be nice if we could have a little dicussion on ways to implement a good EventSystem that handles events for me and others.
Also events that have more than one stage would be interesting.
So a small list of what this “Event System” should be used for:
- Keeping track of events in the world
- Saving and Reloading the events
- Change other actors based on the events (like the NPCs text after the bridge collapsed)
- Handle events that have more than 2 states
I am still a beginner in these kinds of game logic things and maybe i’m overthinking this, but i would love me some good discussion and ideas about it.
You don’t need to post actual code or BPs. This is just about getting ideas and systems together.
(: Thanks in advance