Optimal Resolution for Node.js games

Discussion and feedback on Construct 2

Post » Fri Nov 06, 2015 4:53 pm

Silverforce wrote:...my minimum spec is an AMD or NV GPU.


This is probably best to have this in the requirements, but to @Colludium 's point, I can also see it frustrating users since it seems overkill for a 2D engine. But I guess.. what can you do? it is what it is..
B
100
S
33
G
16
Posts: 1,204
Reputation: 16,865

Post » Fri Nov 06, 2015 10:03 pm

jobel wrote:I have observed when playing (the NW.js export) there are 3 processes (2 of them are background processes) that end up growing as the game is being played. So far in my game it seems to cap out at around 600MB (total).

If you're looking in Task Manager, those numbers don't even include textures, because they're stored separately in GPU memory. Those numbers can be difficult to interpret too: see understanding CPU and memory measurements.

sorry if this is a dumb question, but can you explain this "switching"?

Lots and lots of laptops (even the one I'm typing on now) ship with two GPUs: a low-power, cheap and weak Intel GPU, designed to save battery, and a gaming-grade AMD or nVidia chip to run games fast. Both nVidia and AMD have really crap systems that automatically pick the GPU, and never pick the fast one for indie games, only AAA titles. For a while they wouldn't even let you manually pick the fast GPU for browsers, although I think that is fixed now. So GTA starts up on the powerful GPU and your browser or NW.js probably defaults to the weak Intel chip. Maybe if you got in touch with both of them they could whitelist your game for the powerful GPU, but you have to do it for every game you publish, and it involves trying to talk to a big corporation who probably don't care.

So you can tell the users to do it themselves: normally there is a control panel that allows users to manually set the GPU for each program. For example on my laptop I can open nVidia settings, go to "Manage 3D settings", and manually add a program to use "High performance nVidia processor". It only lists programs nVidia think are noteworthy by default, so sometimes you have to manually add a program to the list too. However I've seen this alone entirely solve all performance issues with HTML5 games, but it is not the default, and lots of people probably don't know the option exists. So the whole system is kind of rubbish and biased against independent developers, but if you can make sure users are aware they might have a second GPU and may need to manually set the game to use it for it to run well, that might help.
Scirra Founder
B
399
S
236
G
89
Posts: 24,519
Reputation: 195,361

Post » Fri Nov 06, 2015 10:34 pm

Ashley wrote:
jobel wrote:Also I've learned about how NW export games load all the layouts into memory and never free any of it

That's not true, layout-by-layout loading frees images when you change layouts, so it only ever has one layout loaded.


This may be true for Construct 2, but the wrappers do NOT behave that way.

NW.js for example has a memory cache nw.exe alongside the main nw.exe, it stores any recently accessed asset into that cache and never lets them go until the entire process is ended (exit game).

This means if the game has 900MB of images/sprites in memory format, that cache will be ~900MB, even on a minimal main title screen layout.

So while you change layout and C2 behaves correctly (dumping the current stuff from memory), Chromium (NW and Chrome) does not. Try it and you will see. Just make a blank layout, throw a lot of 2048 x 2048 single color sprites onto a layout that you never call (Assets Layout) while loading a blank layout at the start. You'll see the processes I am referring to, with one bloated up by however many ~16MB 2048 x 2048 textures you added.

I know Chromium also behave this way on Android Chrome and Crosswalk, so bigger games will eventually eat up a lot of memory on the cache process.

C2 clearing seem to affect GPU VRAM, so layout changes flushes that out correctly, but it doesn't affect the way Chromium handles cache (loading asset from disk to system memory). This is from monitoring GPU vram with Afterburner and different layout transitions. GPU VRAM is behaving correctly but system ram is never released.
B
70
S
24
G
19
Posts: 1,757
Reputation: 17,616

Post » Sat Nov 07, 2015 3:53 am

Ashley wrote:So you can tell the users to do it themselves: normally there is a control panel that allows users to manually set the GPU for each program.


This is great to add for support! thanks..

My test machine is a $350 USD laptop with a HD4400 gpu. And I looked in control panel and I didn't see any 3D settings or anything like that. I'm glad to have such a low-end machine so I can see the how the game will perform on the low end of the spectrum.

I'm just wondering if I had made the game's art low-res pixel-art and the entire resolution was 240x135 if I'd be seeing the same issues?
B
100
S
33
G
16
Posts: 1,204
Reputation: 16,865

Post » Sat Nov 07, 2015 1:43 pm

Silverforce wrote:NW.js for example has a memory cache nw.exe alongside the main nw.exe, it stores any recently accessed asset into that cache and never lets them go until the entire process is ended (exit game).

This means if the game has 900MB of images/sprites in memory format, that cache will be ~900MB, even on a minimal main title screen layout.

Cache is not the same as used memory, which the blog post I linked to covers somewhat. Unused memory is wasted memory, so maybe Chrome or even the OS maintains a cache of the decompressed images, or it's related to garbage collection. The thing about caches though is they can be evicted to free up the memory if the system ends up running low. So in a way it doesn't count - it's not going to make you run out of memory, it just speeds things up when there's spare memory available.

Of course it's possible there's a C2 bug that is leaking memory (although it seems unlikely by now, with many very large games running just fine for some time). The key is if it crashes due to memory exhaustion, then by all means go ahead and file a bug report. Otherwise it's probably just hanging on to resources in case they're needed again.
Scirra Founder
B
399
S
236
G
89
Posts: 24,519
Reputation: 195,361

Post » Sat Nov 07, 2015 11:53 pm

@Ashley
For my games, it has not crashed in my experience and its not a memory leak, I can increase the size of the "cache" nw.exe process just by adding more dummy un-used large sprites to an assets layout (never called). If its a 2048 x 2048 sprite, the cache increase by 16MB so I know its actually loading all the asset from disk into cache.

This is problematic under 2 scenario:

1. Very large games, can indeed overwhelm the 32bit OS restriction on 4GB total memory and crash. Klang's dev have reported this, so the game will only work on 64 bit OS. It's not that his layout is that big or complex, the game layout itself doesn't use much but all the assets (big game, high fidelity assets) in cache uses a lot of memory. This was due to the expectation that C2 has functional layout-by-layout memory management (which it does) but we didn't know about Chromium caching everything up to a few weeks ago.

2. Android does this with Crosswalk, I've seen this behavior myself. Games have a very large memory footprint if there's lots of assets due to shared vram & system ram, so there's assets of the current layout in system ram, there's assets in vram, then there's assets being held in cache by chromium, all in the same system ram pool. It does end up crashing quite soon due to these devices using so much memory for background tasks, when we have well designed layouts to fit <200mb. This means bigger games with lots of smaller layouts is still a no-go. I haven't tested on Safari & iOS to see if it behaves like Chromium, but I suspect not since I never saw such skyrocketing memory use of my own games on iOS as compared to Android.

I know this isn't on your end, it's a Chromium/NW.js thing, but other devs should know to avoid making that huge epic game thinking its gonna be okay as long as they get clever on layout management.
B
70
S
24
G
19
Posts: 1,757
Reputation: 17,616

Post » Sun Nov 08, 2015 1:57 am

I've made an observation long time ago, when looking at loading times and performance when using hd assets, that there might be an issue, and ultimately decided I'll go with pixelart, but with the idea that after completion of the game I'll redo those assets in hd, and see if game will still work well.
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
91
S
30
G
22
Posts: 1,985
Reputation: 20,149

Post » Sun Nov 08, 2015 4:29 am

@megatronx yeah I'd have to do my own bench marks to make sure it'd be worth it. I've done a lot of the art myself in the game (and I'm not really an artist - not that I didn't put the hours in!).. so if I could make the game run considerably faster on slower machines I'd consider it, since I'd be forced to work with a real artist -- I don't have time to learn pixel-art style!

I originally picked 1920x1080 not knowing anything really... I was working with an artist at the time and he was being snooty about HD graphics and I was like, okay, let's do HD. So now, 2 years later (and the artist is long gone) here I am.

anyways just wondering if anyone on here went through the same decision making, of having to decide the best resolution for NW.js - it of course depends on the game, but performance is a genuine factor.
B
100
S
33
G
16
Posts: 1,204
Reputation: 16,865

Post » Sun Nov 08, 2015 5:17 am

Hmm... I can't say that I've ever really thought that performance would be an issue at 1920x1080. The only machines my game doesn't run on are the old laptops at work, and their GPUs don't even support webGL. I'm trying a single large layout (100,000 x 60,000px) and performance hasn't been an issue yet.
If I ever do run into issues, I'll come up with an alternative method or cut some of the offending content, but I know everyone doesn't fly by the seat of their pants like me when it comes to game design. :P
Be sure to check out my Metroidvania game, A Hole in the Earth
B
59
S
24
G
3
Posts: 359
Reputation: 5,683

Post » Sun Nov 08, 2015 1:04 pm

jobel wrote:@megatronx yeah I'd have to do my own bench marks to make sure it'd be worth it. I've done a lot of the art myself in the game (and I'm not really an artist - not that I didn't put the hours in!).. so if I could make the game run considerably faster on slower machines I'd consider it, since I'd be forced to work with a real artist -- I don't have time to learn pixel-art style!

I originally picked 1920x1080 not knowing anything really... I was working with an artist at the time and he was being snooty about HD graphics and I was like, okay, let's do HD. So now, 2 years later (and the artist is long gone) here I am.

anyways just wondering if anyone on here went through the same decision making, of having to decide the best resolution for NW.js - it of course depends on the game, but performance is a genuine factor.


For me it was a nightmare and took very long time to make decision of dropping hd assets and going with pixelart. But the longer that decision took, the more other things I did in construct and ultimately, in the end it was easier to go with pixelart. Pixelart is not that difficult.
My professional Royalty Free Music at Scirra Assets Store
--------------------------------
Specs: i5 2500, 16gb of ram, gtx 770, win 7, Focusrite Scarlett 8i6, Mackie mr8mk2, Alesis 320, browsing the net on chrome.
B
91
S
30
G
22
Posts: 1,985
Reputation: 20,149

PreviousNext

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 4 guests