- Home /
RPC vs WWW : Performance
I'm working on a multiplayer game, and I have the following question:
The multiplayer part of the game is running on an Azure VM, in a standalone unity application. In that same machine, the server communicates to a MySQL DB using the mysql connector for C#.
Now, from my clients, I need to access the db for different things: consumables sync, highscores, data, etc... In the past, what I did was have a php script hosted, and just make WWW calls to that script to interact with the DB, but now that I have the server, I'm tempted to just make an RPC call to the server and make it do whatever it is I need to do, and save me the coding in PHP.
Is this advisable? does it have any drawbacks performance wise?
Thanks!
In runtime in a multiplayer application (while in gameplay) isn't a good idea to search or update anything in any database.. For sure you will get a poor performance. Probably I didn't understand your question, but if you just want to use your PHP interface to check or update somethings after a gameplay.. I can't see any problem. If you have a instance of application to access the database, as a server in the multiplayer, it should be used only while in the gameplay. But even in this case I guess is not a good idea.. $$anonymous$$aybe you can try to handle the memory or some txt in the runtime. Just wondering... I had some troubles accessing databases all the time and I find a solution using a simple text file.
Answer by tobiass · Jul 30, 2014 at 09:35 AM
Unlike WWW calls, you won't get a response from RPCs. So for the RPC response you need the server to send another RPC back.
You will have to take care that the DB interaction is independent from your game loop and not affecting your performance. It might be easier in a separate service but a Thread Pool might do the job as well.
Most likely, the RPC will be less overhead to send.
Your answer
Follow this Question
Related Questions
Is there a more flexible method of sending data over network than RPC? 1 Answer
Multiplayer Scoreboard Problem. 1 Answer
Networking Unity can't get players on network to change each others variables. 0 Answers
RPC Call doesnt get called 2 Answers
How to send timestamp via RPC so it was relative to the receiver? 1 Answer