spawning players to different locations.

Im a bit of a newb, and not a programmer, but I have had some luck in getting Photon to work wonderfully in some simple projects/tests.
I dont need specific code examples as I will need to figure out how to do everything I need in PlayMaker (that has some photon specific actions. Im looking for hints as to HOW to achieve this.
Firstly I need to restrict the amount of player in my game to 4. So Create Room (hard-coded room-name) and spawn first character. After 4 have been spawned into the room, I will then want a new room spawned so any MORE players than 4 get a new instance of the game.

In addition, and specifically what I am asking here. I need to move each Player to a different starting location. So First man in, gets to spawn as the Farmer in the "Farm", second man in becomes the Priest in the "Church", 3rd man in gets to be in the "Research Unit" and so on...

What is the process I need to look at for this gameplay, needing different locations and player models?

Thanks

MArk

Comments

  • It's great to read you do your first steps with Photon and Playmaker. I'm not too deep into how you achieve behavior in Playmaker but I'm sure you can ask for details in their forum, if you don't already know.

    About your questions:

    To get 4 players in a room, set it's maxPlayer value when you create it. This must be exposed in Playmaker somehow, too.
    You best follow this workflow for Random Matchmaking here: http://doc.exitgames.com/photon-cloud/M ... references

    To assign a role per player, you need to keep in mind that single players might leave before the game is even full. This makes role assignment a bit more complex than "player 2 is xyz".
    One way is to let everyone pick their role, based on which roles are not used.
    I guess the better way is to assign roles. One player checks available roles and sends an RPC to the new players to assign a role. Typically, this is done by the Master Client.

    As said: I have only a vague idea of how this transfers to Playmaker.
  • Thanks for the response: Well AFAIK Playmaker has many actions that are exact representations of the Photon Functions.
    Currently I have only used your photon demo files for my experiments, but confirmed that a game server started using these scipts is also available to the PlayMaker actions.

    Just to conform one thing in your post? When you say...
    I guess the better way is to assign roles. One player checks available roles and sends an RPC to the new players to assign a role. Typically, this is done by the Master Client.

    ...you mean "behind the scenes" so the first,or master client will be assigning the roles, but that user does not need to PHYSICALLY assign anything, like create a "team".
    In my game, I am hiding all multiplayer action from the user (no logion screen at all, no room name creation no choice of rooms) In fact they dont even KNOW that there are other players playing at all! Until that is, the story reveals it. (and they are handed a weapon, of course...)

    One SPECIFIC question... How do I assign roles...?
  • There is no concept of roles in PUN. I just named it this way so I don't have to write "picking the character and spawnpoint" ;)

    If you do it behind the scenes or not is up to you. If it should happen invisibly, then come up with some logic to let the master assign roles automatically, so players won't notice.
    Keep in mind, the master might switch when the current master leaves or disconnects. All current clients (but not the players) should be aware which client is which role.
    When a new player joins, make the master pick a "role" and send an RPC containing: "You are a farmer" (etc). Instead of sending that text, send a number (1 == farmer, etc).
  • Thanks Tobias, that makes it clearer, Im slowly getting to the bottom of this... and thanks for contacting PlayMaker, Jean over there was almost WAITING for me to post, and is checking some stuff out for me...

    What Service!

    :D

    Mark
  • Hehe, yes, I was talking to Jean quickly. Awesome he already has the answers you needed.
    Please post a link to the matching topic on the other forum. Maybe this helps someone else, too :)
  • Hi Guys,

    ok, yes I just replied now on your PlayMaker Forum thread:

    http://hutonggames.com/playmakerforum/index.php?topic=1390.msg11366#msg11366

    Also, to continue on Tobias description of roles implementations. I think one good way would be to have each player with a specific script or Fsm hosting the role description so that indeed you can keep track of everything as the master switches for one reason or another. This would be a good approach I feel. Other characters simply ask to each other for the roles and act accordingly ( regardless of wether your user is visually aware of his or others' roles, that's already your game implementation of it)

    To assign roles with PlayMaker, yes Tobias is right, you will need RPC calls, and typically, the chat demo implementation is a good base to create that feature. instead of sending a RPC call event with a text that the user wrote, you will send an RPC call event containing the role descriptiong or ID, you could event have specific events for each Role. So you would fire the event "YOU ARE NOW A FARMER" event using the action "Broadcast Event to Player"
    https://hutonggames.fogbugz.com/default.asp?W921

    As for spawning players in different locations, given your description, I think you should keep a list of spawn dummy GameObjects in the right order, and simply count the number of players in your room as you spawn a new one, and get that related next location to spawn. For this, ArrayMaker would be best suited cause you can fill this information during editing time and use it at runtime when spawning.
    https://hutonggames.fogbugz.com/default.asp?W715

    bye,

    Jean