Quote:Original post by sooner123
Ahh I see.
I don't see a big advantage of having the C++ application make all the updates itself over it calling an update.php. Unless C++ would simply do it far faster than PHP can. But I'd imagine in both cases the bottleneck would be the database.
Well I'll definitely weigh all the suggestions here and figure something out based on the final nature after more design fleshing. I now see that choosing between an "update when user loads a page or does something update-relevant"-solution, a "curlPP-driven C++ app that executes an update.php"-solution, and a "C++ app that updates the gamestate itself"-solution is fairly dependent on the specific nature/popularity of the game.
Ultimately I'll choose something that works without introducing any serious bottlenecks and takes the least work to implement.
Basically the drawbacks of a c++ program running curlpp is:
1) Most free/cheap hosts won't allow it, you'll have to pay for a dedicated server (Same is usually true for windows scheduler and cron) (The windows scheduler also has a lower limit of 5 minutes, atleast on Vista (not sure about server editions)
2) curlpp doesn't run update.php , it generates a HTTP request, sends it to the webserver and has the webserver parse the php script, this is unnecessary overhead.
a c++ app that updates the gamestate directly basically has the same primary drawback as the curlpp solution, it requires a dedicated server, however it has less overhead since it doesn't involve the webserver or the php parser in the update process, If you've allready written your update.php script its probably not worth the effort though.
If you got a dedicated server and know that the database will be the only bottleneck you could just run "php.exe update.php" and have update.php loop and sleep for you, this has less overhead than the curlpp solution (no webserver gets involved) and takes less effort to code (no need for c++ code, just add set_time_limit(0), an infinite loop, a time check(to ensure the correct amount of time has passed before running another update),a short sleep(to avoid eating up all cpu resources while doing nothing) to your update.php script) and a way to terminate the script cleanly (if you need to make updates to the script you don't want to kill it in the middle of an update).
[size="1"]I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!