marcgfx Posted July 18, 2016 Share Posted July 18, 2016 Optimization is a task that is never done, or so it seems to me. I started off struggling with performance with just a few units, now I'm struggling with a few hundred. But I never stopped struggling, because as soon as I managed to get any improvement I also pushed the new limits. So far it was always fairly clear where to optimize, while using the profiler. But lately it's been getting very hard. Today I optimized a function that checks if a unit collides with the outer boundaries of the world. I could not find a way to optimize the function, but I now only call the function when a unit it close to the edge. This brought me a whopping gain of ~1%. This sounds more impressive, if you consider the performance consumed by that function was ~1%. I've noticed it seems to be better to optimize the way something is done, than to optimize the actual functions. I was wondering if anyone here knows any good strategies to find bottle necks that are hard to profile. On a side note: I am displaying a minimap (canvas) and manipulate pixels directly. This is slower than the the WebGL draw calls for the whole scene. Is that to be expected? The game I'm trying to optimize (use Chrome or get even worse Performance ): http://data.cyberlympics.com/html/game.html?param=Devader_1 Quote Link to comment Share on other sites More sharing options...
Firenibbler Posted August 11, 2016 Share Posted August 11, 2016 If you want some tips to optimize, check this out: http://www.firenibbler.com/2016/05/best-performance-tips-and-tricks-for-your-html5-canvas-games/ One good way to find bottlenecks is to run a profile of the game in chrome dev tools. Quote Link to comment Share on other sites More sharing options...
rgk Posted September 25, 2016 Share Posted September 25, 2016 Honestly this might sound simple, but sometimes I just remove a specific chunk of code. I generally have some bad feelings about that peice of code's performance, and if the game runs faster (even though broken in most cases), I now know where to look. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.