pvp help

For discussions about game development that does not fit in any of the other topics.
Post Reply
witherdon
Posts: 7
Joined: Sun Feb 14, 2010 6:47 pm

pvp help

Post by witherdon »

i have a fully working ai combat system but i don't know how to change this to work in a pvp environment

does anyone know how to construct a pvp system and can give me a basic script or know if halls has done a video or know of any other video ect

thanks
this is a link to my new epic game site enjoy people
http://tinyurl.com/play-shinobiwars
Image
User avatar
Callan S.
Posts: 2042
Joined: Sun Jan 24, 2010 5:43 am

Re: pvp help

Post by Callan S. »

asycronous pvp? Or players take turns?

In terms of numbers engaging each other, each player is much like a monster - they have a set of numbers that work against each other like a standard player vs monster encounter. The only change is player choice, if there is any (if there isn't, you can go full asycronous PVP and indeed aught to). And again, player choices are just logged into the database as a number, numbers interact in the same way they do in player vs monster.

If you know how to do PVE you probably know the bulk of this already.
Fight Cycle : My latest Browser game WIP
Driftwurld : My Browser Game WIP
Philosopher Gamer : My Blog
witherdon
Posts: 7
Joined: Sun Feb 14, 2010 6:47 pm

Re: pvp help

Post by witherdon »

thanks for the reply and it makes it all looks so easy now except how do i alert the people who have been attacked to the fact that they have been attacked?
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: pvp help

Post by Jackolantern »

If you are wanting to go with PHP alone, you would either have to make PvP voluntary where both players have to agree before it begins, make it open and hardcore where players must be constantly alert since they could be killed without knowing if they don't refresh, or make it abstract where players can only make one attack against other players at a time, over long periods of time.

If you want to use AJAX, you could have an icon on the page that lights up when the player is under attack, allowing them to click on it to defend themselves.
The indelible lord of tl;dr
User avatar
OldRod
Posts: 1320
Joined: Sun Sep 20, 2009 4:26 pm

Re: pvp help

Post by OldRod »

You could store a flag in their user data and the next time they log in, or load a page, whatever, check that flag and let them know.
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: pvp help

Post by hallsofvallhalla »

the way I did it in FS was like what oldrod had mentioned. You have a field in the players table called lastattackeby then why someone attacks you it stores their name there. You could also go further than that and add damage and time.

FS has a full working PVP system that I will be releasing soon.
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: pvp help

Post by Jackolantern »

OldRod wrote:You could store a flag in their user data and the next time they log in, or load a page, whatever, check that flag and let them know.
That is pretty much what I meant by the third method I mentioned. You either have to let players attack each other back and forth over periods of time, or allow them nearly real-time attacking, which would likely be considered hardcore since players could be killed while they are reading a page, afk for just a moment, just before refreshing the page, etc.
The indelible lord of tl;dr
witherdon
Posts: 7
Joined: Sun Feb 14, 2010 6:47 pm

Re: pvp help

Post by witherdon »

well the hard core method would suit the games style better

i used this as my method:

Code: Select all

$username = $_session['username'];
$result=mysql_query("SELECT * from battle where session_id='$username'");
if(mysql_num_rows($result) > 0) {
	while($row = mysql_fetch_array($result)) {	
echo "<a href=\"../battle.php\">you have been attacked";
this is a link to my new epic game site enjoy people
http://tinyurl.com/play-shinobiwars
Image
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: pvp help

Post by hallsofvallhalla »

so basically you are putting this on top of every page? And then when a attack is made a entry is put into the battle table with the attacked players name?
That's actually a good method. I personally would add a field to players called attacked, and then check it, that way on top of your page you can just put

Code: Select all

if($playerinfo3['attacked'] == 1)
{echo "you have been attacked......and the link blah blah";}
since you are already querying the player on every page anyways you are not making a extra query.
witherdon
Posts: 7
Joined: Sun Feb 14, 2010 6:47 pm

Re: pvp help

Post by witherdon »

are suggesting to use this as well as my method

and to answer your questions my method is place in the menu which is a include and the moves are put directly into the table this was to allow for multiple techniques to be used
this is a link to my new epic game site enjoy people
http://tinyurl.com/play-shinobiwars
Image
Post Reply

Return to “General Development”