Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Angry Bots Multiplayer Coop

Discussion in 'Multiplayer' started by bertelmonster2k, Sep 15, 2011.

  1. bertelmonster2k

    bertelmonster2k

    Joined:
    Apr 3, 2009
    Posts:
    78
    Photon Angry Bots Demo



    Get it - runs ins the cloud, no Server necessary
    Download from the Asset Store:
    http://u3d.as/content/exit-games/photon-angry-bots-demo/2i9

    Overview
    In collaboration with M2H we've been developing a multiplayer coop version of the official Unity demo "Angry Bots". This demo now shows the power of Unity AND Photon. The multiplayer is implemented using the new Photon Unity Networking plugin.

    You can play the game via Wooglie.com: http://www.wooglie.com/playgame.php?gameID=899

    Related Asset Store Downloads
    Photon Unity Networking: http://u3d.as/content/exit-games/photon-unity-networking/2ey
    Photon Viking Demo: http://u3d.as/content/exit-games/photon-viking-demo/2gg

    Requirements
    Compatible with Unity Free.

    As server use either

    Feedback is welcome! Just reply here.
     
    Last edited: Oct 18, 2011
  2. ColossalDuck

    ColossalDuck

    Joined:
    Jun 6, 2009
    Posts:
    3,246
    So is this photon plugin free for use or what? I can't find any info on the use of this plug in.

    Edit: nevermind, got it: link
     
  3. fholm

    fholm

    Joined:
    Aug 20, 2011
    Posts:
    2,052
    I'll ask what I asked in the Viking Demo thread, is the server authoritative in this example? I've seen a lot of photon examples from you guys, but nothing where the server has control over movement. In all the unity demos the server is just a simple relay agent that pushes data to the remote clients.
     
  4. PrimeDerektive

    PrimeDerektive

    Joined:
    Dec 13, 2009
    Posts:
    3,090
    Leepo mentioned in the other thread that only the player health and enemy AI are authoritative.
     
  5. ExitBG

    ExitBG

    Guest

    Joined:
    Oct 16, 2009
    Posts:
    52
  6. MikeHergaarden

    MikeHergaarden

    Joined:
    Mar 9, 2008
    Posts:
    1,027
    The Photon server only relays messages in this case. The masterclient is authorative over health and enemy AI but not over player movement indeed (for simplicity). You can already make the masterClient authorative yourself.
     
  7. Nateao

    Nateao

    Joined:
    May 20, 2011
    Posts:
    74
    Wen i try to download it,It set that i need to activate the account
    my unity account is active ,the unity asset it active
    My Unity 3D is 3.4.1.
    will this mean photon account do i have to make 1
     
  8. evillemez

    evillemez

    Joined:
    Sep 21, 2011
    Posts:
    24
    If one were to modify the code to make the master client authoritative over movement as well, would there be any benefit left in using Photon over the built-in networking? It seems to me that this would require a ton more bandwidth, thus making your max-player limit the same as it would be if you weren't using Photon, maybe even lower since there seems to be an extra trip for all the movement data with Photon in the middle.

    Am I missing something? I'm not an expert in networking yet, still trying to wrap my head around some basic concepts. :)
     
  9. PrimeDerektive

    PrimeDerektive

    Joined:
    Dec 13, 2009
    Posts:
    3,090
    I don't know anything about photon's networking, but I'm assuming that its the same as the built-in networking in that even seemingly "peer-to-peer" messages are authoritative under the hood. For example, if a client sends a message to another client (or all clients), under the hood it really sends it to the server and the server relays it to all other clients. There is never any true client-to-client communication.

    That said, the only difference between non-authoritative and authoritative movement is in non-authoritative, the client is telling everyone (the server, and the server relaying to everyone) where he moved, and in authoritative, he's telling the server what button he pushed, and the server is relaying to everyone (including the client pushing the button) where he is moving based on that input. So the only extra trip is the moving client getting movement confirmation/prediction correction back from the server.
     
  10. bertelmonster2k

    bertelmonster2k

    Joined:
    Apr 3, 2009
    Posts:
    78
    Cloud enabled.
     
  11. friuns3

    friuns3

    Joined:
    Oct 30, 2009
    Posts:
    307
    hI, i get Loading 0% without any messages in console, copied my appid and pressed save
     
    Last edited: Dec 14, 2011
  12. dreamerflyer

    dreamerflyer

    Joined:
    Jun 11, 2011
    Posts:
    927
    HI,U3D 3.5 can make swf now ,this DEMO can comunicate with AS3??I want to know how to make web game using U3D3.5 and flash molehill.
     
  13. ficho

    ficho

    Joined:
    Dec 17, 2010
    Posts:
    82
    i get loading 0% too whats the problem?
     
  14. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    As we released a new Photon Unity Networking version, this demo was updated as well. It's already live in the store.

    dreamflyer: So far, export to flash is not possible. We're working on it but integration into AS3 is slow.
    ficho: try to update, create a new, empty project and import the package in there. Make sure to follow the readme (adding the scenes to the build setup, etc.)
     
  15. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    This is also updated to PUN 1.12.
    I didn't notice performance or other issues (like someone commented in the Store).
     
  16. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
  17. kamikaze21

    kamikaze21

    Joined:
    Sep 3, 2010
    Posts:
    18
    Hi there! i have a simple question, for example if i create a room, and one dude enter and we kill one "spider" in all client (active) the enemy disappears, but if later join another person, he still see the enemy that just killed before ... how I can solve this problem?

    PS: Sorry for my poor english.
     
  18. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    The simple solution would be to have a buffered RPC take care of that. When players join, they get all the buffered RPCs and can remove the killed enemies, before jumping into the action.

    Simple solutions always have some drawback though:
    If you do this for a lot of enemies, the room will fill up with buffered RPCs and joining players will be flooded with those and in worst case, slower machines will loose connection or won't catch up.
    It's fine for a small levels and rooms that get closed after a while.


    Aside from buffered RPCs, Photon allows you to set properties for a room. Those can be updated by any player and they could contain byte[] or short[] or whatever.
    Let's say you have more than 255 enemies, then each could get an ID of type short. For each kill, some player needs to add that ID to the room's killed-enemies property. Anyone who's around already gets the kill anyways, so the property update doesn't have to be broadcasted. New players first look at the property and remove those enemies.
     
  19. kamikaze21

    kamikaze21

    Joined:
    Sep 3, 2010
    Posts:
    18
    EDITED: I found the problem ... in Health.js

    In the line:

    view.RPC("SetHP", PhotonTargets.Others, health);

    I change for this:

    view.RPC("SetHP", PhotonTargets.OthersBuffered, health);

    Thanks @TobiasS for the explanation!
     
    Last edited: May 24, 2012
  20. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
  21. Ashkan_gc

    Ashkan_gc

    Joined:
    Aug 12, 2009
    Posts:
    1,117
    @Evan The master client in photon is different from the server which is relaying messages. So there is additional trip time between them. If you self host you can put them in a LAN but on the cloud it's not a good idea maybe. I don't have much info on the product and the possibility of hosting master clients with photon lite apps or not.
    In other packages and networking middlewares you might use a separate program to relay messages for proxying and load balancing and ... but they always should be on the same LAN and not connected together on the internet. All servers from DB server to login server should be on the LAN and only those which really need it should be connected to outside world.
     
  22. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    Updated to PUN 1.16. Click here for details.
    If you downloaded 1.16.1, please download again. It won't compile. 1.16.2 (or .3) does.
    Sorry for the inconvenience.
     
    Last edited: Aug 3, 2012
  23. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    I just uploaded v1.17 of PUN (free), the Viking Demo and Photon Angry Bots.
    There's a fix for an exception, so: Please update!
    Click here for details.
     
  24. SrBilyon

    SrBilyon

    Joined:
    Jul 13, 2010
    Posts:
    291
    Can anyone confirm that this is working in Unity 4? The Vikings Demo seems to work fine, but when I try to use this demo, rooms aren't showing up for me when running multiple clients.
     
  25. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    I just tested it successfully.
    Rooms are not being listed? Do you host yourself of using the Photon Cloud?
    All clients use the same appId and GameVersion (string passed to ConnectUsingSettings())?

    Sometimes those issues are fixed when re-importing into a new empty project.
     
  26. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,350
    works in 4.

    I had extra spaces copied to the app id string (start and end)
    It didnt give any errors, but also didnt create any rooms for others to see..
     
  27. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    Hmm. This was a known issue and I hoped it was fixed with a Photon Cloud update.
    I'll investigate.
    The next PUN version already trims the appIds.
     
  28. SrBilyon

    SrBilyon

    Joined:
    Jul 13, 2010
    Posts:
    291
    Thanks for checking.
    I've tried reimporting multiple times, as well as using another appIds.
     
  29. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    I'm really sorry but also out of ideas: I can't reproduce it yet and have no logged errors.

    Even if you used other AppIds, maybe you still had a copy+paste whitespace in it (each time). Some browsers tend to include a space when you copy the appId from your application overview.
     
  30. cloyd

    cloyd

    Joined:
    Oct 17, 2012
    Posts:
    12
    how to install the new version of PUN to unity?
    just copy paste the photon unity networking folder to my project??

    tnx in advance.
     
  31. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    You better import unitypackages when you have those. This should make sure files get updated, even if they are moved around.
     
  32. cloyd

    cloyd

    Joined:
    Oct 17, 2012
    Posts:
    12
    how to change the character in photon angry bots demo?
    sorry for my english..
     
  33. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
  34. vrejaandrei

    vrejaandrei

    Joined:
    Mar 17, 2013
    Posts:
    3
    Hi, I tried importing the package in Unity 4 but all I see is this:

    Any idea? I am new to Unity development so I don't know if this is a problem or something, but I think it should look different, mostly the game enviroment should be there like in the angry bots demo.

    Nevermind, got it to work. Hardly found these instructions in a text file after I downloaded the assets.

    For PUN instructions see the PUN readme at: "Photon Unity Networking/readme.txt"

    The Unity Asset Store does not properly save build settings (the selected scenes) therefor you will have to correct these.

    To get this demo working:

    1) Create a fresh project and download the package from the asset store.
    2) Add the following scenes to your buildsettings:
    Scenes/0_Preloader
    Scenes/1_MainMenu
    Scenes/2_AngryBotsMP
    Scenes/3_Endscene
    3) Setup PUN (see the PUN wizard or the readme). You can either host your own server or use the free Photon Cloud trial.
    4) Run the preloader or mainmenu.
     
    Last edited: Mar 17, 2013
  35. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    Just updated the demo to PUN v1.20.
    The demo itself does not change though. Just in case someone bases his work on this.
     
  36. topaz7

    topaz7

    Joined:
    Dec 15, 2012
    Posts:
    76
    Does it supports P2P Method? Thanks for the sample.
     
  37. Omar101

    Omar101

    Joined:
    Sep 3, 2013
    Posts:
    2
    Hello, i m a beginner can yu tell me where can i find a tutorial for making this game, thanks a bunch
     
  38. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    Omar101: Good you ask. This demo is not really good for beginners.
    Better start with the Photon Unity Networking package and the Marco Polo Tutorial.
    Please note: As the Monster prefab changed again in the Asset Store, we will update the tutorial, too. Hopefully soon. The result of the tutorial is also in the PUN package.
     
  39. 99thmonkey

    99thmonkey

    Joined:
    Aug 10, 2012
    Posts:
    525
    Wanting to do the Co-op thing with a game I already have created. Is it fairly easy to integrate the Co-op concept from this Demo package to my game?
     
  40. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    If it's easy or not depends on your experience and requirements.
    For multiplayer games in general, it is fairly easy, I'd say. But I am biased of course.
     
  41. tw3sth

    tw3sth

    Joined:
    Mar 2, 2015
    Posts:
    4
    Hello - I realize this is a fairly old demo, but when testing it I noticed that by moving the mouse very slowly I was able to get the player states quite significantly out of sync (see screenshot where laser for Guest7582 points in two different directions). Is this fixable and where should I look to fix it?

    AngryBotPhotonSync.jpg
     
  42. CoMMoN86

    CoMMoN86

    Joined:
    Jul 19, 2013
    Posts:
    21
    Доброго, у меня проблема с выводом комнат в спске (их просто нет при сусловии, что дна создана точно), и не отображается правильно кол-во комнат и пользователей, просто пишет 0.
    Что делать, проект переведен на андроид платформу.
     
  43. KanBi

    KanBi

    Joined:
    Apr 5, 2017
    Posts:
    7