Some optimization questions

0 favourites
  • 11 posts
  • Hi!

    I read many themes about optimization, but I still have few questions:

    1) Somewhere I saw, that Ashley says that "delete" action makes "trash" in javaskript code. So what can I do?

    If I no longer needed some sprite, I can replace it with "set position" action, but it not good, because I remeber that set position/angle/size/opasity... are optimization killers.

    And what can I do with bullet or fume animation, to example? "Spawn/delete-Spawn/delete-Spawn/delete..." or "set position to gun" on launch and "set position (-1000, -1000)" when it hit another object?

    It's difficult to understand... especially with my English ((

    2) And anybody know what sprite limit has C2 for internet or mobile games?

    I mean they are not on the screen at once. On screen just ststic backplane and hero with one enemy which have very many animation frames. It's , haven't scroll, haven't physics, or smth difficult like that, just many animation frames. So how many can I store in C2? 200, 300...?

  • 1. This is incorrect - C2 handles all of this for you. Delete as much as you like!

    2. Depends on the hardware, sprite size, memory, etc. There's no 'hard limit'.

  • 1) Don't worry about this. We handle it in the engine for you, so you don't need to worry about it when using Construct 2. Position, angle, opacity and size are not optimisation killers on many platforms too. See performance tips.

    2) Construct 2 does not impose any limit, so it's as many as the device hardware can handle.

  • Thanks for response!

    I'm asking for a reason, because, to example, this game -

    scirra.com/arcade/games/addicting-puzzle-games/4590/space-n-time

    lagged on notebooks and on some of mobile devices. I'm trying to find the cause. I not use "for each" , physics, particles, effects, colizions(okey, only 3 times), I'm not creating many objects, it haven't too many events, because its free edition... maybe, I make an error somewhere and can't see it yet. It looks like smth "eat" my fps))

  • If you share the .capx file it will make it easier for us to find the problems.

  • 1) Don't worry about this. We handle it in the engine for you, so you don't need to worry about it when using Construct 2. Position, angle, opacity and size are not optimisation killers on many platforms too. See performance tips.

    2) Construct 2 does not impose any limit, so it's as many as the device hardware can handle.

    I thought the size of sprite objects affected memory usage, or am I wrong? I remembered have background images that were 1024x512, but then when changed to 512x512, I saved around 3-5mb of memory usage

  • retrodude - yes, the size of the source image affects memory usage. But I meant using one image and stretching it at runtime. Most desktop computers can do that with no performance impact, even if the sprite is stretched really big. I guess some mobile devices would struggle if you stretch images really big (it uses more of the overdraw budget), but generally the size, position, angle and opacity are not especially important for performance.

  • Ashley

    Oh I see, that's good to hear then

  • And last question - Is "unbounded scrolling" makes FPS to down?

    Or is not affected by this?

  • Kurz

    my Newgrounds submission has about 200 or so objects on the screen at the same time (mostly static), but still gets about 60 fps on the ipad (though it can lag a bit on mobile phones, but this is probably down to bad programming and wasteful memory management on my behalf). I do get a bit of slowdown when the enemies spin off the screen (due to using rotate, probably), but it's only brief and acceptable.

    I have discovered that sometimes just one small mistake in the programming can be enough to half your frame rate. For example, during the early stages of creating my game I accidentally had it set to constantly move one of the sprites to the top of the layer. As soon as I added 'trigger once' to the event, the frame rate doubled.

    I did encounter issues when originally trying out your Space N Time game on the ipad (shortly after it was submitted) - I basically got an explosion of noise all at once. When I first added music to my game I got the exact same thing, but soon discovered I had the music constantly trying to play itself again and again. So a lot of the time the performance issues are call by good ol' fashioned inexperience on our behalf. Also, the fact that different browsers seem to have different strengths and weaknesses really doesn't help keep things consistent.

    Anyway, best of luck with the competition. It's been really nice to see such a wide variety of games.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Oh, thanks, good luck to you too)

    And what you say about noice explosion? It's like music in loop event (repeat first second again and again)? I understand correctly?

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