Black screen

Z

zendraw

Guest
Hi,
so recently for some reason ive been getting a black screen after i switch rooms. at first i thought it was the transition code but i narrowd it down to simply room_goto and i get it again. another odd thing is that i dont get when i switch to all rooms, only to some. in one of the rooms i get the black screen i have only 1 type of object which has no code or w/e, it acts as a solid but doesnt have the solid check on it. littelary no other objects and i get the black screen. oh and i must point out its not a depth problem, i tryed putting player object above all other and nothing also the view is on the player becouse i can hear when i jump or do somthing(i set listener position to the player).
i really have no idea why im getting this black screen and it doesnt seem related to my codes. any ideas?

EDIT: okay so when i remove this code i dont get the black screen anymore

Code:
view_wport[0]=display_get_width();
view_hport[0]=display_get_height();

var scrn=view_wport[0]/view_hport[0];

view_wview[0]=640;
view_hview[0]=view_wview[0]/min(scrn, 1.25);

view_hborder[0]=view_wview[0];
view_vborder[0]=view_hview[0];

surface_resize(application_surface, display_get_width(), display_get_height());
this code runs at the start of every room and like i sayd i get the black screen only in some rooms not all.
 
Last edited:
N

nujumkey

Guest
Check if views are enabled and if rooms are visible from the start
 
Z

zendraw

Guest
what do you mean rooms are visible ? do you mwean visible when the room start? and yes views are enabled and its visible from start
 

TheouAegis

Member
Just to clarify, did you check that views are enabled in ALL rooms? You can put at the start of that code you posted

views_enabled=true;

If you still get the issue, then at least we ruled out the view isn't visible.

What color is your screen clearing at? Default grey or did you change it to black? If it's set to black, maybe you teleport the player to outside the room.

Set a keyboard event (obviously to a key you're not already using) and have it run show_message(string(view_xview)+","+string(view_yview)+"#"+string(view_wport)+"x"+vstring(view_hport)+"#"+string(view_hview)) and make sure none of the numbers seem odd.
 
Z

zendraw

Guest
i wrote views enabled but i still have it, and the player is not outside of the room cus he dies when outside of the room and as i sayd i can hear the sound effects of jumping when i jump. oh and the clearing colour is the default one, gray.
 
Z

zendraw

Guest
okay, so i have a more clear vision on the supposed cause of the problem.
so when i change the settings in the views tab like the width and height, or set them in the room create event, i get the black screen. when they are the default values, i dont get the black screen. also i have a button to change the view width/height from smaller to bigger and if i didnt get the black screen from start, i wont get it when i change w/h but if i got the black screen it stays black. so im not sure if the problem is in me or in game maker? the only solution i see now is to set view w/h after room create event or an object or somthing. shuld i inform yoyo about this issue?
 
Z

zendraw

Guest
Update on black screen, it happens again.
So ive filled room2 with other objects so its like finished now, but now when i enter it i get the black screen. before when there were only ground objects(empty of any code or checks), i didnt get the black screen. so in conclusion content seems to be an issue, but it onle seems, becouse when i start in room1 i never get the black screen and ive got there pretty much the same content as room2. so i did a test, instead of starting in room1 i set it to start in room2 and i dont get the black screen like this even if i go back to room1 from room2 and then back from room1 to room2, i dont get the black screen. but if i set it to start from room1 and go to room2 i get it. i also disabled the code i use to set views ports application surface etc, the display overall but that doesnt affect it atall. culd it be a memory problem or somthing? but then again like i said it only happens if i start in room1 and transit to room2.

EDIT: I was thinking is there a way to free graphical memory absolutely or w/e it is called before transiting from one room to another? or a way to procedurely load content?
 
Last edited:
I

icuurd12b42

Guest
all you rooms should use views
all your viewport on screen should be the same size

you should have a boot room that does nothing for a second, then perform a room_goto_next(), use it to display a logo maybe. during this time the graphics should stabilize

you should not do anything to views or graphics related (surface_resize) in the create event.

resizing the application surface should be done in the steps
if(surface_exists(application_surface)
{
if(surface_get_width(appliucation_surface)!= the size you wand)
{
surface_resize(the size you want)
}
}

BTW why are you doing this

surface_resize(application_surface, display_get_width(), display_get_height());

That is now a huge NONO especially for people running in 4k. you should resize the surface to the view port size or the view in room whichever is smallest.

I know there is a blog out there (pre 4k days) that mentions doing this resize to match the display. but this is now definitely a dangerous thing to do.
 
Z

zendraw

Guest
Thanx for the responce, here is my resault.
i made a boot room and a boot object with an alarm event so after 1 sec i go to next room also i have an transition object with this code
Code:
//ap=alpha of black screen, gp=wether to fade in 1 or fade out 0
if (ap>gp) {ap-=.01};

if (ap<gp) {ap+=.05};

if (abs(gp-ap)<.1)
{
    ap=gp;
    instance_destroy();
}
also i wrote the surface_resize the way you suggested and i do the view settings + the resizing in an alarm event that triggers 4 steps after creating of object. the object itself is created last of all things that happen in room create event.
and i still get the black screen the same way i got it before. but now i also found somthing else.
when i go from room1 to room2, i get the black screen.
when i go from room1 to room0(has only basic empty ground objects) i dont get the black screen and then from room0 to room1 to room2 i still dont get the black screen.
all three rooms run same scripts in room create event.
Code:
scr_room_setup(s_bc0);
scr_room_create();
scr_bridges();
 
I

icuurd12b42

Guest
now I'm confident you get a black room from your code interaction and not from trying you fiddle with the screen properties too soon.
probable cause you have an endless loop. you can post your gmz (file/export). I can probably figure it out in a minute
 
Z

zendraw

Guest
Okay so i fixed it with icuurds help and basically its bad code structuring andtasks overlapping each other but now things are more clear when theyr happening and i dont get the blackness.
 
Top