Loading High-Resolution Backgrounds Efficiently

For questions about using Classic.

Post » Thu Mar 25, 2010 5:09 pm

OK, could I, in order to transition between layouts smoothly without having to load textures each time, load the textures for the NEXT layout while the player is playing the first layout? So technically, the textures for two layouts would always be loaded at any time. Would loading the textures for the next layout while one layout is running cause a performance hit?

I'm going to test this out sometime soon, could be a promising method of doing things.
B
2
S
1
G
5
Posts: 50
Reputation: 1,500

Post » Tue Mar 30, 2010 6:20 pm

What if you broke up your super large background into say 4 layouts ( if it were a big square). Then jump to the next one when you hit the border.
I am saying this with out testing and guessing that Textures only use VRam only on the current one\. er.. Right?
B
28
S
8
G
8
Posts: 530
Reputation: 7,154

Post » Tue Mar 30, 2010 9:16 pm

Well each background is one layout, basically, at 1280x720 resolution. There's no scrolling or anything (well actually there is, but only in special scenes and I'll load the textures for these manually thus avoiding the problem). I can load each layout fine, it's just loading LOTS of layouts at once that makes the VRAM huge. Without loading multiple layouts in one go, there is a huge pause as you transition between layouts and the program loads the texture.

I've tried making it load the textures for the next layout while the player is still on a previous one, but loading the textures at any point causes a pause; there no way to slowly or 'subtly' load in layout textures in the background.

By cutting up brackgrounds and minimising wasted forground space, I should be able to load each screen in at around 10mb of VRAM. This means I should safely be able to load up to six layouts at a time, and have them transition smoothly, without overstepping the ~60mb VRAM usage required for working with rubbish graphics cards. I'll design the game's environment around this limit; I'll add doors or some such that the player has to move through, then slyly load/dump the neccessary textures as the screen changes, eliminating the noticable pause for loading.

I havn't tested this fully yet; I need to try loading 6 full backgrounds and layout object in one go and see if the VRAM stays at a reasonable level. If not, I'll have to drop the load to 5, and so on 'til it work. It's a pain, and a compromise, but I think I can make it work.
B
2
S
1
G
5
Posts: 50
Reputation: 1,500

Post » Wed Mar 31, 2010 12:59 pm

You could also make them 1/4 the size (1/2 the width + 1/2 the height = 1/4 the size) and upscale them. That happens all the time in games.
B
2
S
2
G
2
Posts: 372
Reputation: 1,794

Post » Wed Mar 31, 2010 8:51 pm

[quote="Mr Wolf":2phizdyg]You could also make them 1/4 the size (1/2 the width + 1/2 the height = 1/4 the size) and upscale them. That happens all the time in games.[/quote:2phizdyg]

Wut?

Like what games, care to name them?

Im sorry but you cant scale a high rez image up and expect decent results. Regardless of interpolation type, there is data loss.
[url:2phizdyg]http://en.wikipedia.org/wiki/Image_scaling[/url:2phizdyg]
Rule of thumb is you can scale an image down, and still have good results, but not up.
Image Image
B
161
S
48
G
89
Posts: 7,347
Reputation: 66,249

Post » Wed Mar 31, 2010 9:35 pm

Good point. A lot of game special effects (in 3D games especially) use lower resolution images then scale up, but it probably wouldn't work well for static images. He could still try it though and see.
B
2
S
2
G
2
Posts: 372
Reputation: 1,794

Post » Wed Mar 31, 2010 9:44 pm

I selectively scale my graphics to fit within the ram I am aiming for. I will never reduce something to 50%, because that's just too low and results in ugly visuals.

However, reducing by 10% or so here and there, is much more difficult to notice and adds up.

[quote:1jonkr52]Like what games, care to name them?[/quote:1jonkr52]

Virtually every 3D game on consoles and PC reduce and then stretch their textures constantly. Level of detail, fitting into lower specs and other reasons. It's required to fit a wide range of specs, as well as fitting withing the lower ram the consoles have vs. PC.
B
2
S
2
G
4
Posts: 156
Reputation: 1,762

Post » Wed Mar 31, 2010 10:27 pm

Well that's 3d tho. So his only options are to slice one image up, or to piecemeal several objects together, IE tree here, rock there, cloud up there, etc.
That may actually be better in some cases, given you can use things like a gradient, or tiled background for larger portions that don't have a lot of detail.
For instance if you wanted a starfield you would quickly run out of ram if you loaded a huge image, or cut up equivalent, but you could reduce that to a fraction if you just make the background a dark color and placed stars etc. as sprites. And that is essentially what 3d does.
Image Image
B
161
S
48
G
89
Posts: 7,347
Reputation: 66,249

Post » Wed Mar 31, 2010 11:11 pm

Well really there is a lot of 2D games that use it as well. Resizing a rock for example, to add variety instead of having them all the same size, without having to draw another one.
B
2
S
2
G
4
Posts: 156
Reputation: 1,762

Previous

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests