PvP script

For discussions about game development that does not fit in any of the other topics.
Post Reply
petermax
Posts: 37
Joined: Thu Feb 03, 2011 4:27 pm

PvP script

Post by petermax »

hi i am new to this site and i was wondering if omeone could help me to make a pvp script and how to setup the sql for that, i am using hall´s tutorials base for my game
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: PvP script

Post by hallsofvallhalla »

What kind of PVP are you looking for?

Players can click on other players and attack them whether they are offline or not? Or more of a realtime approach?

The latter is far more difficult.
zvi5
Posts: 14
Joined: Sun Oct 31, 2010 9:24 am

Re: PvP script

Post by zvi5 »

i was also looking for one though i've been through the tut's and there are somre turn based p-v-p, but i am still with the whole mmorpgtut series code and i'm trying to move it over to $_session vs.$_session2 but have no clue how,secondly if i were to make a "auto self creating table"(like my hiscores

Code: Select all

<?php
include_once 'connect.php';
session_start();

include_once 'logo.php';
?>
 <link href="style.css" rel="stylesheet" type="text/css" />
<div id="login2" div align="center">


<?php

  if(!isset($start))
  {
    $start=0;
  }
  $order="SELECT * from players";
  $order2=mysql_query($order);
  $d=0;
  $f=0;
  $g=1;
  print "<center>Page: ";
  while($order3=mysql_fetch_array($order2))
  {
    if($f%20==0)
    {
      print "<A href='topland.php?start=$d'>$g</a> ";
      $g++;
    }
    $d=$d+1;
    $f++;
  }
  print "</center><center>Players by Rank<br>";
  print "<table border='1'><tr><td>Player</td><td>Level</td><td>hitpoints</td></tr>";
  $topplayers="SELECT * from players order by exper DESC Limit $start, 20";
  $topplayers2=mysql_query($topplayers) or die("Could not query players");
  while($topplayer3=mysql_fetch_array($topplayers2))
  {
    $topplayer3['name']=strip_tags($topplayer3['name']);
    print "<tr><td>$topplayer3[name]</td><td>$topplayer3[level]</td><td>$topplayer3[maxhp]</td></tr>";
  }
  print "</table>";
?>
)

and how would i make it a like in each name of my hiscores to the "attack" page(for that player!) OH and BTW i got corn jobs working =))) tysm halls you own :P(oh and 1 last thing not really related,how would i sell turns ect on paypal? is there a way to sell code/non-pysical meterials?)have a good one,zvi!
cake!

___zvi5__
PHP&SQL,HTML,CSS---"understander" :P
User avatar
Callan S.
Posts: 2042
Joined: Sun Jan 24, 2010 5:43 am

Re: PvP script

Post by Callan S. »

You gotta slow down man, programming, unlike normal life, is about getting each step done right, one at a time.

PVP where you simply attack the stats of another player is simple, in that it's essentially the same thing as attacking a monster from the database (as shown in the tutes). Instead of pulling monster stats, you pull up some other players stats.
Fight Cycle : My latest Browser game WIP
Driftwurld : My Browser Game WIP
Philosopher Gamer : My Blog
petermax
Posts: 37
Joined: Thu Feb 03, 2011 4:27 pm

Re: PvP script

Post by petermax »

yes, that make sense ,

well i think it would be better a live pvp where players can fight each other realtime , but let me try that first
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: PvP script

Post by Jackolantern »

That is quite a bit more difficult than over-time PvP. A couple of the challenges are:

1. Keeping it fair when anyone can exit the battle at any time.
2. Notifying the attacked player in a timely manner that they have been attacked (PHP cannot do this alone).
3. Keeping players updated without obscene bandwidth costs....etc.

You will have to use a ton of clever Javascript to get real-time PvP. My suggestion, as always, is to use jQuery for all of your JS needs!
The indelible lord of tl;dr
Post Reply

Return to “General Development”