Multiplayer; find when everyone is ready?

Ok - so I have a multiplayer game idea which revolves around all moves being simultaneously executed when all players are ready (i.e. “WeGo”). All players checks the “ready” button and when all have done this, all hell break loose until the turn is resolved and all players enter the planning state again.

Reading up on Yun-Kun’s excellent post I have put an enum as “currentMode” in the playerState and then I have tried to loop over all player states in both gameState and gameMode to check when all have entered the mode “kReady” to trigger a game state change but both in gameState and gameMode I get the quite cryptic “Player State Object Reference is not compatible with Player State Object Reference.”…

Any ideas?

It’s the million dollar question.

Look at this… maybe it helps a little.

Are you trying to copy and paste a node that comes from an object reference to an object?

do it in reverse… get the node from the object.

and another thing… you should avoid using the tick event… and even more so when you use a For or forech… that is a guaranteed catastrophe

Ok - might be so; it is an early “blocking out” phase and I am still sketching out the particulars, but what blows my mind is that the “Player Array” which is an array of ‘Player State Object References’ available in the gameState cannot be cast to “Player State Object References” in the gameState… it is very counter-intuitive.

I try to do the exact thing I have in my original post in the gameState, but it does not grokk that.

Cast it… with the name of your PlayerState class… maybe that works.

3

2 Likes

Come think of it - that might be it! I’ll try it and let you know!

i think your variable “current mode” is not a member of PlayerState Base Class … Then you need cast it if you want get acess to it

Such a stupid error! You were right - I was thrown off by the UI “beautification” of class names… sigh.

I have named my playerState derived class player_state, and they both “beautifies” into “Player State” by the UI, so I got the cryptic error “Player State Object Reference is not compatible with Player State Object Reference”…

Well; I will now for sure change the names of my game_mode, game_state and all other similarly named derivations!

Thank you for your assistance!