Is my c++ classes / blueprints diagram optimal for my city builder project ?

Hi all,

Red rectangles are c++ classes. White ones are blueprints. Red arrows are include . Blue arrows are inhéritance (c++ class → blueprint). Black arrows are blueprint classes references.

MyNodeClass, MySegmentClass and InfrastructureGraphManagerClass are used to define and update the road network graph.

For instance :

AMySegmentClass* AInfrastructureGraphManager::ConnectNodes(AMyNodeClass * Nod1, AMyNodeClass * Nod2, SegmentType SegType, bool IsCurv)

FSubdividedSegment AInfrastructureGraphManager::SubdivideSegment(AMySegmentClass * Segment, FVector NewNodeLocation)

DrawPreviewInfrastructure_BP is used to preview the road network before validating it.
For instance :

DrawStraightSegment()
DrawTangentSegment()
DrawTangentSegmentsAndCurve()
SnapMouseOnExistingNode()

DrawInfrastructure_BP is used to draw the road Network after validating the preview.
For instance :

DrawSegmentAndTwoNodes()
DrawSegmentAndTwoNodesFromColinear()
Split Straight Segment for Crossroads()
ConvertTurnNodeToCrossroads()

Spline_BP contains spline components and a procedural Mesh (which is used for procedural junctions). Each instance of Spline_BP is stored in the SplinesArray array inside DrawInfrastructure_BP. Each index of this array is stored in the variable MySegmentClass->SplinesArrayIndex.

For instance :

AttachMeshes()
UpdateSplineComponents()

ZonesBlock_BP is used to store the data of the building zones. One of its variables is a 2D arrays of Zones structs.

For instance :

Update()
Draw()
Erase()
SetConvexHull()

ZonesManager_BP is used to manage the ZonesBlock_BPs according to the road network.

For instance :

SpawnZBsAroundSubSpline()
SetZonePoints()
UpdateZBsConvexHull()
SpawnZBsAroundSegment()

As you know, CityBuilderPlayerController_BP is used to call whatever Node we want according to the Mouse/Keyboard Events.

Is there any need please to optimize this diagram ?

You could decouple the player controller from the managers through static functions.

I’m guessing you would also need a mesh instance manager that would govern hierarchical static meshes for the city. It could be invoked by the specific structure bp. Each building would dictate it’s needed meshes and pass in the correct offsets to the hism manager, it would hook to existing hism components or if needed create new ones.

3dRaven, thanks for your answer.

You could decouple the player controller from the managers through static functions.

You mean I shouldn’t use manager references in PLayController, and use static functions instead? Can I create static blueprint functions?

I don’t think they are accessible from bp. You need to inherit from BlueprintFunctionLibrary that is only pickable in a new c++ class.

but all my manager class are blueprint only, except hte InfrastructureGraphManager_BP blueprint which inherits from InfrastructureGraphManager class. So i should recreate every single manager blueprint classes in c++ ?

It was just a suggestion, mainly If you were already in c++.

Keeping with bp’s you will just have to keep a reference to the managers that’s all.

Thank you for your answers