SOLVED room_get_width and room_get_height??

Is there no way to get the current width and height of a room we're not occupying?
I can clearly set the width and height of another room but how can there be no accompanying get functions? 🤯
 
It doesn't make sense. If gamemakers engine can find the room, find the variable addresses, and then set a new value, how could it not be possible to pull those values?
Even if we are only storing that data and then applying it when we happen to enter that room, why can't I read it back?
The size of my room depends on the size of a level. Am I supposed to catalog 500+ rooms for their size and then incorporate that in my project?
I'm constantly, constantly changing the size of my rooms in the IDE. Cataloging that, and keeping it up to date isn't realistic.
And if I did do that, I would still need to wrap the room_set_ size functions in my own functions to keep that catalog updated during runtime.
Oh no no so I'm supposed to traverse every room initially and popuate the catalog this way? So I'm supposed to make 500+ rooms, one at a time, creating god knows how many instances, letting them get destoried, just to store a value that is already stored somewhere?
I can't just let every instance in my project run its create event willy nilly, that would completely break the game.
No. That isn't an option. That's just stupid.
I've spent enough time working with low level languages to know that there is no excuse for these functions to be missing.
If you can set the variable, you should be able to get the variable.
What in the world of computer science, other than parallel processing, could possibly be preventing GM from accessing these values, but allows it to write them?
Nothing.
 

Gamebot

Member
Why would you need 500+ levels, even as an exaggeration, why not have one large room, maybe two or three that use multiple levels? Just use the view/camera to change min and max sizes for clamping of the total area to be seen and where and how you want to move around.
 
Why would you need 500+ levels, even as an exaggeration, why not have one large room, maybe two or three that use multiple levels? Just use the view/camera to change min and max sizes for clamping of the total area to be seen and where and how you want to move around.
Its called a puzzle game. That's why I need 500+ levels. It expands all the time. So what your saying is I should place all 500 levels in one room and just show the part I want?! Like what? Or maybe your saying levels should be stored in my own format and parsed? So I should completely ignore the features of the room editor and just make my own, completely custom level designer, then my own format to save these levels, and parse them in? You release that it could take as long to develop the level editor as it would to make half the levels themselves?
Like I said it's a puzzle game. I need the edit, test, code, test, edit, test, code, test, so on.
Obviously there are 100 solutions. Tho most are stupid.
I'm not asking for a solution. I can do that myself.
Don't make excuses that I'm doing it wrong when this is what rooms exist for.
No what I'm looking for is a staff member to go "Yeah that is really dumb and should have been fixed probably back in GMS1 days."
If they wish to have a "professional" piece of software then things like this must be fixed. I started this thread in a different topic because it is not a programming issue, it's a GMS2 issue.

EDIT: I am using views. I am clamping them. How does this help me with room size?
Did you know that if you make your room 500,000x500,000, even if you only show 100x100 with a view, the size has a serious performance impact, especially on androids where surfaces support is atrocious
 

Gamebot

Member
I don't disagree those should be in there and your points about how certain values can be read and other variable/values can't are frustrating and legitimate. With only a few posts I just wanted to make sure you knew about other options...

@chamaeleon posted what I was going to say about the request to YYG.
 
Then you should file a feature request where YYG people will take a look at it, instead of the forums, where they don't.
I don't disagree those should be in there and your points about how certain values can be read and other variable/values can't are frustrating and legitimate. With only a few posts I just wanted to make sure you knew about other options...

@chamaeleon posted what I was going to say about the request to YYG.
I would just like apologize for how I articulated most of this. I have made many bug reports/feature requests. I just want to spark conversation about the growing inaccuracies and omitions in both GML and the manual. I really think it's time GML got an overhaul. As I'm sure most of you have experienced, most of gamemakers functionality has to be learned by testing.
There is A lot of information about how things can and can't be used in gamemaker, but little of it is in the manual. Instead you have to test it, or hope an active forum member remembers testing it
 

FoxyOfJungle

Kazan Games
Well, I think it's unnecessary. You can do the inverse of that, have an array of structs with the dimensions of all the rooms and when entering the room, set the room_width and room_height to the defined size. You can handle this however you like. In 9 years of GML experience I never needed these functions. If the game expands all the time, just add values to the array. There are several ways to do this, the one you want to do is not the best.
 
Well, I think it's unnecessary. You can do the inverse of that, have an array of structs with the dimensions of all the rooms and when entering the room, set the room_width and room_height to the defined size. You can handle this however you like. In 9 years of GML experience I never needed these functions. If the game expands all the time, just add values to the array. There are several ways to do this, the one you want to do is not the best.
I already explained why this isn't an option for me. I can't be bothered to manually update array entries everytime I modify a room in the IDE. I'm gonna be testing and changing the size 100 times before I finally settle with something.
If I change a rooms size and I forget to update the catalog before testing, and I likely will, it'll just add more and more wasted time. If your code has hundreds of hard-coded, magic numbers, your gonna have a bad time.
Also, does it really matter that you've never needed these functions? There are many functions I've never needed but that doesn't make them unnecessary.
I've been using GML for 15 years, and c++ on the side. Anyhow, for the lurkers that are curious, I'm scaling the rooms based on their original set size. To show my 15 years of GML, I'll share with you all an ACTUAL clean solution that doesn't require dirty workarounds or large arrays of magic numbers.
SOLUTION: Use a persistent object. Do your room scaling math in the Room Start event. This also avoids room_set_ size which has the side affect of permanently making the change
 

FoxyOfJungle

Kazan Games
SOLUTION: Use a persistent object. Do your room scaling math in the Room Start event. This also avoids room_set_ size which has the side affect of permanently making the change
You don't need 15 years of experience to do this, just think that this possibility exists (I think with 2 months of GML you can get it).
Congratulations that you managed to find the solution. As I said, there are several ways to do this.
 

rIKmAN

Member
I just want to spark conversation
The way you reply to people isn't really conducive to having a conversation though, you apologised for it once then went straight back to it in the next reply.

If your issue is sorted, use your solution for now and in the meantime file a suggestion for the "missing" features to YYG as chameleon suggested above.
If you don't file it then it will never even be considered as something they may add or deem as worth bothering to add.
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
There is A lot of information about how things can and can't be used in gamemaker, but little of it is in the manual. Instead you have to test it, or hope an active forum member remembers testing it
The manual is an excellent resource and one of the most comprehensive pieces of documentation that I've seen for any tool... so I'm not sure how you came to this conclusion.

EDIT: I am using views. I am clamping them. How does this help me with room size?
This is actually a solution to your problem, and easy enough to set up. Simply select a view that you will NOT be using, and set it to the size of the room each time you edit the room. You can then use the room_get_camera() function to retrieve the camera data for that view (which doesn't need to be visible, iirc) and then use the camera functions to get the width/height.

Is this an ideal solution? Nope! But it should work... :) That said, I would absolutely agree that the omission of functions to get room width and height seems very odd and is a bit of a hole in the functionality, so please do file a bug with YYG about it suggesting they be added.
 
Simply select a view that you will NOT be using, and set it to the size of the room each time you edit the room. You can then use the room_get_camera() function to retrieve the camera data for that view (which doesn't need to be visible, iirc) and then use the camera functions to get the width/height.
I like this solution. I will always be settings the rooms dimensions before entering it, so I can ignore the room settings and just use the unused view. Nice, I'll be able to set the room size without loosing it's initial settings.
However, sometimes I need to read the rooms current size, and not it's initail size. So I guess I'll just have to use another view to store that too.

I guess at this point all I can really do is test these different solutions for the fastest one
 
The manual is an excellent resource and one of the most comprehensive pieces of documentation that I've seen for any tool... so I'm not sure how you came to this conclusion.
Just personal experience. I'm not saying the manual is useless. I refer to it at least a hundred times a day. But I always come away from it with more questions. I have many examples, but I'll just give one.
room_goto. The manual CLEARLY says what room_goto does, but it doesn't say WHEN. Does it happen immediately? At the end of the step? At the end of the event? Do instances run their destory event? Do instances run their clean up event? The only way to know is to test it, or ask someone who has tested it.
I encounter this issue very, VERY often.
There is a lot of documentation on how specific things will act, but little documentation on when or why it will act
 

rIKmAN

Member
I have many examples, but I'll just give one.
room_goto. The manual CLEARLY says what room_goto does, but it doesn't say WHEN. Does it happen immediately? At the end of the step? At the end of the event?
From the manual page for room_goto():
Note that the room will not change until the end of the event where the function was called, so any code after this has been called will still run if in the same event. This function will also trigger the Room End event.
 
@rIKmAN
I stand corrected.
It would also appear that the manual does say that the clean up even runs when a room ends, just not on the same page.
I should just go to bed. Clearly I'm burnt out.
Thanks everyone for your patience
 
Top