Photon Unity Networking

How should I specify to which machines to load balance? (if for example Game1 and Game2 are on different machines)

Hi Tobias, great product! I’m guessing the Windows Azure deploy kit should be out soon too? :smile:

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

By specifiying their urls/ips and ports in the config.

Hi.
JavaScript conflict: BCE0004: Ambiguous reference ‘RPC’: PhotonView.RPC(String, PhotonTargets, *Object[ ]), PhotonView.RPC(String, PhotonPlayer, *Object[ ]), UnityEngine.RPC. What to do?

How are you calling the RPC?

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.

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.

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.

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;
}

“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.

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

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.

I fixed my issue.
#pragma strict
public class Machinegun extends Photon.MonoBehaviour {
/////
}

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…

Try “Run as Administrator”.

have already tried, but same problem

Didn’t help.

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

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:

Connect() failed: System.Security.SecurityException: Unable to connect, as no valid crossdomain policy was found
  at System.Net.Sockets.Socket.Connect_internal (IntPtr sock, System.Net.SocketAddress sa, System.Int32 error, Boolean requireSocketPolicyFile) [0x00000] in <filename unknown>:0 
  at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP, Boolean requireSocketPolicy) [0x00000] in <filename unknown>:0 
  at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP) [0x00000] in <filename unknown>:0 
  at System.Net.Sockets.Socket.Connect (System.Net.IPAddress address, Int32 port) [0x00000] in <filename unknown>:0 
  at ExitGames.Client.Photon.NConnect.StartConnection () [0x00000] in <filename unknown>:0 
UnityEngine.Debug:LogError(Object)
PhotonHandler:smile:ebugReturn(DebugLevel, String) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:77)
NetworkingPeer:smile:ebugReturn(DebugLevel, String) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:669)
ExitGames.Client.Photon.NConnect:StartConnection()
ExitGames.Client.Photon.EnetPeer:Connect(String, String, Byte)
ExitGames.Client.Photon.PhotonPeer:Connect(String, String)
NetworkingPeer:Connect(String, String) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:136)
PhotonNetwork:Connect(String, Int32, String) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonNetwork.cs:101)
MainMenu:Awake() (at Assets/Photon Unity Networking/DemoWorker/Scripts/Menu/MainMenu.cs:19)

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:

2011-08-28 01:52:54,257 [1] INFO  Exitgames.Realtime.Policy.Application.Policy [(null)] - Application start. AppId: Policy ApplicationPath: C:\Photon-Server\Policy
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
2011-08-28 01:52:54,283 [1] INFO  Exitgames.Realtime.Policy.Application.Policy [(null)] - Policy file: 
<cross-domain-policy>
	<allow-access-from domain="*" to-ports="5055,5056,5057,4530,4531,4532" />
</cross-domain-policy>

Can this error happen because I have x64 windows server and not x32 one? )

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