I remember there was a reason why I moved it into BeginDeferred…
I just don’t remember anymore what it was
But engine have changed so much, need to revision that code again.
I remember there was a reason why I moved it into BeginDeferred…
I just don’t remember anymore what it was
But engine have changed so much, need to revision that code again.
Think you could also provide SetLifespan / GetLifespan methods (for the pool) similar to AActor? I added them on my end for now. It’s just that I use them for cleaning up projectiles
Edit: Just to clarify, I can’t simply add them in the derived class as the handle is private
Sure, will make that change as well!
Instead of changing all that, I believe you can take these calls out of APooledActor::SpawnFromPool() and just move them into APooledActor::FinishSpawnFromPool():
EVENT_OnPoolBeginPlay();
OnPoolBeginPlay.Broadcast();
The actual bug is that APooledActor::FinishSpawnFromPool() is called too early.
I’m fixing that now.
Thanks a lot for that.
Do you know what’s stopping them being showing up on clients? I was going to add network support but this is not a very apparent issue. I log their spawning, I also log their destroyed function, they all spawn properly and none of them are prematurely destroyed.
But after they spawn, they don’t exist on the client. Only the server. How do I get them to stay after spawn on the client, or show up? I can’t tell what’s going on.
This is in my do list, I didn’t go into networking yet.
The game I built this for have no networking so probably I have refactoring ahead to deal with.
Hello, It seem the demo project is not compatible with Unreal Engine 4.20.2. I could not opened a project.
Could you update a demo project ? Or I did something wrong ?
On demo project ‘.uproject’ file you can right click and select “Switch Engine Version…”
I upload 4.20 tonight at home, but really all I do to update a project is simply like explained above.
Also, I do NOT include binaries on demo projects; I expect Unreal Engine developers to have Visual Studio C++ compiler installed on developer machine:
Too fix error when I open .uproject in a newer version of engine. I found a solution in this thread.
https://forums.unrealengine.com/development-discussion/c-gameplay-programming/118722-c-4-16-transition-guide
But my knowledge about c++ is almost zero. I can use only blueprint. So, I do not know how to modify POOL.Target.cs.
Oh, lucky. I have UE version 4.18. in my machine. And I found a demo for this version. I can open it eventually.
Then, I realized. The Pool projectile works if I set a mesh or sprite as a root component. If I use “DefaultSceneRoot” as a root component, Pool Projectile does not work.
@skydashstudio I uploaded 4.20 project with windows binaries (for editor only) here:
I began today experimenting with a new node (+new component) that allows allocation of multiple classes within the same pool, with varying pool size we can determine for each class.
Classes don’t have to obey a hierarchy, they only have to be children of PooledActor class, but they all can be unrelated to each other while sharing the same memory pool.
I didn’t battle tested this yet… I will implement into my personal unpublished project first. When it’s stable I add to the public released plugin.
(each colored bullet is a different Blueprint Class with different pool sizes, stored in the same Pool Component, same spawn node):
I’ve done experiments with networking today.
Conclusion I got is: I will not include built-in replication.
This is something devs should implement in a by-project basis to fit particular design;
The reason for that is simply due to Pools consuming absurd bandwidth and causing latency spikes.
I really don’t want devs blaming me for out of control lag in their game, so I’m leaving that out of my hands.
Btw, the “Shared Pool” Component is still under tests, in my game seems 100% stable so far.
New “Shared Pool” Component and custom Spawn node for that type of Pool are now included on latest plugin update (Unreal 4.20)
The workflow is pretty much the same, so I’m not including any new documentation on it for now;
The only difference is you can add to the Shared Pool a list of “Template Classes” children of Pooled Actor and how big a memory pool is for each of those classes.
Once done that from Details Panel (on a Shared Pool Blueprint Asset’s default Details), you can call a “Spawn Actor from Shared Pool” node and specify the target class for that particular node:
I love your plug-in, its super helpful.
I just have a question for you, I’m using 4.17 and I’m trying to get AI enemies to be used from a pool.
I have been able to successfully spawn from pool, return to pool and spawn again. The problem I’m facing is that when they are spawned from the pool for a second time their AI controllers don’t seem to work anymore.
Any advice you can give me would be a great help.
Thanks in advance
[USER=“325033”]Jason Ivens[/USER] did you try to make AIController possess / unpossess on “Pool Begin/End Play” events?
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
(More info in this video.)
To fix this glitch. I add “event begin play. -> set actor location = player pawn location.” to my pooled bullets.
You can create a new collision channel for “bullets” and set its default channel to ignore any Actors member of that same channel (bullets).
Otherwise yeah, them bullets will collide with each other as soon the Actors are created for the first time.
This is very important for any game.
Epic has some info about these channels here:
Cheers. I wasn’t able to add network support to yours cleanly or in any way that made sense. I made one from scratch and I think if you wanted to add network support (again, cleanly) you’d need to do the same as it’s simply not structured for it. It’s certainly not a project specific thing, though. I’ll use the solution for shared pools based on what you’ve done (don’t worry, for internal use on our single project only).
A key factor is both the Pool Component and Spawned Actors must be members of the chain of Actors owned by a Network Connection to make it work online; but that, from my tests, resulted on a lot of bandwidth traffic so I’d rather not include “built-in code” to do that.