I'm confused - can the server/client boundaries be elaborated?

I had to re-watch the 2nd half of this lecture several times. Why does checking for NetworkServer.active work for a server which is also a client? The whole reason we changed the spawn and despawn events to work on authority is so that it would work for the host client/server and not just clients. But then we add a check that prevents the server from subscribing?

Also, this is a pattern with this course - one of the things I love about many lectures you guys do is that you let errors occur and then show how you debug them. I’m just taking you at your word for why you handled this code the way you did and it is now basically a black box for me. I won’t be able to modify much of the code created in this lecture since your rationale for the changes you made is usually “this wont work” or “this is wrong”. Would love more detail on that, even if its in a written lecture supplement.

8 Likes

@Nathan_Farrer think this might have got overlooked

well the author has changed unit script’s condition for when to invoke a AuthorityOnUnitDespawned so that when that unit dies it invokes it irrespective- if the instance is client or server (host).
So that we can remove that particular unit from the SelectedUnits list in unitSelectionHandler script.
but that creates a problem with rtsPlayer(subscribing client units 2 times)…we still need to employ checks …so that if the instance is server, it does not add any client unit repetitively to the player’s myUnit list.

And one more thing, The guy there- Yitzchak (teaching assistant) in udemy q/a. He is pretty good… i will suggest asking there also.

Btw i totally agree with you on second para…
1 month in and still trying to make sense of the chaos.
I mean i like the author’s architecture design patterns and decisions… like subscribing instead of hard coding and early out ifs… but when it comes to teaching :no_mouth:.

4 Likes

Privacy & Terms