Help - Search - Members - Calendar
Full Version: Hardware Requirements For Using Surfaces
Game Maker Community > Working with Game Maker > Advanced Users Only
th15
I'm using a 2048x2048 surface in my game Battleships Forever, now, by my calculations, that should require 12mb of memory (assuming 24-bit colours). The problem is, I've got a user with a 64mb memory card (albeit on a laptop) reporting that he can't run the game.

In response to his complaint, I threw in a little code to double check if the surface was being created. If the surface for some reason doesn't exists (which happens when you press ctrl-alt-del while in-game or do something else that messes with your vram) it will attempt to recreate the surface. It then checks a second time if the surface was successfully recreated. If it fails, it shows an error message to the user. That's what he's getting. So, the problem is that the surface cannot be created on his computer though to my knowledge he should definitely be able to.

Has anyone else come across similar constraints when dealing with really large surfaces?
Potnop
2048x2048 is WAAAAY too big! How much Vram does your gfx card have? What could you possibly use such a big surface for? The whole room or soemthing? Try doing it instead where only the part in the visible view is beingdrawn to or somehting...
th15
Yea, the whole room. But 2048x2048 is really only 12mb...

Drawing only part of the area just doesn't give the effect I want.
GearGOD
QUOTE
I'm using a 2048x2048 surface in my game Battleships Forever, now, by my calculations, that should require 12mb of memory (assuming 24-bit colours).

Assumption wrong. You forgot the alpha byte. 16 megs. It's not too bad but combined with the front/back buffers, what windows wants, and the rest of your game graphics, it looks to be too much for a 64m video card. But really, someone with a laptop that weak shouldn't expect to be able to play decent games.
th15
Thanks for that, I did forget the alpha channel. I guess I'll just have to write it to handle a lo-fi version if insufficient memory is found.
grandhighgamer
Scale a view or something, there is no reason to use a surface that big, it will get scaled down either way.
LSnK
The laptop's graphics chip may not be able to handle textures that large, irrelevant of its RAM's capacity to contain the amount of data required. According to 3D Mark '06, the maximum texture size allowed on my GeForce 6600 is 4096x4096. It has 256Mb of RAM on the card. Assumedly the 6600 is vastly superior to whatever the laptop has.
th15
Hmm, they have a hardcoded maximum texture size? Didn't know such a limitation existed. Thanks.

In the end, I coded a separate routine that checks if the platform can handle it and uses a smaller surface (or no surface) if it detects that it can't.
Sindarin
The surface dimensions should be something like your view width and height. Which they should be less than 1024x768.

QUOTE
I guess I'll just have to write it to handle a lo-fi version if insufficient memory is found.

The error value surface_create returns is -1. Use that to detect surface drawing failure.
Xemrel
In older cards, it's likely to be the maximum texture size that's a problem, not the actual amount of memory. Also, many cards can't handle textures that aren't powers of two in size, or the same width as height (which is why GM always forces them to be, internally). So, it's good to keep in mind that if you allocate a surface that's supposed to be 1280x960(~5 megs), you're still probably taking up 2048x2048(16 megs) in texture space on the card.

PS: Everyone and their moms should get new video cards. smile.gif
th15
sindarin: I'd implemented that a looong time ago...

Blarg, and I had such high hopes for surfaces. I discovered that even making the surface only the size of the view (1024x768) is still too much. If we can't reliably make surfaces the size of the playing area, I don't see how useful it could be sad.gif

I'd also wanted to implement surfaces for drawing my hud (so that it won't jiggle so damn much when the game is zoomed in and out) but if surfaces really are so limited then I really don't see the point.

I guess working in higher resolutions with GM just isn't a good idea.
TwistyWristy
You can't get a surface of 1024x768, which is only 3 MB?
What kind of graphics card are you testing this on?
Certain cards (especially ProSavage) wreak havoc on the surfaces and graphics just to make life difficult for us [GRIN].

The problem could be because the dimensions of the surface isn't the same size, which can also occur with sprites, so making the surface 1024 x 1024 might make things work help...

TwistyWristy
th15
I believe it was that stupid intel onboard card, not sure what the model was. As xemrel mentioned, it's not the video ram that's really the issue, it's the maximum texture size. From my understanding, the max texture size in the Riva TNT generation was about 512x512. I could be wrong though.
Xemrel
QUOTE (th15 @ Jan 1 2007, 08:57 AM)
I'd also wanted to implement surfaces for drawing my hud (so that it won't jiggle so damn much when the game is zoomed in and out) but if surfaces really are so limited then I really don't see the point.
You don't need surfaces for that. Take a look at d3d_set_projection_ortho(). You don't actually have to be in 3D mode to use it, but since the HUD is above everything else, anyway, you can use that to basically "unzoom" before drawing the hud. That would also allow you to avoid having to actually move the HUD in the first place.
Xemrel
EDIT: Oops, the system freaked out and I ended up with a double post...
TwistyWristy
Oops sorry Xemrel, I skipped over your post when reading.

Anyway, th15, it's sounding like it's the graphics card.
One of my copmuters has the ProSavage DDR and it won't handle any sprites/surface unless the width and height are the same.
At least you're getting an error message... the program just crashes before it can even start.

What sized surfaces are you able to create?
I'm wondering if you might be able to use two smaller surfaces instead of one.

TwistyWristy
th15
I don't think the ortho projection will help any. The HUD bounces because everything in it has to be scaled to the level of zoom the game is currently at. Different objects are rounded off to different values so the elements of the hud appear to bounce around 1 pixel when zooming in and out. With a surface, I could have drawn everything at normal scale then scaled the whole lot as one. I don't think the projection does that does it?

As for making small surfaces, I haven't tried, but it is possible to make the large surface out of "tiles" of smaller surfaces, it would just make drawing to them a real pain in the ass since you'd almost have to draw everything once for each surface.
Xemrel
That's what I was saying, though. using a projection reset, you wouldn't need to do any scaling. Something like...
CODE
d3d_set_projection_ortho(0,0,display_get_width(),display_get_height,0);
...would make it so you could just draw the HUD (unscaled) up in the top left corner of the room. No scaling, no shifting.
th15
Uhh, I'd still have to scale the elements of the HUD when drawing, otherwise the text and icons would all be too small compared to the HUD drawing area. My view changes in width and height but not viewing port in order to achieve a zoom effect. I could use two views, but everything is drawn for each view you have so having a 2nd view would be really slow.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.