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

The project runs on 4.8, the previous 1-4 sections do reference the 4.7 API in the docs but if you download the project all features work in 4.8

  • Tom

Thanks for the fast answer. I would highly prefer to just follow the tutorial series instead of downloading the project as a whole, as I would learn a lot more. Is the API backwards compatible? What I was asking is if I follow the tutorials using the 4.8 engine, will I still get the correct results on the tutorials that were made on 4.7 .

Thanks Tom for that tutorial series, really helpful to quickly understand the UE C++ architecture. Btw the links to the source files like SCharacter.cpp in A new, community-hosted Unreal Engine Wiki - Announcements and Releases - Unreal Engine Forums have become invalid since you seem to have moved some files into subfolders.

Hi Tom, I was playing around with the project and studying it, and i think i found some strange behaviour with the “grab” system and/or physics.
Here a video (easier to show), just jump on an object and then try to carry it.

Im trying to understand what is happening :slight_smile:

Awesome series thanks again!

Haha, that is really odd I believe I’m disabling collision while carrying an object. It seems to be using the object as a base to stand on, and pushing the character and therefor the platform since it’s attached to the character.

The series is not a step-by-step, but you could still use the branches on GitHub to go section-by-section to make things a little easier.

Right, thanks for letting me know!

ok i have questions to do if you can help me of course answer me please :slight_smile:

i changed the time. is going like 16.01-16.02-16.03 ok. The problem is the day-night cycle is not combining with the time. What i have to change?

I mean 16.01 day 16.03 night 16.08 day something like this.

These Sections look so good, Awesom, i like , hope can see some video tutorials for this.

Whenever I try to open the project, Unreal crashes. Is there a fix?

excuse, every section is individual? or like section3 contains section2 and section1 content. if i want learn the content , first, i learn section1 , section 2 , section3 … or directly master.

master contains all sections

It depends, what Error are you getting?

I used to get an error (not sure what it was), but now it just says unreal crashed unexpectedly and closes the program. It no longer tells me the error because it crashes 5 seconds after I try to open it.

The log files in /Saved/Logs should have some information on what is happening.

Hello, i read these codes about Section-2,and have a function cant understand, want help. eg

FVector ASWeapon::GetCameraDamageStartLocation(const FVector& AimDir) const
ASPlayerController* PC = MyPawn ? Cast<ASPlayerController>(MyPawn->Controller) : nullptr;
FVector OutStartTrace = FVector::ZeroVector;

if (PC)
	FRotator dummyRot;
	PC-&gt;GetPlayerViewPoint(OutStartTrace, dummyRot);

	// Adjust trace so there is nothing blocking the ray between the camera and the pawn, and calculate distance from adjusted start
	// TODO: Break down into easy to understand code (copied from ShooterGame)
	OutStartTrace = OutStartTrace + AimDir * ((Instigator-&gt;GetActorLocation() - OutStartTrace) | AimDir);

return OutStartTrace;


i read this like that get a location with Camera View as Trace start, but i dont know why do this code ,

OutStartTrace = OutStartTrace + AimDir * ((Instigator->GetActorLocation() - OutStartTrace) | AimDir);

why not direct to get camera location :

like this :

PC->GetPlayerViewPoint(CamLoc, CamRot);

use CamLoc as Trace start

Thats a great work !
Did you think about some melee actions ? For example killing zombies / players by axe ?

With the last section 6 i don’t see nothing about:

  • Prone
  • Weapon start selection
  • Big Map with AI manager

Hi AlphaWerewolf,

I adjusted the code later on to work better for third person games where the damage ray should come from the weapon muzzle and not the camera view point. The code I was using was for first person from ShooterGame and was adding an adjustment when the trace would be interfered with by a close to camera wall. I recommend checking out the source from the later sections for an updated and hopefully clearer implementation.

Not ALL features can be included in a sample game. Because it’s just that, a sample. I hope it’s still useful as it does have a lot of other features to get you started. Big map AI was something I wanted to include but didn’t have enough time to fit in.

For who is interested i’m working on the implementation of “no weapon equipped” animation, at the moment i merged the standard third person idle and walk/run animation with the idle and walk/run animation from Animation Starter Pack, in this way when you start without weapons (or you drop all your weapons) the character have a more natural pose of the arms. Is a very simple stuff to do, in the next days (when i wil have time) i will post here how i have achivied here.

Here the video of the result.

Audio is out of sync because i used the wrong settings in Dxtory and discovered only now the issue :stuck_out_tongue:


Being a developer with previous gamedev experience (lately in Unity), I’m starting to learn UE4 the C++ route and later move in to Blueprints. Projects like this are an awesome way to learn a new tool, in a “real life” scenario. Congrats for pulling it off, it’s a tremendous work and well done!

From what I’ve seen unfortunately, this is more for people that already have experience with the engine and might want to learn things that they haven’t already covered, ie, it isn’t for absolute beginers to the tool itself. More specifically, I think the tutorials need a more step by step approach that can be found in the official programming guides and the Shooting Game tutorial.

This comes from simple things like:

  • Ok, I’ve programmer the input in a SCharacter, how should I go to test this?
  • Should I just drag and drop it in the scene?
  • Am I supposed to have that humanoid UE model already?
  • Since I don’t, I reckon I can import feature packs from the Third Person template for instance, should I import that? But if I do, it should already have this sort of stuff done, I want to start fresh to learn everything.

What I suggest is, keeping the organization as is for more experienced users who might not need this hand holding but, have some sort of collapsible area in each topic with step by step instructions with images. Furthermore, specify context things like “Create an empty project” at the beginning of section 1. With improved documentation this can easily be THE c++ UE4 tutorial (specially because from what I’ve seen, this is the only one that is updated to the last version)!

To workaround this I’m getting up to speed with some basic stuff from the programming guide and this 3rd Person Game with Blueprints (v4.8) video tutorials initial part.

Hope that helped, thanks for your work @Tom Looman!

Hi vvolkgang,

What I think would be a great approach is to not try an pack it all into a single tutorial, but perhaps use a modular “tracks” approach that likes like Digital Tutors use to give you a track of individual tutorials to follow (this series would come after setting up a project, learning C++ 101 and editor basics) If I had to do this step-by-step, there wouldn’t be nearly as many features to learn from (simply because of the time available to build and release this project) and a lot would still be considered too complex for absolute beginners (wrapping your head around replication while still learning C++ syntax isn’t easy for example)

I hope you can still follow along and learn from it, perhaps after reading up on the other available resources that introduce C++ and the editor itself.

  • Tom