Preloading should help with the "pauses" that you see, and turf atlases may eke out a little more performance for drawing, but I'm not sure how much. When I did the turf atlas test originally it looked like a moderate improvement, but it was difficult to quantify.
My analysis of the latest profile data:

1) The drawImage() calls that are used to build the individual textures (single icon frames) out of a single icon (all the frames packed together) appear to be a performance hit. To whatever extent these can be front-loaded, I think the game will perform better during play. These calls would still be needed when building a proper texture atlas. (I wish very badly that I could use the icon as-is, but the bleed problem seems impossible to overcome.)

2) Switching textures appears to create quite a bit of overhead, as obeserved in dart.RenderContextWebGL.activateRenderTexture$1(). This suggests that building an atlas does have the potential to offer real gains.

3) dart.Matrix.copyFromAndConcat$2() seems to be called an awful lot and is taking way more time than its simple structure would imply it should. This is all the more troubling because of the fact that most objects use an identity matrix. I wonder if a newer version of StageXL might call this less often, or if there's any way to otherwise reduce the number of calls. It appears to be called at multiple stages, so it may be the biggest villain of all--but it may also be the hardest to subdue.
What will you be focusing on first and when do you intend to work on it? Thanks!
First I'll be focusing on 510 early bugs.
You should check the performance in 510. This might surprise you.
The profile posted is in the latest version. There's no noticeable FPS upgrades since the things that are slowing down our webclient game weren't optimized in that release.

EDIT: Ooops, I'm wrong. We posted a 509 one. We'll post an updated one tonight.
I imagine the 510 profile is the same, since it didn't change anything that should impact webclient performance.
Do you have an idea of when you'll be able to put time into those mentioned optimizations? Because at the moment both of our games (Severed & Eternia) are not playable in the webclient, in the sense that FPS often dips as low as 3FPS for the majority of machines (and struggles at times even for very good machines)... and is generally not presentable.

I'm hoping that you're still confident that the webclient can match the performance of DS. Our game is an ORPG so we'll also need to make sure the webclient isn't bogging down server CPU.

EDIT: Answered in a pager message exchange.
When you get a chance, a new profile result from 510.1324 would be helpful. The webclient has been updated to use a newer version of StageXL, and I'm curious how/whether that will impact speed. (If it doesn't do much, I still have a number of ideas on how to proceed that I haven't gotten to yet.)
New CPU profile:

https://dl.dropboxusercontent.com/u/10657252/ byond1324.cpuprofile



It could just be a case of confirmation bias, but there seems to be some noticeable performance increases. I'll get a second opinion (WANO) soon.
This was definitely worth the effort. It's a massive performance increase for me. There's still some stuttering when new resources are loaded but this is so much smoother than the previous version.
In response to Pixel Realms
Pixel Realms wrote:
Movement is typically a steady 40-50FPS, though in new areas it can dip as low as 20 on my machine. The longer you're in an area, the more stable the FPS becomes, and it can take a little while (~5-10) seconds before it's 40+.

Idle is now 58-60FPS, movement is 50-60FPS. Increased onscreen animation (such as mobs attacking) will still cause FPS drops but it's not nearly as severe, though it can hit the 20s. Much smoother overall nonetheless, and I think once your other changes are made, such as preloading, the webclient will be in good shape.
Wow, that's way better than I hoped! Looks like it was worth the headache of the update. Thanks for the feedback.
I tested with another 5 people or so, and all were reporting FPS at 40-60, with most consistently at 50+.
In response to Lummox JR
Will building an atlas be the next focus for the webclient optimizations? Assuming preloading will get rid of the stuttering that's occurring when resources are being downloaded during play, I imagine the webclient will be in a good enough shape to handle any game that DS can.
Will building an atlas be the next focus for the webclient optimizations?

The worrying part about atlasing is that the performance improvement may be negligible or computationally impossible to achieve with the manpower that we have.

While it's true that buffer swapping from a material change at the GPU level decreases performance due to an inability to batch drawcalls efficiently, the real question is just how much of our hangups are from how we're building and transmitting the data into the GPU in the first place, and just how much of it is actually happening at the GPU level.

This is one of those blind spots that keeps getting harder and harder to research because modern graphics interfaces and tile-based 2D games aren't a place that tend to overlap very often.

Tile-based games are generally designed in such a way that the underlying structure presumes that all tiles are uniformly sized, uniformly positioned, and uniformly layered.

BYOND makes none of these assumptions, so it makes atlasing incredibly complex and also makes drawcall construction almost unoptimizable. Most tile-based engines also assume that different scenes have self-contained graphics. Again, BYOND's design does us no favors here by making absolutely zero distinctions between distinct regions of the gameworld by which we can divide loaded assets. BYOND has two ways to look at assets given the current segmentation model: Load everything ahead of time, or load everything upon need.

Atlasing gets extremely difficult to pull off when you have variable-sized sprites in the mix. Normally, games don't bother atlasing multiple sprites together because there's no point in doing that. There's not enough of them on the screen at once to see improvements, and the difficulty is massive. However, tiles are easily batched by simply assuming that an entire region of the tilemap will all share the same root graphical assets and dimensions. Unfortunately, these assumptions are largely made because it's quite easy to get to the point where you have tens of thousands of tiles being rendered at a time.

BYOND assumes worst-case behavior in almost every category as far as typical 2D game engines are concerned, and it has to make it a nightmare to work with for Lummox as well as a nightmare to optimize.


The other problem in terms of WebGL performance is overdraw. Overdraw is a massive problem for WebGL apps. Overdraw occurs when you draw to the same pixel on the display twice. The more often you overdraw, the worse performance gets. 3D games prevent overdraw by rendering front-to-back. They preserve pixels that have been drawn by recording the draw depth in a GPU surface called the zbuffer. It will only draw if the pixel's z value is closer to the render plane than the one already there. By sorting your polygons front-to-back before sending them to the GPU, you gain significant optimizations due to GPU-level early ejections.

The problem with that? Transparent pixels don't draw what's behind them. conditional branching is slow as sin in a shader. (Shaders operate on the GPU, not the CPU) So you can't just test if a pixel is transparent and unmark the zbuffer. What you wind up doing is sorting semi-transparent graphics to draw last, and then performing a binary AND against the zbuffer on the separate draw call. Then you draw the resulting image over the finalized render. This creates a minimum 2x overdraw if you have even a single transparent pixel in the scene.

BYOND, again, makes no assumptions regarding layering to make any of this easier. Every sprite and every tile needs to assume both transparency and z-order conflicts. This means that your CPU-driven sort needs to reorder the entire drawcall every time an object's appearance changes. And Javascript is slow.

Starting to see the bigger picture now?
So atlasting might not be worth the trouble for the gains we'd see, and preloading, or something else, may be the better major optimization to look at next. I seemed to have mixed up preloading with atlasing prior to reading your post. Thanks for the detailed explanation.
So atlasting might not be worth the trouble for the gains we'd see

Might be, might not be. Problems are problems and programming is the art of compromise. Just saying that we're working with several unknown quantities because ultimately we are playing with a double-blind.

If that sounds pessimistic, it's not meant to be. The challenges are there, but so is reality.
In response to Writing A New One
Writing A New One wrote:
Pixel Realms wrote:
Movement is typically a steady 40-50FPS, though in new areas it can dip as low as 20 on my machine. The longer you're in an area, the more stable the FPS becomes, and it can take a little while (~5-10) seconds before it's 40+.

Idle is now 58-60FPS, movement is 50-60FPS. Increased onscreen animation (such as mobs attacking) will still cause FPS drops but it's not nearly as severe, though it can hit the 20s. Much smoother overall nonetheless, and I think once your other changes are made, such as preloading, the webclient will be in good shape.

As of .1333, idle is now 30-40FPS, movement is 20-30FPS, sometimes dropping as low as <5FPS when a spell is used or a monster attacks. This is strange since preloading resources is now a thing, but maybe something else is causing it?

CPU: https://dl.dropboxusercontent.com/u/10657252/1333.cpuprofile


Page: 1 2 3 4 5 6 7 ... 9 10 11