Join In Progress needs a 5 second delay for certain devices/events

Summary

I am unsure if this is a bug or if its how the system is setup but when you have a join in progress function via verse and you have say…

GetPlayspace().PlayerAddedEvent().Subscribe(OnPlayerJoinInProgress)

When the player joins in progress it works and run but ive noticed 2 devices that do not work until after 5 seconds

These devices are

Teleporter
Hud Message Device

With a sleep(5.0) They work as intended without the Sleep(5.0) they do not

This could also be the case with other device so wanted to atleast mention it

My code is as below for ref.

Please select what you are reporting on:

Verse

What Type of Bug are you experiencing?

Devices

Steps to Reproduce

Unsure if its a bug just something i noticed while setting up a game

Expected Result

I would think events shouldnt fire until the player is in the game and the events should work

Observed Result

Without the Sleep(5.0) the player does not activate events or they do and the outcome isnt correct

Platform(s)

PC

Further up they is Player.IsActive checks so everything passes its just without this Sleep(5.0) certain devices do not work.

Further to this if you start the game then all devices work off the bat its just jip that needs a delay.

Sleep(5.0) seems optimistic here, did you try it on Switch or mobile ?

Also, if I may, when players join, the PlayerAddedEvent fires, then (seconds/minutes) later, they get assigned a fort character and a spawner (no nameplates still), then they get assigned another spawner and their nameplates show, atleast that’s what I noticed on some settings.
I agree that this invisible spawn flow is hard to work with but I’ve made my own workaround by waiting for players to actually move (forcefully or not)

Btw the HUD message device has an option for JIP players, I think it uses the queue which has a default decay time of 15s, so you might want to tweak that maybe ?

The teleporter and hud device i show/teleport via verse only and not on device states ect

I am on pc and joining on Xbox series x

Also when the player joins it shows

Name has join the world

Then i assume when active ect it says

Name have joined the island

Even after that without that Sleep(5.0) it doesnt work with those 2 devices

Very odd and tbh ive never used them in this way before so it could be the norm i thought it was worth mentioning for others as they could think they have issues ect and it turns out its just a time delay is needed for the system to catch up

Yes it doesn’t work because the fort_character is not spawned in yet at this point. Because you’re not actually teleporting the player but the character in this case

A lot of devices would be failing up so early in the joining flow, you need to enhance your detection

1 Like

A friend said to use the PlayerSpawned() on the spawn pads instead of the PlayerAddedEvent() as its more reliable and time is better so ill do that.

1 Like

You can try but I’m pretty sure it’s not enough (for certain devices), sounds like an upgrade for sure though

1 Like

I experience 2 primary issues in my games in regards to JIP.

  1. The Player Joined Playspace event will pass an invalid Player or FortCharacter
  2. The Joined Event never even fires

They have some sort of reactive handling for player server initialization while they’re constructing all the objects and for whatever reason they don’t bother doing any validating before handing us these game objects nor do they disclose or discuss this anywhere.

This is probably the most minimal straight forward handling methodology.

player_manager := class(creative_device):

   @editable JIPMutator:mutator_zone_device=mutator_zone_device:

   var Players:[]player=array:

   OnBegin<override>()<suspends>:void=
      # Add async looped listener or subscription for playspace join
      # Same as above for mutator's agent enters event
      # Add handler for flickering mutator (loops enable/disable)

   # Route both of the detection methods into this function
   (Player:player).OnJoin()<suspends>:void=
        Result := Player.Validate
        if(Result?, not Players.Find[Player]):
           set Players += array{Player}
           # Add whatever handling after this point

   # Ensures you only get valid players past OnJoin
   (Player:player).Validate()<suspends>:logic=
      var IsValid:logic=false
      race:
         loop:
            if(Player.IsActive[],Player.GetFortCharacter[].IsActive[]):
               set IsValid=true; DPrint("Valid Player"); break
            else:
               Sleep(0.0)
         Sleep(60.0) # 1 minute timeout
      IsValid

Ensure that the mutator zone wraps the player spawn pads or location that new players will be at.

The idea here is that where the playspace join event fails the mutator zone will detect the player and with the validation handling and managed array of already valid players you can ensure that your players are always valid before you ever pass them into handling, and you can catch players that epics handling fails over silently on or whatever its doing.

OnJoin is a collective handler for these enter and join events, it routes into the validation handler, this will handle immediately for a larger percentage of players were just here to catch the stragglers (slow loaders and whatnot), and theres a timeout so you dont infinitely loop handling for people who aren’t able to validate or leave during the validation to prevent infinite looping.
The verification that the player is not already in your map or array is very important here as well because you need to know who still needs to be initialized and not repeatedly initialize already initialized players.

You can use a standard map here, or use an array, use the agent type or player, and handle your asyncs how you’d like, this is adapted from my somewhat unconventional handling for the purposes of demonstrating how to get reliable handling of the playspace.

I tried mutators and it was triggering too early (since you can spawn twice), not sure if setup related or if it depends on what you’re trying to call after they “joined”

After some very extensive troubleshooting after still getting JIP errors this is what I landed on, and what tested stable. Single PlayerCounter, with a validating array, and a new confirmation state in the Validating function for Players.

PlayerCounter:player_counter_device=player_counter_device:
var Players:[]player=array:
var Validating:[]player=array:

PlayerDetectedListener()<suspends>:void=
      loop:
         Agent:=PlayerCounter.CountedEvent.Await()
         if(Player:=player[Agent]):
            spawn. Player.Detected()

(Player:player).Detected()<suspends>:void=
      if(not Validating.Find[Player]):
         Validated:=Player.Validate()
         if(Validated?):
            if(not Players.Find[Player]):
               Player.Joined()
            else:
               Player.Spawned()

An important part of this is that I found even when a player passed Player.IsActive[] and FortChar.IsActive[] that essentially means nothing, because you will still have players failing initialization after those checks. The only way to truly validate everyone is to require the player to move themselves. No amount of additional detection methods between the Player Counter (which is an actual reliable Playspace) and this input has any relevance due to the existence of these failures without this additional handling.

if(Player.IsActive[],FC:=Player.GetFortCharacter[],FC.IsActive[]):
      FC.SprintedEvent().Await()

The only thing from the Playspace i use at this point is the PlayerRemoved event, as as far as I know once they’re in and leave the Playspace functions properly but if you’d heard otherwise let me know and I suppose I’ll finish the full replacement.

This is such a weird thing tho right.

Maybe this is why some devices dnt work on jip idk

Yeah it absolutely is. I was having players miss 1.0 only device triggers for item grants, or switch state changes, etc.

I just spent 3 weeks bugfixing JIP issues, more than just this too… Net replication issues, device failures, etc. I have a pretty good handle on the Player Validation situation right now in live games and on Epics side they are passing us invalid objects, and the checks they’ve provided us also do not actually ensure that we can start handling as they’d like to suggest.

There is a serious problem with their lack of proper player object validation before they pass the object through to us, and their lack of accountability on this. There is also a big issue with the lack of control over net replication which is another component of JIP issues that are a lot harder to understand (game objects including objects with collision can be in separate states on separate clients at the same time).

I will take some time to formally address these details with staff as soon as I get some time. Still have to recover from all of the lost time here solving all this stuff… (There’s a whole teleports failing at long distance thing too I don’t even care to get into right now, lets just say its been a long month).

I had issues before with the item granter not granting to players randomly i think it could be related hence why it was random.

That was even set on the device too.

Ive never had issues teleporting players tbh even at far distances so i hope you sort it :slight_smile:

Could get this post to be seen tbh its got a ton of info from a few devs and itll give epic something to look at

I would add the validation requiring the sprinted event to complete after both the player and fort_char active checks pass, and see if that reliably solves your issues. I would be willing to bet it does and it would be nice to have the confirmation in the thread here.
I believe that this can impact purely 1.0 setups as well, not even having to do with code, because of their lack of proper object validation before passing it through into additional systems at the playspace level.

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