How do I check to see if a player has fully loaded in before starting?

When the client joins the game, the game registers that they have joined and starts the game, but if they don’t have an incredible PC, they might not have fully loaded in by the time the match starts, its there a way to delay the game until everything is fully loaded in instead of just having an array using PostLogIn?

1 Like

You’ll need to come up with a definition for “everything is fully loaded”, and then determine when that is the case, and begin your game then.

yeah but how would I be able to define it, if its relative and has no related nodes, its just “is the environment and player fully loaded” thats what the question actually is

That’s the tricky part – what all do you need loaded? What your project needs to have available before you can start may differ wildly from what mine does, or anyone else’s. :slight_smile:

You can attach callback events to know when everything you need loaded is available, and then when the total of all of those callbacks is called, then begin. I unfortunately can’t really give much in the way of code, but a way to do something like that, is to bring up a load screen from your GameInstance, when a level change occurs, keep a count on all calls to load level, and then when the number of loaded levels equals the number of levels that need to be loaded, clear the load screen. There are probably many other ways. A project I’m working on does basically that, but also triggers force loading of several other non-level related assets, and waits for those to be loaded as well. If I were doing it with a new 5.x project, I’d probably see about doing it in a GameSubsystem than GameInstance, but maybe GameInstance is the better place.

You can hook into the preloadmap and postloadmap events with something like

	FCoreUObjectDelegates::PreLoadMap.AddUObject(this, &UMyGameInstance::PreLoadMapCallback);
	FCoreUObjectDelegates::PostLoadMapWithWorld.AddUObject(this, &UMyGameInstance::PostLoadMapCallback);
1 Like

If you are just trying to be better than sh>tty games like ARK, all you have to do as a developer is care about your project essentially.

On spawn, check/sweep test a copy of the character capsule around the character to make sure he’s not stuck.

Also line trace downwards to make sure he’s standing on something.

If you keep getting false answers to all of the queries, then you know either the guys is cheating/flying in space, or the level parts aren’t loaded in.

I’d put a maximum loop of 10 on the checks, assuming ofc that the rest of the level at least hints at being loaded by the rest of the load process.

If they all fail, I’d flag the player as a potential hacker for furher monitoring and spawn them in a designated location…
Or you can offer them the option to respawn at a known location of their choosing.
Either way, you probably caught a hacker cheater rather than a legitimate player, so do with that what you will…

thank you, I guess it is a pretty vague question. do you know how I could do those callbacks in blueprint?

hmm. doesn’t look like FCoreUObjectDelegates are exposed to blueprint, at least in my 5.1… might be other methods to get there, but I don’t know what they are right off, and i’m stupid tired after a very long weekend, sorry :slight_smile:

1 Like

dw, thanks anyway

Btw, doesnt the new layer system thing they created specifically for loading stuff in provide actual callbacks when utilized correctly?

I can’t remeber the name of it, let me look it up rq…

Here you go. This junk should supposedly have the callbacks for async loading status…

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.