Ongoing C++ Gameplay Example Series: Making a Survival Game



Hi! Thank you for your sample. Very nice to play and to learn a lot! I have a question: I imported my own model skinned and rigged, then did a retarget animation, then linked the meta blueprint. It works great, except reloading animations, and changing weapons that didnt play (but the game reload and is able to change to flashlight, just that both animation didnt play) Anyone know’s why? Thank you!

I am not at home with my PC, but trying to help, did you create all the sockets on your new imported mesh?

Hi Alexarg. Yes, I added the three sockets: on pelvis, on spine_03, and on hand_r.

EDIT: I found the issue. I needed to point on weapon blueprint the animation composite for the new character, as pointed the maniquee. So that’s make me wonder if I need to make every weapon for ever character I will add independant. So Does that’s mean lots of same weapon?

EDIT 2: Could enyone please add an example for how to make a type of zombie that shoots? I would love to see more aditions like adding prone and how to add things like that as the iddle without weapon movement, or the nice flash back done by ZioYuri78, as this sample if very fun to tweak it :slight_smile: (and play it!)

Im having problems with multiple PC’s since 9.1
The open command does not work. Any idea?

I’m not in 4.9.1 yet to try out, but it sounds like a general engine bug. Your best bet it to take this to AnswerHub for the support team to look at.

Open works for me, make sure you’re using open, and that the session you’re trying to connect to has ?listen in the command line, otherwise you won’t be able to join it.

Hi Tom

Thanks for the great tutorial series ! I learned a lot from it.

I am extending the code to enable spawning objects into the world and then carrying them. Just as into your Pickup() function I have a SpawnNewActor() function hooked up to the B key.

void USCarryObjectComponent::SpawnNewActor()
	if (GetIsCarryingActor())

	if (GetOwner()->Role < ROLE_Authority)
	UWorld* const World = GetWorld();
	if (World){
		//ConstructorHelpers::FObjectFinder<UBlueprint> MyBlueprint(TEXT("/Game/Test/Stairs/StairsBP.StairsBP"));
		auto Object = StaticLoadObject(UObject::StaticClass(), nullptr, TEXT("/Game/Test/Stairs/StairsBP"));
		UBlueprint *BP = Cast<UBlueprint>(Object);
		APawn* OwningPawn = Cast<APawn>(GetOwner());

		FActorSpawnParameters SpawnParams;
		SpawnParams.Instigator = OwningPawn;
		SpawnParams.Instigator = OwningPawn->Instigator;

		FVector Location = OwningPawn->GetActorLocation() + OwningPawn->GetActorForwardVector() * 600;

		AActor *SpawnedActor = World->SpawnActor<AActor>((UClass*)BP->GeneratedClass, Location, FVector::ZeroVector.Rotation(), SpawnParams);


void USCarryObjectComponent::ServerSpawnNewActor_Implementation()

bool USCarryObjectComponent::ServerSpawnNewActor_Validate()
	return true;

void USCarryObjectComponent::OnSpawnNewActorMulticast_Implementation(AActor* SpawnedActor)
	if (SpawnedActor)

It works fine in singleplayer, the object is spawned when the B key is hit, attached to the end of the boom and I can move it around and drop it when I press the middle mouse button. The problem is in multiplayer. On the server its all fine but on the clients the SpawnedActor parameter in the OnSpawnNewActorMulticast_Implementation function is always null. When I drop the object it appears on both client and server but on spawning it fails to attach to the boom in the client as it is null.

Any thoughts on what might be wrong ?

Thanks !

Don’t see something immediately wrong. Perhaps the Actor does not exist on the Client yet because of the SetReplicates call coming in late.

BTW I highly recommend never using FObjectFinder, you can use code like

in the Header file to expose a class reference to Blueprint and assign it in the component instead of hard-coding content lines (I know yours is WIP/test code, but I try to stay away from this entirely)

Thanks Tom for the inputs. Yes I suspect it is a replication issue. I have not yet found a work around but trying to, will post if I do.


when trying to use this project, i download part 8, i have both visual studio professional 2012, and community 2013, UE4 and get the (Failed to build) try building manually… can someone help?

My Error is

You mention part 8? But there are only 6 sections. if you download the latest from GitHub you need to run it with 4.9. From your log output it seems to fail on OnLanded() which is a function in the API that got changed around 4.8. Please make sure you got the latest, and are trying to compile in Visual Studio 2013 with 4.9.

Hi there Tom!

As usual thanks for your contribution mate!

Just my 50 cents, I’ve quickly read through parts of the code, and since you like good practices, here’s my contribution:

  • You’re sending Client messages using FStrings, it makes more sense - in terms of bandwidth, performance - to instead send a uint32, having most of the messages hardcoded on the client. All the client has to do, is open the map of those messages (stored in an XML or w/e), and they get their message. uint32 vs FString… And use that solution for special unpredicted messages, or well, just a combination of both sendClientMessage(uint32 messageID, FString replaceString);

You are totally right mate. I spotted these bumps in networking when I started profiling recently, but wasn’t sending enough yet to warrant priority. IDs are for sure a better way of handling this. If I get this updated in my primary project I’ll see if I can update the survival game too with that.


I am stuck with something… I do want to make a simple rpg launcher. So the weapon fire a proyectil that, on impact, explode like the bomb. Tried to change the damage_type, but I am unable to do it, any help please? Thanks!

Hello and congratulations for the project. I am a newbie but I’m slowly trying to understand all the tutorial.

Right now I’m trying to change the respawn time parameters of the players but I can not understand how it works. Could anyone help? Thank you.

Tom would you be willing to update the project to the latest release?

I’ve been keeping it up to date with the latest stable releases, currently 4.9. 4.10 is still in preview, I’ll likely update it after the first stable release.