Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 03-28-2007, 05:19 PM   #1 (permalink)
 
True Techie

Join Date: May 2006

Location: Chicago IL

Posts: 104

thejeremy

Send a message via AIM to thejeremy
Arrow PHP 2-player game?

Hey all,
I'm planning on making an online 2-player game with PHP for a class project. I'm pretty good with PHP now, but I have no idea how to do this. The 2 main functions I want are:

1. Once a user is logged in, he/she is able to see a list of all the others who are logged in as well.

2. Being able to click on another person's user name or sending an instant message in order to initiate a game.

3. Once the game has begun, both players will be looking at the same playing field, and changes will be represented on both player's screens.

How easy/hard will this be to do within 4 weeks? Can anyone point me to some examples or good tutorials for this type of PHP code?

Thanks a bunch!
__________________
CPU: AMD Athlon 64 X2 5200+ Windsor, 2.6 GHz
RAM: CORSAIR XMS2 2GB 240-Pin DDR2
VIDCARD: EVGA PCI-Express x16 GeForce 7900GS 256MB
MOBO: ASUS M2N-SLI Deluxe AM2
HDD: Seagate Barracuda 320GB 7200 RPM SATA

my blog: http://jspot.gotdns.com
thejeremy is offline  
Old 03-28-2007, 08:31 PM   #2 (permalink)
sheky's Avatar
 
Junior Techie

Join Date: Jul 2005

Posts: 93

sheky

Send a message via AIM to sheky
Default Re: PHP 2-player game?

i noticed you said playing field...what exactly are they going to be looking at? because this program by the way you make it sound can be either very simple or VERY complex. and can i ask why PHP?
sheky is offline  
Old 03-29-2007, 05:41 PM   #3 (permalink)
 
Monster Techie

Join Date: May 2004

Location: Tucson, AZ, USA

Posts: 1,183

Vormund

Send a message via AIM to Vormund Send a message via MSN to Vormund Send a message via Yahoo to Vormund
Default Re: PHP 2-player game?

One thing to note is that PHP is server-side...hence you're either going to be reloading the page each time, or using some javascript AJAX.

Using just PHP, the only way this would be possible is by setting a refresh timer on the page (refresh every x seconds), and storing values (either in a file or database) as to who's turn it is, then updating the "fields" accordingly.

The bottom line is...you need to decide what this game will be, if PHP is really what you want, and how you plan on storing data (in a file, mysql db [best], or an alternate method)... the logic being along the lines of:

1. User logs in, the session is set. Page refreshes every 5 seconds.
2. MySQL table has flags for the user's - if they're playing and who they're playing, and another to determine who's turn it is.
3. Then you might have another table with a unique game ID which those players are using, which would represent your "fields", and you would draw the HTML output based on any values stored here.

Definitely not ideal for a real game, but it'd be a good learning experience and likely good enough for your class (I assume)!

PS: I dare you to make a Chess application like this!
__________________
Vormund is offline  
Old 03-29-2007, 11:04 PM   #4 (permalink)
 
True Techie

Join Date: May 2006

Location: Chicago IL

Posts: 104

thejeremy

Send a message via AIM to thejeremy
Default Re: PHP 2-player game?

Thanks for the replies guys. After reviewing the game mechanics and how hard it would actually be to emulate this game, I've decided against doing it. I was choosing PHP because that's really the only language I know in terms of online programming. What are other options? I know things can be done with Java, but I felt that it would take me too long to learn game programming in Java, and I don't have that kind of time. Maybe in my free time, we'll see how things pan out in the future. Anyway, I have another question on a different project but I'll leave that for a new thread
__________________
CPU: AMD Athlon 64 X2 5200+ Windsor, 2.6 GHz
RAM: CORSAIR XMS2 2GB 240-Pin DDR2
VIDCARD: EVGA PCI-Express x16 GeForce 7900GS 256MB
MOBO: ASUS M2N-SLI Deluxe AM2
HDD: Seagate Barracuda 320GB 7200 RPM SATA

my blog: http://jspot.gotdns.com
thejeremy is offline  
Old 04-09-2007, 06:01 PM   #5 (permalink)
 
True Techie

Join Date: Apr 2005

Posts: 110

Murdoc

Default Re: PHP 2-player game?

well I've made a 4 player PHP game and i have it posted on my server right now. although it doesn't exactly do everything you've posted, but this wouldn't be a problem because it's meant for up to 4 people to play on the very same computer. The game itself is not very fascinating since it is just only a school project, but nevertheless it got us pretty good marks. We used Mysql to store our game data and we have also built our own anti-cheat system.

here's the link to our game

click here

PS: I have a group formed with my friends to try to explore into using PHP to create web games and other developments. If during the summer you're interested in joining us you can. Please contact me @ murdoc2k@gmail.com
Murdoc is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
stalker robina_80 PC Gaming 14 09-04-2007 08:37 AM
Anyone recommend a FPS Game? stepnkev PC Gaming 7 03-28-2007 10:00 PM
Fast performance during game, slow after. krazy_taco Hardware Troubleshooting 17 03-28-2007 12:42 AM
Installing Flash Player on Vista? shortstop20 Windows Operating Systems and Software 1 03-26-2007 05:55 AM
Mp3 Player for Military use? Vodreb Phones – PDA’s – Bluetooth – Other handhelds 7 03-19-2007 01:26 PM