World Created when server starts
The way the MMO Demo is setup is that the world is created when the first player signs on. How could I go about changing that so that the world is created when the server starts?
Thanks in advance for any input!
Thanks in advance for any input!
0
Comments
Find the File PhotonApplication.cs in your server and use the code in the link below.. the code has comments explaining what goes where, the key thing is to create your world inside the Initialize() Function
http://pastebin.com/eYVkGAxt
If that doesnt work let me know...
A better idea is to put all that in a separate class and create an instance of the class inside the PhotonApplication.cs file, and then call a function that will do the work, that is actually how I do it to start everything I need on the server, like the world and the npcs...
It was before: Then i changed it to... ...and that solved
Also make sure that both names are exactly the same
WorldOneCreate = MmoWorldCache.Instance.TryCreate(
WorldOneName, WorldOneTopLeft, WorldOneBotRight, WorldOneDimention, out WorldOne
);
I believe the names are the same but I will check
WorldOneTopLeft = new[] { 1f, 1f };
WorldOneBotRight = new float[] { 60000f, 60000f };
WorldOneDimention = new float[] { 3000f, 3000f };
In Unity I have 9 terrain pieces in a 3x3 square each terrain piece is 2000x2000. The first one is located at 0,0 and the last one at 4000,4000 so in total it takes up 6000 by 6000. Do I have the Photon size setup correctly?
WorldOneTopLeft = new[] { 1f, 1f };
WorldOneBotRight = new float[] { 60000f, 60000f };
WorldOneDimention = new float[] { 3000f, 3000f };
It looks like that both worlds must have exactly the same size or you would get an error.
My settings in the client to match the server are:
The key thing here for the size is the grid array: So you have 20 * 1000 = 20000
And the tiles are 1000.
I dont have to work with the terrain in my game now so I left those as they are and they work fine for me.
The bottom right would then be {5999f,5999f}.
The server's tile dimensions are invisible to the client. The optimal setting reduces the number of subscribed items together with the interest area size to the minimum (to what you want to display). The mmo island demo uses a tile size of {1000f,1000f} with 20 tiles in each direction and a default minimum interest area size (view distance) of {501f,501f} and a maximum size of {1500f,1500f}.