Photon for Unity3D.

digoxy
edited December 2010 in Photon Server
Hello Tobias, (all)

I have only recently started using Photon with Unity3D(3.1). I am a new user to both, so I spend a lot of time reading, more so than anything else. I was asked to post something that might help others in their quest for running these two together. I thought I might start simply by running through some of the things I have been through and explain what I had a hard time understanding or gathering information on when working with Photon.

Of course as many do, you research what might best fit your solution as far as networking goes and Photon offered the means to expand very far in the line of code to handle large amounts of Concurrent users (CCU’s). Also, the price tag for under 50 users was exactly right on. Unity 3D is also the same type of situation, using the free version with the option to upgrade to pro was also a winning situation – Photon = WIN, Unity3D=Win. This is coupled with the fact that not only is the price right but also both of these products are leaders in their respective fields. This I figured would allow our team to experiment with both together, and, when (if) we get a product, we can then dish out the dough where we should.

The first step of course was to download Unity3D, install and make sure everything was running. This really wasn’t a problem, it installed no hitches and was running the demo’s without any problems at all.

Next was Photon, from the beginning after we decided to use Photon, the visit to the Photon site (exitgames.com) was a little discouraging in that I couldn’t figure out exactly what I should download. Reading the download files was confusing to some degree, when you see all the old packages with Unity in the very specifically in the name, you wonder, where are the new unity packages, my first thought was it wasn’t supported anymore. It wasn’t until I spent another couple of hours researching did I find out that it was all in one package, so, I downloaded the Photon Server SDK 2.2.2.

Unpacked this and went directly to the deploy folder where I found a nice little treasure chest of things to play with. So far, the understanding of why some of these dir’s have code and others do not, I don’t fully understand but, I do know that the bin_win32 has a nice little group of things to play with. I read through some more information about this win32 version found in the bin_win32 and found that the PhotonControl.exe was located here. Of course, I just clicked it and it wanted a license, I picked that up from the download section, copied it to the directory where PhotonControl.exe was located and launched it locally on my machine. Once it was up, I found it in the system tray, right clicked and told it to start the application, up and running. A happy camper.

What might make this a better process? I can only say that, with the understanding of the broad group of people that exitgames is trying to accommodate, it might be better to say to a Unity3D user that “All you should need would be one of these” or “Delete these folders, you will not need them”. ? I am not real sure really, from exitgames standpoint, I would think that the goal is to get this on people machine, get them using it quickly and make it as painless as possible so to allow them to get in deep so you have future customers. Of course also, the consideration someone like myself who had only spent 3 days researching, popped it open and spent another 3 days figuring it out.. noob to the product is why it takes so long. So, anything to make someone like myself get right to the meat is good. Maybe even possibly a specific test/demo zip file with all you need to setup a test run with the server and Unity3D.

We were able to finally isolate the Unity3D scripts and import them. We then went to look for (as found on a message forum somewhere) the demo-realtime.exe that we could run, with the server running on the local machine, we could see that the instances of users were increasing with every launch of the demo-realtime.exe. BTW, this is located in a completely different file (The DOTNET) in the directory demo-realtime/demo-realtime/bin/debug/demo-realtime.exe.

Don’t get me wrong, this is very doable, it just takes so long and so much reading to run a simple demo test.

If your running Unity3D (3.1) this is somewhat your steps to get there. In Unity3D, they have a new demo (bootcamp) that replaced islands, the island demo that is used with a Photon MMO example does not load correctly in Unity3D 3.1, so, this is useless now without some work on the Islands Unity3D demo.

It must sound as though I am rambling, I am sorry if so, I do know that I have spent many hours on this to simply get to a Unity3D Example running Photon. Right now, I have the small version of the demo in Unity3D using the 32bit version of the server program and am able to run demo-realtime.exe to place users in the 3D World. I see them as boxes and they all spawn perfectly.

In closing, as trivial as all this sounds, I have read that 2.2.2 is supposed to have rotation, its supposed to be there somewhere, and, it may be. But, this demo does not show these boxes rotating and I cannot locate in the code anywhere to rotate them. So, this is where I am now, digging through to understand all about Photon to determine if indeed Photon can rotate with the single location command. Reading the forums, someone has said that 2.2.2 includes the long awaited rotation, is rotating? I don’t see it happening. !

At any rate, sorry for the long mail, I would gladly do this on the phone with Photon if you like.

Comments

  • Yes it does contain rotation in the corresponding project.

    Though adding rotations is rather trivial, just follow the path the position works and send the eulers the same way :) (or use quaternions if you don't care about sending 4 floats ... or just the rotation around y from eulers if you don't intend to add vertical rotations of any kind)
  • Hello dreamora,

    I see you out there a lot to replying to many messages by the community, very informative and very helpful. Thank you.

    At the risk of making myself appear like a complete noob, which I am to both Photon and Unity3d, much of what you are talking about here is new stuff. I was simply saying that I do not see any rotation in the small demo set that we have started testing with. Of course, much of what you posted above will need to be mulled over to look through the code and understand how you are rotating.

    In such applications like IrrLicht, this is contained in the location string sent to all client's. So, first glance, I don't see anything like this. Rotation, and I hope you agree with me here, is as important to the player(s) as is location. This should be an easy call from the server right? In IrrLicht, you might use vector3d(x,y,z,r). Is the demo using this in some way? or, do you have to utilize work arounds (or you might say, simple programming). Can I expect to find anything that encapsulates rotation in this fashion?
  • Digoxy:
    Thanks for the feedback. I'm glad you didn't give up on Photon when you barely got through all the hurdles.
    I am digesting your post still and we will improve the processes.

    Some quick responses:

    I agree, the download page might look confusing. Aside from many other things, there is the Server SDK named ExitGames-Photon-Server-SDK_v2-2-2.zip and the Unity SDK named Photon-Unity3D_v6-0-0_SDK.zip
    I think the decision to have a Server SDK and several Client SDKs is OK. It just needs to become more obvious what to get for which usecase.

    We also will include a test client into the Server SDK, so there's instant something to test it.

    The Developer Network got updated just recently and hopefully this helps new users setting up the server side: Running Photon in 5 Minutes. This could be extended by client side demos.
  • Thanks Tobias, I appreciate you looking into it for future users. :) would be nice to just open a zip with everything there and nothing else though, maybe thats asking alot! :)
  • About the rotation.. this was a recent change for the island demo which you were not able to open (btw you only have to fix one file or so and it will work just fine, the unity3d forums have posts about it).