Stop adding invisible objects to rooms!

Video tutorial on how to use this system

Get it on...
Pastebin | Github | GMC Marketplace ( Support Me )


Summary

This is a really simple Game Maker Studio Control Engine that can save you a ton of work in a game that uses a LOT of rooms.

I've been building this for a long time. My first version was built in GM 8.1, I added a bunch to it in GMS, and now in GMS2 I've completely simplified it down to only 3 scripts.

In short, you can manage all of your controllers in one code window, instead of jumping around and trying to find invisible objects in rooms.


Usage

This extension is comprised of 3 scripts.

mcs_add_controllers(rooms,controllers);

This script is the meat and potatoes of the whole system. Using it you define a room, or a list of rooms, and a controller object, or a list of controller objects, and that's it! When the room is launched those controllers get created automatically.

As an example:

mcs_add_controllers(rm_jungle,con_rain);

The above code would add the "con_rain" object to the room "rm_jungle".

It doesn't end there though.

You can specify multiple rooms and/or objects and take care of a lot of your controller distribution in one call.

mcs_add_controllers([rm_jungle, rm_beach], [con_rain, con_enemy_manager]);

The above code will add the controllers "con_rain" and "con_enemy_manager" to the rooms "rm_jungle" and "rm_beach".

mcs_auto_add( "Slug" );

This is a beautiful script that does all the heavy lifting for you. Let's say you have a fantastic naming convention in your game, for instance every controller that is associated with the jungle levels has "jungle" in the name.

You can add this code at some point in your game:

mcs_auto_add("jungle");

Then, all objects that have "jungle" in their name ( such as con_jungle_vines or con_jungle_weather ) will automatically be added to any rooms that have "jungle" in their name ( for instance "rm_jungle_start" or "rm_jungle_main" ).

This has the potential to eliminate the need of writing a lot of unnecessary create controller calls.

mcs_remove_controller( room, controller );

This script is far less exciting, it simply removes any single controller from a given room, and even destroys it if it already exists.


In Closing

This is a system that has served me quite well, and I'm sure will help you a lot too. Give it a go! And if you like it be sure to let me know via my social media, email, or a comment below.