Asset - Scripts Signal System Like Godot

G

gloomytoad

Guest
Introduction

Event systems are very useful in software development, especially in Game Development where actions can effect so many different aspects of a game. The concept of an event system is integrated into the Godot engine in the form of its Signals system, and Unity has a couple different options for achieving this effect. I have released a very lightweight system modeled after the Godot Signals system. This allows you to eliminate dependencies between objects and keep all the logic that change the state of your instances inside of themselves. I have a video describing its use!

Example
Let me give you an example! Lets say that you have a room in your game, and when your player walks into that room you want alarms to sound, enemies to change state and start chasing the player, and change the music. Commonly in GameMaker this would mean that you would need to either add checks EVERY FRAME for these different objects to detect if this action has happened, or when the action did happen an object would use with(alarms) {}, with (enemies) {} etc. to notify those objects.

With Signals you can simply fire the event from your trigger! Any object in your game can register to be notified when that event gets fired! Any object can fire the event and not worry about who is doing what when it is fired, and all the objects that want to be notified do not need to know about who is firing it! They simply register, and do what they want when it happens! Not only is this cleaner, but it more performant!

The asset does not come with any extra rooms, sprites, or un-needed resources. Just import the scripts folder and you are good to go!


Get The Asset:

https://marketplace.yoyogames.com/assets/7465/gloomy-signals

Video:

 
H

Homunculus

Guest
I’m not familiar with godot signal system, but I can definitely see why you wanted to create this kind of system in game maker. It’s easy to forget how decoupling can help keeping a large project under control, and in this case you also provide a nice pattern to make multiple objects react to global events without performing a check every step. Love it!

Just a note: in the video you mention that signals should be disconnected on instance destroy, and I can see why that’s the case, but unless there’s some magic going on behind the curtains, it’s probably better to do so in the cleanup event, since changing rooms removes the current instances without firing the destroy event
 
Top