playMaker

Author Topic: Best practice for large variable pools  (Read 172 times)

chippers

  • Playmaker Newbie
  • *
  • Posts: 3
    • View Profile
Best practice for large variable pools
« on: October 19, 2020, 11:22:55 AM »
I'm trying to shave seconds off of the start-up load time and keep performance unaffected by about 10,000 vars, all bools, strings & floats. They're all in Don'tDestroyOnLoad, since I need them around at all times. Some questions:
1. Does dividing them all into massive arrays, instead of individual variables, help performance?
2. Is it useful to deactivate these objects/groups of objects when I don't need them, even though they're static and just for data?
3. I know global variables have a bad rep, but aren't global arrays efficient for this type of data storage? They seem the easiest to implement.
Thank you!

nFighter

  • Beta Group
  • Full Member
  • *
  • Posts: 163
    • View Profile
    • multiplayer adult fighting
Re: Best practice for large variable pools
« Reply #1 on: October 19, 2020, 12:28:14 PM »
10000 vars as “don’t destroy”... That doesn’t look like efficient solution in any case, why not using database and pick up only those you actually need at the current time? But if you REALLY operate 10000 values at one time maybe you should check DOTS/ECS. Unity’s monobehavior and playmaker is not the best solution for 10000 simultaneous calculations
indie developer of multiplayer adult fighting
http://nakedfighter3d.com

chippers

  • Playmaker Newbie
  • *
  • Posts: 3
    • View Profile
Re: Best practice for large variable pools
« Reply #2 on: October 19, 2020, 01:03:22 PM »
Thanks for the reply, I'm sure you're right, I'm at my first game :'(. So what is the best, most light-weight way to store such a giant database that can be accessed from FSMs at any time (and modified from time to time)? One huge non-monobehaviour script? And optionally, since they are currently only in FSMs now, is it possible to transfer them to that?
« Last Edit: October 19, 2020, 01:06:53 PM by chippers »

nFighter

  • Beta Group
  • Full Member
  • *
  • Posts: 163
    • View Profile
    • multiplayer adult fighting
Re: Best practice for large variable pools
« Reply #3 on: October 19, 2020, 03:23:51 PM »
One of the best save/load solutions for unity/playmaker is Easy Save. I'm using it all the time.
https://moodkie.com/easysave/

Also, people recommend BG Database. (I have not tried it yet, but looks like it's a really good database solution for unity/playmaker)
https://www.bansheegz.com/BGDatabase/
indie developer of multiplayer adult fighting
http://nakedfighter3d.com

chippers

  • Playmaker Newbie
  • *
  • Posts: 3
    • View Profile
Re: Best practice for large variable pools
« Reply #4 on: October 19, 2020, 03:59:49 PM »
I'm using Easy Save 3 heavily, but that takes its sweet time too, the BG Database looks like it hits the nail on the head, just need to fork out the 30 bones ::) Guess it wasn't as straightforward an issue as I had hoped. Anyway, thanks a million!
Edit: Lucky me, I already had a similar asset called Databox from a Humble Bundle that also has PM support, throwing that in in case this gets some eyes from Google 8)
« Last Edit: October 19, 2020, 04:17:12 PM by chippers »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 5546
    • View Profile
    • jinxtergames
Re: Best practice for large variable pools
« Reply #5 on: October 20, 2020, 02:24:54 AM »
Hi.

Hash Tables can be helpful here, you can find them in the Array maker package on the Ecosystem.

Also check this topic :
https://hutonggames.com/playmakerforum/index.php?topic=20829.0

10000 vars as “don’t destroy”... That doesn’t look like efficient solution in any case, why not using database and pick up only those you actually need at the current time? But if you REALLY operate 10000 values at one time maybe you should check DOTS/ECS. Unity’s monobehavior and playmaker is not the best solution for 10000 simultaneous calculations

10000 vars as single vars might not be the best solution for handling, but performance wise it would be better than loading / saving on each scene change.

DOTS is a lot worse and slower than playmaker due to mirroring, same for BOLT.
« Last Edit: October 20, 2020, 02:31:28 AM by djaydino »