Master Tick Manager - Override GEngine or use GameInstance?

Hello!

I have a possibly unusual topic, at least it’s very hard to research. I’ve been digging into the source code to figure out how Unreal Engine ticks (updates) the engine loop, and each of the tick categories (TG_PrePhysics, etc)

I originally was going to use a GameInstance with FTicker::GetCoreTicker().AddTicker() on initialization but I realized that the coreticker here is toward the end of a frame after all the other groups have executed I believe. It occurs **after **GEngine->Tick but **before **GEngine->TickDeferredCommands in LaunchEngineLoop.cpp

I would prefer to have my GameInstance tick at the beginning of a frame, but I suppose it doesn’t really matter if its at the end of a frame either? I think it would work fine but I’m not certain. I noticed that GEngine could be inherited and override the main Tick function since it’s virtual, but I can’t find where I could specify what type of engine it should initialize the the pointer to.

Any suggestions on how to get my GameInstance to tick at the beginning of a frame or how I can specify GEngine?

Just to be explicit this is 4.26

Can you tell us a bit more about what you are trying to do? Because having a global tick doesn’t seem like a good solution to whatever it is.

UWorld::Tick() - which can be found in LevelTick.cpp

FTickFunctions are indeed ticked before FTickableGameObjects, but it’s pretty straightforward to create an FTickFunction for something so long as it has a valid UWorld.

Unreal Engine doesn’t use a fixed timestep tick which means deterministic (or semi-deterministic) sims aren’t viable in its normal tick API. A lot of people resort to forking the engine and modifying the source, but I’m noodling ways around that with my own methods/API on actors.

Can UWorlds be initialized and persist between level scenes?
EDIT: Looks like UWorld can’t be inheritted? It’s final.

Only one UWorld can exist at once (outside of the editor at least) - and no you can’t subclass it. You can fix the timestep of the engine when using Chaos, but the physics tick is closely coupled with the game tick either way. Separating them isn’t an option.

Determinism in UE4 is a lost cause frankly, you’ll find a lot of threads on the subject.

it’s definitely doable, games have shipped with it. Just requires some tinkering.
So if one wants to use UWorld tick, how does one get the UWorld tick handler if you can’t subclass it?

Ignoring the determinism goal, if I wanted a tick for any reason at all in the beginning of the frame that is not tied to a level/scene where would be a spot I can look? I keep finding search results for GameInstance and people asking for a tick to be in it, but it still doesn’t.