Trying to improve my basic understanding of client-server relationships in UE4 so there is no inherent problem to solve.
I am setting my game up in a way that the server does everything and the client is basically a terminal for displaying what happens and sending input requests. So, an authoritative server. I am new to UE4 and also somewhat new to network programming.
I think I’ve grasped most of the basic concepts such as replication and using switch has authority/remote to control who executes the command and so forth. My character is running around on the server and the client displays what is happening just fine.
Here’s the question:
When the proxy character spawns, he also spawns his server blueprints such as the character and it’s AI controller, the proxy character simply matches the transform of the server character. He spawns them using Event Begin Play -> Switch Has Authority (Authority) -> Spawn Actor from Class. While doing so also sets variables contained in the newly spawned AI controller. For the purpose of an example, lets say there’s a blueprint named ‘Bob’ being set to the server AI controller’s variable ‘ThisIsBob’ and it would be done by ‘Set ThisIsBob’ and taking the ‘Return Value’ of the new AI Controller from the Spawn Actor node as a target.
Inside the AI Controller, if I put a ‘Print String’ that prints the object’s name for ‘ThisIsBob’ and connect it to Event Tick or one of my Custom Events (for moving, etc) it will properly display ThisIsBob’s object name. However, if I put it in Event Begin Play it will say ‘None’.
My thought is that Event Begin Play is not accessing server information so as far as it’s concerned ThisIsBob is a null reference, and relates to what is available to the client only. And the question is how do I use ‘Event Begin Play’ for server-side variables, or how do I do it properly in a way that doesn’t require me to.
I would appreciate any information,