Announcement

Collapse
No announcement yet.

Plugin Object Pool Component

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

    #31
    Originally posted by Galeon View Post
    Hi Bruno Xavier

    Your plugin should be usefull for open world maps.
    Does it works with any characters BP, for example i have BP AI controlled characters including Behaviour Trees, does your plugin works also in that case ?
    Yes, any blueprint child of ACharacter class can be pooled (when I submit the 1.1 update).
    All you have to do is, like in the guides above in OP, reparent the base Blueprint Asset of your Character class to APooledCharacter instead of being a child of plain ACharacter;
    That will not change anything in your code and everything will keep on working as usual in your Character like it was a direct child of plain ACharacter, but now with automatic pooling support.
    | Finite State Machine | Auto-Save Plugin | USQLite Plugin | Object-Pool | Sound-Occlusion | Anti-Cheat Plugin | Property Transfer Tool | Magic Nodes |

    Comment


      #32
      1.1 with support for Characters and Pawns (with or without Skeletal Meshes) is now live on Marketplace.
      | Finite State Machine | Auto-Save Plugin | USQLite Plugin | Object-Pool | Sound-Occlusion | Anti-Cheat Plugin | Property Transfer Tool | Magic Nodes |

      Comment


        #33
        Excellent, thank you. How to enable the animation update tick after getting character from pool? I cant seem to find the right setting. Characters are listen in AB debug, but there is no tick. Using UE4.15.

        Edit: Nevermind, now found it. Needed to activate mesh. Used toggle activation and that was wrong.
        Last edited by SaOk; 02-27-2017, 06:52 PM.

        Comment


          #34
          Originally posted by SaOk View Post
          Excellent, thank you. How to enable the animation update tick after getting character from pool? I cant seem to find the right setting. Characters are listen in AB debug, but there is no tick. Using UE4.15.

          Edit: Nevermind, now found it. Needed to activate mesh. Used toggle activation and that was wrong.
          It picks the Tick option from your Character Blueprint asset.
          If in the base Asset ticking is disabled then when coming out of Pool the Actor will not tick as well.
          | Finite State Machine | Auto-Save Plugin | USQLite Plugin | Object-Pool | Sound-Occlusion | Anti-Cheat Plugin | Property Transfer Tool | Magic Nodes |

          Comment


            #35
            I have one question: can your system handle 100k actors ? (generation + rendering)

            Right now, I am using hierarchical instanced static mesh to create and display those actors, as trying to render them separately was not thinkable in terms of performance (even by disabling ticking ability).

            Does your plugin only solve the generation time, or also help improve the rendering time ? I am mostly interested in the rendering speed since I handled the generation in C++ and performance were roughly ok.

            Comment


              #36
              Originally posted by kryann View Post
              I have one question: can your system handle 100k actors ? (generation + rendering)

              Right now, I am using hierarchical instanced static mesh to create and display those actors, as trying to render them separately was not thinkable in terms of performance (even by disabling ticking ability).

              Does your plugin only solve the generation time, or also help improve the rendering time ? I am mostly interested in the rendering speed since I handled the generation in C++ and performance were roughly ok.
              Nope, this plugin will not do anything to speed up GPU cycles.
              After all we already have GPU Instancing for that.
              | Finite State Machine | Auto-Save Plugin | USQLite Plugin | Object-Pool | Sound-Occlusion | Anti-Cheat Plugin | Property Transfer Tool | Magic Nodes |

              Comment


                #37
                Hi, this is most likely bug in my side, but I am having one AI character class that always have path following not simulating (and cant move) when taken from pool. Same time I have other AI character classes that work normally when taken from pool. Would you happen to know what settings are affecting the PF-component not to simulate? Been battling with the issue for days and cant spot differences between working/not working AI controllers.

                Anyway, this have been amazing plugin. FPS stays much more stable.

                EDIT: Sorry wrong alarm. I had max agents set too low in Project settings for crowd manager.
                Last edited by SaOk; 03-08-2017, 03:56 PM.

                Comment


                  #38
                  Object Pool {1.2.0}

                  Status: Updated

                  New API Functions:

                  C++ coders can use templated functions to cast directly, Blueprints have to cast manually.


                  (Object Pool Component):

                  * GetObjectArray(): Directly access Actors storage, be careful what you do with this.
                  * GetObjectsFromPool(): Returns two Arrays from the Pool, Spawned and Inactive member Actors.
                  * GetSpawnedObjects(): Returns an Array of currently spawned Actors from the Pool.
                  * GetInactiveObjects(): Returns an Array of currently inactive Actors in the Pool.
                  * GetSpawnedObject(): Returns an Actor currently spawned from the Pool.
                  * GetInactiveObject(): Returns an Actor currently inactive in the Pool.

                  Templated C++ Functions:

                  * GetObjectsFromPool<T>(): Returns Array of Actors from Pool, type-casting to T.
                  * GetSpawnedObjects<T>(): Returns Array of spawned Actors from Pool, type-casting to T.
                  * GetInactiveObjects<T>(): Returns Array of inactive Actors in the Pool, type-casting to T.


                  (Pawn Pool Component):

                  * GetPawnArray(): Directly access Pawns storage, be careful what you do with this.
                  * GetPawnsFromPool(): Returns two Arrays from the Pool, Spawned and Inactive member Pawns.
                  * GetSpawnedPawns(): Returns an Array of currently spawned Pawns from the Pool.
                  * GetInactivePawns(): Returns an Array of currently inactive Pawns in the Pool.
                  * GetSpawnedPawn(): Returns a Pawn currently spawned from the Pool.
                  * GetInactivePawn(): Returns a Pawn currently inactive in the Pool.

                  Templated C++ Functions:

                  * GetPawnsFromPool<T>(): Returns Array of Pawns from Pool, type-casting to T.
                  * GetSpawnedPawns<T>(): Returns Array of spawned Pawns from Pool, type-casting to T.
                  * GetInactivePawns<T>(): Returns Array of inactive Pawns in the Pool, type-casting to T.


                  (Character Pool Component):

                  * GetCharacterArray(): Directly access Characters storage, be careful what you do with this.
                  * GetCharactersFromPool(): Returns two Arrays from the Pool, Spawned and Inactive Characters.
                  * GetSpawnedCharacters(): Returns an Array of currently spawned Characters from the Pool.
                  * GetInactiveCharacters(): Returns an Array of currently inactive Characters in the Pool.
                  * GetSpawnedCharacter(): Returns a Character currently spawned from the Pool.
                  * GetInactiveCharacter(): Returns a Character currently inactive in the Pool.

                  Templated C++ Functions:

                  * GetCharactersFromPool<T>(): Returns Array of Characters from Pool, type-casting to T.
                  * GetSpawnedCharacters<T>(): Returns Array of spawned Characters from Pool, type-casting to T.
                  * GetInactiveCharacters<T>(): Returns Array of inactive Characters in the Pool, type-casting to T.


                  (Pooled Actor, Pawn, Character Classes):

                  * GetOwningPool(): Returns a direct reference to the Pool Component owner of this Actor.


                  Last edited by BrUnO XaVIeR; 03-16-2017, 05:22 AM.
                  | Finite State Machine | Auto-Save Plugin | USQLite Plugin | Object-Pool | Sound-Occlusion | Anti-Cheat Plugin | Property Transfer Tool | Magic Nodes |

                  Comment


                    #39
                    Hi, I just bought the plugin.

                    Two things i'm wondering about, using Blueprint with 4.15...

                    - One of the uses i had for it, needs the collision test override that spawnactor has. Not sure if that could be added, or that i will have to implement the collision check myself ? Maybe in c++ it's just a function that the regular SpawnActor calls, that could be added ?

                    - It also doesn't support expose on spawn variables. how to get arguments to an object spawned from pool before or on the onpoolbeginplay fires? thus a bit like constructor scripts...


                    And another thing: In an actors add component list, all three are called the same, no difference between object, pawn or character pool. Same for the blueprint variable type panel. That's a bit hit and miss to choose the right one.

                    Click image for larger version

Name:	2017-03-18 23_12_43-Zoeken.jpg
Views:	1
Size:	57.4 KB
ID:	1124878

                    Other then that, great work. Wonder why Epic hasn't made something like this a first class citizen yet.

                    One more thing... From the Docs above, it wasn't immediately obvious that you don't need to create the component as an asset if you create the component inside an actor. Why would one create the component as an asset?
                    Last edited by FrederickD; 03-18-2017, 07:46 PM.

                    Comment


                      #40
                      Hi [MENTION=112949]FrederickD[/MENTION]

                      This dropdown list is a mistake on me, it shouldn't be there and I will remove this.
                      The reason why you create an asset is because the classes you see from that dropdown list are "prototype classes" for your pool components, you should not use them directly as doing so you cause annoying issues with casting when your project grows.
                      If you pick a class from that list you are actually spawning a prototype class instead of creating your own pool component.

                      Emulating the behavior of Construction scripts on Actor pull is a complicated thing to do, I am still working on it.

                      The collision test can be performed manually, but I can add that to the plugin as well, this isn't hard to change; I will make some changes to the plugin and send files to Epic next week.
                      | Finite State Machine | Auto-Save Plugin | USQLite Plugin | Object-Pool | Sound-Occlusion | Anti-Cheat Plugin | Property Transfer Tool | Magic Nodes |

                      Comment


                        #41
                        Thank you for looking into this, but...

                        - If we're not to use the addcomponent dropdown list, then how do we add that component to an actor ?
                        - if you mean the dropdown with the variable types ( these are also the same ), can't we set a variable to the pool component type then ? to have a local reference to a pool component.


                        Another thing... that would make the plugin even more usefull:

                        Would it be possible to set the object pool count dynamically? I understand that you can't or shouldn't change it during runtime. That would defeat the purpose. But setting the size value once at runtime would be nice if this depends on other parameters. If you know and set the size by the time the actor containing the objectPool component is constructed or something, that should be possible to do right ?
                        Last edited by FrederickD; 03-18-2017, 09:10 PM.

                        Comment


                          #42
                          Ok, i didn't knew you could drag and drop a component to a blueprint actor's components panel, so that one is solved.
                          Last edited by FrederickD; 03-18-2017, 09:10 PM.

                          Comment


                            #43
                            When you create a component asset, it will appear in that same dropdown list, with the name gave you it; under the "Custom" components list.
                            I have already fixed the error of pools being displayed with the same name; the prototype classes won't be in there anymore and you will be able to either create Actor, Pawn, Character pools directly from base classes or use assets if you create one (you don't really need to create assets).

                            I was working on custom Lifespan for when you spawn characters on the Pool and correcting a problem with the "Tick" function ignored after "Spawn Actor from Pool" is called, devs have been requesting this;
                            Lifespan and bugfix for the Tick function are now complete so I can now investigate about a way to execute Blueprint's Constructor Scripts when spawning an Actor from the Pool.

                            I am pretty sure that doing that will require development of a custom K2_ Node, it's the only way I can think of accessing variables marked "Expose on Spawn" and update their values;
                            These K2 things are really tedious and troublesome the work with, but I'll see what can do about it.
                            Last edited by BrUnO XaVIeR; 03-18-2017, 09:40 PM.
                            | Finite State Machine | Auto-Save Plugin | USQLite Plugin | Object-Pool | Sound-Occlusion | Anti-Cheat Plugin | Property Transfer Tool | Magic Nodes |

                            Comment


                              #44
                              [MENTION=112949]FrederickD[/MENTION] Okay... this Blueprint Node is going places
                              It literally gave me a headache because there's zero% documentation for things like this and I fell into a rabbit hole of infinite casting stuff to blueprint pins and from pins all over the place...
                              * Btw, I have no idea if this is going to work at all though; all it does for now is print a "-hello world, I'm alive!" lol *


                              Blueprint's exposed parameters:




                              The custom K2 Node I've made to capture, and process, those parameters that have to change inside of a Construction Script for a 'Pooled Actor' when firing the 'On Pool Begin Play' event:





                              Step two will be taking those exposed properties and actually make them work when the Actor comes out of the Pool
                              Last edited by BrUnO XaVIeR; 03-19-2017, 07:33 AM.
                              | Finite State Machine | Auto-Save Plugin | USQLite Plugin | Object-Pool | Sound-Occlusion | Anti-Cheat Plugin | Property Transfer Tool | Magic Nodes |

                              Comment


                                #45
                                Oh boy... Got this working, finally; lol
                                Complicated stuff, but seems to work fine now, exposed properties are now being processed by the new Spawn node.
                                For some weird reason, I'm not really sure why yet, this node is giving our game even more framerates when we disable 'Instantiate on Demand' on Project Settings *YaY*:





                                Also, I'm receiving a lot of questions about the math to make a projectile move, since the "Projectile movement component" causes problems.
                                To makes things easier to everyone, I have created a custom Projectile component that you can use in your pooled bullets without worrying about annoying math stuff. Just attach a 'Pool Projectice' to your APooledActor bullet and it just works:





                                Well, now I have to:

                                * Bug hunt more.
                                * Implement the functions for Pools of Characters and Pawns.
                                * Port from UE4.15 to earlier engines.

                                I'm not working on this all the time, so I hope to finish that last step somewhere by the end of this week, cheers.
                                | Finite State Machine | Auto-Save Plugin | USQLite Plugin | Object-Pool | Sound-Occlusion | Anti-Cheat Plugin | Property Transfer Tool | Magic Nodes |

                                Comment

                                Working...
                                X