Best way to make an inventory screen? [SOLVED]

0 favourites
  • 9 posts
From the Asset Store
Best car suspension with spring effect and very cool terrain generation.
  • I'm currently just destroying and recreating initial objects on a global layer when the player presses pause, but this ends up making the game lag really bad for a bit since it has to recreate dozens upon dozens of objects. I destroy and recreate said objects to minimize impact on CPU they cause when they wouldn't be needed when the game resumes.

    Is there a better way to do this?

  • You could just make your inventory layer invisible and add conditions to disable relevant events when it is not visible.

  • You're right. I realize now I made a serious error in my events that makes the game lag because I remember I've tested C3 spawning 100,000 objects that have no events associated and C3 basically doesn't care at all. I can still fix it, it's just probably gonna take a few days. Thanks for the help.

  • Instead of creating everything at once you could create things when they would come in to view.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It was actually just a matter of the menu has about 200-300 objects and multiple events across my game were referring to them due to oversight on my part. Isolating said objects to only be referenced for inventory related things made the frame rate go back to the same as if it were closed even though the objects all exist at all times. C3 basically does very minute CPU processing of objects that are just static and laying around while invisible.

  • If you have 200-300 objects in a menu then you're doing it wrong

  • Not really, given the nature of it.

    It has to display a total of 18 icons for weapons, each with their own bar to display ammo left for them, as well as the weapon name and other independent parts like one use items and things like exit stage, options, etc. This is only a portion of what is required for it.

    Just the 18 weapon icons with ammo bars, names, etc. is already up to 72 objects alone.

  • Hundreds of objects should not be an issue. With the perftest, my phone only starts losing frames at 100,000 objects and my computer at 150,000. And that's just from max frames per second, it probably wouldn't even be noticeable until significantly more.

    You should definitely isolate your events in scope though, there's no reason for any events to not filter out only the things they should be affecting.

    On that note, even creating/destroying hundreds of objects at the same time normally wouldn't cause any noticeable lag, so there was probably something else acting on it in that case as well.

  • Hundreds of objects can be an issue as each one has their own separate graphics. You're referring to 100,000 instances which might be fine, depends on the number of objects.

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