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

**URL:** <https://forums.unrealengine.com/t/ongoing-c-gameplay-example-series-making-a-survival-game/24878>\
**Category:** Announcements\
**Tags:** unreal-engine\
**Created:** [March 20, 2015, 3:38pm UTC](https://forums.unrealengine.com/t/ongoing-c-gameplay-example-series-making-a-survival-game/24878 "2015-03-20T15:38:03Z")\
**Posts on this page:** 20\
**Page:** 13

<div class="post-metadata">

**Author:** ![Tom\_Looman](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tom_looman/32/1215549_2.png) [@Tom\_Looman](https://forums.unrealengine.com/u/Tom_Looman)\
**Post date:** [April 28, 2016, 8:22am UTC](https://forums.unrealengine.com/t/ongoing-c-gameplay-example-series-making-a-survival-game/24878/250 "2016-04-28T08:22:57Z")

</div>

> [@MonsieurVoltaire;517323](#):
>
> Hello, I’m not sure if this project is still active but it would be a great asset for me. Unfortunately, when trying to launch the project I receive the message:
> 
> I am running Windows 10 with Visual Studio 2015, and am trying to open the uproject file in Unreal Editor 4.10. I cloned the git repository, but am trying with the zip now (30 minute download.)
> 
> [http://i.imgur.com/8E7JR0u.png](http://i.imgur.com/8E7JR0u.png)

Hi!

Did you compile the source with your own Visual Studio or did this come fresh from the repository? If it’s fresh can you try rebuilding it in VS2015, otherwise you may need to double-check your build configuration in VS, “Development Editor” + Platform: “Win64”.

---

<div class="post-metadata">

**Author:** ![selement](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@selement](https://forums.unrealengine.com/u/selement)\
**Post date:** [April 30, 2016, 7:44am UTC](https://forums.unrealengine.com/t/ongoing-c-gameplay-example-series-making-a-survival-game/24878/251 "2016-04-30T07:44:26Z")

</div>

Hi,

I installed VS 2015 community and removed VS2013. I noticed when I build source its defaulting to VS2013 and engine 4.7. I believe VS2015 is only supported for 4.10 and above. I could not find an environment variable to change so I am not sure how its defaulting; I thought this project was based on the aforementioned? If so, any idea how to make this happen. In the short term, I assume I can point everything to 4.10 within each project and override the defaults? Appreciate the clarification.

---

<div class="post-metadata">

**Author:** ![Tom\_Looman](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tom_looman/32/1215549_2.png) [@Tom\_Looman](https://forums.unrealengine.com/u/Tom_Looman)\
**Post date:** [May 7, 2016, 2:36pm UTC](https://forums.unrealengine.com/t/ongoing-c-gameplay-example-series-making-a-survival-game/24878/252 "2016-05-07T14:36:58Z")

</div>

> [@selement;522206](#):
>
> Hi,
> 
> I installed VS 2015 community and removed VS2013. I noticed when I build source its defaulting to VS2013 and engine 4.7. I believe VS2015 is only supported for 4.10 and above. I could not find an environment variable to change so I am not sure how its defaulting; I thought this project was based on the aforementioned? If so, any idea how to make this happen. In the short term, I assume I can point everything to 4.10 within each project and override the defaults? Appreciate the clarification.

Yeah you should simply be able to make it point to 4.10 and build the project from inside Visual Studio 2015.

---

<div class="post-metadata">

**Author:** ![Takira](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Takira](https://forums.unrealengine.com/u/Takira)\
**Post date:** [May 19, 2016, 1:38pm UTC](https://forums.unrealengine.com/t/ongoing-c-gameplay-example-series-making-a-survival-game/24878/253 "2016-05-19T13:38:25Z")

</div>

What About mac version? tried compiling section 1 got error message, i will try branch and see anymore errors

---

<div class="post-metadata">

**Author:** ![Curious\_Rubick](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Curious\_Rubick](https://forums.unrealengine.com/u/Curious_Rubick)\
**Post date:** [May 20, 2016, 9:07pm UTC](https://forums.unrealengine.com/t/ongoing-c-gameplay-example-series-making-a-survival-game/24878/254 "2016-05-20T21:07:05Z")

</div>

> [@;514531](#):
>
> Noticed the same when opening the project, I’ll look for a fix the next time I do an upgrade of the project.

After changing UAudioComponent’s access from protected to public in STimeOfDayManager.h, I no longer get the error.

---

<div class="post-metadata">

**Author:** ![Tom\_Looman](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tom_looman/32/1215549_2.png) [@Tom\_Looman](https://forums.unrealengine.com/u/Tom_Looman)\
**Post date:** [May 30, 2016, 6:54pm UTC](https://forums.unrealengine.com/t/ongoing-c-gameplay-example-series-making-a-survival-game/24878/255 "2016-05-30T18:54:02Z")

</div>

> [@Curious\_Rubick;533650](#):
>
> After changing UAudioComponent’s access from protected to public in STimeOfDayManager.h, I no longer get the error.

Thanks for the suggestion Rubick. I tried the same, but it did not solve the warning on my end, something else must be going wrong internally.

---

<div class="post-metadata">

**Author:** ![alked](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@alked](https://forums.unrealengine.com/u/alked)\
**Post date:** [June 2, 2016, 11:59am UTC](https://forums.unrealengine.com/t/ongoing-c-gameplay-example-series-making-a-survival-game/24878/256 "2016-06-02T11:59:14Z")

</div>

can update to 4.12?

---

<div class="post-metadata">

**Author:** ![Hevedy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Hevedy](https://forums.unrealengine.com/u/Hevedy)\
**Post date:** [June 6, 2016, 10:22am UTC](https://forums.unrealengine.com/t/ongoing-c-gameplay-example-series-making-a-survival-game/24878/257 "2016-06-06T10:22:55Z")

</div>

I have a problem at update to the 4.12 directly from 4.10 from Github.

After patch some changes in the 4.12 API following the and others guide [4.12 Transition Guide - C++ - Epic Developer Community Forums](https://forums.unrealengine.com/showthread.php?112644-4-12-Transition-Guide) I get a problem at the end when looks like all is done at compile I get this error:

> [@](#):
>
> 1\> Creating library D:\Users\Documents\Unreal Projects\SurvivalGame 4.12\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-SurvivalGame-5343.lib and object D:\Users\Documents\Unreal Projects\SurvivalGame 4.12\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-SurvivalGame-5343.exp  
> 1\>Module.SurvivalGame.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void \_\_cdecl IGameplayTaskOwnerInterface::OnGameplayTaskActivated(class UGameplayTask &)” (?OnGameplayTaskActivated@IGameplayTaskOwnerInterface@@UEAAXAEAVUGameplayTask@@@Z)  
> 1\>SurvivalGame.generated.cpp.obj : error LNK2001: unresolved external symbol “public: virtual void \_\_cdecl IGameplayTaskOwnerInterface::OnGameplayTaskActivated(class UGameplayTask &)” (?OnGameplayTaskActivated@IGameplayTaskOwnerInterface@@UEAAXAEAVUGameplayTask@@@Z)  
> 1\>D:\Users\Documents\Unreal Projects\SurvivalGame 4.12\Binaries\Win64\UE4Editor-SurvivalGame-5343.dll : fatal error LNK1120: 1 unresolved externals

Edit\*: Looks like need include in the Build file the “GameplayTasks” module

---

<div class="post-metadata">

**Author:** ![Tom\_Looman](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tom_looman/32/1215549_2.png) [@Tom\_Looman](https://forums.unrealengine.com/u/Tom_Looman)\
**Post date:** [June 6, 2016, 1:39pm UTC](https://forums.unrealengine.com/t/ongoing-c-gameplay-example-series-making-a-survival-game/24878/258 "2016-06-06T13:39:15Z")

</div>

Hi All!

I’ve just upgraded the project to 4.12 on GitHub (Including the GameplayTasks people have experienced)

[https://github.com//EpicSurvivalGameSeries](https://github.com//EpicSurvivalGameSeries)

---

<div class="post-metadata">

**Author:** ![Hevedy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Hevedy](https://forums.unrealengine.com/u/Hevedy)\
**Post date:** [June 6, 2016, 4:29pm UTC](https://forums.unrealengine.com/t/ongoing-c-gameplay-example-series-making-a-survival-game/24878/259 "2016-06-06T16:29:26Z")

</div>

> [@;542863](#):
>
> Hi All!
> 
> I’ve just upgraded the project to 4.12 on GitHub (Including the GameplayTasks people have experienced)
> 
> [https://github.com//EpicSurvivalGameSeries](https://github.com//EpicSurvivalGameSeries)

I spend some hours today updating and now you go and update xD Fine!

I tried to change the UMG files but is not possible in 4.12 is bugged and the engine crash [Serious UMG BUG can't do nothing - Platform & Builds - Epic Developer Community Forums](https://answers.unrealengine.com/questions/431622/serious-umg-bug-cant-do-nothing.html)

By the way for when the fix of the jump in the air ? At jump in the air you need to calculate different size of translation.

\*The packaged version/compiled in 4.12 don’t show or don’t have mouse in the menus.

\*Bullet decal direction is wrong.

---

<div class="post-metadata">

**Author:** ![turtledma](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@turtledma](https://forums.unrealengine.com/u/turtledma)\
**Post date:** [June 20, 2016, 10:45pm UTC](https://forums.unrealengine.com/t/ongoing-c-gameplay-example-series-making-a-survival-game/24878/261 "2016-06-20T22:45:58Z")

</div>

I am newbie to game development, and to unreal too… I am reviewing the project and I have a first question, maybe someone can help, when a new bot is spawned the code seems very simple …

```auto

	FActorSpawnParameters SpawnInfo;
	SpawnInfo.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AdjustIfPossibleButAlwaysSpawn;

	ASZombieAIController* AIC = GetWorld()->SpawnActor<ASZombieAIController>(SpawnInfo);
	RestartPlayer(AIC);

```

I don’t understand how does the engine know it has to build and spawn an instance of Zombie Character blueprint from this… can anyone help me understand the mechanics behind this?

thanks in advance and kind regards

David

---

<div class="post-metadata">

**Author:** ![Tom\_Looman](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tom_looman/32/1215549_2.png) [@Tom\_Looman](https://forums.unrealengine.com/u/Tom_Looman)\
**Post date:** [June 22, 2016, 1:06pm UTC](https://forums.unrealengine.com/t/ongoing-c-gameplay-example-series-making-a-survival-game/24878/262 "2016-06-22T13:06:11Z")

</div>

> [@turtledma;551609](#):
>
> I am newbie to game development, and to unreal too… I am reviewing the project and I have a first question, maybe someone can help, when a new bot is spawned the code seems very simple …
> 
> ```auto
> 
> FActorSpawnParameters SpawnInfo;
> SpawnInfo.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AdjustIfPossibleButAlwaysSpawn;
> 
> ASZombieAIController* AIC = GetWorld()->SpawnActor<ASZombieAIController>(SpawnInfo);
> RestartPlayer(AIC);
> 
> ```
> 
> I don’t understand how does the engine know it has to build and spawn an instance of Zombie Character blueprint from this… can anyone help me understand the mechanics behind this?
> 
> thanks in advance and kind regards
> 
> David

Hi David,

I totally understand the confusion. It’s a bit of an obscure system. If you search for GetDefaultPawnClassForController\_Implementation inside SGameMode.cpp you’ll find how it figures out which BotClass to use for the AI controller.

That function is called internally by the game framework when you call RestartPlayer(Controller)

Hope that helps.

-

---

<div class="post-metadata">

**Author:** ![Hevedy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Hevedy](https://forums.unrealengine.com/u/Hevedy)\
**Post date:** [June 22, 2016, 1:17pm UTC](https://forums.unrealengine.com/t/ongoing-c-gameplay-example-series-making-a-survival-game/24878/263 "2016-06-22T13:17:43Z")

</div>

[MENTION=156] [/MENTION] there is a problem when play and the player dead some times the engine crash or just freezes but not sure why.

---

<div class="post-metadata">

**Author:** ![Tom\_Looman](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tom_looman/32/1215549_2.png) [@Tom\_Looman](https://forums.unrealengine.com/u/Tom_Looman)\
**Post date:** [June 22, 2016, 2:12pm UTC](https://forums.unrealengine.com/t/ongoing-c-gameplay-example-series-making-a-survival-game/24878/264 "2016-06-22T14:12:21Z")

</div>

> [@Hevedy;552630](#):
>
> [MENTION=156] [/MENTION] there is a problem when play and the player dead some times the engine crash or just freezes but not sure why.

Do you have a call stack or any log message / crash info that could help track this down?

---

<div class="post-metadata">

**Author:** ![Hevedy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Hevedy](https://forums.unrealengine.com/u/Hevedy)\
**Post date:** [June 22, 2016, 2:30pm UTC](https://forums.unrealengine.com/t/ongoing-c-gameplay-example-series-making-a-survival-game/24878/265 "2016-06-22T14:30:34Z")

</div>

I’ll check the next time but the engine just freeze and there is not report or something, I think is related with this [https://github.com//EpicSurvivalGameSeries/issues/14](https://github.com//EpicSurvivalGameSeries/issues/14) but not sure I need to give a check with the debugger or something.

---

<div class="post-metadata">

**Author:** ![turtledma](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@turtledma](https://forums.unrealengine.com/u/turtledma)\
**Post date:** [June 23, 2016, 7:06pm UTC](https://forums.unrealengine.com/t/ongoing-c-gameplay-example-series-making-a-survival-game/24878/266 "2016-06-23T19:06:50Z")

</div>

> [@;552621](#):
>
> Hi David,
> 
> I totally understand the confusion. It’s a bit of an obscure system. If you search for GetDefaultPawnClassForController\_Implementation inside SGameMode.cpp you’ll find how it figures out which BotClass to use for the AI controller.
> 
> That function is called internally by the game framework when you call RestartPlayer(Controller)
> 
> Hope that helps.
> 
> -

He he… Just a couple lines below… thank you so much!!!

---

<div class="post-metadata">

**Author:** ![acxsasx](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@acxsasx](https://forums.unrealengine.com/u/acxsasx)\
**Post date:** [June 27, 2016, 5:34pm UTC](https://forums.unrealengine.com/t/ongoing-c-gameplay-example-series-making-a-survival-game/24878/267 "2016-06-27T17:34:59Z")

</div>

> [@;514531](#):
>
> Noticed the same when opening the project, I’ll look for a fix the next time I do an upgrade of the project.

I pulled down the 4.12 version and got the same error. Am I missing something? Looking forward to digging into what you have done . I appreciate it.

Error /Game/Maps/CoopLandscape\_Map : Failed import for AudioComponent /Game/Base/BP\_TimeOfDayManager.Default\_\_BP\_TimeOfDayManager\_C:AmbientAudioComp

---

<div class="post-metadata">

**Author:** ![Tom\_Looman](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tom_looman/32/1215549_2.png) [@Tom\_Looman](https://forums.unrealengine.com/u/Tom_Looman)\
**Post date:** [June 27, 2016, 10:23pm UTC](https://forums.unrealengine.com/t/ongoing-c-gameplay-example-series-making-a-survival-game/24878/268 "2016-06-27T22:23:28Z")

</div>

> [@acxsasx;555431](#):
>
> I pulled down the 4.12 version and got the same error. Am I missing something? Looking forward to digging into what you have done . I appreciate it.
> 
> Error /Game/Maps/CoopLandscape\_Map : Failed import for AudioComponent /Game/Base/BP\_TimeOfDayManager.Default\_\_BP\_TimeOfDayManager\_C:AmbientAudioComp

The suggested fix did not work for me either. I wonder why it’s complaining about the component.

---

<div class="post-metadata">

**Author:** ![Ambience\_Lee](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ambience\_Lee](https://forums.unrealengine.com/u/Ambience_Lee)\
**Post date:** [July 17, 2016, 3:18am UTC](https://forums.unrealengine.com/t/ongoing-c-gameplay-example-series-making-a-survival-game/24878/269 "2016-07-17T03:18:55Z")

</div>

Very nice tutorial! I am looking at the sprinting part, but I am not sure how IsSprinting(), and bWantsToRun actually changes the speed of the player character. could you give me a hint?

---

<div class="post-metadata">

**Author:** ![Tom\_Looman](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tom_looman/32/1215549_2.png) [@Tom\_Looman](https://forums.unrealengine.com/u/Tom_Looman)\
**Post date:** [July 17, 2016, 4:25pm UTC](https://forums.unrealengine.com/t/ongoing-c-gameplay-example-series-making-a-survival-game/24878/270 "2016-07-17T16:25:06Z")

</div>

> [@Ambience Lee;565911](#):
>
> Very nice tutorial! I am looking at the sprinting part, but I am not sure how IsSprinting(), and bWantsToRun actually changes the speed of the player character. could you give me a hint?

Have a look at the custom CharacterMovementComponent class, that’s what modified the walking speed. You can also find it by searching the project for IsSprinting()

-

[Previous page](https://forums.unrealengine.com/t/ongoing-c-gameplay-example-series-making-a-survival-game/24878.md?page=12)

[Next page](https://forums.unrealengine.com/t/ongoing-c-gameplay-example-series-making-a-survival-game/24878.md?page=14)
