I am learning Unreal Engine 4 now and want to make RTS game. I have good experience with Unity, but want to try to do it using UE 4.
Current engine architecture contains World class with GameMode. Each GameMode have one PlayerController. PlayerController has its own HUD, Camera, Pawn etc.
All I want is a pure scene with my own objects like in Unity. Because now, when I press Play button, default GameMode class spawn a lot of FPS like things that I don’t need.
PlayerController and GameMode contain a lot of codes from Unreal Tournament game that I don’t need.
Even World class works as a multilayer match maker.
It is possible to remove all of this stuff and write my own game logic? Thanks.
We have tried hard to make any features of our Framework classes ‘opt-in’, rather than getting in you way. You can make a new GameMode which specifies no Default Pawn to spawn/possess. HUD will probably still be relevant for an RTS, and contains no base functionality. I would certainly be interested to know what code in PlayerController and GameMode is getting in your way or feels ‘FPS-like’.
Default GameMode contains a lot of multilayer FPS stuff:
NumPlayers, NumBots, MinRespawnDelay, GameSession (login approval, arbitration, online game interface), NumTravellingPlayers. I don’t need this)
PlayerStarts - player spawn points array. Also I don’t need this)
and so on
As talk about PlayerControllerClass it is like a universal class that can do all stuff, like god object pattern. For example, method StartFire(uint8 FireModeNum = 0); have no relation to RTS game.
As I see I need to reimplement PlayerControllerClass methods to avoid spawning FPS player by default. I really still don’t clearly understand how to change this architecture for my task. I simply need some function like
OnFinishLoading where I can define my game states logic, have a direct access to Input and spawn Actors that I need.
While certainly UE4 is under heavy FPS influence from their previous titles, I don’t think at all that it’s a bad thing to begin with.
I do like Epic to make things like StartFire( I assume this will be deprecated later down the road) to trigger serverside respawn to be a more generic functions, but many of the multiplayer side of thing is really important for your to keep eyes on if you are aiming to do, if at all, a multiplayer RTS.
They needed time to clean up some of those heavily FPS influenced parts, some of those you mentioned, to be more abstracted. ie instead of using say, bIsSpectating || bIsWaiting && !IsFrozen(), to check for if a player can respawn(restart), it should be a function call that lets people can easily override it and just return true or false.
Despite RTS(control multiple pawns and defeat ends a game) and FPS(control only single pawn and can respawn) have many things different, but on multiplayer engine side it’s not that much different, sending controller message to tell a pawn to shoot, and sending message to tell one of your RTS unit pawn to move, is essentially the same thing on architecture side.
What Epic really need to do is, make a thorough documentation and diagrams to explain the architecture more clearly, so people can have confidence to dive into one part of it and find what they want to change.
Even if it’s relatively well commented code, going through the code is no small task for people like me that have no previous unreal engine experience.
(I made my diagram like only half way and are already bouncing around 10-ish cpp files in Runtime\Engine just trying to understand how a player from connect to join and spawn for the first time works.)
mmortall, you make some really good points, thanks for the feedback. I was actually surprised that StartFire was still there, I’m hoping we can remove that. If your GameMode specifies NULL as the Default Pawn Class, all spawn code should be ignored, but we need to make sure that is the case.
I am using 4.0.1 source codes. May be it is out of date now. If I specify Default Pawn Class as NULL I will have several error message like “No Default Pawn Class find”. And I still have FPS like camera.
I’ve updated my subscription today and I am going to update my sources as soon as I have free time.
yes, you right. I think it will be better to use some abstract PlayerController. And for FPS demo use FPSPlayerController with Default pawn, StartFire, FPC camera and capsule collider.
I think that Epic needs to adds sequence diagrams for some major classes for better understanding the flow.
as well as I)
I’ve just figured out that Unreal has made a new game demos. Tower Defence RTS game demo it is just what I need now. It has RTS top view camera without default pawn. And looks like it is c++ based. I’m going to investigate it.