Announcement

Collapse
No announcement yet.

Plugin Object Pool Component

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

    Okay... based on changes for the 1.9.0 plugin I am submitting for review today, for Unreal 4.22+, I rewrote the whole original post covering a lot of things that was not mentioned previously:

    https://forums.unrealengine.com/unre...ent#post104929
    | Savior | USQLite | FSM | Object Pool | Sound Occlusion | Property Transfer | Magic Nodes | MORE |

    Comment


      After latest plugin update, pawn-pool component/Pool Pawn dosent seem to be working correctly. If trying to create spawn from pool, the node connection gets deleted instanlty and you cant reconnect it even it shows green. Blueprint compile with spawn pawn from pool cause editor to crash.
      Last edited by SaOk; 06-29-2019, 08:06 AM.

      Comment


        Originally posted by SaOk View Post
        After latest plugin update, pawn-pool component dosent seem to be working correctly. If trying to create spawn from pool from blueprint using that class as parent, the node connection gets deleted instanlty and you cant reconnect it even it shows green. Blueprint compile with spawn pawn from pool cause editor to crash.
        Can you show me a screenshot of node and component and send me a crash log?

        _____

        Edit:

        Oh okay, I did a mistake.
        In Pawn K2Node_ there is this:
        Code:
        PoolPinName(TEXT("ObjectPool"));
        That is wrong, the pin name is "PawnPool"... That's why you get a crash.
        I messed up, sorry! I fixed the mistake on K2Node_SpawnPawnFromPool and sending to Epic to update files on Marketplace
        | Savior | USQLite | FSM | Object Pool | Sound Occlusion | Property Transfer | Magic Nodes | MORE |

        Comment


          No worries, thanks for the quick support.

          Comment


            The fix should be available on Marketplace now.
            | Savior | USQLite | FSM | Object Pool | Sound Occlusion | Property Transfer | Magic Nodes | MORE |

            Comment


              Originally posted by skydashstudio View Post
              I got a problem. Sometimes, my enemy is destroyed immediately when I start level.
              After trials and errors, I realized event begin overlap of my bullets are fired when a pool is initialized. Their location are 0,0,0

              https://youtu.be/BAmKjlgZQ3k
              (More info in this video.)

              To fix this glitch. I add "event begin play. -> set actor location = player pawn location." to my pooled bullets.
              I had the same issue with my overlaps all triggering at once. I use begin play and moved them to a coordinate (z = -1000) where I knew they wouldn't trigger. Worked like a charm, thanks for figuring that out!

              Given everything in a pool seems to spawn at 0,0,0 this is the only workaround I have found, is there a way to delay events or something? I tried unchecking start on tick and auto initialize but that didn't work.

              Comment


                All you need is a proper collision channel setup.
                Make your collision channel ignore itself and set your classes to use that channel by default.
                For example bullets should be in a bullet channel where it's impossible for bullets to collide with each other.

                You can also change a Blueprint's collision channel on pool's begin/end play events.
                | Savior | USQLite | FSM | Object Pool | Sound Occlusion | Property Transfer | Magic Nodes | MORE |

                Comment


                  Originally posted by BrUnO XaVIeR View Post
                  All you need is a proper collision channel setup.
                  Make your collision channel ignore itself and set your classes to use that channel by default.
                  For example bullets should be in a bullet channel where it's impossible for bullets to collide with each other.

                  You can also change a Blueprint's collision channel on pool's begin/end play events.
                  Egg on my face, I had my custom collision channel overlapping itself by accident.

                  Another question: Let's say I have a blueprint that is part of a pool. If I have a child actor attached to that pooled BP (inside the components tab, not scripted) does that effect performance in any way? In other words if I have a pool of 10 blueprints and each one includes a child actor does that break the pooling system?

                  Last edited by rustbucket1971; 07-21-2019, 02:26 PM.

                  Comment


                    Originally posted by rustbucket1971 View Post
                    if I have a pool of 10 blueprints and each one includes a child actor does that break the pooling system?
                    They should function normally, just don't add pool components to the child actors that are the same type of pool they are spawned from.
                    | Savior | USQLite | FSM | Object Pool | Sound Occlusion | Property Transfer | Magic Nodes | MORE |

                    Comment


                      Originally posted by BrUnO XaVIeR View Post

                      They should function normally, just don't add pool components to the child actors that are the same type of pool they are spawned from.
                      Right, otherwise we get an infinite loop situation, correct?

                      Comment


                        Not always, you just make it possible to happen, so it's good practice to just not make it possible to happen
                        | Savior | USQLite | FSM | Object Pool | Sound Occlusion | Property Transfer | Magic Nodes | MORE |

                        Comment


                          Hi Bruno,

                          Sorry for yet another question, your patience while I sort this out as a BP newbie is really appreciated so far! (hopefully all this helps other people as well)

                          I am using a shared pool to hold different level parts for my endless runner (see attached) as each part has different enemies, things to avoid etc.
                          Right now the shared pool uses all available actors in a class then moves to the next class in the list and repeats itself.
                          I would like it to pick an actor from a template class in the shared pool list at random, is that possible? Am I using/thinking about shared pools completely wrong? Should I just create multiple pools, one for each level part BP and then do a randomization before the spawn nodes?

                          Click image for larger version

Name:	sharedpool.png
Views:	1
Size:	11.3 KB
ID:	1645174

                          I should also mention, just in case, that I have a level part base class (parent is your pool actor) and all my other level parts extend from that base class. Not sure if that makes things better or worse in this case. Hierarchy looks something like this:

                          Pool Actor
                          -- BP_Level_Part_base
                          ---- BP_level_Part_variation1
                          ---- BP_level_Part_variation2
                          ...etc

                          Comment


                            If you want to return a random LevelPart you should make a "switch on int" node with a random int node attached, then call "spawn from shared pool" node using a different class for each node depending of value given by your random int node.

                            If random returns <= 1 spawn LevelPart_Base, If random == 2 spawn LevelPart_XX, etc.
                            You can do that in blueprint graph.

                            | Savior | USQLite | FSM | Object Pool | Sound Occlusion | Property Transfer | Magic Nodes | MORE |

                            Comment


                              Originally posted by BrUnO XaVIeR View Post
                              If you want to return a random LevelPart you should make a "switch on int" node with a random int node attached, then call "spawn from shared pool" node using a different class for each node depending of value given by your random int node.

                              If random returns <= 1 spawn LevelPart_Base, If random == 2 spawn LevelPart_XX, etc.
                              You can do that in blueprint graph.

                              That seems to have done the trick, thank you. (my preliminary version of spaghetti BP attached for anyone following along).
                              Follow up question: Is there a performance gain to be had using a shared pool and randomizing the class it spawns versus having multiple pools each holding one type of class? Maybe I'm not entirely sure what the main objective of a shared pool would be?

                              Unrelated but curious: Can each level part that is part of the shared level parts pool have it's own child pool of actors that are not shared with the parent pool? Put another way can a pooled actor have it's own child pool? (not sharing any pooled actors btw them of course, don't want an infinite loop situation)

                              Attached Files

                              Comment


                                I do not recommend adding pool components to pooled actors, it's like stepping on eggs.

                                A Shared Pool Component exists simply to pack groups of memory together where it makes sense.
                                For each class in a shared pool is one less Pool Component you have to attach somewhere else.
                                | Savior | USQLite | FSM | Object Pool | Sound Occlusion | Property Transfer | Magic Nodes | MORE |

                                Comment

                                Working...
                                X