Problem & Goal
The game needed lots of projectile variations, with different speeds, arcs, piercing and impacts, for both the AI and the player. Possession adds a twist: when the player takes over an enemy, that enemy’s weapon has to keep working under player control, and hit harder.
The goal was to write the core once in C++ and let designers make every variation in Blueprint:
- Create new projectile types without new code.
- Tune speed, arc and piercing live in the editor.
- Swap what happens on impact.
- Keep lots of projectiles in the world without spawning anything mid-fight.
Architecture
Four pieces, each with one job. The launcher decides when to fire and where to aim, the pool decides which actor gets reused, the projectile decides how it flies and what it hits, and the effect decides what a hit does.
- LauncherReload timing, aim, player or AI
- PoolHands out the next projectile
- ProjectileFlight, gravity, penetration
- EffectDamage and status on hit
- USCR_ProjectileLauncherComponent
- An attack component any character can carry. It holds two projectile classes: the AI version, and the stronger version used while the player possesses that character.
- ASCR_Projectile
- Movement and collision through
UProjectileMovementComponent, plus delayed gravity, penetration, an optional lifetime and a Niagara trail. - USCR_ProjectileEffectBase
- An abstract object with one
ApplyEffectevent.DirectHitEffectdamages what was hit;AreaEffectdamages everything in a radius. Both can also apply a status effect. - ASCR_ObjectPool
- Spawns one projectile class when the level starts and hands its projectiles out in round-robin order.
A new projectile is a new Blueprint and a choice of effect class.
No C++ changes.

How a Shot Works
Loading and firing
After each shot the launcher waits out its reload time, then takes the next projectile from the pool and attaches it to the weapon’s spawn point with collision off. That loaded bolt is the one you see on the crossbow.
On fire, it detaches the projectile, turns collision and movement on and works out the aim: the spawn point’s forward vector for the player, a line straight to the player for the AI. Then it hands over to the projectile:
void ASCR_Projectile::LaunchProjectile(FVector AimVector)
{
if (ProjectileMovement)
{
// Reset any existing movement
ProjectileMovement->StopMovementImmediately();
ProjectileMovement->Velocity = FVector::ZeroVector;
// Set initial velocity
ProjectileMovement->Velocity = AimVector * InitialSpeed;
ProjectileMovement->UpdateComponentVelocity();
}
// Reset any existing timers
GetWorldTimerManager().ClearTimer(GravityTimerHandle);
GetWorld()->GetTimerManager().ClearTimer(LifetimeTimerHandle);
// Set up new timers
if (InitialGravityDelay > 0.f)
{
GetWorldTimerManager().SetTimer(GravityTimerHandle, this,
&ASCR_Projectile::EnableGravity,
InitialGravityDelay, false);
}
else
{
// If no delay, enable gravity immediately
ProjectileMovement->ProjectileGravityScale = CustomGravityScale;
}
if (bIsTimedProjectile)
{
GetWorld()->GetTimerManager().SetTimer(LifetimeTimerHandle, this,
&ASCR_Projectile::DestroyDueToTimeout,
ProjectileLifetime, false);
}
ActivateTrailEffect();
}
Flight
Velocity is the aim direction times InitialSpeed. Gravity stays off for InitialGravityDelay seconds and then switches to CustomGravityScale, so bolts fly flat and accurate up close and drop at range. Timed projectiles expire after a set lifetime and can fire their effect when they do, which suits grenade-like projectiles.
Hits and penetration
Projectiles use overlaps instead of blocking hits, so they can pass through enemies. Each hit costs PenetrationSpeedLoss of speed. A projectile stops when it drops below MinPenetrationSpeed or reaches MaxPenetration hits, and the first pierce can switch gravity on, so a bolt that went through someone starts to drop. A stopped projectile attaches to whatever it hit and stays there. If that actor is destroyed, the projectile goes back to the pool.
void ASCR_Projectile::OnOverlapBegin(
UPrimitiveComponent* OverlappedComponent, AActor* OtherActor,
UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep,
const FHitResult& SweepResult)
{
if (!OtherActor || OtherActor == this || !OtherComp) return;
if (USCR_Possession_Component* U_P_C =
OtherActor->FindComponentByClass<USCR_Possession_Component>())
{
bool bIsPlayer = U_P_C->bIsPlayer;
if ((bIsPlayer && bIgnorePlayer) || (!bIsPlayer && bIgnoreEnemy))
{
return; // Ignore this actor
}
}
float ProjectileSpeed = ProjectileMovement->Velocity.Size();
if (ProjectileSpeed <= MinPenetrationSpeed)
{
SetPhysicsEnabled(false);
return;
}
StuckToActor = OtherActor;
StuckToComponent = OtherComp;
if (CurrentPenetrationCount <= MaxPenetration)
{
if (AutoGravityOnPenetration && CurrentPenetrationCount == 0)
{
EnableGravity();
}
CurrentPenetrationCount++;
float NewSpeed = ProjectileSpeed - PenetrationSpeedLoss;
if (NewSpeed <= MinPenetrationSpeed)
{
EndOfProjectile();
}
else
{
ProjectileMovement->Velocity =
ProjectileMovement->Velocity.GetSafeNormal() * NewSpeed;
}
}
if (CurrentPenetrationCount >= MaxPenetration)
{
EndOfProjectile();
}
if (ProjectileEffectClass)
{
USCR_ProjectileEffectBase* Effect =
NewObject<USCR_ProjectileEffectBase>(this, ProjectileEffectClass);
if (Effect)
{
Effect->ApplyEffect(OtherActor, SweepResult, GetInstigator());
}
}
}
Effects
On every hit the projectile creates its ProjectileEffectClass and calls ApplyEffect. That’s a BlueprintNativeEvent, so an effect can be written in C++ or in Blueprint. DirectHitEffect damages the actor that was hit. AreaEffect sweeps a sphere and scales damage with distance (no falloff, linear or exponential), with its own damage value for the actor actually hit. Each effect has flags for whether it can damage the player and enemies, and either one can apply a status effect. The area effect was built but cut from the final game for scope.
Possession
Every launcher holds two projectile classes, one for the AI and one for when the player possesses that character. When possession changes, the launcher sends its loaded projectile back to the pool and loads one from the other pool. The player’s version of an enemy weapon can be faster or hit harder with no special cases in the projectile code.
Pooling
Each projectile class has a pool actor that spawns its projectiles when the level starts and registers itself with the game mode. Launchers find their pools by projectile class, so a new projectile type needs no extra wiring.
The pool hands projectiles out in strict rotation instead of searching for a free one. A bolt stuck in a wall stays there until its turn comes round again, so a fight leaves the arena littered with spent bolts, and the cost stays flat: nothing is spawned or destroyed in combat. A pool only grows if it’s empty.
AActor* ASCR_ObjectPool::GetPooledActorRoundRobin()
{
// Double-check empty pool
if (PooledActors.Num() == 0)
{
TopUpPool();
if (PooledActors.Num() == 0)
{
UE_LOG(LogTemp, Error, TEXT("Failed to create any pooled actors!"));
return nullptr;
}
}
CurrentPoolIndex %= PooledActors.Num();
// Get component
USCR_ActivatableComponent* Comp = PooledActors[CurrentPoolIndex++];
if (!Comp)
{
UE_LOG(LogTemp, Warning, TEXT("Null component in pool!"));
return nullptr;
}
Comp->Enable();
return Comp->GetOwner();
}
Designer Workflow
Designers build and tune projectiles entirely in Blueprint:
- Create a Blueprint from
ASCR_Projectile, or duplicate an existing one. - Set the speed, gravity delay and scale, penetration count and speed loss, and an optional lifetime.
- Assign the mesh and the trail VFX.
- Pick an effect class and set its damage, radius and falloff.
- Give a launcher the projectile class, in its AI slot, player slot or both, and make sure the level has a pool for it.
Speed, arc and piercing can all be tuned in the editor with immediate feedback, which kept combat balancing in the designers’ hands.

Results
- Designers created and tuned projectile variants without asking for code changes, so combat iteration didn’t wait on programmers.
- Delayed gravity made bolts feel accurate up close while still arcing at range.
- The player and the AI fire through the same launcher, so possession needed no separate player weapon system.
- Nothing is spawned or destroyed mid-fight: every projectile comes from a pool filled when the level loads.
- New on-hit behaviour is a new effect subclass, in C++ or Blueprint, with no changes to the projectile.
What I’d Change
- Stop allocating an effect per hit. The projectile creates a new effect object with
NewObjecton every hit, but the effects keep no per-hit state. Calling them on the class default object would do the same job without the allocation. - Recycle the oldest projectile only when no free one is left. Strict rotation will take a bolt that’s still in flight if the pool is smaller than fire rate × flight time, so every pool has to be sized for the worst case.
