Need general help with howto concepts!

Hello everyone, I'm starting a game in my garage and want to use Photon Cloud Networking solution.

The problem is that I never really programmed a multiplayer game, at least not from scratch...
So here are basic examples I'd need some help if you have some time to share :)

I understood RPC's, etc etc... I also know what are the risks of multiplayer, master client & other things like these.
What I don't understand are this kind of things:

1. My game will be multiplayer with 2 teams (1 vs 4).
For the moment, what i did (and worked) is:


I don't care (i don't spawn photonViews) about "spectating" people. They can spectate and they can choose to join a team (if there's enough room) thus instancing prefabs containing photonViews and scripts that will register them in static variables (it's a prototype for the moment :P) with "Awake()" and "OnDestroy()".

With that, everyone seeing or playing in the game see them in the correct side.
If a new one comes in for example, it will spawn the prefabs of my characters and thus with Awake() function says who and how many people are on each team.

=> Is there a better way to do this kind of things? (First, i was trying with RPC sent by the Master to update informations of the newcomer, and RPC sent by the people who join one team to the others connected).

=> Also, I though that "PhotonTargets.AllBuffered" would send an RPC to everyone who will connect "now, and after until the end of server"... Seems I didn't understand what was the "Buffered".




2. My biggest problem for the moment:
My map will need to be dynamic.


a) Dynamic at the start (i was thinking to set this dynamic part on the RoomProperties... Good idea? How much properties can i store there? Will it impact the other players?)

b) Dynamic during the game (ex: a character take the key A from chest B... When a new player comes in... How will he know?)
> RPC? Properties? serialize from other players photonView observed script? Something else?



3. In fact... What I'm asking most from you is to help me by guiding me in what cases each scenario could be solved... Or what RPC are most useful for, Properties, serialization, maybe there's also something else...


It's a really painful process, I don't see where I can search and as I'm alone on my project, I really need your help.

This will be VERY MUCH appreciated. Thanks for all your time guys! :D

Comments

  • > Is there a better way to do this kind of things?
    Yes, you can base the "team" info on the prefabs you instantiate per player choice.
    Try not to send data from spectating players.

    > Seems I didn't understand what was the "Buffered".
    I don't understand what you didn't understand :)
    Buffered means: Even someone who joins later will get the event. Without buffer only current players get it.
    All means: You and the others get it. Others means: You don't get the RPC locally.

    > I was thinking to set this dynamic part on the RoomProperties... Good idea?
    I don't know what you need to set. If you set megabytes of data: No. If you set a few dozen variables or a byte[] to initialize some stuff: Fine.
    There is no hard limit. It depends on the clients, network and most of all: How many players are in one room interacting how much.

    > a character take the key A from chest B... When a new player comes in... How will he know?
    Properties might be ok. It's independent from the actual players. You need to think about what happens if someone leaves: Does the item vanish, drop or get back to it's initial place?

    RPCs are good for actions that happen now and then. Sync (continuous via OnPhotonSerializeView) is good for stuff that moves or gets changed a lot and everyone needs to know. Properties are good for stuff that's not often changed and a "state".

    Sorry it took so long to get back to your questions.
    Hope it helps a bit.
  • Hello mate, I'm gonna sleep for the moment. But I'll check better your answer.
    The least i can say is "thanks you so much mate :D". Thanks for your time.

    Thanks for your tips.
    Also, about the "Buffered" trouble I have is that I think it wasn't received even when sending PhotonTarget.AllBuffered... That's why I couldn't see a difference, thus not understand...

    Does it hits only players who just connect? (thus only the "Scene" photonViews receive RPC?) Or does it hits photonViews when a photonView is created (like when you instantiate a prefab to which you've attached a photonView observing a script?)

    > BTW, sorry, lots of questions :)
  • > Does it hits only players who just connect?
    PhotonTarget.AllBuffered is executed on any "live" player immediately. Anyone who's joining later on will get the RPCs in the order they happened but before the stuff that's happening "live". If something is not explicitly buffered, players who join later on won't get the RPC/update.
    Now you could have the idea to just buffer everything so players who arrive late can replay the whole game. That's a simple idea but effectively very limited. As everything that was buffered is sent to new players when they join (more or less instantly when they join), a huge buffer with lots of stuff in might break new clients due to bandwidth issues. So you should always just buffer what is needed to buffer.
  • Ok mate, thanks for your answers. That should be good for the moment, gotta work :D
    See ya!