So, I'm wanting to add a feature to a game where you build a space craft, inside the space craft is broken into a grid, the player can erect walls, and what I'm wanting to do is have enclosed spaces be detected as "rooms" and assigned a purpose.
Now... The idea is each cell will be assigned a room identifier and then perform a validity check. A room will be considered valid if for every cell that has the same identifier, the following conditions are met:
A. Every cell is bordered on every side by a cell that has the same room identifier as itself.
B. Failing A, every side that is not bordered by an identically identifying cell, is bordered by a wall of some kind.
There is a yoyo asset that set out to do this here: https://marketplace.gamemaker.io/assets/8224/detect-rooms-like-rimworld
But it's a bit old and new features have been implemented in Gamemaker I think might enable to do the same thing better.
My idea is, take a room manager object, said ob contains a struct containing all player defined rooms. f the player clicks the define room tool, it creates a new sub-struct. The player can then click on cells which are added to the currently denoted sub-struct. Every time any struct is updated, all cells check if they satisfy condition A and/or B, and if yes, the struct is marked as a valid room.
I think this is the best way to do this that I could come up with. Thoughts?