Sork 2016 # 3
Progress! Can now build roads, settlements, cities, upgrades and 3 tiers of walls.
seen from United States
seen from United States

seen from Russia

seen from United Kingdom
seen from China
seen from Italy

seen from Canada
seen from France

seen from Russia

seen from Russia

seen from Malaysia

seen from Italy
seen from Russia
seen from Maldives
seen from United States
seen from Netherlands
seen from United States

seen from Russia
seen from France
seen from United States
Sork 2016 # 3
Progress! Can now build roads, settlements, cities, upgrades and 3 tiers of walls.
Sork 2016 #2
Whoo! now picking between different hexes, plus a fancy border.
Kingdoms of Sork Update 2016:
Ben and I are working on Sork again. Gonna be posting on here more. Good to keep track of things, makes you feel good about accomplishing biz.
Generating a game board out of hexes was way more difficult than expected.
Tutorial Pt.2 (Testing and Gameplay)
To test that things are working, you can run two .exe at the same time. So first add your scene to the build settings. (File > build settings> addcurrent.)
Then build a standalone version using settings of your choosing. (Select Windows, Mac, Linux Standalone, press build, choose build path.)
When you play, the game will try to find a server to join. if no games are running, you will be given the chance to create a room. Otherwise, you will be put into an available server.
Tutorial Pt.1 (Set-up)
To start, set up a new Unity project.
As well, you need to create a Exitgames.com account if you do not have one already. You can sign up for a “Forever free” account on their site. With your account you need to go to your dashboard, and copy your “appID” that is listed. https://www.exitgames.com/en/Realtime/Dashboard
In order to get the necessary Photon classes and framework, you need to download and install the free “Photon Unity Networking” package from the Asset Store in Unity. (Ctrl+ 9 to open)
Once you do, the “P.U.N.” (Photon Unity Networking,) settings will appear. Select “I already have an account.” Then paste in your appID in the box that appears. This allows you to access the Photon Cloud, so you can host servers.
Now is a good time to set up a basic scene for your cubes to play on. Create a ground plane, a basic light source (directional works,) and a empty game object, which you attach a new script called “RandomMatchMaker”. Get it here.
Now that you have your scene you can set up your player. For this I used a simple cube, but you can use what ever you want. On your player you should have a collider, a rigidbody (freeze rotations to stop crazy movements,) Then attach the “Photon View” premade script. Create and attach a new script called “NetworkCharacter”. And also attach your player control script.
Here Are the scripts I used in my example: -PlayerControl , NetworkCharacter .
if you are using your own player script, make sure you include the following line before your player controls, as I did in my example. This makes sure that you can only control your player:
On your player, click and drag the “Network Character” script component into the “Observe” box of the “Photon View” script. And set the “Observe option” to “Reliable Delta Compressed.”
I suggest putting a colored material on your player if it is a white cube at this point, or a colored material on your ground plane, just so it is easier to see.
At this point, drag your player into the resources folder in your project hierarchy (the only thing in there otherwise is the PhotonServerSettings”,) to make it a prefab.
Make sure whatever you name your player prefab, is what is written in the RandomMatchMaker script, in the “OnJoinedRoom” function. In the example script, mine is called “playerprefab” to make things easy.
Now that your player is a prefab, you can delete the version in the scene.
Side Notes:
In the process of writing a basic tutorial on setting up the simple example I have working here. It is written with the understanding that you have basic understanding of Unity, and have some experience in editor.
Also, for testing you can just open two versions of the same build on one computer. Sure am glad I figured that out after all my testing and going back and forth on two computers.
Success?
Ended up writing my own simple movement script. Seems that the .js one from the asset store was causing some issues (mainly the rotation issues.)
The flashing, bouncing and teleporting was caused by a couple things, which is why it took so long to figure out (and why it was so frustrating.) First, I had forgotten to but a rigidbody on my player prefab, meaning the server wasn't fully aware of each players position, just that they were moving. So it showed them in-transit, just not at their final destination.
The other part of the problem was that rather than having the networking script component being tracked by the photon server script, I had the player controls being tracked. This caused the server to look at what was input directly, rather than it being sorted based on "who-dunnit". This is why both cubes were semi controlled by both users.
So I have a working version. I did what I set out to do, which was gain understanding on how to set up and use PhotonCloud, and also to get a most basic example functioning.
Currently when you load the standalone, if there is not a player running the game then you can start a server. If there is a game up, you are given the option to start a server or join the existing one. The server name may be gibberish, but I'm counting it as a win.
Photon Testing Cont'd
Got a second player spawned, and each player controls their own x and z position, however there are still some issues. You only control one player, but when one rotates they both do somehow. Also, the game is constantly trying to reset the other player you can see back to spawn on your screen.
They are unaffected on their own screen, and can move freely, but as they move on yours it appears they are teleporting back and forth from their true position and spawn. When they stop, they are fine on their screen, but on yours they are just sitting bouncing in spawn.
Latency is pretty minimal though, so I have that going for me, which is nice.