destroying 1000 objects using more cpu than creating 1000 object. slowing game. Solution please.

  • Have you not tried particles yet?

    Hi,

    I think particle cannot be used for creating road. Can you share capx example to show me how it will be done? that will be very helpful.

  • Just set the speed to zero, and up the timeout.

  • With particles it is faster then with sprites but not as fast as with TBGs, at least in my attempts. I really think the fastest and best suited way for a mobile game is to use animations and fixed road parts:

    1drv.ms/u/s!Ap_-qxoGKbDcg3HteBHYrBIHUG4b

  • There's a lot of overdraw with this method.

    Might be better off shearing quads in Paster.

  • The new C3 beta :)

    newt Did you mean my last example? Sounds like Tilemaps or do you mean something else? I do not know exactly what it is, but for me it was the fastest way to create something presentable. Not optimal but already far better than hundreds of objects. Maybe you can give a simple example. For my part I am at the end with my ideas for now.

  • Nah the Paster object allows you to draw a quadrilateral, so basically you would use the raycaster method to daisy chain quads together to resemble a road.

    Setting up for an endless road would be somewhat complicated, but it would have zip waste.

  • You could try something like this, and play around with the sprite by adding different images.

    This will give you low cpu usage.

    https://www.sizzle-games.com/road.capx

  • youtu.be/tcgMAigbFdg

    towards the end of video, there is a cpu clutter caused by the objects count, as cpu spikes cause of to many objects (probably more then 1000 you had initially) and makes you lose fps ... you sure the items you are coded to get destroyed are actually getting destroyed? im thinking you are not destroying the items properly. or not all of them.

    Also when i said to many objects continously depending on position or calculations, that also apply to your zombies spawning outside screen trying to get to the car... those add up if you have to many... since they will always try calculate the path to the car... and imagine 100 of them doing that + 1000 objects in screen,... don't know why you have 1000 objects in screen when you could fake that gameplay and quality with 5-10 static objects.

    That gameplay done properly just what i seen in the video, should cost around 5% cpu or less on pc around 10% on mobile... optimization, look for stuff you missed out destroying, maybe the road itself? or zombies/bushes?

  • > youtu.be/tcgMAigbFdg

    towards the end of video, there is a cpu clutter caused by the objects count, as cpu spikes cause of to many objects (probably more then 1000 you had initially) and makes you lose fps ... you sure the items you are coded to get destroyed are actually getting destroyed? im thinking you are not destroying the items properly. or not all of them.

    Also when i said to many objects continously depending on position or calculations, that also apply to your zombies spawning outside screen trying to get to the car... those add up if you have to many... since they will always try calculate the path to the car... and imagine 100 of them doing that + 1000 objects in screen,... don't know why you have 1000 objects in screen when you could fake that gameplay and quality with 5-10 static objects.

    That gameplay done properly just what i seen in the video, should cost around 5% cpu or less on pc around 10% on mobile... optimization, look for stuff you missed out destroying, maybe the road itself? or zombies/bushes?

    Hi Thanks for the suggestion, just want to share few info. As of now the main issue is road only because road is what continuously constructed and thus destruction is required and this destruction is consuming lot of cpu. Leaving all other object zombies etc aside. I am focusing on road construction only. I think ashley is already aware of it and as shared in above post he has optimised it for C3 but C2 is still pending. This is one of the drawback of construct 2 where we can't create heavy games on mobile and we have to create casual games only. Just for the info, all objects are destroyed to save RAM plus avoiding calculation method to reduce arithmetic pressure on CPU. trying to destroying object with less cpu consumption but focus is on road construction only.

    Thanks for the efforts. Really appreciate it.

  • I don't know if something like that was posted already or if it's really helpful for you. but have a look:

    drive.google.com/uc

  • You could try something like this, and play around with the sprite by adding different images.

    This will give you low cpu usage.

    https://www.sizzle-games.com/road.capx

    Thanks a lot. Though it is bit different from my requirement but really nice one. I will surely keep for using in future game.

  • With particles it is faster then with sprites but not as fast as with TBGs, at least in my attempts. I really think the fastest and best suited way for a mobile game is to use animations and fixed road parts:

    https://1drv.ms/u/s!Ap_-qxoGKbDcg3HteBHYrBIHUG4b

    Thanks for the capx. looks nice. but still waiting for solution for my issue.

  • I don't know if something like that was posted already or if it's really helpful for you. but have a look:

    https://drive.google.com/uc?export=download&id=1_ocC3-EDQx3Rp__iaubIUFTrGLGGcjZj

    Thanks for sharing this example but I feel it is quite different from my requirement and yes cpu consumption is spiking up too in destroying objects though it was supposed to be reduced. I am facing same issue in my project too.

  • Have you tried objects recycling ?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Have you tried objects recycling ?

    Sorry no idea about that. Could yoo please let me know how to do that?

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