Re: Sessions VS MySQL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Matt Fielding wrote:
I've recently begun work on a web-based RPG game with some friends, and have
recently been thinking about the best solution for loading and saving
persistent variables like player life/stats and other information. I am both
familiar with sessions and mysql for saving and loading variables, and
that's not my question, but I am instead interested in which method would be
more efficient to use. If the data is getting reloaded on each individual
page, would it be more efficient on the system hosting the game to save
certain numbers and variables in a session, or to reaccess the database each
time it needs those numbers.

My biggest concern with using sessions, is if someone were to exit the
browser mid saves to the database, all information would be lost. Since it
is web-based, there is no real way for me to be able to expect everyone to
follow certain procedures to load/save, and I would really like to stay away
from that as well, as it's not as user-friendly and intuitive as an
auto-save feature. I guess my main question here is, are there ways to
auto-save and guarantee data wouldn't be lost without having to load, read,
write, and close a connection to mysql on each page load?

Seems as you don't know if the user will close the browser between page loads, AND to be user friendly so that they don't have to click a save button, the ONLY way would be to save the game every time the page loads.

So save all data to the database each page run. This will also help in that other players will beble use that data. Say if you needed the top scoring 10 players for example, the data is already saved in the database so it will be easy to find that out, with the most up-to date player data.

Darren


I appreciate any tips, insight, thoughts, stories, or help in absolutely any
fashion that I can get. Even a tip of a nature outside my question related
to my project would be great. it's my first project of this kind, and I'd
like to avoid any problems I can, so I'm putting a lot of forethought into
it all. Also, I'm the only coder, so to have to go back and rewrite a ton of
code from one save method to another is just way too much work.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux