2
votes

I want to make a simple online multiple player cards game using PHP/Ajax. I guess I need socket programming (I want it to be real time). I've worked with sockets before in Java, but not for an online program, just a network game. I searched but I didn't really find a comprehensive code.Also another issue is that several games might be played simultaneously and I don't want them to interrupt each other. How to manage them all?

Could you guys give me a simple understanding of how to do it? Do I need to write two codes, one for the management (host) and another one for clients? Is it possible to test these kind of programs on localhost(xampp)?

Also any simple codes will be appreciated.

Thanks in advance.

1
are you sure php is the right language for this?user557846
PHP and AJAX don't really work with sockets, you just send information with ids, and other identifying things (that's what I've done). Java is much more flexible and allows/requires the use of different sockets, etc. Of course, you can do it with sockets, I just don't see a need.Jon Egeland
Hmm, I don't get it. If PHP is not the right language to do this. How do people write chat-servers/games/etc in PHP?user1253460
Due to PHP Shared-Nothing and Short-Live architecture it is difficult (not impossible) to create real-time apps. Node.js is a nice paradigm of a realtime .js application platform, mainly due to its non-blocking asynchronous architecture, albeit it has its drawbacks.William Dixon

1 Answers

0
votes

In a similar question from earlier today I found the APE Project that while researching.

I haven't tried it but it looks fairly good with the main limitation seeming to be no Windows server support. So you probably couldn't install and develop it on a Windows localhost LAMP set up, maybe think of installing Linux and setting up a LAMP server locally on that - it's what I did.

Good luck, and if you give it a shot, let me know how you go. I'm quite interested but don't have an application for it at the moment.