Home // Blog // Ugly Briefs Update #3

Let me have CONTROL!

Right, so this issue with “Controllers” in Unreal has been an on going annoyance since the beginning of the project. Anyone who has done work with Pawn Possession or Multiplayer has had to deal with Controllers (Player Controllers / AI Controllers). Imagine having to deal with assuming control of your ship, but the AI still wants to fly and shoot regardless of you being there. Or not having your HUD display for you since the Server executed the ship initialization logic without confirming you are the Client that’s actually in control of the ship. All of this we will get into in this Ugly Brief Update.

“Controller” Definition;

Basically a “Controller” class is the main bridge that a Player (or even AI) interfaces with the game. Think of it like the Player’s “soul” where the Player can apply inputs into the game, even if they aren’t in “possession” of a “Pawn”. Things like calling up Menus, or requesting to respawn in Multiplayer, or in our game – triggering Telepresence between Ship and the PDI. Basically it allows for high level control inputs to occur that aren’t Pawn dependent. The problem(s) arise when the Player either takes control of a AI Controlled Pawn or even when a Player takes control of a Pawn in Multiplayer and needs to validate with the server before something like the HUD can initialize.

Multiplayer Control woes

With Multiplayer, several times we’ve run into the issue with a respawn of a player (just doing some quick Death Match with ships) where we had several cases that Players didn’t have their Ship initialize (start up and given flight control/weapons) and/or not have their HUD initialize either. The problem here with the Pawn is that the “Event Possess” seems to trigger on the Server side first before the Client seems to know that they are in possession of the Pawn itself, so if the Server runs the logic of the Event Possess first and tries to pass the info to the Client’s Controller, there’s no handshake between Client and Server to verify this possession was successful first and both sides know that “THIS” Client is the one in possession. This is extremely frustrating since you would assume that on “Event Possess” in Multiplayer that the Client would automatically announce to the server that “Yes I am in possession”, but nah… ugh. It looks like I will need to put in some checks on the client side first to make sure THEY are the ones to trigger this properly so that HUDs and Throttle/Weapons, etc can all be initialized properly.

GTFO My Cockpit AI!

Another really dumb thing about Controllers seems to be that even though “Player Controllers” and “AI Controllers” use the same “Controller” base class in code, they are still treated differently on the Pawn which means that both an AI Controller and a Player Controller can Possess the same Pawn at the same time! You’d think this would be funny (and yeah it kinda is at first), but it’s pretty annoying that I need to specifically tell the AI Controller to stop all of it’s behaviours and then remove it “properly” from the Pawn BEFORE allowing a new Controller to take hold of the Pawn…. You’d think that it would be simple with Controllers, right? I mean my assumption was that you could only have one Controller at a time, but nope, not the case apparently… Still, I recall back in 4.22 that I was still having a problem when calling “Detach from Controller pending Destroy” on the Pawn where AI Controllers weren’t being detached, but I haven’t checked it again in awhile (might be a memory leak there with multiple AI Controllers just being added on to the Pawn every time you telepresence out!). Either case, I seem to finally have a handle on this at least from the Single Player side of things. It’s gonna be a bitch to validate this on the server side though, but I’ll get there.

AI Autopossess on Spawn PLZ, K THX

So with Spaceship Hangars being able to produce new ships with a very basic economy (and sped up build times), you’d think that the default “AI Autopossess” flags would work right away with both “Placed In World” and “Spawned” right off the bat, right? Well, before 4.19, apparently there wasn’t a flag for both “Placed In World AND Spawned”, there was only one or the other. AND “Place In World” still allowed for “Spawned” in Pawns to act as if they were “Placed In World”…. I mean wtf?? So it took until recently to figure out that that new flag was there and wasn’t the default setting and with 4.25 integration, this became apparent when all of our “Spawned” new ships from the Hangar would just spawn but not fly out of the hangar… UGH this is so annoying when these small feature changes and default changes to things like Possession screw with a lot of core mechanics of the game!

Summary

In Summary – Controllers are a great way to control high level logic/inputs for Players and how they interact with the game/engine, but I really wish alot of these Controller issues were a bit more streamlined in the engine for ease of Possession. Either way, I’ll get through these and we will have the capabilities of Possessing AI ships in Multiplayer, but I will also lock out being able to have multiple Players Possess the same ship haha.

This doesn’t begin to scratch the surface of the dumb “Game In Focus” crazy with the UI and the amount of hoops I need to go through before I can talk about the PDI and displaying and using the cursor (or even click and drag box selection). But that can wait for another Brief. In the mean time I’m going to move these Briefs Mondays and Thursdays to allow more time to focus on the work ahead.

I hope you all enjoyed.

God speed, Warden

-Kami

0 Comments ON " Ugly Briefs Update #3 "

Subscribe to the Solar Warden Newsletter

Solar Warden on Social Media

Facebook

Twitter


YouTube


Reddit

Join Live Chat on Discord

Solar Warden on IndieDB

Solar Warden

Polar Zenith Copyright © 2022 Polar Zenith, LLC. All Rights Reserved.