I'm currently writing a multiplayer Connect 4 game. When a player makes a move, that move is written to a file containing the state of every position on the Connect 4 board.
I currently have a PHP script with a delayed loop that checks for changes since the previous loop iteration, and if there is a change, the PHP script returns the updated file to be sent to the player.
This method is extremely inefficient and messy; is there a better way to be instantly notified of changes in the game?
Also, I've tried to use inotify, however it doesn't seem to work on my server. (Mac OS X Server 10.8, so that's probably why...)
It'd be hard to it in PHP, how about using node.js? It has these functions built right in.