pvp help
pvp help
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
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
Re: pvp help
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.
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
Driftwurld : My Browser Game WIP
Philosopher Gamer : My Blog
Re: pvp help
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?
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: pvp help
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.
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
Re: pvp help
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.
- hallsofvallhalla
- Site Admin
- Posts: 12026
- Joined: Wed Apr 22, 2009 11:29 pm
Re: pvp help
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.
FS has a full working PVP system that I will be releasing soon.
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: pvp help
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.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.
The indelible lord of tl;dr
Re: pvp help
well the hard core method would suit the games style better
i used this as my method:
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";
- hallsofvallhalla
- Site Admin
- Posts: 12026
- Joined: Wed Apr 22, 2009 11:29 pm
Re: pvp help
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
since you are already querying the player on every page anyways you are not making a extra query.
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";}
Re: pvp help
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
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