Performance question...

0 favourites
From the Asset Store
Firebase: Analytics, Dynamic Links, Remote Config, Performance, Crashlytics on Android, iOS & Web Browser
  • I'm making a space game with a starry background using a bunch of star objects more or less randomly placed each time you load. The player can fly in any direction for forever so I'm making the stars wrap. What's unclear to me from the manual is whether replacing all the star sprites with small star tiled backgrounds or small star particles would help performance at all, as the manual mainly discourages sprite tiling (which I am not doing). I like my stars and would like to be able to fit a lot in, though I don't relish the prospect of making 30 different tiled background objects for different colors, sizes, and brightness levels (as currently I do most of that in a single sprite with animations).

    I'm not planning to "release" this game on mobile devices but my current framerate of 27-40, average 35 fps in firefox (with ~400 objects) is bugging me and I like things that run as smoothly as possible.

    Thanks!

  • Could you upload it somewhere? 35 fps with ~400 objects it's kind of low.

    Your pc might be not powerful enought to handle this or you doing something wrong in C2.

  • I'd say that if your "stars" are actually drawn sprites that,fitting them onto a power of two tiled background may improve performance...but if your stars are just pixels created at one side then wrapped,that creating them,destroying them offscreen and re-creating them would be better for performance...

    I certainly think with 400 objects and only average 35FPS there are probably a few more places you could make big improvements on performance...I currently have a project with average 1000 objects running at steady 60 FPS

    Just to add particles are a no no if you want performance up....

  • My PC may well not be powerful enough as it's a laptop with an integrated graphics card (it runs the lower end AAA stuff fine though). Still, I did just go and test it in chrome and chrome runs it smooth, so I don't know how much this has to do with my computer.

    Here is my capx... I did have to do clean up work to make it readable as I tend to strike through events/actions as I iterate on them. The first event sheet has star stuff: dropbox.com/s/70g33v2ae8bbm6c/starproj.capx

    The stars themselves are actually sizeable 16 x 16 sprites that I size downward for variety... in reality they don't get bigger than 4x4 but I like starting big and sizing small since it makes things a bit more crisp. I didn't think it would hurt much to have them start a little big since the manual said that size doesn't really matter.

  • I can't open your file, You are using third party plugin "CSV to Array".

  • Forgot about that, sorry. Here is the capx with the CSV events removed.

    dropbox.com/s/ey8n0hhatzsjub7/gutted.capx

    You won't be able to fly but firefox still runs slow regardless.

  • Still needs "CSV to Array".

  • Forgot you had to delete the plug-in from the object list... I suppose that would have the fastest way to do it in the first place. Retry the link!

  • yeah. 400 sprites on a desktop based computer does seem low. Do you have any specifications on your computer. Try turning WebGL off if you can. if your on an older laptop your computer might try to software render the effects which will kill performance.

  • I think it's more of a firefox issue. I test it on my brothers pc (he's got firefox and chrome installed)

    chrome - 60fps all the time

    firefox - 20 - 45 and keeps changing

  • yeah. 400 sprites on a desktop based computer does seem low. Do you have any specifications on your computer. Try turning WebGL off if you can. if your on an older laptop your computer might try to software render the effects which will kill performance.

    When I turn off webgl I generally get higher framerates... chrome gets even smoother (while still saying 55-60 fps) and firefox *claims* to hit 60 fps but it continues to look chunky and stutter, nothing like chrome at all.

    My laptop isn't old per se but again it's not top of the line and has an integrated graphics card (i5-2435M 2.4 ghz duo). It's also running it on a much larger desktop monitor which I noticed does affect performance (1650x1050).

  • I get 60 fps in Chrome but only 30-40 in Firefox too. But I think it's the enemy AI loop that's killing the framerate, not the stars.

  • I don't think it's the whole story. When I disable the enemy AI events it runs around 40-45 FPS, indeed better, but obviously not the whole problem. It also doesn't explain to me why canvas2d would run faster (pretty much the opposite of what the manual implies). Maybe I have some runaway effects hanging around...? Hmm...

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I suggest You to disable all of your events and eneble them one by one to see which one's are causing this framerate drop.

    same with effects if you are using any.

  • I just did as you said and it's my star field wrapping. I'm currently trying to move blocks of the field at the same time cause I thought it would be easier on the processor... maybe someone has a much better suggestion than the horribly jury-rigged set-up I have? I'd go the "in visible window" route but I'd like a less repetitive starfield than that if possible... since the player will be able to move in any direction at any time it's not like I can just shoot stars at them from the other side of the screen.

    Also, my current setup for detecting where stars are is a pretty heavyhanded use of canvastolayer and layertocanvas. If someone has a more reasonable way to compare their positions to the screen/an object in a different layer parallax that'd help too.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)