Implementing AI

Options
I am developing a 4 player turnbased card game in which the room has AI in the beginning and then players can join and replace the AI. So my question is..... is it possible that a player joins a game and replaces the AI while the AI is playing his turn. So the player will have got the room variables just before the AI submits the move that he played so that the player will appear like having his turn while the AI already has played for him??

Comments

  • GodBian
    Options
    emmmmm.....
    maybe you can use PhotonTaget.**Buffered**, it will save all commit in server, and send to your player who is new comming. Then you can set a tag (ID) to mark your AI, when your player join, it can use the id to find his own room variables.
  • N1warhead
    Options
    Unless things have changed in a recent version - the master player controls Scene Objects... So if your AI's are on the start of the map, it will be easier......

    All you'd have to do is relieve the photon view from being a scene object, and give it permission to the joining player. - however don't give the AI's cameras automatically. I'd create that locally on the connecting clients PC... Never try to use Buffered RPC's unless you absolutely have too. Too many of them and you'll have a flood of a mess.

    So the steps I'd do
    • Create your scene
    • Place the AI where you want them
    • Save the scene
    • Master Client connects (Master takes ownership automatically of sceneobjects)
    • Then have the newly joined player request from the master that hey I want this object
    • transfer ownership
    • create camera
    • .. anything else you need to do.
    It sounds like a lot of steps, but it's really not.