Legacy GM Practical Surface Size Limit

A

AttaBoy

Guest
The manual notes that it's a good practice to limit the size of a surface to the size of your view. However, I have an effect that involves layering several surfaces and I want it to scroll with the view. I could probably figure out a system of creating new surfaces when the view scrolls a certain amount, but that would be not only a hassle but also would require extra draws to copy the contents over.

For a pixel art game with a low resolution, would having a surface that's room width be too risky? A room would probably be around 1200-2000 pixels wide, and 250-500 pixels high.
 

Dmi7ry

Member
It depends on hardware/platform. For desktops 2048*512 isn't much, there is no reason to worry.
P.S. And remember that the texture size will be rounded up to the nearest power of 2 (510 → 512, 520 → 1024, 2049 → 4096, etc).
 
A

AttaBoy

Guest
It depends on hardware/platform. For desktops 2048*512 isn't much, there is no reason to worry.
P.S. And remember that the texture size will be rounded up to the nearest power of 2 (510 → 512, 520 → 1024, 2049 → 4096, etc).
Great, thank you! Your P.S. is great to know also. Does that mean the drawable portion of the surface is rounded up too, or will I not be able to draw outside of the size I create it with?
 

Dmi7ry

Member
Does that mean the drawable portion of the surface is rounded up too, or will I not be able to draw outside of the size I create it with?
It draws only defined size (and you can't draw outside this).

If say more precisely, I don't know how exactly GMS handles surfaces on low-level, but there are old video cards which just don't supports textures whose size is not multiple of power of two (or has limited support). So it is better if you consider the worst option.
 
T

The Sentient

Guest
Assuming PC. You are pretty safe with 4096 x 4096.

Might get some compatibility issues if you pushed 8192 x 8192.
 

Neptune

Member
I don't know anything about what you're trying to do, but could you just make it the size of your camera view?
 
A

AttaBoy

Guest
I don't know anything about what you're trying to do, but could you just make it the size of your camera view?
That would bring complications. I'm drawing to the surface but I want it to scroll with the world, which would mean I figuring out some sort of copying method to create a new surface every time the view scrolls (possible, but annoying). I'll probably just make a big room wide one, I definitely have no plans to use this mechanic in a room bigger than 4096
 

Neptune

Member
Alright.
I may not understand properly, but all the stuff you want to draw to this surface, could still have their "draw targets" set to this theoretical view-sized surface.
And then you just:
Code:
//set target
draw_clear_alpha(c_black,0);
//draw stuff
//reset target

draw_surface(surf,view_x,view_y);
Which would let your surface track around with the player's view.

Anywho, best of luck!
 

Dmi7ry

Member
Alright.
I may not understand properly, but all the stuff you want to draw to this surface, could still have their "draw targets" set to this theoretical view-sized surface.
And then you just:
Code:
//set target
draw_clear_alpha(c_black,0);
//draw stuff
//reset target

draw_surface(surf,view_x,view_y);
Which would let your surface track around with the player's view.
I don't know, what and how @AttaBoy does, but a simple example: place first part of the code into create or room start event, like this
room start event
Code:
//set target
draw_clear_alpha(c_black,0);
//draw 1000 objects, 1000000 particles, apply 50 shaders, etc
//reset target
draw event
Code:
draw_surface(surf,0,0);
i.e. the surface used as static background, and sometime there may be added new things (blood, shells, etc). Now it makes sense, right?
 
A

AttaBoy

Guest
Alright.
I may not understand properly, but all the stuff you want to draw to this surface, could still have their "draw targets" set to this theoretical view-sized surface.
I don't know, what and how @AttaBoy does, but a simple example: place first part of the code...
Thanks for these! The effect I'm doing has the surface draw to itself to apply a shader that makes it fade to an offblack color. I also want to be able to have something drawn to screen, then have the view move and return and have that thing still there, but now faded over time. Because of this I need it to be bigger than just the view, which I'm pretty sure will be fine because my game runs at a small resolution
 
Top