Okay so I’ve been working on this MMO for about half a year and it was nearing its release I developed it using Flash player actionscript 3.0 + PHP +Mysql; Then I heard about Unity and I’m slowing starting to think I might release the game on this platform so I have some 3D elements in my game. I have a basic game elements of the the MMO already created and before I work on the multiplayer or enemy elements I would like to know what kind of server would be best suited for an MMO;
Its a zombie mmo with guns and melee weapons(duh), and I want the players to buy private organizations to swoop down and kill some zombies and then get pulled back up when there time is up.
I have a strong background in Flash/Actionscript, MySql, PHP; I don’t know if I have much options but I preferably would like a server option that supports physics so I don’t have to do some advanced calculations in PHP and have the results sent to MySql it just gets confusing.
Thanks Unity community and Thank you Unity developers your doing a great job im picking this stuff fairly quickly.
If your server in PHP is almost done and works for your game, then don’t switch at all. You can use the WWW class of Unity to communicate with the server you did. This way, you won’t have to code everything once more, just for the sake of it.
Most likely you won’t find a networking server for Unity that works in PHP, so you can’t simply switch the engines.
Physics are complex, no matter which language you write them in. Meaning: they are expensive on the server and your cost/player goes up if you use them. Aside from that, physics simulations are difficult to keep in sync. You might not instantly get the effects you want and instead end up with visible corrections and issues with timing.
Physics that don’t affect the gameplay are something else entirely and can be done independently on each client (without sync or check on the server).
I am curious about the PHP thing. On my localhost using php for my database access was quite fast. Instantanious, even. In fact, I have a little ‘Please wait’ box that pops up between sending and receiving data and on localhost I never even see it, but when I placed the stuff on my web space last night… boy did I ever get enough time to inspect the flaws in the background image… lol… doesn’t help me only having a 384k connection…
Anyways, the problem I am having is the length of time it takes a single message to travel to the server and back. Now, on my server my host is … something, I forget. It is not localhost, I know that. Wether that is a subdomain that acts like localhost or wether it is hosted elsewhere, I just don’t know. All I know is that my server uses an actual URL, not local host. Does this mean that my access on the erver side will allways be slow? Does this mean that no matter how fast my connection, relying on PHP on that web space will always be slow? Cause, quite frankly, that speed is no good for anything other than turn based games…
Now comes the other question… If I connect to a MySQL database directly from within Unity but still have the 384k connection, will there be a speed increase between doing this and going through PHP? I guess that is the point I have been trying to make from the beginning… how much of an additional slowdown does PHP offer on top of a direct database connection?
Regarding connecting directly to you database within Unity: This is obviously possible, but I would not really recommend this approach unless you are just experimenting. Aside from the security concerns, SQL databases are generally not designed around the idea of hundreds or thousands of clients being connected from disparate sources.
Regarding PHP and real time games: It’s suitability depends greatly on the nature of your game. Like Tobias said, if it is working for you already, keep using it. In my experience the downside to using HTTP for your protocol is going to be increased latency and some increased overhead in terms of protocol size. The one advantage to using HTTP is that you are a lot less likely to have firewall troubles. Depending on what sort of techniques you use, and what type of firewall is between you and your clients, there can still be problems.
Nothing can ever just be easy, can it? Way too much to ask
What I meant to ask was if my server has a constant MySQL connection or does thousands of calls to php files what would be speed tradeof. Purely for interest sake. It seems to me like licking the best server solution is like picking the best games console. Each has their ups and downs and which one you pick is per-game dependant on what you are willing to compromise on or sacrifice for what
The WWW method is very simple, useful and easy to use. but like MyDude is experiencing is there’s ton of connection requests happening for every-single-variable needed, Unless of course your using split() which is helpful and I ditched the physics idea for the MMO I’ll just have to wait until its better supported. Dose anybody know how i can get ahold of uLink i don’t see it on Google.
I’ve managed to figure out how to use System.XML so i can get a list of players positions in one request which is very useful. For some reason Xml.Load(); likes to freeze a couple of frames when its called so now I’m having trouble with that when i try using yield it says i can’t yield an Xml.Load(); If you know why i can’t yield xml.load() please refer to this thread: http://forum.unity3d.com/threads/89014-Yielding-Xml.Load()-with-out-errors