Jump to content
  • Advertisement
Sign in to follow this  
l3mon

PHP - calculating too long?

This topic is 4802 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi! I made a little battleships clone using PHP. It works perfectly when I run it on localhost. When I try to play it on the internet though, it "crashes". After like the second move, an empty page is displayed. Any idea why this happens? If it was server response time, wouldn't it be a server timed out message or something? You can find the game here (note: the IE modified version isn't online yet, so it might look yucky. Looks good in Opera :D) Thanks.

Share this post


Link to post
Share on other sites
Advertisement
I'd have to know the actual code you used to see if it had any error in it or mistake. If it was that though it would be easy to fix, but if there is a problom with your server that will be harder to fix.

Share this post


Link to post
Share on other sites
Usually when php parsing takes way too much the server returns a page saying timed out or something instead of blank.

Share this post


Link to post
Share on other sites
Well the code itself seems to be fine, since it runs on localhost.
So I think it has to do with the time out. But I wonder why it displays the game's page, and not an error page.

Share this post


Link to post
Share on other sites
Sounds like a problem with the server itself, perhaps php versions are incompatible or something, if the server is not yours (most likelly) you should contact for support from the server's owners

Share this post


Link to post
Share on other sites
I tried your game and I think that it takes too long to refresh. The page is not empty, and I guess that the script is stopped before the executaion end. So, there are (at least) 2 possibilities:

1) To pervent server DOS and to maintain a good quality of service, some servers will stop scripts if they take too long to finish (after all, it is rather easy to create an infinite loop, and such kind of loop can kill the servers).

2) you added an exit() somewhere.

If (1) is the problem, can you optimize the code to run quicker?

Regards,

Share this post


Link to post
Share on other sites
Thanks.
First I'll leave away the "AI" I think. That should be enough to see if that is the problem. If that is the case, I'll try to optimize it...

Share this post


Link to post
Share on other sites
It is far better, but there are still some problems. I do think that these are infinite loops - the PHP processor might stop them after a while. It seems that there is at least one of these loop at the very end, when the computer is going to win (teh noes! it was nearly finished!), but I also met two of them during the game. back and click again on the map (the computer performs another retry) seems to fix the problem, thus I guess that it has something to do with the way you choose your targets.

HTH,

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!