PHP Browser Game Question - Pretty General Language Suitability and Approach Question

Posted by JimBadger on Game Development See other posts from Game Development or by JimBadger
Published on 2012-09-17T14:37:11Z Indexed on 2012/09/17 15:54 UTC
Read the original article Hit count: 513

Filed under:
|
|
|

I'm developing a browser game, using PHP, but I'm unsure if the way I'm going about doing it is to be encouraged anymore.

It's basically one of those MMOs where you level up various buildings and what have you, but, you then commit some abstract fighting entity that the game gives you, to an automated battle with another player (producing a textual, but hopefully amusing and varied combat report).

Basically, as soon as two players agree to fight, PHP functions on the "fight.php" page run queries against a huge MySQL database, looking up all sorts of complicated fight moves and outcomes. There are about three hundred thousand combinations of combat stance, attack, move and defensive stances, so obviously this is quite a resource hungry process, and, on the super cheapo hosted server I'm using for development, it rapidly runs out of memory.

The PHP script for the fight logic currently has about a thousand lines of code in it, and I'd say it's about half-finished as I try to add a bit of AI into the fight script.

Is there a better way to do something this massive than simply having some functions in a PHP file calling the MySQL Database?

I taught myself a modicum of PHP a while ago, and most of the stuff I read online (ages ago) about similar games was all PHP-based. but a) am I right to be using PHP at all, and b) am I missing some clever way of doing things that will somehow reduce server resource requirements?

I'd consider non PHP alternatives but, if PHP is suitable, I'd rather stick to that, so there's no overhead of learning something new. I think I'd bite that bullet if it's the best option for a better game, though.

© Game Development or respective owner

Related posts about mmo

Related posts about browser-based-games