Why is my GPU not working at 100%?

The spin is a bit cosmetic just because it looks pretty)… it’s like the idle animation.

Weapons don’t have textures… they just have materials (two or three)

I’m going to watch the video.
Thank you very much.

1 Like

if you want performance then look into object pooling for your ammunition. It will give you a much bigger gain than the spinning weapons.

1 Like

Ok, I’ll look into that.
Thank you!!!.

Hi @3dRaven
I made the pool.

On one hand it’s great, all the effects are pre-loaded into memory and there’s no lag at the start.

But on the other hand it doesn’t help with the FPS.
I will generate 20 projectiles per weapon. (10x20 = 200).
So I have 200 new replicated actors at level.

Well look at this.
They are causing 3.2ms of CPU time just for replication.
And they are completely disabled (no movement, no collisions, hidden)… as if they didn’t exist… but replication consumes CPU anyway.

Even if I disable replication when not using them the problem persists.

//-----------------------------------------------------------------------------
void AAmmoBase::Enable()
{	
	if (HasAuthority())
	{
		bReplicates=true;
		SetReplicateMovement(true);		
	}
}
//-----------------------------------------------------------------------------
void AAmmoBase::Disable()
{
	if (HasAuthority())
	{
		bReplicates=false;
		SetReplicateMovement(false);		
	}	
}
//-----------------------------------------------------------------------------

It looks a little better but it persists.

Any tips to improve this?

Thank you so much!!

In the enable / disable you should turn off rendering (set hidden) and set collisions to none. Deactivate projectile movement component too (set vel to 0, deactivate) .

On enable turn off hidden in game, reenable collisions and set the pmc update component (preferrably a collision component) and activate it to re-run the pmc.

Do you have an audio component on the projectile? If its just for impact sounds then better just fire off a oneshot sound at location.

Turned off items in the pool should just consume memory (zero calculations)

I did it
Sorry, I only showed you the replication part. (I attached all code at the end)

I made a pool for sounds and a particle system as well (everything is reused).

Yes, they do absolutely nothing.
I made a subsystem to simulate the shots. Just place the projectile on the muzzle of the weapon. and then returns it to the pool.

All I do is enable and disable things.

There must be something I haven’t disabled, I think it’s something related to replication (NetBroadcastTicktime) but I’m not sure.


//-----------------------------------------------------------------------------
// 
//-----------------------------------------------------------------------------
void AProjectile::Disable()
{
	AAmmoBase::Disable();

	if(!IsValid(Movement))
	{
		Message::Error("AProjectile::Disable --> Movement is NULL" );
		return;
	}
	Movement->ProjectileGravityScale = 0.0f;
	Movement->Velocity = FVector(0.0f, 0.0f, 0.0f);
	Movement->Deactivate();
	Movement->bAutoActivate=false;



	if(!IsValid(NiagaraTrail))
	{
		Message::Error("AProjectile::Disable --> NiagaraTrail is NULL" );
		return;
	}	
	NiagaraTrail->Disable();	
	NiagaraTrail->Deactivate();
	NiagaraTrail->bAutoActivate=false;
	

	if(!IsValid(NiagaraProjectile))
	{
		Message::Error("AProjectile::Disable --> NiagaraProjectile is NULL" );
		return;
	}
	NiagaraProjectile->Hide();
	NiagaraProjectile->Disable();
	NiagaraProjectile->Deactivate();
	NiagaraProjectile->bAutoActivate=false;
	

	
	if(!IsValid(HitNiagara_Explotion))
	{
		Message::Error("AProjectile::Disable --> HitNiagara_Explotion is NULL" );
		return;
	}	
	//HitNiagara_Explotion->Disable();
	HitNiagara_Explotion->Deactivate();
	HitNiagara_Explotion->bAutoActivate=false;
	

	if(!IsValid(AudioShooting))
	{		
		Message::Error("AProjectile::Disable --> AudioShooting is NULL" );
		return;		
	}
	AudioShooting->InitPooling();
	AudioShooting->Deactivate();
	AudioShooting->bAutoActivate=false;


	if(!IsValid(Hit_Audio))
	{
		Message::Error("AProjectile::Disable --> Hit_Audio is NULL" );
		return;			
	}
	//Hit_Audio->InitPooling();
	Hit_Audio->Deactivate();
	Hit_Audio->bAutoActivate=false;
	
	if(!IsValid(Damage_Component))
	{
		Message::Error("AProjectile::Disable --> Damage_Component is NULL" );
		return;			
	}
	Damage_Component->Deactivate();
	Damage_Component->bAutoActivate=false;


	if (!IsValid(SphereCollider))
	{
		Message::Error("Projectile::Disable --> SphereMesh is NULL");
		return;				
	}
	SphereCollider->SetNotifyRigidBodyCollision(false);
	SphereCollider->SetGenerateOverlapEvents(false);
	SphereCollider->SetCollisionEnabled( ECollisionEnabled::Type::NoCollision);
	SphereCollider->Deactivate();


	if (!IsValid(SphereMesh))
	{
		Message::Error("Projectile::Disable --> SphereMesh is NULL");
		return;				
	}		
	SphereMesh->SetVisibility(false, false);
	SphereMesh->Deactivate();

}
//-----------------------------------------------------------------------------
// 
//-----------------------------------------------------------------------------
void AProjectile::Enable()
{

	AAmmoBase::Enable();

	
	if(!IsValid(Movement))
	{
		Message::Error("AProjectile::Enable --> Movement is NULL" );
		return;
	}
	//Movement->InitialSpeed = 3000.0f;
	//Movement->MaxSpeed = 3000.0f;
	Movement->ProjectileGravityScale = GravityScale;
	Movement->Activate();
	
	

	if(!IsValid(NiagaraTrail))
	{
		Message::Error("AProjectile::Enable --> NiagaraTrail is NULL" );
		return;
	}
	NiagaraTrail->Enable();
	NiagaraTrail->Activate();
	

	if(!IsValid(NiagaraProjectile))
	{
		Message::Error("AProjectile::Enable --> NiagaraProjectile is NULL" );
		return;
	}
	NiagaraProjectile->Show();
	NiagaraProjectile->Enable();
	NiagaraProjectile->Activate();


	
	if(!IsValid(HitNiagara_Explotion))
	{
		Message::Error("AProjectile::Enable --> HitNiagara_Explotion is NULL" );
		return;
	}
	HitNiagara_Explotion->Activate();
	
	

	if(!IsValid(AudioShooting))
	{		
		Message::Error("AProjectile::Enable --> AudioShooting is NULL" );
		return;		
	}	
	AudioShooting->Activate();
	AudioShooting->Play();

	if(!IsValid(Hit_Audio))
	{
		Message::Error("AProjectile::Enable --> Hit_Audio is NULL" );
		return;			
	}
	Hit_Audio->Activate();
	//Hit_Audio->Play();

	if(!IsValid(Damage_Component))
	{
		Message::Error("AProjectile::Enable --> Damage_Component is NULL" );
		return;			
	}
	Damage_Component->Activate();


	if (!IsValid(SphereCollider))
	{
		Message::Error("AProjectile::Enable --> SphereMesh is NULL");
		return;				
	}
	SphereCollider->SetNotifyRigidBodyCollision(true);
	SphereCollider->SetGenerateOverlapEvents(true);
	SphereCollider->SetCollisionEnabled( ECollisionEnabled::Type::QueryAndPhysics);
	SphereCollider->Activate();


	if (!IsValid(SphereMesh))
	{
		Message::Error("AProjectile::Enable --> SphereMesh is NULL");
		return;				
	}		
	SphereMesh->SetVisibility(true, false);
	SphereMesh->Activate();
}

I don’t see that the actors are sending data.
Not even all the actors (ammunition) that are in the level were listed.

NetBroadcastTicktime It must be something else that is not related to the network.

Do you know what it is?