Too many objects? Possible bug found.

0 favourites
  • 6 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • So Ive started a pretty large project. A huge one actually, its an rpg. I was planning on having many different layouts or levels and each is 10,000x10,000 pixels big. Lots of room to run around. Im running into problems with the environment though, I removed all fauna and my frames went from 16 to 60. I disabled collisions and tried a lot of stuff but having individual objects for each tree and plant seems to be slowing it down considerably. Here is the finished layout-

    As you can see, pretty big. And thats just the trees not the tiny little plants and other objects. Do you guys know any tips on how to use that many objects without lag? Ive gotten really far with this game and I dont want to start over with a new engine that can handle what Im trying to do.

    EDIT- Found out something interesting. I found out there were over a million collision checks per second. With no trees or fauna (I deleted the tree and plant objects from the project) My collisions were down to 1000. That makes no sense because I turned off collisions for those objects and the debugger showed no difference in the checks per second until I deleted the object. If somebody wants to check this out an confirm I'm not messing up I would very much appreciate it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The tips are:

    Don't use that many instances, especially if they don't do anything. Use things like tilemaps, and tiledbackgrounds.

    Learn how to do filtering for what objects you have that do something, such as turning on collision cells for los, or using "is on screen"

    Turn on render cells for those layers that have the most objects.

  • That won't work because all of my trees would look square an uniform, can have animations, ect, can spawn a stump for each tree so you can walk under them, and I use random generation for the rest of plants and stuff I cant really random generate a tilemap. Thank you for the input though! Im trying to find ways to optimize (Such as disabling the collisions) it and I have gained a few frames.

    Can you tell me more about render cells? What does that do?

  • On your first level you have thousands of small objects (trees, trunks, shadows, plants, AttackReach sprites etc.), many of which have Chipmunk or Solid behaviors and are part of various collision checks.

    There are ~70 thousands collision checks performed on every tick and these objects are responsible for about 90-95% of them.

    You will never get good performance with this approach.

    I would recommend using a single solid tilemap as a landscape collision map and disabling collisions for all those small objects.

    To identify what is causing performance issues, you can delete objects one by one and see if it improves the CPU utilization and FPS in the Debug Mode. Do the same with events - disable groups of events and see if performance gets better.

  • Thank you guys for the help!

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