Jump to content

Real Time?

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
6 replies to this topic

#1
Guest_DiscoBob_*

Guest_DiscoBob_*
  • Guests
I'm coding a game in PHP, have most of it coded, but I recently implemented clans into the game. One of the features I would like to add in is Real-Time clan fights...however, I have not the slightest idea on the approach to Real-Time coding. Please help. :D

#2
Lop

Lop

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,172 posts
Real-Time fighting in PHP? Hmm. I'm not sure that it is possible with PHP alone. Do you know Java?

How does the game work right now? Is it based off of a database? Got a link so I can test it out?

#3
Guest_DiscoBob_*

Guest_DiscoBob_*
  • Guests
the link is at http://mayhem.sbdesigning.com

It's all text based, and runs off of a MySQL database...

#4
Lop

Lop

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,172 posts
That is a cool game! You'll have to use AJAX or Java+PHP to get real time fight.

#5
Guest_Jonas_*

Guest_Jonas_*
  • Guests
I don't know if you can get exact real time, but if you just had a database backend that you did not mind pounding into submission, couldn't you just create a turn-based environment (I guess you could do it without the database as well), and speed it up as such that it appears to be real-time. Ie there are actual rounds to the game, but perhaps those rounds are so short that the player would not even realize it.

By the way I am not sure how Java or Ajax would work for a real-time fight since those are both client side. The two clients would need to communicate for a real time battle. Would be better to do it just in PHP me thinks.

#6
Guest_DiscoBob_*

Guest_DiscoBob_*
  • Guests
ya, I'm actually thinking of going with the quick turn based...maybe make the actual user status's and such in an iframe so i can call it to a page that refreshes with their new status, health, and such. And put in a "shoutbox" type thing so they can communicate.

#7
Crane

Crane

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 398 posts
With AJAX you could run the PHP without having to refresh the users browser. This would be realtime. Since a large part of AJAX is java script you could also just use PHP and Java script. There is a tutorial in the XML, JSP and AJAX section about connecting AJAX to PHP and MySQL.

The thoughts mentioned above about a turn-based PHP/MySQL would work as well although not as good IMO.