playMaker

Author Topic: Inventory System Help (advanced)  (Read 2640 times)

Bjakuja

  • Junior Playmaker
  • **
  • Posts: 75
Inventory System Help (advanced)
« on: July 31, 2013, 03:52:18 AM »
Hi! I am making inventory for our game and using Playmaker for that purpose. I already followed that example of JeanFabre and it's great way to create inventory system, I am using something similar, however when more items are in inventory, over 10 in my case it begins to lag, I guess it's because system need to check for every item in inventory kill existing ones and recreate items with new indexes. Hash tables are great, I managed to set items, items preview image, check for item type and to add different options to certain items (equip, use, drop...) So I have most things in place except for getting multiple string variable on the event because I want to add explanation of items when you mouse over them in inventory, not just image and I already requested action for that in Action request section.
I will study this more and will try to find solution and to reduce lag, if anyone have any idea for this approach I will be grateful.
Cheers!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Inventory System Help (advanced)
« Reply #1 on: July 31, 2013, 05:37:12 AM »
Hi,

 you'll have to identify where the lag is, try to not have any interface, if there is a lag then you need to optimize that aspect. Else, it's the logic, but without having a proper glance, it's difficult to say what is needed to be refactored.

bye,

 Jean

Bjakuja

  • Junior Playmaker
  • **
  • Posts: 75
Re: Inventory System Help (advanced)
« Reply #2 on: July 31, 2013, 06:01:39 AM »
Thanks for the reply Jean, I have made some tests and I tried to remove everything from the scene and hash tables, just to reference item name and still have the same lag.
Here is how you can test lag:
// Note that you can't notice lag because you don't have any movement on the scene and movement from objects are not noticeable. I notice lag because I have Player animations and it stops for a moment when picking objects.
Open your Inventory scene from array example, create one Big cube on the scene and use rotate 90 on y per sec and add somewhere around 30 items to the scene (in game maybe not possible to encounter 30 items at the same time but that's not causing lag), and start picking objects from the scene. You will notice the more items you have in the inventory the stronger lag you will get.

My guess is that lag occurs because cpu have too many items to calculate at once and too many events to send. Can you give idea how to index and create items in inventory without so many events to every item?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Inventory System Help (advanced)
« Reply #3 on: July 31, 2013, 06:09:17 AM »
Hi

 I remember, a member of this forum made a fix on this, I'll try to search for it, but can't remember exactly where it is in this forum.

bye,

 Jean

Bjakuja

  • Junior Playmaker
  • **
  • Posts: 75
Re: Inventory System Help (advanced)
« Reply #4 on: July 31, 2013, 01:23:04 PM »
If you can find it that would be great, I tried to find but failed!
Thanks anyway Jean!