Php Server/Client for Online Game

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
GandolfMatt
Forum Newbie
Posts: 5
Joined: Fri Aug 08, 2008 1:45 pm

Php Server/Client for Online Game

Post by GandolfMatt »

I have created many different servers and clients in other languages and am now trying to figure it out in php. I understand how to use mysql functions to store and get data, though I am worried about the best way to handle the data in real time.
For example, lets say that I have a simple online game where a player logs on and moves around the map. The player can see other players and chat in a text box. I can let the php on the player's side handle everything, though now what if I add in NPCs? By letting the php on the player's side handle NPCs, they get out of sync and could do things they shouldn't.
What should I use as a server to control NPCs and everything else real time?
I was thinking that I could make a php server that's always pulled up on a machine to control everything in the database, but I'm worried about speed and such.

Any ideas?


-Gandolf
AlanG
Forum Contributor
Posts: 136
Joined: Wed Jun 10, 2009 1:03 am

Re: Php Server/Client for Online Game

Post by AlanG »

PHP is always executed on the server. If you have ALOT of traffic and want to guarantee NPC's actions never cross over, you could implement locking. So when an action occurs, the NPC is then locked until the action completes. If the action is only a few microseconds I don't see the benefit in doing this. To increase your speed you should use stored procedures for advanced queries. It will lessen the overhead of data sent to the MySQL database.
bianka
Forum Newbie
Posts: 1
Joined: Thu Sep 03, 2009 5:33 am

Re: Php Server/Client for Online Game

Post by bianka »

What is the online game where you use a camera to take pictures of a yellow rabbits hidden in the shot? I played this game awhile ago and I can't find it online anywhere. You use a camera to find little bunnies hidden in a big picture. You have to find all of them in a series of locations to win the game. Does anyone know what game this is/have a link for it?
_____________________
yahoo keyword tool ~ overture ~ traffic estimator ~ adwords traffic estimator
Post Reply