• Hey! Guest! The 40th (!!!) GMC Jam will take place between February 25th, 12:00 UTC to March 1st 12:00 UTC. Why not join in this very special anniversary jam! Click here to find out more!

Game closes when trying to draw a surface

Megax60

Member
I did a light system some weeks ago, and it worked, now that i changed my pc, game closes when i try to draw a surface, it doesn't even give a error log
 

Gamerev147

Member
I would check out some of your video settings / drivers. Some of them or all of the drivers may be colliding with GMS.
One thing I would check is DirectX. Make sure you have DirectX 9, and the newest version.

DirectX is often times (all the time) needed to run any advanced graphical features in GMS.

Hope this helped! :)
 

Megax60

Member
i discovered the problem, the surface covers the WHOLE room, (8200,9800), i resized it to the view size, but ehhh you see, it only draws the lights on the top corner left

using draw_surface_part may fix it, but its still closing, (maybe its because i have a trash pc...)
 
Last edited:

TsukaYuriko

šŸŒ 
Forum Staff
Moderator
That's most likely because a surface that large is too big to handle for most average PCs. It's sort of overkill even when you have a high-end PC.

I suggest making the surface smaller and only drawing the region that is actually visible to it.
 

Megax60

Member
That's most likely because a surface that large is too big to handle for most average PCs. It's sort of overkill even when you have a high-end PC.

I suggest making the surface smaller and only drawing the region that is actually visible to it.
im drawing only the visible part, but is it possible to create a surface of the size of the view and change its "x and y"?
 

TsukaYuriko

šŸŒ 
Forum Staff
Moderator
Drawing is not the problem, it's keeping the oversized surface in memory. The PC this is crashing on probably has less video memory available than the surface requires, or it may not even support such a large surface size.

What you're asking about is indeed possible. With a surface as big as the room, you are currently drawing to it at room coordinates and then drawing the visible portion at view coordinates. If you change the surface's size to match the visible region, switch this around. When drawing to the surface, subtract the view coordinates from the draw coordinates to "change its x and y" to be relative to the cutout (as opposed to adding them to the coordinates you draw the cutout at). You will no longer need to cut out the visible part, so just draw the full surface at view coordinates.
 

Megax60

Member
Drawing is not the problem, it's keeping the oversized surface in memory. The PC this is crashing on probably has less video memory available than the surface requires, or it may not even support such a large surface size.

What you're asking about is indeed possible. With a surface as big as the room, you are currently drawing to it at room coordinates and then drawing the visible portion at view coordinates. If you change the surface's size to match the visible region, switch this around. When drawing to the surface, subtract the view coordinates from the draw coordinates to "change its x and y" to be relative to the cutout (as opposed to adding them to the coordinates you draw the cutout at). You will no longer need to cut out the visible part, so just draw the full surface at view coordinates.
Ohh, i understand now, i didn't get it because im not good at english
 
Top