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

Check the spawn line of decal, and change FVector(DecalSize, DecalSize, 1.0f) to FVector(1.0f, DecalSize, DecalSize)

update to 4.15 ?

Work fine here, you only have to switch engine version :slight_smile:

Hello! Really nice work, just need some help, when jumping from one platform to another and having the zombies to follow, after they jump they starts ignoring me.

Think i managed to get it to work.

Hi! Can you please help? I’m having the same problem as you did. Thanks!

Hello! I think i managed to get it work by changing the Zombie behaviour tree. I moved the “Should wander” into the selector since i couldn’t get my zombies to patrol if it wasn’t like that. Then i just changed the Find bot waypoint to “TargetEnemy” as you can see in the picture below. I believe that did the trick, since i noticed when i put out nav links for my zombies to jump after me on roofs they just ignored me and tried to get to a waypoint. Tell me if it works for you too! :slight_smile: Have you managed to find out how to fix the Ammo bug? I noticed if you throw away your weapon and then pick it up again you get full ammo which isn’t so realistic :smiley:

Wow, awesome! I got away with the issue but your way seems far better. I’ll try this. :smiley: I haven’t seen that Ammo bug. I’ll check later when I get the chance. Thanks a lot! :smiley:

Great! :slight_smile:


Im trying to learn a bit using the project, and cannot set up proper headshot&limb damage for the player (i enabled pvp damage). Any help on why it doesnt work would be appreciated.

  1. I added 2 new surface types in project settings for player head and limbs
  2. Added 2 new physical materials cloning PlayerBody, and set the new surfaces there
  3. Changed in player’s PhysicsAsset head and limb surface - click on head at 3d model, set playerhead material for simple collision physical material
  4. For PlayerPawn set collision preset to custom, enable (query and physics), object type to Pawn, and set weapon at trace responses to block.
  5. Changed some code:

#define SURFACE_PLAYERHEAD          SurfaceType5
#define SURFACE_PLAYERLIMB          SurfaceType6

SWeaponInstant.cpp, changed DealDamage function a bit:

	if (PhysMat && DmgType)
		if (PhysMat->SurfaceType == SURFACE_ZOMBIEHEAD || PhysMat->SurfaceType == SURFACE_PLAYERHEAD)
			ActualHitDamage *= DmgType->GetHeadDamageModifier();	
		else if (PhysMat->SurfaceType == SURFACE_ZOMBIELIMB || PhysMat->SurfaceType == SURFACE_PLAYERLIMB)
			ActualHitDamage *= DmgType->GetLimbDamageModifier();		

Hi Tom, how do you add extra weapons like pistols/rifle/melee?

It is awesome for me :smiley: I don’t like tutorials so this is perfect piece of code to look into when i don’t know how to do something in my noobie project :smiley:


I have problem with UE4Editor-SurvivalGame.dll, and the rebuild.

I use the 4.16 and start the rebuild, and i have a error:

How can I fixed this error/problem?

There is a lot not working for 4.16 and 4.17 with this.

I’m an unreal rookie, and i want start my unreal learning from this project.
so , my first question is,can this project export an mobile version?
because my gold is unreal mobile develop!

in the end, sorry for my poor english. because i’m chinese!

hi mr looman,i’ve got a problem,EpicSurvivalGameSeries\SurvivalGame\Binaries\Win64,there is not a UE4Editor-SurvivalGame.dll
while rebuild from vs2017,the issue:

1>e:\unrealengin\ue_4.18\engine\source\runtime\coreuobject\public\Templates/SubclassOf.h(55): error C2027: 使用了未定义类型“ASWeapon”
1>C:\survivalGame\EpicSurvivalGameSeries\SurvivalGame\Intermediate\Build\Win64\UE4Editor\Inc\SurvivalGame\SCharacter.generated.h(11): note: 参见“ASWeapon”的声明
1>e:\unrealengin\ue_4.18\engine\source\runtime\coreuobject\public\Templates/SubclassOf.h(54): note: 编译 类 模板 成员函数 “UClass *TSubclassOf<ASWeapon>::operator *(void) const” 时
1>e:\unrealengin\ue_4.18\engine\source\runtime\coreuobject\public\Templates/SubclassOf.h(77): note: 参见对正在编译的函数 模板 实例化“UClass *TSubclassOf<ASWeapon>::operator *(void) const”的引用
1>C:\survivalGame\EpicSurvivalGameSeries\SurvivalGame\Source\SurvivalGame\Private\World\SGameMode.cpp(385): note: 参见对正在编译的 类 模板 实例化 “TSubclassOf<ASWeapon>” 的引用
1>e:\unrealengin\ue_4.18\engine\source\runtime\coreuobject\public\Templates/SubclassOf.h(55): error C3861: “StaticClass”: 找不到标识符
1>ERROR : UBT error : Failed to produce item: C:\survivalGame\EpicSurvivalGameSeries\SurvivalGame\Binaries\Win64\UE4Editor-SurvivalGame.dll
1>Total build time: 2.78 seconds (Local executor: 0.00 seconds)
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.MakeFile.Targets(44,5): error MSB3075: 命令“E:\unrealEngin\UE_4.18\Engine\Build\BatchFiles\Build.bat SurvivalGameEditor Win64 Development “C:\survivalGame\EpicSurvivalGameSeries\SurvivalGame\SurvivalGame.uproject” -waitmutex”已退出,代码为 5。请验证您是否拥有运行此命令的足够权限。
how can i solve it … is it about hot reload? i hope you can have a look…

I just found this project the other day, it looks a very promising start for building this type of game. I haven’t had time to go through everything in detail yet, but would there be any interaction with a database to get a game like this to work? Would it be a situation where once the Unreal dedicated server went down (or crashed) all the world/player data would be lost and players would have to start anew in a fresh world?

For example, if players had professions and they need to build up their skill to get access to more items. Maybe the player is level 10 out of 100 for First Aid. They login, advance to level 20 First Aid, then log out. Without a database would all of this would just be sitting in server memory?

Any elaboration on how the database fits into the picture for a game like this would be greatly appreciated!

you really should translate your log to english so we can give you some kind of feedback.

Hello, I have followed the tutorial series and it worked great for a base, I have made a few changes but after I updated the project from UE 4.18.3 to 4.19.0 the engine and VS2017pro spit out errors about setting a class as Native. The file in question is the SGameMode.cpp to which I have made no changes. I have spent about 3 days now searching the HUB for any info on a change to the engine that would hide/remove the ability to set a function as Native. If someone would be so kind as to point me in the right direction for info on how to rework this to compile in 4.19 it would be greatly appreciated.

here is the block throwing the error - Native undeclared identifier and ASGameMode uses non-stanard syntax use ‘&’ to create pointer member.

void ASGameMode::InitGame(const FString& MapName, const FString& Options, FString& ErrorMessage)
// HACK: workaround to inject CheckRelevance() into the BeginPlay sequence
UFunction* Func = AActor::GetClass()->FindFunctionByName(FName(TEXT(“ReceiveBeginPlay”)));
Func->FunctionFlags |= FUNC_Native;

/* Spawn all mutators. */
for (int32 i = 0; i &lt; MutatorClasses.Num(); i++)

if (BaseMutator)
    BaseMutator-&gt;InitGame(MapName, Options, ErrorMessage);

Super::InitGame(MapName, Options, ErrorMessage);


Thanks in advance.


I’m having trouble opening the SurvivalGame project in 14.19.2, I get an error about the UE4Editor-SurvivalGame.dll file and am too inexperienced to resolve this, I’ve tried a few things after a couple of days extensively Googling, installed Windows SDK & Visual Studio 2017 (OS: Windows 7 Ultimate 64-bit) as some mentioned that resolved compiling issues but I’ve had the same error since the start.


Log during Rebuild (best screenshot I could get as it happens within 1sec):


If there’s a magic thing I can do to make this work please let me know, it’s frustrating as I’m at a loss :frowning:

This is due to the mods if I recall correctly. What I did was downloaded the 4.18 copy of the source. Opened it in 4.18. Then if you upgrade it, it should tell you that the rifle mode and the other mod are not supported would you like to disable them.
Say yes.
Then find all the mod references and remove them or work on trying to upgrade them to 4.19. I’m going to revisit modding later but this got me started.