I’m at a bit of a crossroads here. Whilst trying to utilize the inventory system, I ran into a snag. Note that in my controller, if i enable the Play Game logic as shown, the character drops into the world and all is well… then it displays my login screen and character selection (which is bad). This means the systems work and don’t break anything. Ruling out any issues with the UI elements that are being fired. All that’s happening from a gameplay standpoint is grabbing the character from the db and setting it as a struc in the playercharacter.
But if I disconnect Play Game (which fires after the character selection phase after CLT_DisplayLogin), this delays the initialization of the inventory system until after a character is selected. There’s no other magic happening, just a bunch of UI mumbo-jumbo beforehand. It gives the following errors, which indicate that the server is not initializing properly and setting references to both the playerinventory and that characterreference.
This baffles me, because if I fire it manually tied to event beginplay, it works fine. However, if I let the UI make the call later, the errors come up and inventory doesn’t work. The only thing that’s non-standard is that I’m not calling the hud into the viewport until initialization of the inventory system.
It’s pretty simple, but has me stumped, it’s almost like I’m waiting too long to initialize the inventory and something’s happening through replication or delayed and I can’t for the life of me find it.
I initially thought that I was re-writing a variable at some point, but narrowed it down to timing. Play Game fires off your initialization like in the marketplace project. If called manually up-front, we’re fine but the entire login/character creation/selection happens after entering the world, which won’t do.
The ONLY difference is removing the connection from Play-Game in the playercharacter below.
I have tried absolutely everything I can think of, even removing pieces down to just firing a login widget then calling playgame and it still fails without any of the login logic happening.
I know this may be silly or simple, but I’ve spent a couple days debugging this and following variables to try to find out where the breaking point is, ruling out the entire entry UI system. The only way that I can get it to work is if I initialize the inventory and drop the character into the world immediately, anything else results in referencing bad variables.
As a side-note, I have a thorough knowledge of the inventory system and have dug into it pretty deep in the last few weeks. In the screenshots below, it works (wrong, but it works). In a perfect world, the playgame function would not be called from the playercharacter, this is a work-around to make it work until I find a good fix.
This is the call from My UI to the PlayGame logic:
Update: Found out that a second player borks it also.
Background: I have a login, server selection, character creation and world.
During initial testing, I had two servers and one client, separate projects, they have been consolidated for ease.
I have a dedicated server build as well as client build.
I moved the sql into a savefile, since resetting it was easier than wiping sql each iteration. (so basically everything’s really simple presently)
So the flow currently is:
- Client connects to the server (fake loading level fired event)
- Server displays login (widget mumbo-jumbo, sets account variable in playercharacter)
- Then character creation/selection (widget mumbo-jumbo, sets my characters array and current character variable in playercharacter)
- Then Play Game (inventory initialization happens here) -> multicasts current character to all other players actor renders (updates nameplate and cosmetics)
- Streams the starting zone level to the player and teleports them to the correct spot (or last saved coordinates).
If play game fires before the login screen (and transfers execution to it), it works. (what this means is that the game starts and the login screen displays with a blank character) Once the character is created/chosen, it updates the character in-game).
If play game fires normally, login and character selection takes place, then when you drop into the game, inventory doesn’t work.
Either way, when a secondary player joins, inventory fails as soon as it initializes (before or after login).
I hope that makes sense.