PVP in php is it possible(non turn based)?

C++, C#, Java, PHP, ect...
Post Reply
fash
Posts: 3
Joined: Tue Dec 13, 2011 10:15 pm

PVP in php is it possible(non turn based)?

Post by fash »

Hey guys am new here and am novice too. I got a question that can we develop player versus player live with php non-turn based in a way. I mean that they sholud be able to use their spells or power or whatever they wish in real time and not turn based. If u have some alternative to php its ok for me i'll learn that too.Btw i know AS3 HTML CSS PHP(learning) JAVA(learning) javascript(I am planing to start when i finish php to a decent level). ;) .
Zyviel
Posts: 75
Joined: Tue Jun 08, 2010 8:12 pm

Re: PVP in php is it possible(non turn based)?

Post by Zyviel »

You might could use ajax/javascript. There are tutorials on W3Schools web site on how to use ajax. I made a chat box that uses a java timer to call the ajax function to check once a second for any new chat messages.

You could also use the java timer to submit a php web page once a second to check a database for people in range of each other that have a target and maybe a move readied.
fash
Posts: 3
Joined: Tue Dec 13, 2011 10:15 pm

Re: PVP in php is it possible(non turn based)?

Post by fash »

well Zyviel the way you suggested is good but I think this method will lead to lag problems coz the timer may check the player stats a bit late which will lead to various problems like say if player1 almost killed player2 (this was the latest check) and by some luck player2 happens to use his best spell enough to kill player1 so this will kill player1 if we see through eyes or player2 and in that time it happen that player1 also killed player2 since both cant die we cant find out who actually died coz the timer didnt check them.

for w3schools i see this ----->w3fools.com<------
Zyviel
Posts: 75
Joined: Tue Jun 08, 2010 8:12 pm

Re: PVP in php is it possible(non turn based)?

Post by Zyviel »

Good point fash.

I would recommend you make your own cron that runs on your home computer. This homemade cron would resubmit the php web page every second to check the database to see if anyone is near to its target and if so carry out the attack that they asked to be readied. You could also keep track of when their last attack was made and make sure there is a proper delay between attacks.

There would also be code in the cron webpage that handles the attack's effect on enemy players and player deaths.
User avatar
Torniquet
Posts: 869
Joined: Sun Aug 02, 2009 6:18 am

Re: PVP in php is it possible(non turn based)?

Post by Torniquet »

non-turn PVP is very difficult to achieve. I personally recomend for php and ajax alone.

If you know AS3, I would use that and learn some socket programming to accompany it.
New Site Coming Soon! Stay tuned :D
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: PVP in php is it possible(non turn based)?

Post by hallsofvallhalla »

There are tutorials on W3Schools web site on how to use ajax.
I also have tutorials on ajax............video tutorials.........
Post Reply

Return to “Coding”