YoYoGames / GameMaker-Bugs

Public tracking for GameMaker bugs
13 stars 5 forks source link

A way to add draw code that runs in the room editor #2839

Open KormexGit opened 6 months ago

KormexGit commented 6 months ago

Is your feature request related to a problem?

For an example of where I would use this, I have an hazard object in my game that's a spike ball that moves in circles. I can set a radius for the circle in variable definitions. However, I can't see the exact path it's going to take without compiling the game and going to it's location, which can make my level design workflow a bit of a chore.

Describe the solution you'd like

A way to add room editor draw code to an object that can use variables from variable definitions. This code would ONLY run in the room editor, not at runtime. If this existed, I could have my object draw a circle in the room editor based on the radius value I set for it in variable definitions, to show where it will go. Other use cases could include things like: Drawing a line between two instances that connected to each other, like a switch and a door. Running draw code the object has in it's regular draw event that draws additional sprites, so you can see those in the room editor as well. Drawing the value of a variable that is edited per instance, so you can see it easily without opening up the variable definitions window or selecting each instance one by one. And more that I can't think of off the top of my head.

Describe alternatives you've considered

I'm not sure what GM's technical limitations are, but I could see it actually being impossible to run GML code in the IDE, since nothing is compiled at that point. So, another option would be to have an editor based approach rather than a code based approach. A limited number of drawing options (such as draw shape, draw sprite, draw text) could be selected from a menu on the object or in the room editor, drag and drop style, instead of having the user write GML. This would get around any possible issues with people trying to run non-drawing functions that can't do anything in the room editor as well.

Additional context

No response

Gamer-XP commented 6 months ago

It really want it, but I kinda doubt it's possible in the current IDE. Ideally, I'd like to be able to write my own custom visual editors for objects. But, from my experience of doing such things in Unity, this is pretty complex issue - it may require some sort of event system to catch editor's inputs so you can write custom interactive components. Just drawing non-interactive stuff doesn't sound THAT complex. So, I think, simple solumtion may be something like node graph or separate language you can write custom editors with. That will have all base components you maya need - sliders, resizeable boxes, drawing lines, etc.

mistletoe commented 5 months ago

+1 this would sometimes be super-useful. Other ways of thinking about this: maybe there are a few things that could be added to the Editor that would largely fulfil this requirement?

Like, IDK, maybe having special Layers where we can draw simple shapes and line segments on, and a measurement tool? Call it the "markup Layer" or something; it wouldn't be included in the game and it would just let end-users do simple drawing stuff.

I've (literally) had to use a pen or other straight object held up to the screen sometimes to check whether two points connect without hitting something, and there's no easy way to check widths or take other measurements in a Room without designing a custom Object of width and using it to check things (which I've done, because I have to make sure I have 48 pixels of clearance anywhere I want my critters to navigate successfully, lol).

jack27121 commented 2 weeks ago

+10 it's one thing that's lacking compared to other Game engines, would be very very useful for level design, and objects with heavy use of instance variables