Ads Posted February 29, 2008 Share Posted February 29, 2008 Now I have googled this, and alos made my own, and both came up Pretty Dodgy. So i was wondering if anyone can give me any Tips and Hints for when i make a new one, or any good Examples or Tuts that i can run by. Cheers, Ads Link to comment https://forums.phpfreaks.com/topic/93668-pvp-battle-arena/ Share on other sites More sharing options...
aschk Posted February 29, 2008 Share Posted February 29, 2008 Eh? What's the question? What are you making? Who's the president? What year is it? A bit more specifity (yes i just made up that word) would be nicer, with an example of what you're doing and what you want to do would be nice. Link to comment https://forums.phpfreaks.com/topic/93668-pvp-battle-arena/#findComment-479887 Share on other sites More sharing options...
moon 111 Posted February 29, 2008 Share Posted February 29, 2008 You are being very vague. Try to explain more in-depth what you need help with. EDIT: Aww aschk! You beat me too it! Link to comment https://forums.phpfreaks.com/topic/93668-pvp-battle-arena/#findComment-479888 Share on other sites More sharing options...
Ads Posted February 29, 2008 Author Share Posted February 29, 2008 Sorry xD I am making a PVP battle Arena, And I have already made my own But it Sucks bad, I have googled it a bit and come up with nothing of Much Help. So i was wondering if anyone where had any advice for when(if) i build another one. Or if there are any Good Tutorials out there. Link to comment https://forums.phpfreaks.com/topic/93668-pvp-battle-arena/#findComment-479892 Share on other sites More sharing options...
aschk Posted February 29, 2008 Share Posted February 29, 2008 Well that's great. However in order for use to improve your battle arena programming we need to see what it's doing (i.e the code). What you want it to do. And also, what your database structure is. If google doesn't turn much up I doubt there's a whole lot out there for "programming player versus player situations". Thus, use your intuition, write out what you want it to do, and analyse what is currently available. Link to comment https://forums.phpfreaks.com/topic/93668-pvp-battle-arena/#findComment-479897 Share on other sites More sharing options...
Ads Posted February 29, 2008 Author Share Posted February 29, 2008 My Code is a few Hundreds Lines Long, thats why i didn't Put it in the opening post. Is there any Base line I can follow, like the basics of writing on of these things Link to comment https://forums.phpfreaks.com/topic/93668-pvp-battle-arena/#findComment-479904 Share on other sites More sharing options...
trq Posted February 29, 2008 Share Posted February 29, 2008 I doupt it. Learn php well, and you won't have too many problems building whatever you like. Sounds to me like your trying to run before you can walk. Link to comment https://forums.phpfreaks.com/topic/93668-pvp-battle-arena/#findComment-479905 Share on other sites More sharing options...
aschk Posted February 29, 2008 Share Posted February 29, 2008 Perhaps just write out what you're doing in a summary. i.e. 1) Person 1 enters arena and chooses character 2) Person 2 enters arena and chooses character (both require DB calls) 3) Each person chooses weapons (DB call, info held in Session) 4) Round 1 begins 5) Process x,y,z happens during battle 6) Round 2,3,4... That at least will give us an overview of what you're doing. Nothing wrong with posting a couple of hundred lines of code. Maybe take out the unimportant bits. (i.e. function getStrength() {return 5;}) Give us the juicy bits, like your database calls, your recursive functions, information pertaining to your storage method, large arrays, etc. Maybe just put a timer and the top and bottom of your script and output the time took to process the script, as perhaps it's running well but the server isn't sending the page back quickly enough? Link to comment https://forums.phpfreaks.com/topic/93668-pvp-battle-arena/#findComment-479906 Share on other sites More sharing options...
Ads Posted February 29, 2008 Author Share Posted February 29, 2008 What I tried to get to do is. Player 1 Clicks on a Link which Enter a Simple Text based Arena with player 2. And then it call all there stats(Health, Str,spd,agl,acc)[just Examples] and Passes them through some Algorithms To bring out a Result. Critcal and Counter inculded. Link to comment https://forums.phpfreaks.com/topic/93668-pvp-battle-arena/#findComment-479910 Share on other sites More sharing options...
moon 111 Posted February 29, 2008 Share Posted February 29, 2008 Listen since everyone has tried to ask you this and you haven't understood (I assume) I'll be direct: Post the entire code or we cannot help you. Link to comment https://forums.phpfreaks.com/topic/93668-pvp-battle-arena/#findComment-479934 Share on other sites More sharing options...
Ads Posted February 29, 2008 Author Share Posted February 29, 2008 <?php include "include/db.php"; $ID=$_GET['ID']; $oppstats3=mysql_fetch_array($oppplayerstats=mysql_query("SELECT * FROM players WHERE id='$ID'")); $oppstats1=mysql_query("SELECT * from mechs where playersid='$ID'"); $oppstats=mysql_fetch_array($oppstats1); //Oppenetns mech Stats $oppmechname=$oppstats['mechname']; $oppcharge=$oppstats['charge']; $oppdex=$oppstats['dexterity']; $opppow=$oppstats['power']; $oppdef=$oppstats['defence']; $oppweaponpow=$oppstats['weaponpower']; //Oppenets Player stats $oppref=$oppstats3['reflex']; $opptac=$oppstats3['tactics']; $oppluck=$oppstats3['luck']; //Your mech stats $mechname=$MECH['mechname']; $charge=$MECH['charge']; $dex=$MECH['dexterity']; $pow=$MECH['power']; $def=$MECH['defence']; $weaponpow=$MECH['weaponpower']; //Your Player stats $ref=$row['reflex']; $tac=$row['tactics']; $luck=$row['luck']; //******************************BATTLE CODE ****************************** while($oppcharge>0 && $charge>0){ //while Mechs are still alive if($oppdex>=$dex) //Openets Speed is Greater than or Equal to Your speed { if($oppcharge>0) { $randmultiplier = rand(0,10); $attackturns = 1000; while($attackturns>=10) { $oppdodge = ($oppref*rand(1,5))-$dex; $dodge = ($ref*rand(1,5))-$oppdex; $attackturns = $attackturns -$oppdex-$dex; if($dodge>$oppdodge) //Dodgeing { echo "<font color='blue'>".$mechname. " dodged " .$oppmechname. "</font><br>"; } else { // Amount of Damage $attackdamage = round((($oppweaponpow + $opppower)*($opptac/2))-$def*$randmultiplier); $criticaldamage = 0; $criticalchance = (($oppluck*6)/10); $criticalnumerator = rand(0,40); if($criticalnumerator<$criticalchance) // Critcal { echo "<font color='yellow'><b> ".$oppmechname. " hit " .$mechname. " for Critical Damage "; $criticaldamage = ($luck*$attackdamage)*30 ; $charge=$charge-$attackdamage-$criticaldamage; echo $criticaldamage. " - ".$charge." Health left <br></font></b>"; } else // Normal Damage { $oppcharge=$oppcharge-$attackdamage; echo"<font color='purple'>". $oppmechname . " hit " . $mechname . " for " . $attackdamage ."-".$oppcharge." Health left</font> <br>"; } if($oppcharge<=0) { $oppcharege==0; echo $oppmechname." wins<br>"; exit(); } } } } } else { if($charge>0) { echo $mechname. " retaliated <br>"; $oppdodge = (($oppref*rand(0,5))-$dex); $dodge = (($ref*rand(0,5))-$oppdex); if($dodge>$oppdodge) { echo $mechname ." dodged " .$oppmechname."<br>"; } else { $attackdamage = round((($weaponpow . $pow) * ($tac/2))-($oppdef*$randmultiplier)); echo $mechname." retaliated for ".$attackdamage." - ".$charge." Health left <br>"; if($charge<=0) { $charege==0; echo $mechname." wins<br>"; exit(); } } } } if($oppdex>=$dex) { if($charge>0) { $randmultiplier = rand(0,2); $attackturns = 1000; while($attackturns>=10) { $oppdodge = (($oppref*rand(0,5))-$dex); $dodge = (($ref*rand(0,5))-$oppdex); $attackturns = $attackturns-($dex-$oppdex); if($dodge>$oppdodge) { echo $oppmechname." dodged ".$mechname."<br>"; } else { $attackdamage = round((($weaponpow + $opppow)* ($tac/2))-($oppdef*$randmultiplier)); $criticaldamage = 0; $criticalchance = (($luck*6)/10); $criticalnumerator = rand(0,10); if($criticalnumerator<$criticalchance) { echo "<font color='green'><b> ".$mechname. " hit " .$oppmechname. " for Critical Damage "; $criticaldamage = ($luck*$attackdamage)/2; $charge=$charge-$attackdamage-$criticaldamage; echo $criticaldamage. " ".$charge." Health left <br></font></b>"; } else { $charge=$charge-$attackdamage-$criticaldamage; echo $mechname." hit ".$oppmechname." for" . $attackdamage . " - ".$charge." Health left <br>"; } if($charge<=0) { $charege==0; echo $mechname." wins<br>"; exit(); } } } } } else { if($oppcharge>0) { echo $oppmechname ." retaliated<br>"; $oppdodge = (($oppref*rand(0,5))-$dex); $dodge = (($ref*rand(0,5))-$oppdex); if($oppdodge<$dodge) { echo $oppmechname ." dodged " .$mechname."<br>"; } else { $attackdamage = round((($oppweaponpow + $opppow)*($opptec/2))-$def*$randmultiplier); echo $oppmechname. " retaliated for ".$attackdamage."-".$oppcharge." Health left <br>"; } if($oppcharge<=0) { $oppcharege==0; echo $oppmechname." wins<br>"; exit(); } } } } ?> <html> <head> <link href=style.css rel='stylesheet' type='css/text'> THere ya go Link to comment https://forums.phpfreaks.com/topic/93668-pvp-battle-arena/#findComment-480434 Share on other sites More sharing options...
revraz Posted February 29, 2008 Share Posted February 29, 2008 And who made that for you? Link to comment https://forums.phpfreaks.com/topic/93668-pvp-battle-arena/#findComment-480446 Share on other sites More sharing options...
Ads Posted February 29, 2008 Author Share Posted February 29, 2008 Oh thats Mean, I made it thank You ^^ Link to comment https://forums.phpfreaks.com/topic/93668-pvp-battle-arena/#findComment-480450 Share on other sites More sharing options...
Neptunus Maris Posted February 29, 2008 Share Posted February 29, 2008 And who made that for you? Yeah Who? Link to comment https://forums.phpfreaks.com/topic/93668-pvp-battle-arena/#findComment-480452 Share on other sites More sharing options...
Neptunus Maris Posted February 29, 2008 Share Posted February 29, 2008 Oh thats Mean, I made it thank You ^^ Yeah that is kinda mean...look Ads ...I cant help you right now...I'm currently at work killing time in the forums...technically I can but no...not right now Link to comment https://forums.phpfreaks.com/topic/93668-pvp-battle-arena/#findComment-480454 Share on other sites More sharing options...
Ads Posted February 29, 2008 Author Share Posted February 29, 2008 Oh thats Mean, I made it thank You ^^ Yeah that is kinda mean...look Ads ...I cant help you right now...I'm currently at work killing time in the forums...technically I can but no...not right now lol thats alright. Link to comment https://forums.phpfreaks.com/topic/93668-pvp-battle-arena/#findComment-480487 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.