Godot Version
4.3
Question
I’m struggling with how to set up a re-usable outline to run levels on.
How do people generally create levels where X happens after 20 seconds, then Y enemies spawn, 10 seconds into combat a voice line gets triggered, then when a certain objective is done you go to the next scene, etc.
I thought to do it with a resource that had a name for easy reference in the explorer (e.g. Pirate Attack or Suddenly Birds), which carries all the info you would need. Types of enemies, how many, when to spawn them.
Which lines of dialogue that need to appear, etc.
But I cannot, for the life of me, imagine how that should interface with every system in the game. Or if that’s even desirable.
Should I have some sort of singleton / level manager that can load in these preset “levels” that you then trigger somewhere else? And have every related system (enemy spawner, dialogue manager, etc) interact with that?
Here I thought coding mechanics was difficult, but I literally have no idea how to even begin putting it all together and making an actual game that goes from A to B.
Your post has way too many questions which do not have simple answers I would recommend going bit by bit. It looks like you are quite overthinking the game process and trying to do everything at once. Start with simple things first and then iterate them.
For this one:
How do people generally create levels where X happens after 20 seconds, then Y enemies spawn, 10 seconds into combat a voice line gets triggered, then when a certain objective is done you go to the next scene, etc.
You are looking for a timer event in Godot, adding this, open the add node section and search for “Timer” this object has a signal “timeout()” which will be triggered on a timeout, the time can be set in “Inspector” “Wait Time” section. In that function you can add what you need, such as audio queue to be played after N time, or spawn new objects ( enemies ). More info can be found here: Timer — Godot Engine (stable) documentation in English
1 Like
Thanks for the response, and apologies i shouldve clarified better.
I guess I’m looking for theory or handy rules.
What are some good ways of creating timelines of events that can scale.
That’s what i meant with my example. Not necessarily the specifics ^^
I’ve been thinking about creating an event manager for my own game. This event manager would be the single source of time and event management. You could have a timer go off periodically, but since I expect some more advanced mechanics, I’d probably keep track of the delta
time and use that to trigger events.
What I’d have this event manager do is keep an array of events that you can add and remove from. You’d need a good definition of events with similar properties so they are compatible with the event processing. The event manager needs a bunch of signals that the rest of the game can respond to.
My event would have properties like repeating
(bool) and seconds_delay
to control their delay and frequency. I am not worried about the event array becoming too big, unless you need to check for certain conditions in which case the frequency of events becomes important.
I have not implemented this for my game yet, but I recognize your struggle of combining many systems of the game. I am experiencing this with quests, which need a lot of information as well. I am getting the most out of signals and responding to them. When sending signals from a centralized singlton, it can be hard to track where each signal is coming from and what triggers it, so be aware of that.
If you’re looking to create advanced systems for event management, maybe this plugin will interest you: GitHub - BananaHolograma/connected: A minimalist node-oriented event system that fits perfectly with the Godot philosophy.
1 Like
Basically, you can categorise your events:
- Time triggered event: use a Timer
- Checkpoint/Interaction triggered: use a Area2D/Area3D
You can have a local or global approach:
- local: a door open when the player is standing on a switch tile
- global: a level manager collects data about whether the player went through all the checkpoints (e.g. got the grapple, spoke with a NPC) before to open the final door
I’ve made a full level for my starter kit here:
You can look at how I use Dialogic and Areas to trigger the dialogues/cutscenes on whether the player has collected his weapon, collected a building pass, etc…
In the second half of the video, you can see that I trigger a enemy spawner when the player enter the room. I basically put together a SwitchHub that listen to input switches (e.g. areas, switches, object pick-up) and output elements (e.g. doors, spawners).
1 Like
Hey!
I feel like we’re of the same mind in the general approach to this. As a signal singleton is what I’ve been using so far in the prototyping stage. It’s allowed me to communicate across anything I want, whenever I need it—and if something emits a signal that’s not being listened to any more: not the biggest issue in the world.
I did start getting a little woozy with how many “managers” I began introducing. A dialogue manager, a signal manager, an event/enemy wave manager (which is when things started breaking down. Where I wasn’t sure what should decide what and communicate it to others.)
I appreciate your comment and will definitely check up on that plug in!
1 Like
That is amazing!
I’ll have a look at your starter kit at the first possible opportunity I’ve got.
Already the video showed a lot of interesting interactions from the interact to cut scene with dialogue, back into gameplay and onto the next room.
I’ve been wanting to move up to 3D from 2D anyhow, so no matter what, that starter kit looks banging!
dude… you have minions… looool…
I loved it already