Hi, I am new to UE and I have a background with Unity.
I spent two evenings trying to figure out how to make a minimal game without all the stuff I dont need.
UE4 forces me to use PlayerController, HUD, GameState etc. the concepts of its Gameplay framework, but my game does not need any of those. I want to write my own actors.
This guide mentions that I can disable gameplay framework somehow, but I can not find a way to do it anywhere
You canât âDisableâ it, but you can choose not to use those classes if you really want to. Either way you canât avoid some things, like have a Controller for the player for example. Without that you get no input, no camera, nothing really. That guide is pretty misleading to be honest.
I would recommend sticking with it where itâs applicable, because otherwise youâll be fighting the engine all the way.
So no Pawn and no HUD, we are getting closer
Now I understand that I need PlayerController to manage camera and input. The name âPlayerControllerâ does not fit my project, but I can live with that.
For some reason I cant remove GameState, PlayerState and Spectator, how do I do that? Or these actors also have some important roles I am not aware of?
Why donât you just not use them in youâre code? You can ignore stuff like GameState etc⌠What is youâre game idea? Maybe we can help you fit youâre game into the framework?
You really shouldnât be wasting time looking at this stuff effectively not using these classes in youâre code is the same as setting them to NoneâŚ
Being an ex-Unity dev too, I can fully understand your frustration with the Gameplay Framework. Feels like in Unity you have this clean blank canvas to start on, but in UE4 you are knee-deep in clutter, constraints, and pre-made stuff you donât want in your project in the first place. You canât really âdisableâ it, but you can ignore it almost completely (unless youâre making an online game. Then youâll be happy you have it.)
Youâll have to handle input in the PlayerController. But aside from that, just make your own Managers and whatnot instead of using all this GameMode/GameState/PlayerState stuff. The default ones are harmless and wonât do anything in particular by themselves
There may be a way to make none of it appear if you create a custom GameMode and override some of its initialization functions (GameMode::InitGame(), maybe?). Youâll have to look into it
It is possible to become comfortable with UE4âs sea of polluted code and all the stuff that it imposes on you and forces you to live with, though. It just takes a lot of time and effort. I guess we have yet to see a âperfectâ engine getting released. It would have to have Unityâs âblank canvasnessâ and UE4âs rendering/tools quality, which is by all means a realistic goal
I really wouldnât want Unreal to be as blank as unity, because having all the extra stuff does not actually stop you from writing stuff from scratch but if you actually need the framework itâs a huge time saver.
I know some people who are using unity and are replicating a lot of the unreal framework, because itâs a well designed, battle tested one. The question of how basic an engine should be in itâs game play framework is a complicated question, because having a blank system has itâs trade offs also.
There just isnât a perfect engine and believe me from experience, not even when itâs completely designed for one game, just different tools with different proâs and cons.
Personally I would learn how to use the gameplay framework, I donât see how it really gets in the way, itâs a pretty sensible basic framework. If you are starting your effort to learn Unreal Engine by trying to make it like Unity, well, youâre making life hard for yourself.
Itâs not that big an effort to figure it out, the documentation is pretty good :
The classes that you can not remove are all required for basic network interaction which is one the keystones of the engine. Every PlayerController will have an PlayerState, which is responsible for replicating the players network data. Same goes for the GameMode and for itâs GameState class, the mode is only available in the host and handles joining, match handling, etc while the GameState is used to replicate global game related information to the connected clients.
Honestly if you choose to ignore the framework then fine, but youâll be in an uphill struggle all the way. A lot of core functionality wonât behave without it and youâll run into mishaps later down the line. If want to use any of the navigation or AI features for example, and you donât use a pawn with a PawnMovementComponent - good luck with that.
Thereâs a lot to be said for using the tools in the way they are designed.
By the way, I know it seems like I just made a little rant about the Gameplay Framework, but I completely agree with the others that it is much better to just bite the bullet and learn how to use it.
The official doc never managed to clearly explain the Gameplay Framework to me. It says things like âthe player name and score goes in PlayerState, and the gameâs rules go in GameModeâ. That just leaves me with more questions than answers. WHY do things have to be like this? What do you mean by âgame rulesâ and how do they even get applied? What does it actually do in practice? What is the lifecycle of all these objects? Why do game-specific things like name and score come built-in into the engine? Itâs ugly!!!
But then I found this: http://cedric.bnslv.de/Downloads/UE4_Network_Compendium_by_Cedric_eXi_Neukirchen.pdf
It explains everything clearly, and from a programmerâs perspective. Read pages 7 to 47 carefully, and suddenly everything will become clear. Youâll see that the Gameplay Framework is actually a brilliant generic structure for online games.
Iâve tried to think of games that wouldnât work well with the Gameplay Framework, and I couldnât think of any. Even games with an atypical online structure such as Dark Souls or DayZ, or even games that people say UE4 âdoesnât do wellâ like RTSs (my guess is that the people who say that are mostly non-programmers who are used to having everything pre-made for their game in advance. UE4 comes with a lot of pre-made shooter gameplay classes that you can use if you make a shooter game, but since it doesnât have pre-made RTS-gameplay-specific classes, they think it canât do RTSs). They all work well. The Gameplay Framework is generic enough that you donât have to worry about specific game compatibility. **The worst case scenario is that you wonât use certain aspects of the framework, but it will never actually prevent you from doing anything **
It basically consists of:
A class that serves as server-only logic (GameMode)
A class that represents the client as a whole, and can communicate with the Server (PlayerController)
A class that represents the public data of every client, accessible to everyone on the network (PlayerState)
A class that is the central place to store data accessible to everyone on the network (GameState)
A bunch of functions to make all connected players safely travel to new maps with everything getting properly cleared and initialized, handy Login() and Logout() events, etcâŚ