Is this tightly coupled?

Hi, I’ve just followed the “Handling Pawn Death” lecture, and I’ve left with a feeling that there are more cross-references between objects than I had originally been expecting. I’m separately also hearing about UE game design that is trying to “minimise coupling”. Would you say that the tutorial does this and, if not, how could I go about restructuring the approach to minimise the coupling? [for context, I’m basically trying to better understand the difference between a tightly and a loosely coupled system within UE] Many thanks

3 Likes

You could create a delegate yourself for actors to add their desired behaviour when the health is depleted or do what a few people were expecting, to use virtual functions (covered in the next section).

So for ActorDed you might have

void AToonTanksGameMode::PawnDied(ABasePawn* DeadPawn)
{
    DeadPawn->HandleDestruction();
}

which makes the function a little pointless, this is assuming you also don’t plan on having other things have a health component to be destroyed.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms