• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Windows My shadows does not work any more.

Arashi

Member
Hello everyone.

I've been working on my game Tech-X, fidgetting with water, trying to create better shaders for it when suddenly started getting black screen instead of the game.

I started to look into this problem, looking for bugs, but instead of bugs I found a very strange behaviour in draw event. I kept on going and found out, that if disable my shadow controller, screen does not turn to black field when pause menu is called any more.

So I started to look into obj_shadow_controller and found out that it does not work any more. That was a surprise, because recenly I worked only with brightly lit rooms, so I did not pay attention.

Here is essential parts of draw event

I create surfaces (nothing is wrong here)
Code:
#region create surface, if there is no
if !surface_exists(sf_shadow)
    {
    sf_shadow = surface_create(obj_camera.width,obj_camera.height);
    surface_set_target(sf_shadow);
    draw_clear_alpha(c_black,0);
    surface_reset_target();
    }
 
if !surface_exists(sf_light)
    {
    sf_light = surface_create(obj_camera.width,obj_camera.height);
    surface_set_target(sf_light);
    draw_clear_alpha(c_black,0);
    surface_reset_target();
    }
#endregion
Then I draw lights on sf_light like this: (works fine)
Code:
surface_set_target(sf_light);
    draw_clear_alpha(c_black,0);
    draw_set_blend_mode(bm_normal);

if instance_exists(obj_generic_room_light)
       {
       with obj_generic_room_light
           {
           draw_sprite_ext(light_sprite,light_sprite_image_index,w2x + x, h2y + y, light_x_scale, light_y_scale, 0, c_white, light_power);
           }
       }
Then I create shadow and draw light over it. (fine too)
Code:
//Draw light(s)
surface_set_target(sf_shadow);
draw_clear(col)


gpu_set_blendmode(bm_add);
draw_surface_ext(sf_light,0,0,1,1,0,c_white,light_power);
gpu_set_blendmode(bm_normal);
surface_reset_target();
Finaly I draw shadow surface over application surface:
(I can see resulting surface in debugged Graphics tab, and I see what expect to see - half transparent grey field with holes made by lights in it)
Code:
//draw light and shadow to screen
gpu_set_blendmode_ext(bm_dest_colour,bm_zero); //multiply blend mode
draw_surface(sf_shadow,x0,y0);
gpu_set_blendmode(bm_normal);

And application surfaces stays unchanged! Nothing happens!


To test it further I replaced drawing shadow surface with drawing black rectangle over my room
Code:
//draw light and shadow to screen

//gpu_set_blendmode_ext(bm_dest_colour,bm_zero); //multiply blend mode
//draw_surface(sf_shadow,x0,y0);

draw_set_color(c_black)
draw_rectangle(0,0,room_width,room_height,0)

//gpu_set_blendmode(bm_normal);
Absolutley nothing! No black rectangle!

I loaded my backup from 3 months ago, where all shadows were fine. Now they are not.

For the first time I encountered this problem yesterday. So I suppose it might be related to GMS2 update.

And it goes not only with shadow controller.
When I was looking into black screen issue, I found out that afted I used draw_clear(c_black) in draw event of my pause menu object function any drawing on application surfaces stopped. But when I turn off shadow_controller pause menu works fine (exept that there are no shadows in pause menu).

So I'm kinda stuck and have no idea what to do.

Please give me advice.
 
Last edited:

Nocturne

Friendly Tyrant
Forum Staff
Admin
To see if it is an issue with the update, go to the Preferences > Runtimes and double click the previous Runtime to the one being used to install/use it. If everything works again then file a bug with YYG...
 

Arashi

Member
Further testing showed, that bug appears after creating shadow and light surfaces.

If I place "exit" at the start of obj_shadow controlled draw event (that is how I disable shadows) my pause menu object keeps drawing after draw_clear(c_black) call.
But if I place "exit" after creating of surfaces - bug occures.

With these sf_shadow and sf_light there are 7 800x450 surfaces 1.37Mb each. (including application surface)

And it works with previous runtime.

You are a great help as always, Nocturne. I did not know that I can change runtime versions like this.

Well, it will be third major bug I'm sending to yoyo.

Yoyo, stop breaking my game, please!
 
Last edited by a moderator:
B

Better Nature

Guest
I'm also having a similar problem since the latest update. I posted in the same thread as kakatoto.
 
A

AFK

Guest
can confirm: surfaces are bugged in the current build.

I have a project that relies on surfaces for lighting and such. I was shocked to find that when I opened it today everything was borked. So I decided to do some testing.

Swapping to the previous runtime caused everything to work.

Then I decided to run a simple debug test for this runtime.
Code:
// debug
if surface_exists(shadowSURF) {
    draw_set_color(c_red);
    draw_circle(x,y,64,0);
    surface_set_target(shadowSURF);
    surface_reset_target();
    draw_set_color(c_blue);
    draw_circle(x,y,32,0);
}
Within the project where surfaces aren't working. This caused the large red circle to be drawn, but not the smaller blue circle.

HOWEVER: when I made a new project, and ran the same code. Both the red and blue circles are drawn.

I'm not quite sure what to make of all of this, but I figure more data on an issue is always handy.
 
D

Deleted member 13992

Guest
I can confirm surfaces are messed up in my project as well. Worked perfectly before, for many months using my rendering control object which I have not touched.
 
B

Better Nature

Guest
I'm still having the same problem in the latest runtime (2.2.1.291) that just released. Is anyone else having ongoing issues?
 
I can also confirm surfaces are working differently in this newer build. I have fixed it in my project, though.
It seems to be something about surfaces not saving their matrices when setting a new target and setting back.

To be more clear:
surface_set_target(surf1)
(camera set projection, view, apply)
(drawing stuff)
surface_set_target(surf2)
(set matrices, draw stuff)
surface_reset_target()​
(we're now targeting surf1 again, but the matrices have been lost, we need to set them again)
(camera set projection, view, apply)

As far as I can tell, this is how it's working now. Before the update, resetting back to a previous target would restore the matrices used beforehand.

I figure this may have been the intended behavior, but perhaps it's not?
 

Hyomoto

Member
@Octopus_Tophat - Your argument might hold some weight if your conclusion wasn't flawed. Updates to the IDE shouldn't break projects, but if an updated runtime does you are free to simply revert back to the working one.

If Yoyo is not free to add, remove or change things there is no point to updating. This is why they took this approach, it allows people to stick with a working runtime until they either decide updating is worth it or start a new project. I'll admit it isn't perfect, but as someone whose project also broke under the recent runtime I can't be too indignant. You are basically saying you should be able to use the latest runtimes but be unaffected by them. It's ideal if they don't break anything, we definitely agree on that, but as long as you can simply roll back to a working one the argument's strength peters out.
 
B

Better Nature

Guest
Smiechu
I did read the update notes AND that tutorial. My code complied with all the changes that the material mentioned. This is also a problem that has carried over from the previous update. I have worked around the problem on my end (using the camera_apply trick mentioned above), but it was still unclear why it was happening. That's why I asked if anyone else was still having the issue, to see if it was more than just me, and if anyone had any input on the situation.

Octopus_Tophat
Thanks for your explanation. This definitely lines up with my experience with the latest update.
 
Top