Dustyy Posted April 7, 2011 Share Posted April 7, 2011 I'm creating a game where 2 people, on separate computers can battle each other. I'm doing it turn-based, like Final Fantasy but I came across a problem, how do I check if the other person has ended their turn? I was thinking that I would have an area in my database that would be true/false if it was their turn. So if the first person ends their turn, their 'turn' becomes false in the database, but how, on the other users computer, do I constantly check if the 'turn' has become false so that they may now play without having to keep updating the browser. Or is their a better way to do something like this? Quote Link to comment https://forums.phpfreaks.com/topic/232959-can-php-check-constantly-if-database-updated/ Share on other sites More sharing options...
ignace Posted April 7, 2011 Share Posted April 7, 2011 Using a push-notification system like: http://www.ape-project.org/ Quote Link to comment https://forums.phpfreaks.com/topic/232959-can-php-check-constantly-if-database-updated/#findComment-1198314 Share on other sites More sharing options...
rguy84 Posted April 7, 2011 Share Posted April 7, 2011 I am not sure if a whole framework is needed, but you will just need to do an AJAX call. Quote Link to comment https://forums.phpfreaks.com/topic/232959-can-php-check-constantly-if-database-updated/#findComment-1198316 Share on other sites More sharing options...
ignace Posted April 7, 2011 Share Posted April 7, 2011 The AJAX-call will constanly ask the server if the field changed, if you have many users on your website it will have to answer a lot of "questions" slowing it down. Using push tells the user when something happened, like for example when the other user left to abort the game. Quote Link to comment https://forums.phpfreaks.com/topic/232959-can-php-check-constantly-if-database-updated/#findComment-1198332 Share on other sites More sharing options...
Dustyy Posted April 7, 2011 Author Share Posted April 7, 2011 Using a push-notification system like: http://www.ape-project.org/ I've never heard of this but it looks amazing, thank you so much man. Quote Link to comment https://forums.phpfreaks.com/topic/232959-can-php-check-constantly-if-database-updated/#findComment-1198444 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.