Announcement

Collapse
No announcement yet.

Plugin Object Pool Component

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Sononeo Oh okay..
    On a new clean project I can get the crash.

    Change line 119 from this:
    Code:
    if ( (OwningPool && OwningPool->ReinitializeInstances ) || (SharedPool && OwningPool->ReinitializeInstances) ) {
    To this (stupid me):
    Code:
    if ( (OwningPool && OwningPool->ReinitializeInstances ) || (SharedPool && SharedPool->ReinitializeInstances) ) {
    I read through that line some 5 times and I didn't see that before..
    | Savior | USQLite | FSM | Object Pool | Sound Occlusion | Property Transfer | Magic Nodes | MORE |

    Comment


      Yup, I am on Unreal 4.25.3.

      Comment


        If you edit the source like above and make a build the crash will stop.
        That's a dumb typo (helped by code auto completion feature).

        I sent fix to Epic again few minutes ago btw.
        | Savior | USQLite | FSM | Object Pool | Sound Occlusion | Property Transfer | Magic Nodes | MORE |

        Comment


          Great!

          Thank you, I'll check that out once it goes live.

          In the mean time I don't know how to rebuild plugins. Editing the source is one thing but the dlls are what the engine/project is using so I'll have to take some time to work that out and see if I can check that fix for myself locally.
          Last edited by Sononeo; 08-10-2020, 08:34 AM.

          Comment


            Hey! Just wanted to say I tested the fix and it works fine now!

            Thank you for being so responsive and sorting it out so quickly

            Comment


              Hey, love the plugin. Just a few questions about object life cycles. I had been using the world Kill Z to eliminate the kind of objects I'm now pooling. I realized these don't get sent back to the pool automatically if the world destroys them. I've made changes to manually return objects to the pool now but I was wondering if it's possible to just have pool objects automatically return to the pool whenever they or their parent are marked for destruction by the world? That would be useful for me. For instance the way my game world is structured the player moves past a lot of these objects during play and I'm destroying sections of the level when they fall behind the player. Those sections had previously spawned their own layouts of pool objects (inside a global object-pool component I keep inside the GameMode class). It would be nice if I could just attach those pool objects to the level fragments and then have them automatically returned when those fragments are themselves destroyed.

              Make sense? Anyway I also just had a quick question about "Return to Pool" itself. If I called that on a pool object that was orphaned or that was spawned as a regular actor because the object-pool had no free objects left will it still be destroyed and cleaned up like a regular actor?

              Thanks

              Comment


                jivebowie that is not possible without modifying source and building your own branch of the engine.

                Orphaned Actors can be destroyed as usual.
                | Savior | USQLite | FSM | Object Pool | Sound Occlusion | Property Transfer | Magic Nodes | MORE |

                Comment


                  Thanks. I know I can destroy orphaned actors but how do I know they're even orphaned if my object-pool has "Instantiate on Demand" checked? It's possible this new instance is outside of the pool so a call to "Return to Pool" would do nothing and what you're saying is that it doesn't automatically destroy such an actor yes? Should I check that the Owning Pool is valid on all instances I'm returning to pool so I can destroy them instead if need be?

                  Comment


                    Originally posted by jivebowie View Post
                    Should I check that the Owning Pool is valid on all instances I'm returning to pool so I can destroy them instead if need be?


                    When the owning pool is gone, if you don't keep orphans alive the pool will destroy them;
                    If you want to keep orphans alive when the pool is gone, both those functions should result invalid and the Actor can destroy itself on collision or you could run a loop and clean them up from somewhere in your logic graph.
                    | Savior | USQLite | FSM | Object Pool | Sound Occlusion | Property Transfer | Magic Nodes | MORE |

                    Comment


                      Sorry I'm going to beat this horse to death right quick. If I have an object-pool that has "Instantiate on Demand" checked it will spawn unpooled objects (still of type pool because that's the base class of such objects) whenever there's no free objects in the pool. Later when I want to clean up such objects with "Return to Pool" nothing will happen because it didn't come from the object-pool. That was what I meant by orphaned. I just think that an object should be destroyed if it has no owning pool. I can manually check for this myself but I think it's cleaner if at least there was a parameter on "Return to Pool" to destroy an object if it's found to have no owning pool. Just my two cents, but thanks for the plugin. It solved a hitch I was having in my infinite runner. Really useful for me. I was actually surprised to find there was nothing like this built-in to the engine.

                      Comment


                        Hi Bruno,
                        I was going to email but figured this is a better place. I'm not able to get custom dilation to work with my APooledActor.

                        The setup
                        I have gone the C++ implementation route. I have a ProjectileActor that inherits APooledActor. The ProjectileActor contains the UPooledProjectile Component which has the movement component. The Actor then forms the base class for a Blueprint projectile (allows me to customize the bullet visuals etc).

                        When I spawn a projectile from the pool and immediately set the Custom Time Dilation to something small - 0.1 or 0.001 - the projectile doesn't slow down. I also tried adjusting the speed mid flight by that didn't seem to take effect. I'm happy to tweak the speed of the MovementComponent if that's an option.

                        I've ensured the Blueprint has Tick working.

                        Global time dilation \ Slomo works fine. But I want to control the bullet speed individually not every actor in the scene.

                        Thanks again for the great plugin.



                        Comment


                          Bino the problem you have is explained a bit last page on this forum, here:

                          https://forums.unrealengine.com/unre...26#post1794126

                          The pooled movement component is a caching container, you should act upon the generated underlying projectile component instead.
                          | Savior | USQLite | FSM | Object Pool | Sound Occlusion | Property Transfer | Magic Nodes | MORE |

                          Comment


                            Originally posted by BrUnO XaVIeR View Post
                            Bino the problem you have is explained a bit last page on this forum, here:

                            https://forums.unrealengine.com/unre...26#post1794126

                            The pooled movement component is a caching container, you should act upon the generated underlying projectile component instead.
                            Thanks Bruno! That helped a lot in working it out but turned out wasn't the issue.

                            For the Custom Time Dilation of an actor to be applied to the projectile movement component, it cannot simulate physics. Discovered this stepping through the TickComponent. It actually skips a bunch of logic that includes movement tied to the delta passed in.

                            Projectiles simulated with physics still get influenced global time dilation.

                            The code makes the best documentation...
                            Last edited by Bino; 09-12-2020, 03:17 PM.

                            Comment

                            Working...
                            X