Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Any good C++ gamemode examples?


Recently I started learning UE4 as a game is going to support modding in the future and I want to implement a gamemode. Examples is the best way of learning for me but there aren't that many good examples for Gamemodes, gamestates and playerstates and alot are outdated.

So if anyone has a few good examples to share that would be greatly appreciated!!


Product Version: UE 4.18
more ▼

asked Jan 24 '18 at 09:34 AM in C++ Programming

avatar image

3 1 2 3

avatar image BrUnO XaVIeR Jan 24 '18 at 02:02 PM

You can download the source code of this project from the "Learn" tab on launcher:


avatar image Pizzaguy Jan 25 '18 at 10:22 PM

Thank you ill have a read

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Any C++ demos from launcher will do, if you have expirance with game modes in blueprints, you practiclly know how to do gamemode in C++, you will automatically find equivalents in C++.... i mean it's same class to begin with. So check API refrence:


Note that you don't need to mirror what other games/demos do (you probably won't learn anything either by doing so), you should look on events and functions avable to do and use them in the way to achieve what you want to make, this is programming. Only thing you need to learn i how classes behave and avoid anything that they don't expect and getting in there way and try to bland the code with it.

Best way to make game mode moddable is by making UT-style mutators, kind of plugins for gamemode. Make something like AMutator class with event functions that will help them manipulate the game (like forwarding all the game events optionaly you can make delegates for mutators to plug in to, it's actully more optimal way, in game mode make function helpful for them to control the game), make array of TSubclassOf<AMutator> init them on game start, and start them up.

Alternativly you can look up UT4 source code in git hub and see how mutators are implemented there, but remember you can't copy any code from it.

If you user want to modify on even bigger scale, they can just override gamemode, your should allow to use different gamemode classes, i mean you will need that yourself for the game eitherway. To make class more modable all functions that you want for user to be able to alter should be virtual.

Also read EULA as there restrictions of editor code distribution and use for modding the game.

more ▼

answered Jan 25 '18 at 10:10 PM

avatar image

37.3k 936 172 1116

avatar image Pizzaguy Jan 25 '18 at 10:22 PM

Thank you for the comment and I am picking up things in my off time now and getting a better understanding of how everything works. And yeah I use examples to get familiar with the code and create my own idea using it.

Currently one thing is bothering me though AGameMode has the function GetMatchState() but AGameModeBase doesnt have it anymore? Do you know why?

Ps. The Modding part will be officialy supported by the game I want to mod, just waiting for the tools and preparing in advance

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question