- Add buttons in the menu
- Add a static field indicating which game mode we are playing (for now, all modes go to the same scene. Will cause quirks later but... later).
- Disable the KO sequence that would normally bring a player back to the menu. Part of the idea of the battle royale (a la Counter Strike I guess) is that defeated players do not respawn. The crux is not to let them re-enter the same room they just lost in; in the meantime, encouraging them to remain "part of the game" in interesting ways is on the plan.
The next step was to implement the other side of a 'battle mode': a battle should not start until all players are onboard. Took more time than I expected.
Replacing materials
Replacing materials
In battle mode, defeated players do not disappear. Instead, they become ghosts. This required replacing all materials and I discovered something unexpected while doing this: Renderer.materials returns a copy of the materials array. This means that replacing a material in that array is ineffective. For changes to take effect, the returned array must be re-assigned to renderer.materials.
RPC note
Sometimes writing 'networked features' can be as easy as tagging a method [PunRPC] and calling PhotonView.RPC(...) but there's a catch: before that even works, the other side must have a copy of the invoked component. At times this may catch you off-guard. For example, the KO sequence in my case is handled by a component local to the KO'd player but the effects of KO should be visible everywhere. an RPC into a [PunRPC]'d function of that component will fail.
Photon Notes
<> Avatar rotation felt 'snappy' (going in brusque increments like a clock hand). Reducing interpolation speed makes rotation smoother (too slow isn't good either since the rotation lag becomes too obvious)
<> Photon provides player 'names' which are the nicknames we're after for our leaderboards. Network-wise it appears that setting the player name via PhotonNetwork.playerName is the way to go (read them normally via PhotonPlayer.name)
<> After all wanted players have joined a match, close the room via PhotonNetwork.room.open = false, PhotonNetwork.room.visible = false
Preventing confusion between battle rooms and the 'main' room.
With several game modes, letting players join whatever room available may cause errors. For now I resolved this by having all 'survival' players entering/creating a named, while battle rooms are randomly created.
No comments:
Post a Comment