Survival sample game

C++ Sample project covering common gameplay concepts packed in a small survival game.

Rate this Tutorial:
(12 votes)

Approved for Versions:4.7


This series focuses on the C++ aspect of Unreal Engine 4. The goal is to introduce a variety of gameplay concepts written in C++, with some Blueprint interaction to get you more comfortable using C++ for your projects by using practical examples instead of relying on theory.

It’s important to note that this series is not a step-by-step tutorial. Instead each two weeks a new section is published, with all source and assets and associated documentation to explain concepts and the “why” behind some of the code. You can leave questions & feedback on the official forum thread and I will try to integrate user questions back into the source and documentation for future reference.

Section6 coopoverview.jpg

Game Premise

The game is a third person survival game focusing on familiar mechanics from games in this genre.

You'll have to find a weapon to defend yourself. Food and ammunition are spread throughout the level and so you are constantly on the search for resources. Enemies may be anywhere, making too much noise while scavenging to survive will attract attention. The environment will have interactive objects to help your defence. The game will support coop play with a buddy. Survive as many days/nights as possible.

You will end up with a basic third person game, fully networked and a small environment with interactive objects that you may use as a base for your own survival game.

Before you get started

It’s not recommended to immediately dive into this sample game if you have no prior C++ experience. There are a few good places to get comfortable with the basics of C++ before moving into more complex concepts such as replication (networking) that are covered in this project.

If you are completely new to Unreal Engine 4 I recommend you first get yourself comfortable with the editor instead. Have a look at the official Getting Started page to get you up to speed or use this collection of links at for a variety of tutorials and places to learn. And finally, to understand what Actors, PlayerControllers and Pawns represent I recommend reading up on them in the Gameplay Framework section of the docs.

While not required before following this series, I do recommend have a good look at Epic’s Coding Standards for C++. I try to keep to this standard throughout the series and it’s good to maintain this standard in your own projects to more easily work with the Engine’s source and public samples which most of the time hold to this standard.

That is a lot to read up on, but again - I highly recommend doing so before dropping yourself into the survival game project.

If you feel you are ready to get started then go ahead and download the project source at GitHub. There is a release branch available for each Section that is complete, or simply get the latest through the master-branch. You can play the game, look through the code and change/add features, if you’re looking for additional information look for the associated Section. If there is no additional info to be found, be sure to grab me on the forums of each individual Section and I’ll be happy to answer your questions!

Sections Overview

The project is split into 6 sections. Each covering one or more gameplay features or other C++ oriented concepts. You can skip to whatever section you find most interesting as the documentation pages have no dependencies between them.

Project Forum Thread

Section 1 - Character Setup

Section6 advancedanimbp03.jpg

Sets up the third-person character movement with animation, object interaction, simple hunger system, all with networking support.

Section 2 - Weapons, Death & Inventory

Section6 equipment03.jpg

Adds weapon support for the character, a flashlight, UT-style inventory with on-character visual representation of the carried items and deals with damage, death and respawns for players.

Section 3 - Zombie AI

Section6 zombieattacking01.jpg

Introduces AI "Zombie" enemy to our game using PawnSensing and Behavior Tree.

Section 4 - Dynamic Time of Day & Game loop

Section6 timeofday combined.jpg

Introduces a dynamic time of day, advanced player spawning and a basic game loop.

Section 5 - Networking

Section6 coop02.jpg

Introduces game networking and the ability to carry around objects like barriers and bombs.

Section 6 - Polish & Review

Section openworldscenery01.jpg

The final section in the series focuses on bug fixing and a bit of polish to the existing features. This section is compatible with the 4.8 release.

Project & Wiki by Tom Looman