#Help with Async Multiplayer
1 messages ยท Page 1 of 1 (latest)
One thing I see in your BP spaghetti is that you grab the Character from the GameInstance. If this is in the GameMode, as you say, this will always be the Server's value.
yes, i do grab from the game instance. as that's where I grab the characters from. But yes, my code is pretty spagetti haha
and alright, hmm
Any suggestions where to put this code? Sorry, I'm still learning as I go
or shall i remove that bit?
Well, you are a beginner and you are trying to solve a complex thing that is even more problemstic in BPs due to not having the same amount of functions available to you.
To fix that specific part I would need to explain for a while and I don't really have the time for that.
The main point is that you first need to send the Server the Data from the Client before it can decide on the Team
no problem, thanks though!
You can do that in the BeginPlay of your PlayerController, limited to IsLocalPlayerController, via an RPC.
You grab the Data from the GameInstance, then pass it into the RPC
On the RPCs side you can then call your "Figure out my team" stuff
If that's in the GameMode, then get the GameMode, cast it to yours, call the function, pass in "self" for the PC and maybe add a pin for the data of the GI that you send with the RPC
That should already improve the setup and maybe even resolve any issues you have
If you decide on the Class what team they go in, that this is def your problem
yep, thanks ๐
I'm assuming the RPC goes into the Player Controller?
or starts there?
is what i have or am assuming you meant
never mind! i figured it out finally. only issue now, i'm unsure if it's only the engine edtior or not, but if i try to join twice as the same 1 man team after hosting it won't let me then join as another team, once it declines the 2nd player. but i am able to join as a different team just fine if i re-host it and dont join it as the same 1 man team and join as another team of differing size