playMaker

Author Topic: Reducing memory footprint using templates  (Read 1784 times)

...

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
Reducing memory footprint using templates
« on: January 12, 2022, 12:10:01 PM »
Hello,

I need a bit of technical advice here since i'm trying to cut down on loading times. Let's say i have 100 prefabs with the completely same FSM. Will i gain anything by making those a template that all 100 prefabs will share or it will only be more convenient since, well, component is component.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: Reducing memory footprint using templates
« Reply #1 on: January 12, 2022, 01:29:54 PM »
Hi.
More convenient, yes.
Decrease Loading time, i don't think so.

but if you have for example an array with prefabs on you scene.
These prefabs will be loaded, even if you did not use them yet.

to reduce loading time you can use resources load to load prefabs you need on a scene.

also after some googling apparently audio clip settings can also increase/decrease loading time and performance.

http://blog.theknightsofunity.com/wrong-import-settings-killing-unity-game-part-2/

...

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
Re: Reducing memory footprint using templates
« Reply #2 on: January 12, 2022, 04:20:34 PM »
Yeah, i reckoned so, i concluded that it's a component after all not some magical script that all prefabs will share, but i've hit post anyway :P

Thanks for the link, audio is sorted a long time ago, compressed, in proper formats, music streamed from storage, sfx loaded in memory...i've got a loading time of 8 seconds on PC with an SSD, but 3 minutes 30 seconds on PS4 with a regular hard drive...

Pooling takes up most of the loading time, but instantating without hiccups is impossible on that hardware even with incremental GC.

I made some tests with and without rigidbodies and colliders to see if they are slowing down the filling of the pools, i clocked the same time, i'm getting clueless.
« Last Edit: January 12, 2022, 04:55:15 PM by Fat Pug Studio »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: Reducing memory footprint using templates
« Reply #3 on: January 13, 2022, 10:25:49 AM »
Hi.
Have you tried doing Update all FSM's in Build and Preprocess Prefab FSM's in build.
in Playmaker/ Tools.

Make a back first before trying :)

...

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
Re: Reducing memory footprint using templates
« Reply #4 on: January 13, 2022, 03:48:59 PM »
No, i'll give it a go, thanks.

Right now i'm making generics of prefabs and changing their properties on runtime. CPU will take an irrelevant hit on runtime, but loading less prefabs will be faster (as far as i keep them simple of course).

Also, bullets and enemies have kinematic rigidbodies and onCollision, i'll probably remove rigidbodies from bullets and change on collision to onTrigger.

And there's always good old manual GC.

Quite a squeeze with those old pieces of junk :D
« Last Edit: January 14, 2022, 12:33:56 AM by Fat Pug Studio »