• Advertisement
Sign in to follow this  

PHP Game?

This topic is 2738 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

Hello,

I'm a PHP Programmer and I always wanted to make a MMORPG.
Nowadays with so many flash games with intuitive and beatiful GUI (zynga games for example), will a PHP game be sucessfull in the market?

What do you think?

PHP games are something that will died forever?

Left your 2cents.
That will be good for me to think in wasting time to make or not a PHP game cause I'm not a flash programmer.

Share this post


Link to post
Share on other sites
Advertisement
Flash is a client-side application. PHP is a server-side script. So you'll need something client-side. I assume you're thinking HTML in which case yes PHP works and will work for a game. You can actually make a multiplayer game using long polling. With new technologies like the HTML 5 canvas tag you can do your game rendering without Flash.

Depends what kind of game you want to make.

Naively you can use straight PHP with no cronjob or anything to create a real-time game. The trick is to rely on AJAX requests that happen less than 5 seconds apart to be done on the same connection. Don't expect this strategy to scale, but you can use a database for the state of a game. That is your clients send input asynchronously with AJAX which sets input columns in a database. In the same PHP file you run a transaction that checks if it's time to update and if so updates the game based on the state in the database. Then at the end gather all the data for the player and echo it back. This works for really small games, but not MMO scale.

The next type is long polling. Sending data and letting the server hold onto the connection until it has data to send back. Each request can be held open for 30 seconds so you've basically created a socket connection. It's kind of a hack though and requires managing incoming and outgoing requests. I made a program actually where each PHP request opened a unix domain socket to a persistent C++ server which managed all of that. That has overhead obviously, but gets closer to MMO scale. With a proper binary protocol (which I used) it is very efficient and similar to having a TCP socket open.

Sadly no method allows real-time with thousands of clients without putting a lot of stress on a server. If you want to go with HTML on the client-side I recommend Web Sockets with a normal socket server.

In conclusion yes any method for a multiplayer game that uses PHP is rather dead unless it's for say a tick-based webpage game. Once you go real-time there's so many better options.

Share this post


Link to post
Share on other sites
There are quite a few php / html+js games out there that look pretty good.
I work for a company which has been developing php / html +js games for years and is very successful + expanding.
Travian and Imperion are games that we've been developing, and the next generation will take a huge step in prettyness and usercomfort.

Nowadays you can make a lot more pretty graphics with js than you'd think.
fluid animation is no problem anymore, no need to use flash for it.
you could of course also develop a flash frontend instead of a html+js frontend.
choice is yours. what makes your game successful is good gameplay, something that hooks you from the start, keeps you interested over time and of course some nice graphics help a lot too.

Share this post


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

  • Advertisement