Basics of UE4 programming

I have started to re-make my project in C++ And I have several questions about how games are meant to work in UE4.

GameMode:
what is this class meant to do exactly? If I have a singleplayer offline game what is this class doing for me?

What happens when I press the play button? Does the game mode spawn then locate the PlayerStart object and spawn a defaultPawn there and assign a player controller to it? If so how can I override this behaviour? How do I destroy the player character and respawn in the same level? I assume the GameMode does that but do I need to write my own function to do so? How can I handle the player not having a character?

Character Controller dynamic:
So every character has controller that receives input and directs the character. However every single example I have seen so far (mainly blueprint examples) the controller has no code in it and the character class handles receiving input and moving and reacting. I would have expected the controller to actually control the character but it just seems to be an intermediary between the UE4 input system and the character that, as far as I can tell, does nothing.

What is the controller supposed to do? What am I missing out on by putting all of my movement code in the character object?

I have watched several tutorials and none of them answered these questions. None of the examples given so far use the gamemode.

GameMode should contain global gameplay code code that maintain the game rules, regardless if you do multiplayer or not, think it like level blueprint code common to all levels

Controller is mind of a character, it does need to be player but AI too and anything that can control character, controller should control and character should be passive and be controlled by controller. PlayerController already contains simple implementation so it does not always need extended. Also it is convention, engine won’t stop you from bypassing controller, but then other features might not work right

Did you check those docs:

I also recomand you to explore engine source code, might give you some idea:

https://github.com/EpicGames/UnrealEngine/blob/9dad25829a2c2d9a44fb11fab9ce5511323e7788/Engine/Source/Runtime/Engine/Private/GameMode.cpp
https://github.com/EpicGames/UnrealEngine/blob/9dad25829a2c2d9a44fb11fab9ce5511323e7788/Engine/Source/Runtime/Engine/Private/PlayerController.cpp