Large layout issues

Discussion and feedback on Construct 2

Post » Wed Apr 10, 2013 9:02 pm

Hey all,

I have been making an RPG for a long time now and it's really going great. All my systems are in place and working fine (which took months!) and I have an amazing artist who has done heaps of characters and some layouts. Only problem is, we have just started drawing the art for the different layouts and quickly ran into trouble when it came to the main town (which is by far the biggest layout in the game).

The artist is making 1 main image for the background then placing other items like houses on top. This works fine for 1 screen images, but on big layouts there are a few problems (layout details: 10,000 x 8,000. Window size: 1360 x 1020). First off the max image size is 2,000 x 2,000, so we need to cut up the image into several pieces. But then, the loading times go way up and the music skips when entering a big layout, as well as the game freezing for a moment whenever a new piece comes on screen.

So I tried making them only appear when you get within a certain range which did help load times, but still caused the game to freeze a little when they appear.

I will soon try cutting it up into much smaller tiles and have them load/destroy depending on distance to the player, but I expect there to be some big slowdown issues having heaps of items on screen and constantly being created and destroyed.

Also I am aware of the tiled background object, but I really want to avoid that as I want to take full advantage of my artist who can create full layouts, completely customised and unique. Since the game is very small (for an RPG), custom drawing every layout is not hard both financially and time wise. So I would really like to take advantage of that.

So yeah, if you have any solutions or suggestions please let me know! I am very passionate about this project and I want to get it as smooth as possible.
B
27
S
8
G
5
Posts: 429
Reputation: 6,902

Post » Wed Apr 10, 2013 9:43 pm

You're talking about the performance when the game is on preview or on the internet?

I'm also interest in learn/know the solution too, because my next task is make a RPG game =\
ImageImageImageImageImageImage
B
93
S
19
G
12
Posts: 1,209
Reputation: 18,369

Post » Wed Apr 10, 2013 9:52 pm

@TELLES0808 - The problems occur in preview mode as well as the .exe (node webkit). It would be fantastic if I could use jpeg instead of pngs for the backgrounds, as they are 10x smaller and look exactly the same.
B
27
S
8
G
5
Posts: 429
Reputation: 6,902

Post » Wed Apr 10, 2013 10:04 pm

You can use jpg:
B
54
S
28
G
18
Posts: 1,520
Reputation: 25,020

Post » Wed Apr 10, 2013 10:06 pm

I think on the runtime, every image will be treated as a bitmap, independent of his file type, and will occupy the same memory size. But, for download, it could save a lot of download!

Did you tried use "Tiled" with its plugin?
ImageImageImageImageImageImage
B
93
S
19
G
12
Posts: 1,209
Reputation: 18,369

Post » Wed Apr 10, 2013 10:30 pm

@ramones - from Performance tips:

[quote]Common misconceptions ... Image formats (e.g. JPEG, PNG-8, PNG-32) affect the download size but have no effect on runtime performance (they are all decompressed to 32-bit bitmap on startup).[/quote]

Setting an image format affects the transmission of the file over the network, but has no effect at all at runtime.

@Tobye - From Best practices:

[quote]Memory use ... Some designers are tempted to design entire levels as single large images, for example 10,000 x 10,000 pixels. This method should be avoided at all costs... (snip)[/quote]

The section goes on, and you should read it all. In other words, as much as you might like to design your game by drawing the entire layout as a single image, you really shouldn't. From a memory use point of view, it's the worst way you can possibly design a game. If you cover your whole 10,000 x 8,000 layout with unique image content, it will use over 300mb of memory. This means you'll need a desktop with at least a 512 MB graphics card to even start the game up, which rules out a lot of common computers, and all mobile devices. And that's just the background before you've even started the rest of your objects and animations! You could end up with a game that won't run anywhere except the most powerful gaming systems.

For this reason, in practice nobody designs games like that. Use tiled backgrounds and creatively recycle a smaller set of images. Even pro commercial games use that approach!Ashley2013-04-10 22:32:52
Scirra Founder
B
359
S
214
G
72
Posts: 22,951
Reputation: 178,578

Post » Wed Apr 10, 2013 11:31 pm

I dunno, if you make the pieces you're creating and destroying small enough, like 256x256, make sure each piece is a entirely different object and not a different instance, and only create 1 each tick, I would think it should work fine, actually. That way it's basically 'streaming' textures to the graphics card and dumping them based on proximity, keeping memory usage down (as long as webgl is being used).

The trick is definitely to try to not send too much image data in a single tick. As I hear the bandwidth for doing that isn't very high on most systems, which is what causes the pause.Arima2013-04-10 23:36:09
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

Post » Wed Apr 10, 2013 11:41 pm

@Arima - it's hard to avoid mid-game pauses from the textures being loaded and dumped on the fly with that method. Also C2's texture management isn't expecting you to do that, so it might keep textures in memory and still accumulate up to the full layout memory size.
Scirra Founder
B
359
S
214
G
72
Posts: 22,951
Reputation: 178,578

Post » Thu Apr 11, 2013 12:38 am

Oh, so webgl mode doesn't always dump textures immediately? In one of my projects I had a large object that caused a pause every time it was created after all its instances had been destroyed, so I assumed it did. Does that have something to do with the instance pooling?
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

Post » Thu Apr 11, 2013 4:13 am

@ramones - Oh I should have been more clear, I knew you could import them but also heard that they get converted on export so it had no real effect (as Ashley just confirmed)

@TELLES0808 - no, I haven't heard of it. Do you have any link?

@Arima - Yeah after trying it a few ways I still ran into the occasional pauses. It was slightly different on different computers though, on one you couldn't notice any pauses at all, but the others had different ranges of pausing.

@Ashley - Okay, thanks for that. Would you have a recommendation as to how large is okay before you run into issues on the average computer? (as in memory usage, and also not concerned about mobile)Tobye2013-04-11 04:16:32
B
27
S
8
G
5
Posts: 429
Reputation: 6,902

Next

Return to Construct 2 General

Who is online

Users browsing this forum: Eisenhans and 15 guests