playMaker

Author Topic: Reducing Lag When Spawning Objects?  (Read 1790 times)

Wrensey

  • Playmaker Newbie
  • *
  • Posts: 23
Reducing Lag When Spawning Objects?
« on: December 06, 2020, 01:34:42 PM »
Does anyone have any tips for reducing lag when spawning an object with a lot of FSMs attached to it? I'm having waves of enemies spawn into a level and each one contains all the different enemy type variations that allow me to easily make prefab variants of enemy types. Problem is, the variations that are unused are just sitting there when the object spawns and it's making my game freeze for a couple of frames when the object is created.

Doing some research, I found out this actually isn't a great strategy for spawning enemies, especially if targeting mobile devices, which I'm doing. Looks like what I should have done is have all the necessary enemies already loaded into the scene, but inactive and activate them as needed. Which, at this point, that would take a fair bit of retooling for me to do, so just wondering if there is an easier way to remedy this before I get to work on it?
Follow me on twitter!

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: Reducing Lag When Spawning Objects?
« Reply #1 on: December 06, 2020, 02:14:25 PM »
Hi.

You need to look into pooling.

There is a simple pool system on the Ecosystem called Pooler.

Wrensey

  • Playmaker Newbie
  • *
  • Posts: 23
Re: Reducing Lag When Spawning Objects?
« Reply #2 on: December 06, 2020, 02:23:34 PM »
Oh, interesting, I'll check this out thanks!
Follow me on twitter!

LuminRabbit

  • Full Member
  • ***
  • Posts: 161
  • Lumin Rabbit
Re: Reducing Lag When Spawning Objects?
« Reply #3 on: December 08, 2020, 05:36:17 PM »
Agree Pooling sounds like the way to go and there are a few different options:
-Pooler, limited but works for simple stuff and its free!
-Pool manager, I use this it costs money but works when spawning multiple of different objects.
-Pooley, another one on the asset store I heard good things from and costs money.

Just thought Id share a few options that I know of.
Have I said how much I love playmaker!!! This is one amazing tool

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: Reducing Lag When Spawning Objects?
« Reply #4 on: December 10, 2020, 12:16:10 PM »
Hi.
I use LeanPool.

You can find actions for it on my Third party asset actions for PlayMaker

Wrensey

  • Playmaker Newbie
  • *
  • Posts: 23
Re: Reducing Lag When Spawning Objects?
« Reply #5 on: December 10, 2020, 08:52:07 PM »
Cool currently using Pooler now, it seems like the right complexity level for what I need to do atm, thanks for the other suggestions!
Follow me on twitter!