Optimizing actor classes for naval turrets (turrets, cannons, projectiles..)

Gnougnou
Sat, 10 Jan 2026 15:28:03 +0000
Programming & Scripting

Hi everyone,

I’m trying to optimize a workflow for creating multiple naval-style turrets (3rd person top-down game, with the turrets looking at the cursor on a 2D plane, Yaw rotation).

Currently, I have something working using the following method :

The ship hull class has sockets which are the hardpoints where the turrets can be spawned.

The turret has 1 or more sockets for attaching cannon in BeginPlay.

The gun class handles the reload timer and spawn the projectile from its barrel socket.

This works. However, with this method, I need to create classes for both turrets and guns.

Ideally, I’d like to have a master “Turret” class, which can be derived into final turrets (simple gun, dual gun, triple guns, etc…) where I can select the mesh for the turret & guns, as well as Niagara shooting effects, and basically have all the code here. This way, I can skip making all the gun actors (they would just be static mesh with a socket at the end for bullet spawn).

However, for each individual gun, I need to keep track of the reload time and ammo type, and I can’t really wrap my head around that. Currently it’s pretty easy because they are all separated actors, with individual variables, tick and fire functions taking care of the reload timer (which is just a bool + a Delay function)

So my questions are : is it even a good idea to do that ? And if so, is it doable ? How can I keep track of all the gun states and timers separately inside the turret if they are not individual actors ?

side note : I find it extremely frustrating to be forced to modify my base meshes to add sockets where things can dynamically spawn. I liked Unity’s ability to make “null object” inside prefabs (class viewport in UE) MUCH MORE. This was way easier to use and allowed you to keep your base mesh unchanged.

5 posts - 2 participants