I continue to have trouble with some basic stuff. I have a browser game which updates each players stats, usually very simple stats such as: Rank: Recruite, Score: 10, Gold: 10, etc..... usually consists of a div being refreshed with a php page that has 1 database query to get updated info every 20 seconds. Here is the problem, as I gain more players on my game, it's starting to lag more and more.
I'm a complete noob with JQuery, Ajax, Javascript, etc.. So I have been reading about Node.js / Socket.io and was wondering if these would be a solution for me to prevent lag for my game and players. It's becoming a problem which will drive players away from the game, which I pay quite a lot in advertising to gain.
This game is a hobby for me and does not provide any positive income, so any help from anyone would be greatly appreciated. I am hoping someone has a place I can simply learn how to refresh a divs content with a php page which Echo's 1 line of text for the stats in my game.
I have a lot of stats to update constantly and currently use code such as this:
Code: Select all
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script>
var auto_refresh = setInterval(
function()
{
$('#showStats').load('stats_update_query.php');
}, 20000);
</script>
Any advice and help would be very greatly appreciated! If needed I would be willing to work with someone on a small budget to help implement a working solution.
At the moment my game has anywhere from 5-15 players online at a single time and is growing daily.
Thanks in advance,
Dustin Bowers