- Home /
Are WWW and WWWForms efficient at large scale?
So I want to preface this by saying I would only consider myself an intermediate coder, but would be able to be productive even with no access to any help resources, using what I know. I only preface by saying this, because I fear doing most things "on my own" (I learn better figuring things out along the way) may hurt me in the long run.
I am working on an online 2D social avatar based game, and as it currently stands, I have a MySQL database that houses all player data (user ID, all stats, item information, where the item is located in a players inventory, how many and what type of upgrades the item has) and because of this and my level of knowledge in getting to and updating that data, I have many different PHP scripts that run queries at real time using WWW and WWWForms.
As an example of a typical sign on, it would look something like this.
User logs in - Query(1) is run to populate the singleton containing all user stats. User loads directly into their inventory and a method is run to populate the inventory, in this method runs another query(2) to load in what the user has stored on their account. The user at that point can move items around, each time running a query(3*) to update the position of that item within the database. User goes into play mode where they then begin killing monsters, each time a monster is killed and an item is dropped a query(4*) runs to update the players items in the database, as well as a query(5*) running every 5 seconds to maintain accurate user information in the database and to prevent progress loss in the event of a crash. And finally a query(6) that runs in the event that the game is closed to save all necessary data to prevent progress loss. These are just a few of what I expect to be many database calls in the future, being an online game, a lot of this can not exist client side for the potential of manipulation.
I will add though that so far none of the queries are complex with 0 joins, and no sub queries. As an example adding a dropped item is:
$sql = "INSERT INTO `items`(`id`, `SItemID`, `Slot`)
VALUES (".$userID.",".$itemID.",".$slot.")";
For some reason I feel like, while this works now, that at a larger scale this will become very inefficient, and potentially require major overhaul of the mechanics.
Any help or insight to my specific case would be greatly appreciated, as almost everything else I have found contains so much information that is more or less specific to another situation or circumstance. This is also a reason why I feel in my gut this may be the wrong way to go, because it is not something that is talked about too much.
Your answer
![](https://koobas.hobune.stream/wayback/20220612122540im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Linq Query - Strange Outcome 1 Answer
Generic sqlite query method 0 Answers
problem retrieving data from SQLite to Android 2 Answers
Problem with SQLite unity Database 0 Answers
get_version can only be called from the main thread. 0 Answers