Im making a web-rpg using PHP, MySQL and AJAX. As there are alot of variables used for player stats I wonder what is the best use for storing this while playing.
Right now Im using session variables while playing and when a task is done it is saved using mysql query update. I made it this way to get less queries to mysql. But I wonder which is less heavy for the server, writing session variables or making mysql updates?
SESSION variables or MYSQL queries
Started by Demodog, Apr 14 2010 10:06 PM
3 replies to this topic
#1
Posted 14 April 2010 - 10:06 PM
|
|
|
#2
Posted 14 April 2010 - 11:22 PM
Hmm, I suppose mysql update queries but I don't see how sessions can replace update queries?
#3
Posted 14 April 2010 - 11:50 PM
Well I have to store variables like health, strenght, room location etc somewhere to be able to create a game? Since players are in mysql database it has to be made an update to be able to save the stats but in the middle of a combat i can just update session variables and then save it to mysql after the fight is done. But if mysql is less resorcefull than writing session variables I might as well do mysql updates all the time.
well perhaps the best would be to store in-combat variables in javascript on client-side and then make a php call to update mysql after fight is done?
well perhaps the best would be to store in-combat variables in javascript on client-side and then make a php call to update mysql after fight is done?
#4
Posted 15 April 2010 - 02:44 AM
Well, I suppose it'd be best to store stats that are dynamic, still changing while combat, into sessions and once combat is over and the defnite new stats are set, then update the database with those. But I'm not sure how your system works like and whether it's 'save' to do so, but atleast it takes less resources I believe.


Sign In
Create Account

Back to top









