I am about to start making an event system for my game.
All the way through this game I've had a hard time determining how to structure things, but this event system will have a huge impact on the game, so I figured it was a good idea to get it "right" from the beginning.
The event system will handle all kinds of random events in my game- In this example, let's assume it controls when the weather will change.
My problem is what class get to do what.
I have my TileWorld class, which currently contains the World Array (2D tile based game), it contains methods that handles mining and building (I have a static WorldBuilder class that assists here, but not relevant atm). It also has a particle engine object that handles all particle generation- which in turn is used to create the weather effects like snow and rain.
Now I also have this EventSystem class, that decides when to change the weather. The TileWorld will have an instance of the EventSystem.
My questions are:
- Should the EventSystem handle everything related to weather, or only change the weather and let the TileWorld class handle the rest?
- Which of the classes should contain the variable(s) related to the weather? (For Instance the weather variable is in the TileWorld, but is changed from the EventSystem)
- If I decide to let the TileWorld hold the variables, and the EventSystem only handles the logic to change events(weather), I will have to give the EventSystem a reference to the TileWorld- I've done this quite a lot in my game, is this good practice, or should I use a different approach?
I hope I've expressed myself clearly enough- Thanks for reading :-)