Is building dynamic programmaticly created blueprints possible?

I'm looking programmatically spawn a bunch of buildable at once (no build gun). I want to behave like a blueprint (blueprint dismantle, build effects) but not actually backed by a blueprint. Anyone know if this is a feasible thing? I'm thinking I have to create an instance of an AFGBlueprintHologram and add a bunch of manually positioned child holograms and then construct the blueprint hologram at the end. I also saw AFGBlueprintProxy and wondering if I need to manually construct that or if it's automatically created by a blueprint hologram... So far I've been able to individually spawn holograms and construct them (although I couldn't figure out how to get the build effects to play first yet), and that works, but now I want to containerize it.
8 Replies
Storm
StormOP4mo ago
Trying to do something like
C++
AFGBlueprintHologram* ContainerHologram = World->SpawnActorDeferred<AFGBlueprintHologram>(
AFGBlueprintHologram::StaticClass(),
WorkingTransform,
this,
BuildInstigator);

for (auto* Buildable : Buildables)
{
AFGHologram::SpawnChildHologramFromRecipe(parent = ContainerHologram, ....)
}

// check player can build
// TBD

// build the entire hologram
ContainerHologram->Construct(...)
C++
AFGBlueprintHologram* ContainerHologram = World->SpawnActorDeferred<AFGBlueprintHologram>(
AFGBlueprintHologram::StaticClass(),
WorkingTransform,
this,
BuildInstigator);

for (auto* Buildable : Buildables)
{
AFGHologram::SpawnChildHologramFromRecipe(parent = ContainerHologram, ....)
}

// check player can build
// TBD

// build the entire hologram
ContainerHologram->Construct(...)
Robb
Robb4mo ago
It should be possible, but what you're describing sounds kind obtuse, can you elaborate more on the end effect you're trying to accomplish? How does the player control its placement?
Storm
StormOP4mo ago
I have a buildable that I interact with to configure the placement and construction. That buildable's interact dialog has a "build" button that once pressed, will trace the world, plan the construction, and do all the spawning. its like placing a blueprint as a crate, then interacting with the crate to build it dynamically, but without an actual backing blueprint since it's dynamic
D4rk
D4rk4mo ago
You can configure FGBuildableSpawnStrategyto spawn a buildable with necessary properties set, or you can call FGBuildableSubsystem->BeginSpawnBuildable, configure all properties on the spawned buildable, then call Buildable->FinishSpawning I dont know how to configure them as a blueprint though
Storm
StormOP4mo ago
Ooh thx somehow I missed that class. And yeah BeginSpawn/Finish is what I started with and that worked. I upgraded that to creating individual holograms and constructing that and that worked, but yeah I'm a little stuck. I'll keep tinkering.
D4rk
D4rk4mo ago
The spawn strategy is intended to be used with UFGTestBlueprintFunctionLibrary::SpawnBuildableFromClass() If you want to go that route
Storm
StormOP4mo ago
Oh wait that's a test class
D4rk
D4rk4mo ago
its usable Buildables usually have properties that have to be set before construction or they will crash. These properties are usually marked as SaveGame. If you get stuck on something, try looking through the operators section of the FS source. Buildables like conveyors/pipes need valid splinedata or they will crash, and the FS sources has the math to rotate/configure the spline data correctly. https://github.com/Slecht-valk/FactorySkyline

Did you find this page helpful?