Photon Unity Networking

Discussion in 'Multiplayer Networking' started by tobiass, Aug 23, 2011.

  1. tobiass

    tobiass

    Member

    Joined:
    Apr 7, 2009
    Messages:
    822
    Photon Unity Networking

    Get it. No server setup needed - runs in the Photon Cloud. No obligation due to free plan.
    Download from the Asset Store:
    http://u3d.as/2ey


    Overview
    This package implements Unity's well known networking API on top of Photon. Keeping the API simple, this gives you standalone, dedicated servers, fixes, tweaks and ongoing support.
    This "plugin" contains a setup wizard, the fully integrated API, Editor extensions and the client library. It's compatible with the Photon Cloud Service, so you don't even have to setup a server!

    Requirements
    Unity v3.5.7 or up.
    Export to Standalone, Web, Win 8 Store, Win 8 Phone with Unity Free.
    Export to Android and iOS can be done with the PUN+ package or "Unity Pro" licenses for mobile.



    As server use either

    [​IMG]

    v1.25 (25. March 2014)
    Fixed: Coroutines (IENumerators) are now called via their own script instance instead of the PhotonHandler monobehaviour.
    Fixed: The Demo Worker controller no longer makes the character shake wildly when colliding with others.
    Changed: When using JoinRoom with the option to create a room (on demand), it will call OnJoinedRoom in all cases. It will call OnCreatedRoom (only) if it actually created the room.
    Changed: PingCloudRegions no longer needs the Socket class. It checks for IPv4 addresses (which we prefer over IPv6 ones) by looking up a '.' in the address. This makes it usable in PUN+.
    Changed: NetworkingPeer constructor will set a SocketImplementation when the "no-socket" (PUN+) assembly is in the project. This allows the same code to run with either PUN Free or PUN+.
    Changed: The "player comparisons" to check for same ID, not same object (just a bit cheaper).
    Removed: Some surplus debug logs from PUN.
    Updated: Compatibility with Unity 4 by working around some features that are obselete (but needed in Unity 3.5).
    Internal: Renamed AuthValues to CustomAuthenticationValues.
    Changed: PeerState (in Enums.cs) no longer has a Connecting and Connected value. Instead we use ConnectingTo*server. Also gone: ConnectedComingFromGameserver. New: ConnectingToNameServer and ConnectedToNameServer.
    Changed: In OfflineMode, the PhotonNetwork.connectionStateDetailed is now PeerState.ConnectedToMaster and PeerState.Joined when in a Room (after join, before leave). Before it was: "Connected".
    Added: Compatibility with "NameServer", which will be contacted by clients to find a suitable MasterServer. This will allow the Photon Cloud to dynamically put applications on separate MasterServers. Self-hosted Photon instances will not have a NameServer soon, so this step is optional.
    Added: PhotonNetwork.UseNameServer, which is false by default for now. It activates using the NameServer for ConnectUsingSetting().
    Added: Internally used NetworkingPeer.GetRegions method. It gets a list of regions from the NameServer (to be able to ping them). NetworkingPeer.AvailableRegions and .AvailableRegionsServers will store the result of that.
    Added: PhotonNetwork.Server. The ServerConnection enum lets you know which type of server the client is connected to.
    Changed: PhotonNetwork.Connect is now .ConnectToMaster and explicitly skips the NameServer to connect to a specific address.
    Changed: Internal code of PhotonNetwork and NetworkingPeer due to some refactoring and the new states needed for NameServer.
    Added: PhotonNetwork.JoinLobby and PhotonNetwork.LeaveLobby, which were lpong overdue to leave/join the lobby on demand. Make use of PhotonNetwork.autoJoinLobby, too!
    Fixed: When authentication failed, the state Disconnected could not be reached and the client could not re-connect anymore. It could get stuck being 'Disconnecting'.
    Changed: PingCloudRegions according to changes with connect process and using settings.
    Changed: PhotonNetwork.connected is now true even while the client is switching servers! Only if you are disconnected or not yet connected, this is false. This should be what you want to know in most cases, when you just need a "yes/no".
    Added: PhotonNetwork.connecting which is true until you successfully connected to any Photon server when you called ConnectUsingSetting (or one of it's alternatives).
    Added: PhotonNetwork.connectedAndReady which is true when you can call operations like Join, Leave, etc. Note: You can call most operations only on a specific type of server, so even when connectedAndReady is true, you can't call Join while in a room on the GameServer.
    Changed: PhotonNetwork.countOfRooms is always returning the statistic value we get from the Master Server (before: it returned the number of listed rooms in lobby).
    Added: OnFailedToConnectToPhoton(DisconnectCause cause) is now also called when the AppId wasn't ok. DisconnectCause is then: InvalidAuthentication.
    Changed: PunStartup script will do a "demo setup" only once in any Editor, saving the success in EditorPrefs. Still, it only runs if no (saved) scene was loaded and the build-setup is empty. If so, we load the hub scene and setup the build settings, so you can test all demos. This should be less annoying than before. If you don't want this at all: Delete PunStartup.cs.
    Changed: The "Windows" menu "Photon Unity Networking" is now a submenu. This allows you to setup your project build settings and open the "Hub Scene" anytime you want. The PUN Wizard is also still opened from here (or ALT+p).
    Changed: The callback OnPhotonPlayerPropertiesChanged now has an object[] as parameter! This way, we can also give you the properties that were changed. Due to limitations in GameObject.SendMessage, we are using a object[] instead of two parameters. Please adjust your code accordingly. If you implemented this method, it will now break until you fix it. See description in Enums.cs, enum PhotonNetworkingMessage, OnPhotonPlayerPropertiesChanged.
    Changed: The callback OnPhotonCustomRoomPropertiesChanged now has an optional parameter: Hashtable propsThatChanged which contains the key-values that you set by calling SetCustomProperties. If you implemented this method before, it will still be called but without the new propsThatChanged (obviously).
    Internal: When destroying a GO locally, we don't check for a valid instantiationID anymore. This improves the cleanup. Changed in RemoveInstantiatedGO.
    Changed: Instantiate will now check if you are in a room and fail if you are not. In offline mode, you can also "join" a room. The reason for this check: Anything instantiated outside of a room is not going to by synced later on or might even conflict with networked objects in the room. The bool value PhotonNetwork.InstantiateInRoomOnly can be set to false, to skip this check.
    Internal: Private method VerifyCanUseNetwork is simpler now. The property connected checks everything that was (also) checked in VerifyCanUseNetwork.
    Added: New value PingCloudServersOnAwake to PhotonServerSettings. Only if this is true, a client will automatically ping our Photon Cloud regions on start and find the best regions (even before you call PhotonNetwork.ConnectToBestCloudServer).
    Changed: Many PhotonNetwork methods now return a bool which tells you if the action (Photon-term: operation) will be send or not. A returned true value usually only means that some operation was sent to the server and doesn't guarantee that it will be executed successfully on that machine. So: Callbacks are as important as before but you can detect more easily if you (e.g.) tried to JoinRandomRoom when you actually can't at that moment. PhotonNetwork.connectedAndReady can be checked before you simply try to send operations.
    Changed: PhotonNetwork.Destroy to enable you to destroy GameObjects while not in a room. By default GameObjects of one room get destroyed when you leave it. Useful if you disabled autoCleanUpPlayerObjects.
    Added: PhotonNetwork.CrcCheckEnabled and PhotonNetwork.PacketLossByCrcCheck. The first makes PUN use a CRC checksum per package, which is overhead but adds security against broken datagram data.
    Added: PhotonNetwork.MaxResendsBeforeDisconnect. Defines the number of times a reliable message can be resent before not getting an ACK for it will trigger a disconnect. Default: 5. It's limited to 10 but you should not really need to go higher than 6.
    Added: Initial support for RaiseEvent. This offers something similar to RPCs but is independent of PhotonViews. The events only contain what you send! To get those events, you need to register a callback method (it's not using SendMessage). Some advanced features are not yet exposed fully (like Interest Groups).
    Added: Documentation of PhotonTargets values (used in RPCs).
    Added: New options for RPCs. When you want all clients to execute an RPC, it's usually sent to everyone else and executed locally instantly. With PhotonTargets.AllViaServer you can actually send the RPC to yourself through the server. This makes sure that those RPCs are executed in the same order on all clients.
    Added: "Typed Lobby" and "SQL Lobby" support. You can now create multiple lobbies and split room-listings according to your own needs. The default lobby (empty name and type "default") still works as before.
    Note: The lobby type defines how a lobby behaves and which options it provides. There are only 2 types currently. The new SQL-Lobby provides more options for filtering in JoinRandomRoom. The "default lobby type" is what was used so far and works with a Hashtable of key-values that a room must match.
    Changed: PUN will now store the lobby that is in use or was used last as PhotonNetwork.lobby. If you join a lobby "map1" and create a room, this room usually gets attached to the "map1"-lobby (unless you call CreateRoom with another lobby). PhotonNetwork.lobby can have a value, even if you are not joined/active in a lobby! It only changes when you set PhotonNetwork.lobby directly or use JoinLobby(typedLobby).
    Added: Parameter "typedLobby" to JoinLobby, JoinRandomRoom and CreateRoom. If this parameter is null, the current lobby is not changed. If you never used any lobby explicitly, then the default lobby is used.
    Added: Classes TypedLobby (a combination of lobby name and lobby type) and enum LobbyType, which contains the two currently possible types. TypedLobby.Default points to the default lobby (no name, default-type).
    Added: JoinRandomRoom has a new parameter sqlLobbyFilter. This parameter is a sql-like string which allows more fine grained filtering with pre-defined properties.
    Changed: When autoJoinLobby is used, it will now return to the lobby that was used last (for creating or joining a room). Of course, this joins the default lobby as before, if no other lobby was used explicitly.
    Added: PhotonNetwork.OnEventCall to get a callback when your custom events are received and executed. Custom event codes must be below 200. Implement your method as EventCallback delegate.
    Added: New class RoomOptions. This wraps up some of the options that a room commonly needs to be set. Visible, closed, MaxPlayers and some others no longer need to be individual parameters of CreateRoom and JoinOrCreateRoom.
    Changed: JoinRoom(name, createIfNotExists) is now JoinOrCreateRoom(string roomName, RoomOptions options, TypedLobby lobby). The "createIfNotExists" is set implicitly and you now have the room options and can set a lobby. The latter 2 parameters are used only if you create a new game! This means: Only player ID 1 sets room props with JoinOrCreateRoom (player 2 and up just join).
    Changed: If you set automaticallySyncScene = true and call PhotonNetwork.LoadLevel on the Master Client, PUN syncs the level-id before loading the level locally. If loading takes a while, you might notice that everyone else starts loading a bit earlier.
    Added: Documentation as Compiled HTML Help (.chm) as well. The PDF might be removed in later updates.
    Updated: Photon Assemblies to v3.2.2.4


    Release History
    All updates are detailed in the changelog.txt in the package.

    Download
    Asset Store

    Special thanks go to Leepo for his great work on the implementation, feedback and support. Thanks also to Caitlyn Team for getting this live incredibly fast :)


    Upcoming
    Support for Unity 5 and WebGL player. Photon Chat for room-independent messages, friend status and more.


    Known Issues
    When you load a new scene, all instantiated GameObjects are destroyed only locally but not on the server. Anyone who joins the room later on still creates those GOs. To work around this, PhotonNetwork.Destroy your instantiated game objects before loading a new scene. Or use: PhotonNetwork.RemoveAllInstantiatedObjects(player).
    Changing the group of a PhotonView is only done locally and not synced.


    Feedback is welcome! Just reply here.
    This post will be edited over time with more info, updates, etc.
    Last edited: Mar 25, 2014
  2. MikeHergaarden

    MikeHergaarden

    Member

    Joined:
    Mar 9, 2008
    Messages:
    885
    Woohoo, we now finally have a proper networking solution available in Unity.
    (If I can bluntly say so myself ;))
  3. Tomme

    Tomme

    Member

    Joined:
    Jun 17, 2010
    Messages:
    66
    Wow, that was a lot more than I expect way to go! Will be having a fun little tinker around :)
  4. omgitsalexl

    omgitsalexl

    New Member

    Joined:
    Jun 20, 2011
    Messages:
    70
    Downloading and will take a look at the package now. I have just recently started playing with Photon, so if this behaves like it sounds, you have just saved me a lot of time!
  5. Dreamora

    Dreamora

    Member

    Joined:
    Apr 5, 2008
    Messages:
    26,586
    Looking forward to see what changed from 0.93 to 1.0 :D
  6. saymoo

    saymoo

    Member

    Joined:
    May 19, 2009
    Messages:
    850
    how is the promised linux version development going? (express edition should be out this month, according to roadmap)
  7. bertelmonster2k

    bertelmonster2k

    New Member

    Joined:
    Apr 3, 2009
    Messages:
    72
    You will be able to use "Photon Unity Networking" on any platform for Unite11 (end of next month).
  8. the_gnoblin

    the_gnoblin

    New Member

    Joined:
    Jan 10, 2009
    Messages:
    721
    Great update! :)
  9. the_gnoblin

    the_gnoblin

    New Member

    Joined:
    Jan 10, 2009
    Messages:
    721
    Is it possible to create an authoritative setup with unity-builds launched on a dedicated hardware alongside photon to simulate movement and raycasting on the server with this new API?

    So players won't be able to start rooms (and only serverside unity builds will be able to do so) and their movement and shooting would be checked on server.

    And the message flow would go like that: clients->photon->unity-build-for-collision-checking-attached-to-photon-like-a-client->photon->clients

    ...I hope that makes sense ).
  10. Dreamora

    Dreamora

    Member

    Joined:
    Apr 5, 2008
    Messages:
    26,586
    Thats exactly what this extension is actually about with the "photon side client" being called master client.

    The allowing only server to create room can also be easily done: only allow the real clients to join existing rooms by only using join room there and restrict createroom to the master clients you start on the server.

    rooms created will show up in the room listing :)
  11. Kaiserludi

    Kaiserludi

    Member

    Joined:
    Jan 21, 2009
    Messages:
    72
    That was already possibel before. This new unity-builtin-netwoking like API is only affecting the client-side. The server-side is completely independent from the client-API. You can have clients, working with the "old" Photon for Unity APi, clients with this new approach, non-unity-clients, all communicating with the same servercode, even in the same rooms, so of course the client-api is not relevant for if you can use an authoritive approach on the server.

    But attention with the authoritve approach: I would recommend to do some load testing rom time to time from the early stages of development on, as depending on the unity-features, you use, even headless-unity instances on the server can get really expensive in terms of cpu if you simualte all movements of a lot of clients in realtime with them.

    For example movement physics in general (not unity-specific, I even do not know, if unity has builtin physiscs or if this would have to be done by a 3rd party middleware anyway) can easily get quite expensive.
    If your client only needs 5% of its cpu power for physics (which by far isn't a critical number for the client), a server with 10 times as much cpu as the client would already run at 100%, if it has to do the same calculations for just 200 clients.

    So you should think about if some serverside expensive game-logic is really needed, before using so much server-side ressources for it, that your server is at its limits with just a few users, although it could handle thousands without that expensive game-logic, or if a simpler logic would also do it.
  12. Dreamora

    Dreamora

    Member

    Joined:
    Apr 5, 2008
    Messages:
    26,586
    yupp unity has PhysX integrated, thats why it holds even more, you can assume that a game with 32 players requires a 3ghz core of a i5 / i7 cpu on its own in an FPS or similar heavy title, especially if you use physical projectiles, not ray predictions.
  13. fholm

    fholm

    Member

    Joined:
    Aug 20, 2011
    Messages:
    1,626
    A quick question: Does this help you with integrating the physics/game logic parts from unity that you might need to make an authorative server that has control over movement? I downloaded the example and messed around with it, but it just seems like the only thing you've built is a game chat / room server that uses relaying to send the data between clients, trusting clients to not cheat as the server has zero control over the clients positions/actions?
  14. aleksbgs

    aleksbgs

    New Member

    Joined:
    Dec 25, 2010
    Messages:
    31
    Thanks all for this great product !
  15. tobiass

    tobiass

    Member

    Joined:
    Apr 7, 2009
    Messages:
    822
    fholm:
    The server is currently just organizing your players into games and then relays everything.
    So far, the server does not understand what's going on in Unity. It would need the levels, the physics engine (which is not deterministic across platforms) and most of all, the server needs to know what sort of cheating has to be detected and how. And then, there's corrections.

    It's usually not a good idea to run a full blown physics environment on the server for every room (or the complete world), just to check if positions are reported correctly.
    The cheapest way to check this is using one of the clients - the host or MasterClient maybe. Or, if absolutely necessary, you could run a Unity headless instance to correct the players.

    I would try to check only a limited set of data from the client. Maybe when the client reports his new score, check if it's possible to reach that score, if the player played at all and if you like, make all clients report all player's scores at the end of the game. Make sure noone can submit scores every second.

    Most of this really depends on the game and is not solved out of the box. But we do most of the rest and now you can. ;)
  16. the_gnoblin

    the_gnoblin

    New Member

    Joined:
    Jan 10, 2009
    Messages:
    721
    When I try to launch Photon from the package I get the following error (please see the image attached).

    I think I've never used Photon on that hardware before - so I suppose I miss .net framework or smth like that (what should I install?).

    thanks,
    Slav

    Attached Files:

  17. tobiass

    tobiass

    Member

    Joined:
    Apr 7, 2009
    Messages:
    822
  18. BBGameDev

    BBGameDev

    New Member

    Joined:
    Nov 23, 2010
    Messages:
    14
    Hi, got this error when start server
    ------------------------------------------------------------

    2124: 02:07:05.468 - ---
    2124: 02:07:05.468 - Service: "Photon Socket Server" starting
    2124: 02:07:05.468 - Config File: C:\Documents and Settings\Bruno\Desktop\Photon-Server\bin_Win32_xp\PhotonServer.config
    2124: 02:07:05.468 - Will NOT produce crash dumps
    2124: 02:07:05.468 -
    2124: 02:07:05.468 - WARNING: ***************************************************************
    2124: 02:07:05.468 - WARNING: Photon has been built to operate on an operating system earlier than Windows Vista.
    2124: 02:07:05.468 - WARNING: Performance will not be as good as when built for Windows Vista or later.
    2124: 02:07:05.468 - WARNING: ***************************************************************
    2124: 02:07:05.468 -
    2124: 02:07:05.468 - Server Starting...
    2124: 02:07:05.468 - CService::OnException() - Exception: CJob::IsProcessInJob() - Accesso negato.
    2124: 02:07:05.468 - Server shutting down...
    2124: 02:07:05.468 - Shutting down socket servers...
    2124: 02:07:05.468 - Destroying ENet thread pool
    2124: 02:07:05.468 - Destroying TCP inactivity timer
    2124: 02:07:05.468 - Destroying Business logic thread pool
    2124: 02:07:05.468 - Destroying servers
    2124: 02:07:05.468 - Destroying TCP Outbound Connection Manager
    2124: 02:07:05.468 - Destroying resolver
    2124: 02:07:05.468 - Destroying TCP Proxy Connection Manager
    2124: 02:07:05.468 - Destroying ENet host
    2124: 02:07:05.468 - Destroying CLR dispatcher
    2124: 02:07:05.468 - Destroying CLR applications
    2124: 02:07:05.468 - Destroying I/O thread pool
    2124: 02:07:05.468 - Destroying ENet buffer allocator
    2124: 02:07:05.468 - Destroying TCP buffer allocator
    2124: 02:07:05.468 - Destroying TCP socket allocator
    2124: 02:07:05.468 - Destroying ENet socket allocator
    2124: 02:07:05.468 - Destroying performance counters
    2124: 02:07:05.468 - Shutdown complete...
    ------------------------------------------------------
  19. the_gnoblin

    the_gnoblin

    New Member

    Joined:
    Jan 10, 2009
    Messages:
    721
    Package on asset store doesn't contain source code for serverside app(s) - should I just take lite app sources from previous releases? (I'd like to add some logic on the server and not just send data from client to client). Sorry if I misunderstood something :).

    What is the difference between Master, Game1 and Game2 apps? (is there any place I missed where I can read about it?)

    thanks,
    Slav
  20. Dreamora

    Dreamora

    Member

    Joined:
    Apr 5, 2008
    Messages:
    26,586
    Master is the master server (you talk to it initially, hides the policy server behind it and in the end forwards you to the actual server (Game1 / Game2) that handle your room in the end which are used for load balancing and can technically even be distributed to other machines
  21. the_gnoblin

    the_gnoblin

    New Member

    Joined:
    Jan 10, 2009
    Messages:
    721
    How should I specify to which machines to load balance? (if for example Game1 and Game2 are on different machines)
  22. yunspace

    yunspace

    Member

    Joined:
    Nov 8, 2010
    Messages:
    30
    Hi Tobias, great product! I'm guessing the Windows Azure deploy kit should be out soon too? :D

    Just wondering is there a reason why only the Win_32 binaries are included in the Photon-Server zip?
  23. Kaiserludi

    Kaiserludi

    Member

    Joined:
    Jan 21, 2009
    Messages:
    72
    By specifiying their urls/ips and ports in the config.
  24. Igavva

    Igavva

    New Member

    Joined:
    Aug 26, 2011
    Messages:
    5
    Hi.
    JavaScript conflict: BCE0004: Ambiguous reference 'RPC': PhotonView.RPC(String, PhotonTargets, *Object[]), PhotonView.RPC(String, PhotonPlayer, *Object[]), UnityEngine.RPC. What to do?
  25. MikeHergaarden

    MikeHergaarden

    Member

    Joined:
    Mar 9, 2008
    Messages:
    885
    How are you calling the RPC?
  26. MikeHergaarden

    MikeHergaarden

    Member

    Joined:
    Mar 9, 2008
    Messages:
    885
    Game1 and Game2 are no different...but different instances. They could've been placed on two seperate servers. Master is the app that routes all players to a game server. (The master contains the room list of rooms on ALL game servers).

    Currently you cannot -yet- modify the server side logic. This is an idea for future updates though. You need to use the bundled server, using the lite app server will not work. When&if server side logic is added, you will be able to use RPCTarger.Server to send an RPC to the server only.
  27. bertelmonster2k

    bertelmonster2k

    New Member

    Joined:
    Apr 3, 2009
    Messages:
    72
    Indeed - Azure version is in the works and looks good already. We had to build a special tech to allow sticky sessions with a specific node through the Azure Loadbalancer.

    This version runs on all Windows Versions: XP, Vista, Win7, Server 2008 and 32 and 64bit. So this Photon binary is only 7MB in size and fits neatly into the package.
    Last edited: Aug 26, 2011
  28. rhamm1320

    rhamm1320

    New Member

    Joined:
    Mar 29, 2008
    Messages:
    44
    a couple of side notes that knocked me for a loop that may help others. I downloaded and everything worked amazingly well on my home network. When I put my public ip address for our house, it didn't... nothing to do with yours, but I guess my router and / or isp doesn't allow you to "connect to yourself"

    Also, I have a virtual dedicated server that I thought I would try it on. Since its just a base machine without Unity, I downloaded from your site instead of from the link in this thread. Maybe it was me, but I could never get it to connect. After scratching my head for about a day, I put this threads version on the virtual dedicated server, changed the ip in the load balances and its working good.
  29. Igavva

    Igavva

    New Member

    Joined:
    Aug 26, 2011
    Messages:
    5
    import PhotonView;
    import PhotonTargets;
    import PhotonPlayer;

    var hp : int = 100;

    function ApplyDamage (hp: int){
    photonView.RPC("setHP",PhotonTargets.Others, hp);
    }

    @RPC
    function setHP(newHP : int){
    hp=newHP;
    }
  30. bertelmonster2k

    bertelmonster2k

    New Member

    Joined:
    Apr 3, 2009
    Messages:
    72
    "Photon Unity Networking" uses the brand new Photon3 which will go live next week. It supports load balancing across nodes out of the box which is used here as well.
  31. phil_ivey

    phil_ivey

    New Member

    Joined:
    Dec 3, 2010
    Messages:
    31
    ReflectionException: Can not read main module
    Mono.Cecil.StructureReader.VisitModuleDefinitionCollection (Mono.Cecil.ModuleDefinitionCollection modules)
    Mono.Cecil.ModuleDefinitionCollection.Accept (IReflectionStructureVisitor visitor)
    Mono.Cecil.AssemblyDefinition.Accept (IReflectionStructureVisitor visitor)
    Mono.Cecil.AssemblyFactory.GetAssembly (Mono.Cecil.Binary.ImageReader irv, Boolean manifestOnly)
    Mono.Cecil.AssemblyFactory.GetAssembly (Mono.Cecil.Binary.ImageReader reader)
    Mono.Cecil.AssemblyFactory.GetAssembly (System.String file)
    UnityEditor.AssemblyHelper.ExtractAllClassesThatInheritMonoBehaviourAndScriptableObject (System.String path, System.String[] classNamesArray, System.String[] classNameSpacesArray) (at C:/BuildAgent/work/842f9557127e852/Editor/Mono/AssemblyHelper.cs:144)
    +19 nulls,reflection exceptions and internal compiler errors
  32. tobiass

    tobiass

    Member

    Joined:
    Apr 7, 2009
    Messages:
    822
    phil_ivey
    That doesn't really look like something from the plugin. If it's causing this, then you should report a bug to Unity.
    In 3.4, we tested the plugin.

    Igavva
    Ambiguous reference 'RPC': PhotonView.RPC(String, PhotonTargets, *Object[]), PhotonView.RPC(String, PhotonPlayer, *Object[]), UnityEngine.RPC.
    Maybe you copied the plugins folder to your project's base, when you should have moved it? Try a search for "Plugins" or "Photon Unity Networking" in the Project "search" of the Editor. I assume you find it twice. Remove one.

    I think the other questions are already answered?

    I will ask one myself: How are you doing so far with the plugin?

    From my perspective, unzipping and starting the server is one the biggest inconvenience but this will become obsolete with the upcoming hosted service.
  33. Igavva

    Igavva

    New Member

    Joined:
    Aug 26, 2011
    Messages:
    5
    I fixed my issue.
    #pragma strict
    public class Machinegun extends Photon.MonoBehaviour {
    /////
    }
    Last edited: Aug 27, 2011
  34. BBGameDev

    BBGameDev

    New Member

    Joined:
    Nov 23, 2010
    Messages:
    14
    server does NOT start....

    Window xp pro SP 3
    -----------------------------------

    Hi, got this error when start server
    ------------------------------------------------------------

    2124: 02:07:05.468 - ---
    2124: 02:07:05.468 - Service: "Photon Socket Server" starting
    2124: 02:07:05.468 - Config File: C:\Documents and Settings\Bruno\Desktop\Photon-Server\bin_Win32_xp\PhotonServer.config
    2124: 02:07:05.468 - Will NOT produce crash dumps
    2124: 02:07:05.468 -
    2124: 02:07:05.468 - WARNING: ************************************************** *************
    2124: 02:07:05.468 - WARNING: Photon has been built to operate on an operating system earlier than Windows Vista.
    2124: 02:07:05.468 - WARNING: Performance will not be as good as when built for Windows Vista or later.
    2124: 02:07:05.468 - WARNING: ************************************************** *************
    2124: 02:07:05.468 -
    2124: 02:07:05.468 - Server Starting...
    2124: 02:07:05.468 - CService::OnException() - Exception: CJob::IsProcessInJob() - Accesso negato.
    2124: 02:07:05.468 - Server shutting down...
    2124: 02:07:05.468 - Shutting down socket servers...
    2124: 02:07:05.468 - Destroying ENet thread pool
    2124: 02:07:05.468 - Destroying TCP inactivity timer
    2124: 02:07:05.468 - Destroying Business logic thread pool
    2124: 02:07:05.468 - Destroying servers
    2124: 02:07:05.468 - Destroying TCP Outbound Connection Manager
    2124: 02:07:05.468 - Destroying resolver
    2124: 02:07:05.468 - Destroying TCP Proxy Connection Manager
    2124: 02:07:05.468 - Destroying ENet host
    2124: 02:07:05.468 - Destroying CLR dispatcher
    2124: 02:07:05.468 - Destroying CLR applications
    2124: 02:07:05.468 - Destroying I/O thread pool
    2124: 02:07:05.468 - Destroying ENet buffer allocator
    2124: 02:07:05.468 - Destroying TCP buffer allocator
    2124: 02:07:05.468 - Destroying TCP socket allocator
    2124: 02:07:05.468 - Destroying ENet socket allocator
    2124: 02:07:05.468 - Destroying performance counters
    2124: 02:07:05.468 - Shutdown complete...
  35. bertelmonster2k

    bertelmonster2k

    New Member

    Joined:
    Apr 3, 2009
    Messages:
    72
    Try "Run as Administrator".
  36. BBGameDev

    BBGameDev

    New Member

    Joined:
    Nov 23, 2010
    Messages:
    14
    have already tried, but same problem
  37. the_gnoblin

    the_gnoblin

    New Member

    Joined:
    Jan 10, 2009
    Messages:
    721
    Didn't help.

    I'll try to install the latest windows updates on this machine and try installing .net framework 1 more time.
  38. yunspace

    yunspace

    Member

    Joined:
    Nov 8, 2010
    Messages:
    30
    I'm hosting the Photon-Server on a vm. I've changed all the IPs from localhost to the actual IP of the vm and the demo is working fine in standard build. However when I try to build the web player, I get the following error:

    Code (csharp):
    1.  
    2. Connect() failed: System.Security.SecurityException: Unable to connect, as no valid crossdomain policy was found
    3.   at System.Net.Sockets.Socket.Connect_internal (IntPtr sock, System.Net.SocketAddress sa, System.Int32 error, Boolean requireSocketPolicyFile) [0x00000] in <filename unknown>:0
    4.   at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP, Boolean requireSocketPolicy) [0x00000] in <filename unknown>:0
    5.   at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP) [0x00000] in <filename unknown>:0
    6.   at System.Net.Sockets.Socket.Connect (System.Net.IPAddress address, Int32 port) [0x00000] in <filename unknown>:0
    7.   at ExitGames.Client.Photon.NConnect.StartConnection () [0x00000] in <filename unknown>:0
    8. UnityEngine.Debug:LogError(Object)
    9. PhotonHandler:DebugReturn(DebugLevel, String) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:77)
    10. NetworkingPeer:DebugReturn(DebugLevel, String) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:669)
    11. ExitGames.Client.Photon.NConnect:StartConnection()
    12. ExitGames.Client.Photon.EnetPeer:Connect(String, String, Byte)
    13. ExitGames.Client.Photon.PhotonPeer:Connect(String, String)
    14. NetworkingPeer:Connect(String, String) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:136)
    15. PhotonNetwork:Connect(String, Int32, String) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonNetwork.cs:101)
    16. MainMenu:Awake() (at Assets/Photon Unity Networking/DemoWorker/Scripts/Menu/MainMenu.cs:19)
    17.  
    It's as if the policy file is not found. But I can see from the server log that the policy files are being read correctly:
    Code (csharp):
    1.  
    2. 2011-08-28 01:52:54,257 [1] INFO  Exitgames.Realtime.Policy.Application.Policy [(null)] - Application start. AppId: Policy ApplicationPath: C:\Photon-Server\Policy
    3. 2011-08-28 01:52:54,282 [1] DEBUG Exitgames.Realtime.Policy.Application.Policy [(null)] - Reading policy file: C:\Photon-Server\Policy\assets/socket-policy.xml
    4. 2011-08-28 01:52:54,283 [1] INFO  Exitgames.Realtime.Policy.Application.Policy [(null)] - Policy file:
    5. <cross-domain-policy>
    6.     <allow-access-from domain="*" to-ports="5055,5056,5057,4530,4531,4532" />
    7. </cross-domain-policy>
    8.  
  39. the_gnoblin

    the_gnoblin

    New Member

    Joined:
    Jan 10, 2009
    Messages:
    721
    Can this error happen because I have x64 windows server and not x32 one? )
  40. the_gnoblin

    the_gnoblin

    New Member

    Joined:
    Jan 10, 2009
    Messages:
    721
    I've updated windows - this didn't help.
    I've tried launching Photon in Windows XP compatibility mode - this didn't help.

    Any ideas?

    thanks,
    Slav
  41. appels

    appels

    Member

    Joined:
    Jun 25, 2010
    Messages:
    2,644
  42. tobiass

    tobiass

    Member

    Joined:
    Apr 7, 2009
    Messages:
    822
    Yunspace:
    Maybe you didn't allow port TCP 843 in the firewall. That should be the default policy-file-request port for Webplayers. The log entry shows that Photon already is starting the policy app and the file.

    gnoblin:
    The build we included in the package should be compatible with all Windows OSs from XP up. We disabled perfmon counters, because they are the only thing that's 64 bit incompatible (in a 32 bit build).
    But: You need the DotNet framework 3.5 or 4.0. The first one won't do. If PhotonControl can't even be started, then it's likely missing. The Control is a 100% pure DotNet assembly.

    bbgamedev:
    If you unzipped with Windows Explorer's built-in unzip feature, please delete the unzipped server folder and unzip again. This time, using winrar or 7zip. Maybe the explorer marked your files as "from external source" and doesn't trust those.
    It's definitely a rights issue - that's what the error says. As administrator, it should run though. Check the folder's rights again?
    Last edited: Aug 28, 2011
  43. BBGameDev

    BBGameDev

    New Member

    Joined:
    Nov 23, 2010
    Messages:
    14
    tried everything...(I'm a mac user!) but nothing, strange that bootcamp demo version works
  44. the_gnoblin

    the_gnoblin

    New Member

    Joined:
    Jan 10, 2009
    Messages:
    721
    Tobias, I installed .net framework from the link you posted...
  45. Igavva

    Igavva

    New Member

    Joined:
    Aug 26, 2011
    Messages:
    5
    I have the same error as gnoblin (windows 2008, framework 4)
  46. yunspace

    yunspace

    Member

    Joined:
    Nov 8, 2010
    Messages:
    30
    Yes I tried switching off the firewall and also did a port scan to make sure port 843 is free. But the policy request simply isn't hitting the policy server.

    Where as if I were run the client from inside the vm, it runs correctly with the following log:

    Code (csharp):
    1. 2011-08-29 01:40:39,778 [11] DEBUG Exitgames.Realtime.Policy.Application.Policy [(null)] - OnInit - <policy-file-request/>
    2. 2011-08-29 01:40:39,793 [11] DEBUG Exitgames.Realtime.Policy.Application.Policy [(null)] - Policy sent.
    I'm thinking it's probably something to do with the network connectivity between my host machine and guest vm?
  47. Igavva

    Igavva

    New Member

    Joined:
    Aug 26, 2011
    Messages:
    5
    Old Photon runs OK on win2008, Photon supplied with Unity-plugin doesn't start on win2008 (while it runs OK on win7).
    Last edited: Aug 28, 2011
  48. tobiass

    tobiass

    Member

    Joined:
    Apr 7, 2009
    Messages:
    822
    Igavva: thx for that info. We will take a look asap.
  49. Dreamora

    Dreamora

    Member

    Joined:
    Apr 5, 2008
    Messages:
    26,586
    I had no problem starting up the Photon supplied with it on my Win 2k8 32bit box.
    But I would guess that on 64bit it might potentially fail as its the 32bit XP version according the naming, not the normal 32bit one

    my problem is more that the socket policy server on the 1.0 server is plain simply not reachable at least I failed to get it working while the 0.93 beta one worked without any problem and need for reconfiguration. but I can not for sure say that its photons failure, thus I've not reported it yet on the unity photon network board over at exit games
  50. yunspace

    yunspace

    Member

    Joined:
    Nov 8, 2010
    Messages:
    30
    sounds like similar symptoms to what I'm experiencing. I'm connecting from a web client to Photon hosted on Windows vm. The policy server does not respond even though the ip is correct and port 843 is enabled, it only seems to respond if the web client is hosted on the same vm. The one time I did manage to get it to work is by copying the crossdomain.xml over to wwwroot in IIS, but that stopped working also now.

    I'd narrow it down to the policy server because the socket server itself connects fine via the standard client. Just wanted to confirm, the IP address of the policy server on port 843 should be the same as the Load Balancer entry point on port 5050 right?
    Last edited: Aug 29, 2011