Search Unity

  1. Check out our Unite Austin 2017 YouTube playlist to catch up on what you missed. More videos coming soon.
    Dismiss Notice
  2. Unity 2017.2 is now released.
    Dismiss Notice
  3. The Unity Gear Store is here to help you look great at your next meetup, user group or conference. With all new Unity apparel, stickers and more!
    Dismiss Notice
  4. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice
  6. Unity 2017.3 beta is now available for download.
    Dismiss Notice

Photon Unity Networking

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

  1. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    1,891
    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 (older) networking API on top of Photon.
    Keeping the API simple, this gives you standalone, dedicated servers, fixes, tweaks and ongoing support.
    This package 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 v4.7 or up.
    Export to Standalone, WebGL, Win 8.1 Store, Win 8.1 Phone, UWP and more.
    Unity 5 exports PUN Free also to Android and iOS.
    Unity 4 exports to Android and iOS with the PUN+ package or "Unity Pro" licenses for mobile.

    Server Options
    cloud-banner.jpg

    v1.87 (11. October 2017)
    Fixed: Basic Tutorial: remove obsolete warnings in Unity 5 and up versions for override of methods defined in PunBehaviour.
    Fixed: Demo hub doesn't throw anymore !dest.m_MultiFrameGUIState.m_NamedKeyControlList on Unity 4.7 and early version of 5 due to a Unity bug (https://issuetracker.unity3d.com/is...t-m-namedkeycontrollist-when-pressing-any-key).
    Fixed: Editor scripts for demos are now resolving "Photon Unity Networking" dynamically to allow for developers to move this folder around within the Assets. This applied to Demos and server settings handling.
    New: Best Region WhiteList dashboard link in ServerSettings.
    Updated: RPC calls allocate less memory.
    Updated: NetworkingPeer.ExecuteRPC() now takes Sender as ID instead of PhotonPlayer class, this change also allows sender to be unidentified wereas before it would throw an exception
    Added: Russia 'ru' as a selectable region.
    Added: Check for GameObject being null in RunViewUpdate(). There seems to be a rare condition in which this causes havoc.
    Added: SetExpectedUsers() for a Room.
    Fixed: Handling of Event "Error Info" (code 251). The content wasn't read and passed-on.
    Updated: To Photon3Unity3d.dll v4.1.1.17. See release_history.txt for details.
    Xbox One:
    Note: You must get the latest Xbox One "Addon" v1.87, as there are a fixes you should apply.
    Fixed: In the addon, the WebSocket implementation was fixed to avoid a crash bug when you disconnected and reconnected in quick succession.
    Fixed: In the addon, the Photon3Unity3D.dll was exchanged to be compatible with IL2CPP, Roslyn and .Net 4.6 as build settings. It's still compatible with Mono 2.x, too.


    v1.86 (30. August 2017)

    Fixed: The fallback thread implementation to always call SendAcksOnly, as long as isMessageQueueRunning is false. This keeps connections from timing out by sending ACKs and Pings as needed.
    Fixed: Compatibility with Unity 2017.
    Changed: In the PhotonServerSettings, you can now select any of the implemented Transport Protocols for Photon: UDP, TCP and WebSockets. WebGL will always use WebSockets and Xbox One has it available, too. If you want to use it on other platforms, you have to set the define WEBSOCKET and make sure the websocket dll exports to the target platform.
    Note: Check your PhotonServerSettings to make sure the (Transport) Protocol setting is valid after updating.
    Note: A few files were moved within the Unity project. The Editor should figure out they are moved and updated. If it logs errors about duplicate definitions, look up the location of the class in this package and remove the other.
    Updated: PUN to no longer uses obsolete enum values of the Photon library (dll).
    Added: tvOS to the meta settings of Assets\Plugins\Photon3Unity3d.dll.
    Updated: Photon3Unity3d.dll to v4.1.1.15. See Assets\Plugins\release_history.txt for details.
    Xbox One:
    Changed: This PUN version only allows WSS communication on Xbox One. A thin native library is used as wrapper for the platform implementation of WSS.
    Updated: The warnings/errors for UNITY_XBOXONE for the cases: "No authentication value", "Wrong authentication type", "XSTS token not set for authentication" and "Not using WSS".


    v1.85 (6. July 2017)
    Fixed: Interest Groups IDs are now of type byte for Instantiate (and all related code) as well. This fixes a cast exception.
    Fixed: Internal use of NetworkingPeer.IsInitialConnect. It's now reset when the connection fails while connecting. This (currently) affects the "connected" and "connecting" values, which is likely to change. This fix is minimal by design.
    Updated: PUN to no longer make use of obsolete enum values of the Photon library (dll).
    Updated: Chat API and ChatGui. Now uses a thread to call SendOutgoingCommands, which keeps connections up (except on WebGL, where threading is not available).
    Updated: To Photon library v4.1.1.14 with various fixes. See plugins\release_history.txt.

    v1.84.1 (2. June 2017)
    Fixed: A minor bug in the Photon3Unity3d.dll, which is now v4.1.1.13. The StreamBuffer.Seek() could fail to seek position 0 when length is 0.

    v1.84 (30. May 2017)
    Fixed: PlayerRoomIndexing can now be added at runtime even on non MasterClient instance. master player is now indicated in the inspector.
    Updated: NetworkingPeer.RunViewUpdate allocates less memory.
    Moved: ReorderableListResources to namespace Photon.Pun to avoid conflicts with other "Rotorz" variants. This is an internal Editor-only change.
    Updated: Unity 2017 Support.
    Added: Support for a Switch add-on. You need to be certified developer for the platform to get access for this. Contact us by mail: developer@photonengine.com
    Changed: SocketWebTcp to handle status changes for the used WebSocket. This fixes uncommon issues in WebGL exports.
    Changed: SocketUdp.cs to lock less parts of the DNS / connection setup, which avoids potential freezes.
    Updated: To Photon library v4.1.1.12 with various fixes. See plugins\release_history.txt.

    v1.83 (13. April 2017)
    Fixed: A bug of v1.82, which caused disconnects.

    v1.82 (12. April 2017)

    Fixed: Memory allocation in OnSerializeWrite(), when the view doesn't write data to the stream.
    Removed: Conversion Wizard for very old Unity Networking projects of Unity 4.x. There is no automatic conversion possible for Unity 5.x "uNet" networking.
    Moved: hasVoice and hasChat values are now in the general PhotonEditorUtils as HasVoice and HasChat, available to more Photon editor-classes if needed. Also, make sure to use HasCheckedProducts.
    Added: RoomOption.DeleteNullProperties. When set to true, the server will delete Custom Room properties, when they are set to null as value. Defaults to off/false but can be really useful to keep the number of room-properties in check. This becomes available on the Photon Cloud after the Easter holidays.
    Fixed: Room.SetCustomProperties() to delete keys with null as value (the client that was setting the custom props did keep the key/value until until it was updated). The callback OnPhotonCustomRoomPropertiesChanged still has the keys with null values. They just don't get stored in Room.CustomProperties anymore.
    Changed: Interest Groups IDs are now of type byte, as used by the Photon servers. It was an integer before but for the wrong reasons. This affects PhotonView.group, PhotonNetwork.SetSendingEnabled() and PhotonNetwork.SetReceivingEnabled(). The method SetReceivingEnabled is replaced by SetInterestGroups(). When you update, make sure to use the correct order of parameters.
    Changed: UtilityScripts folder. Some scripts were not useful and got moved or deleted. General clean up.
    Removed: PlayerVariables script content. It's completely replaced with the ColorPerPlayer script, which is more versatile.
    Added: Checks of mandatory configuration values for console exports to make sure no setting is missing. In doubt, look out for error logs or a NotSupportedException on connect.
    Fixed: The server selection "Best Region" now supports clusters, if sent by the Name Server. Clusters are optionally used by Exit Games as set of machines in a region. As before, PUN only stores the best region, not the cluster. The idea is that this automatically selects a fitting region (not a specific cluster).
    Added: PhotonNetwork.CloudRegion to make the currently used Cloud Region accessible. This is mostly to expose existing values and to make debugging a little easier.
    Updated: To Photon3Unity3D.dll v4.1.1.10 with some additional improvements in terms of memory usage.

    v1.81 (16. March 2017)
    Updated: Basic Demo Launcher.cs: removed Log Level setup, it's now done in the Photon Settings.
    Updated: Chat Demo ChatGui.cs: removed running in background setup, it's now done in the Photon settings.
    Fixed: NetworkingPeer.cs: Fixed Scene Object OwnerShip transfer on late Join.
    Fixed: ColorPerPlayer.cs and ColorPerPlayerApply.cs for a more robust connection with PlayerRoomIndexing.cs instance.
    Fixed: Ownership handling when returning to a game.
    Updated: Setting the log levels via code will now override the logging settings ("Pun Logging" and "Network Logging") from the PhotonServerSettings config.
    Updated: Demo Hub scene to better highlight tutorial links versus links to online documentation.
    Updated: Link for PhotonAnimatorView trigger doc url.
    Added: Callback OnOwnershipTransfered. Called when a PhotonView Owner is transfered to a Player.
    Added: Callback OnPhotonPlayerActivityChanged. Called when a remote Photon Player activity changed. This will be called ONLY is PlayerTtl is greater than 0. Check PhotonPlayer.IsInactive for the player.
    Added: GetCustomRoomList(). Enables you to fetch a short, filtered list of room names from an "SQL lobby".
    Fixed: Basic Demo Launcher: Fixed 5.4+ SceneManager OnSceneLoad callback to not throw errors when coming back to the demo hub
    Fixed: ColorPerPlayerApply.cs: Disable routine was not safe and would throw errors
    Changed: WebGL exports will now use secure https "GetPing" requests. This enables Best Region for content on https hosting.
    Changed: The fallback thread to keep connections doesn't have to run when in offlineMode.
    Updated: The Photon assemblies to v4.1.1.9, which includes several fixes. E.g. "WouldBlock Exception" and "BlockCopy Exception". More info is in the release history file for the dll.

    v1.80 (15. December 2016)
    Fixed: PhotonTransformView first take routine to take in consideration what to update instead of forcing position, rotation scale no matter what.
    Updated: PlayerRoomIndexing.cs to account for potential race conditions when masterClient is transfered and new player joins. SanitizeIndexing() is now in place.
    Fixed: Fix ownership management for scene objects when MasterCLient is/was changed.
    Updated: Chat demo, with new Friend Status update and message implementation available in the Interface as a friends' List.
    Added: "Best Region" support for WebGL exports (uses http to measure roundtrip times). This will require a server-side fix for CORS, coming in January. Working preliminary.
    Fixed: JoinRandomRoom() will now correctly send ExpectedUsers to the Game Server (if any were set in the RoomOptions). This fixes issues when you wanted to reserve slots in a room for other players.
    Added: A null-reference check in FindGameObjectsWithComponent(), which could fail in rare cases otherwise.
    Changed: Setting RunInBackground is now done in the PhotonSettings file. It's enabled by default but in a few exports, this could lead to issues.
    Added: The internal "AuthEvent". This event by the server can now update the client's token anytime (before that expires). Good for longer play sessions.
    Removed: Surplus debug log output.
    Changed: Public variable- and property-naming to PascalCase (beginning with an uppercase character) in RoomInfo, Room and PhotonPlayer class. The old naming is still available but attributed as Obsolete, so you should update asap. Sadly, this is extra work for everyone but we want to make the API more stringent.
    Changed: The PhotonPlayer.name is now .NickName to make it more obvious that this is not the user's ID (and might be changed at will).
    Removed: Obsolete PhotonView.observed. Since a while, each PhotonView has a list of observed components instead. If you have a very old (!) project, check your PhotonViews and make sure they still observe the scripts you meant to observe. Newer projects won't be affected.

    v1.79 (18. November 2016)

    Changed: PUN will no longer aggregate the data from ALL objects in a group into ONE message. Instead, a maximum of 10 objects will be sent together. The idea is to avoid huge messages, which need fragmentation. Fragmentation needs to be avoided, because fragments are always reliable (and you basically lose "unreliable" updates when you send too much). There is a new variable for this: NetworkingPeer.ObjectsInOneUpdate.
    Changed: As we send max 10 gameobject-updates in one message (by default), we can use a byte as type for their ID (instead of short). This minimally saves data but makes this PUN incompatible with older builds. We separate PUN versions for you so there won't be a clash. PhotonNetwork.versionPUN is inserted into your Game Version to separate players.
    Updated: PunTeams to keep PlayerPerTeams Listing up to date.
    Updated: PlayerRoomIndexing improved consistency across various network contexts.
    Fixed: SocketWebTcp for WebGL was time scale dependant and would stop receiving events when Time.TimeScale = 0.
    Updated: DemoChat UI reworked to match demo Hub look and feel.
    Updated: DemoHub pixel Perfect Canvas fix.
    Added: Two more regions: Korea, Seoul (kr) and India, Chennai (in). If you're using the hosting option "Best Region", you may want to update the configuration in your PhotonServerSettings file.


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


    Download
    Asset Store

    Special thanks go to Jean, Vadim, Leepo, Hamza and Olli for their great work, feedback and support. Thanks also to Caitlyn and team for getting this live incredibly fast :)


    Upcoming
    Support for more platforms, more useful components and lighter networking.


    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. If you Instantiate a new object in a group that wasn't subscribed first, then the local client won't create the GameObject (it is culled by Interest Group).
    When you use multiple scenes, the viewIDs of PhotonViews in those scenes will always start at 1. Edit the PunSceneSettingsFile in your project to enter a minimum ViewID per scene if needed.


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

    MikeHergaarden

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

    Tomme

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

    omgitsalexl

    Joined:
    Jun 20, 2011
    Posts:
    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

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

    saymoo

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

    bertelmonster2k

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

    the_gnoblin

    Joined:
    Jan 10, 2009
    Posts:
    722
    Great update! :)
     
  9. the_gnoblin

    the_gnoblin

    Joined:
    Jan 10, 2009
    Posts:
    722
    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

    Joined:
    Apr 5, 2008
    Posts:
    26,596
    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

    Joined:
    Jan 21, 2009
    Posts:
    85
    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

    Joined:
    Apr 5, 2008
    Posts:
    26,596
    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

    Joined:
    Aug 20, 2011
    Posts:
    1,782
    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

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

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    1,891
    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

    Joined:
    Jan 10, 2009
    Posts:
    722
    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

    Joined:
    Apr 7, 2009
    Posts:
    1,891
  18. BBGameDev

    BBGameDev

    Joined:
    Nov 23, 2010
    Posts:
    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

    Joined:
    Jan 10, 2009
    Posts:
    722
    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

    Joined:
    Apr 5, 2008
    Posts:
    26,596
    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

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

    yunspace

    Joined:
    Nov 8, 2010
    Posts:
    41
    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

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

    Igavva

    Joined:
    Aug 26, 2011
    Posts:
    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

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

    MikeHergaarden

    Joined:
    Mar 9, 2008
    Posts:
    966
    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

    Joined:
    Apr 3, 2009
    Posts:
    78
    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

    Joined:
    Mar 29, 2008
    Posts:
    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

    Joined:
    Aug 26, 2011
    Posts:
    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

    Joined:
    Apr 3, 2009
    Posts:
    78
    "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

    Joined:
    Dec 3, 2010
    Posts:
    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

    Joined:
    Apr 7, 2009
    Posts:
    1,891
    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

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

    BBGameDev

    Joined:
    Nov 23, 2010
    Posts:
    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

    Joined:
    Apr 3, 2009
    Posts:
    78
    Try "Run as Administrator".
     
  36. BBGameDev

    BBGameDev

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

    the_gnoblin

    Joined:
    Jan 10, 2009
    Posts:
    722
    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

    Joined:
    Nov 8, 2010
    Posts:
    41
    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

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

    the_gnoblin

    Joined:
    Jan 10, 2009
    Posts:
    722
    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

    Joined:
    Jun 25, 2010
    Posts:
    2,685
  42. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    1,891
    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

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

    the_gnoblin

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

    Igavva

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

    yunspace

    Joined:
    Nov 8, 2010
    Posts:
    41
    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

    Joined:
    Aug 26, 2011
    Posts:
    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

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

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,596
    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

    Joined:
    Nov 8, 2010
    Posts:
    41
    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