I want to create multiplayer game with PHP. I created full OOP system for that - classes that management the whole game. I also stated to write the HTML+Canvas code for the game - and now i have a problem. For real HTML5 multiplayer game i need to use Node.js + Socket.io technology. But i don't want to leave all my PHP code and start implement all again with Node.
So i tried to use AJAX Polling so players can update the server every time they do something in the game - but the problem is - if any player close the browser or hack the javascript game timer - the server can't know about because PHP code is execute one time. I thought about create a cron-job that run every second and check if player is still active, but cron-job is limited to execute every one minute (and also i don't think it's correct method).
so what can i do? i need to leave all my work in PHP and start learning and implement all again with Node.js? There is no other option to make the server run even if PHP code has already execute?
Just a personal opinion, I am a big fan of PHP, I love it, however I do recognize when PHP is not the answer for a particular problem. PHP was not designed for real time applications, sure there are a lot of solutions for that: Ape or Ratchet but at the end I feel like I am consuming more CPU cycles than I really need. I would stick to Nodejs and socket.io since they are meant to be used by real time applications. Again, this is just a personal opinion.