Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(1 edit) (+3)

Hey!

I'd recommend that you use the dev tools (F12 while your game is running, or F6 when launching your game) to grab a CPU profile and look where most of your game's time is spent. See https://developers.google.com/web/tools/chrome-dev... and/or https://developer.chrome.com/devtools/docs/cpu-pro....

Here are some ideas of what MIGHT be performance bottlenecks:

  1. Does each one of your bullets have a behavior? You might want to add them to a list instead and have a single bullet manager that takes care of moving them around by looping over them. Less work for the engine.
  2. Are you creating / deleting bullets all the time? You could create a pool of hidden / unused bullets when the game starts. Make them invisible and add them to a list that you can pick from when you need to spawn a new bullet. Once a bullet goes offscreen, remove it from the live bullet list and add it back to the available bullets pool. Less work allocating, creating, destroying and garbage collecting bullets for the engine.

But don't do any of that until you have profiled and located where most of your game actually spends its CPU time or you might end up optimizing the 5% instead of the 95%.

(+1)

Thanks for the advice! These tips (along with plugging a couple memory leaks I found w/ the dev tools) help set me on the right track, and things are looking better already.