BP_Crowd_Gamemode

Consists of one EventGraph and one Function (SpawnSegments).

Controlling the Amount of Segments to Spawn/Delete

image.png

image.png

The game spawns 4 segments ahead of the player (using a For Loop from 0 to 3). Using the length of the main/parent segment (BP_BaseGroundSegment), each of the 4 segments spawns exactly 4,300 units ahead of the previous one (Variable: NextSpawnXLocation), creating a perfect match. I've limited the number of segments in the level to 10. When we reach 12 segments (4+4+4), the first 4 segments are deleted and removed from the array.

Setting Up New Segment Types Using the SegmentByWeight Logic

image.png

All segments inherit from BP_BaseGroundSegment, making it simple to create new segments. After creating a new segment, add it to the SegmentClassesArray variable in the Details panel (shown on the right of the image).

By adjusting the SpawnWeight, you can control how frequently each type of segment appears, affecting both difficulty and randomness.

BP_Crowd_Player

Controls the main player character, manages the follower crowd, and handles movement input and battle states. Contains one EventGraph and four functions: UpdateFollowerCount, HandleFollowerDestroyed, CheckForGameOver, and RefreshMyFollowerCountDisplay.

Functions

image.png

The spawn sound for player followers can be modified in the UpdateFollowerCount function, immediately after the SpawnActor node. The unit death sound can be found in the HandleFollowerDestroyed function.

You can also modify the PlayerFollowerIconTexture in this Blueprint.