Last Man Standing

Discuss anything not covered by any of the other categories.
Post Reply
Senban
Posts: 19
Joined: Sat Apr 14, 2007 8:04 pm

Last Man Standing

Post by Senban »

I really want to add a Last Man Standing game mode to my mod. So far I've got as far as coding it so that the fraglimit sets the number of lives each player has and players stop respawning when they run out of lives. What I don't know how to do is tell when all but one of the players/teams are dead.
Once I know all the players are dead what I want to do is start a new round, respawning all items and players in to the map.
Any ideas/suggestions?
Dr. Shadowborg
InsideQC Staff
Posts: 1120
Joined: Sat Oct 16, 2004 3:34 pm

Post by Dr. Shadowborg »

First check to see how many players there are, next check and see which players are dead. (Compare dead_players against total_players, if equal or 1 off, reset game)
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Re: Last Man Standing

Post by Baker »

Senban wrote:I really want to add a Last Man Standing game mode to my mod. So far I've got as far as coding it so that the fraglimit sets the number of lives each player has and players stop respawning when they run out of lives. What I don't know how to do is tell when all but one of the players/teams are dead.
Once I know all the players are dead what I want to do is start a new round, respawning all items and players in to the map.
Any ideas/suggestions?
You might find this helpful:

Clan Arena (by Mungo) 1.3 source code

Clan Arena is round-based and once all the players are dead, a new round starts. A little different than your idea of players having X lives, but I think the code should be helpful none the less.
Senban
Posts: 19
Joined: Sat Apr 14, 2007 8:04 pm

Post by Senban »

Dr. Shadowborg wrote:First check to see how many players there are, next check and see which players are dead. (Compare dead_players against total_players, if equal or 1 off, reset game)
Interesting, I've never come across those values before, is there a complete list of them anywhere? And most importantly can this method be made to work with teamplay?
Baker wrote:You might find this helpful:

Clan Arena (by Mungo) 1.3 source code

Clan Arena is round-based and once all the players are dead, a new round starts. A little different than your idea of players having X lives, but I think the code should be helpful none the less.
Cool I'll have a good look at that. Getting the basic round structure in place seems like being the big hurdle, along with indexing everything that need's to be replaced (cos eventually I'm going to get to coop and need to spawn a full levels worth of fresh monsters each time the players run out of blood.)

This is all a lot harder work than making different kinds of fireballs come out of the monsters.
Dr. Shadowborg
InsideQC Staff
Posts: 1120
Joined: Sat Oct 16, 2004 3:34 pm

Post by Dr. Shadowborg »

Senban wrote:
Dr. Shadowborg wrote:First check to see how many players there are, next check and see which players are dead. (Compare dead_players against total_players, if equal or 1 off, reset game)
Interesting, I've never come across those values before, is there a complete list of them anywhere? And most importantly can this method be made to work with teamplay?
That's because they don't exist in quakec by default. What I mean for you to do is declare in DEFS.QC

float total_players;
float dead_players;

Then in CLIENT.QC under clientconnect() add
total_players = total_players + 1;

In clientdisconnect() add
total_players = total_players - 1;

And finally, whereever you check if a player has expended all lives and dump him into observer mode add something like:

dead_players = dead_players + 1;

If you want this to work in teamplay, you'll have to do something a bit different. (Same principle applies, just slightly more complex)
Senban
Posts: 19
Joined: Sat Apr 14, 2007 8:04 pm

Post by Senban »

Ahhhh, cool gotcha, makes a lot more sense than having a little daemon constantly searching the map to see if anyone's still alive.
Lardarse
Posts: 266
Joined: Sat Nov 05, 2005 1:58 pm
Location: Bristol, UK

Post by Lardarse »

Senban wrote:Ahhhh, cool gotcha, makes a lot more sense than having a little daemon constantly searching the map to see if anyone's still alive.
Tracking how the total changes is often the fastest way to count things...
MeTcHsteekle
Posts: 399
Joined: Thu May 15, 2008 10:46 pm
Location: its a secret

Post by MeTcHsteekle »

hmm but dont rule out the demon, that would be cool if a demon was the ref or somthing, or um hmm:D
bah
Stealth Kill
Posts: 83
Joined: Fri Dec 29, 2006 12:34 pm

Post by Stealth Kill »

Clanarena is very interesting.
How can play it? If i start a map it spawns me with no weapons. Are there any commands to start game?
Wazat
Posts: 771
Joined: Fri Oct 15, 2004 9:50 pm
Location: Middle 'o the desert, USA

Post by Wazat »

Lardarse wrote:
Senban wrote:Ahhhh, cool gotcha, makes a lot more sense than having a little daemon constantly searching the map to see if anyone's still alive.
Tracking how the total changes is often the fastest way to count things...
I should note that a daemon that checks with a find command, say, every 5 seconds is an *extremely* good idea. If you're going to do it by changes alone, then you must make sure you have every single control point and possibility covered. Clients connecting, disconnecting, dying, kill command... *everything*. It may be much better to have a hybrid system that includes the daemon thinking every 5 seconds to audit the results and correct mistakes. If a mistake is made and not corrected, a match may never end even though no players are left alive, and that's very frustrating for players.

Also, make sure that when a player joins, he joins dead and has to wait for the round to restart. If the new player pops right into the match to fight, then whenever a player dies he can just disconnect and reconnect to keep playing and that encourages abuse.

BTW, when you said "daemon" I thought "demon" as in the fiend monster. I imagined an invincible super-powerful fiend that patrols the level by foot and quickly kills any player it finds. Could be something you release into the level right at the get-go, or only if a round goes past a certain time limit to finish off the stragglers. Unleash the army of fiends!

You'd just need some sort of level prowling code, or maybe just let the demon teleport near the location of random players when it can't see a target. The make it able to move extremely fast, jump very fast or climb walls, and kill with only a couple of slashes. Maybe even a spitting ranged attack.

That should take care of some of the players that like to drag these kinds of matches on forever.

*poof* Rawr! "Oh gawd mah camp'n strategy are not werkin!!!"

-Wazat
When my computer inevitably explodes and kills me, my cat inherits everything I own. He may be the only one capable of continuing my work.
Lardarse
Posts: 266
Joined: Sat Nov 05, 2005 1:58 pm
Location: Bristol, UK

Post by Lardarse »

Wazat wrote:
Lardarse wrote:
Senban wrote:Ahhhh, cool gotcha, makes a lot more sense than having a little daemon constantly searching the map to see if anyone's still alive.
Tracking how the total changes is often the fastest way to count things...
I should note that a daemon that checks with a find command, say, every 5 seconds is an *extremely* good idea. If you're going to do it by changes alone, then you must make sure you have every single control point and possibility covered. Clients connecting, disconnecting, dying, kill command... *everything*. It may be much better to have a hybrid system that includes the daemon thinking every 5 seconds to audit the results and correct mistakes. If a mistake is made and not corrected, a match may never end even though no players are left alive, and that's very frustrating for players.
Very true. The more ways it ccan change, the more likely you are to screw up and miss one...

If you don't want to create an entity for this, then use the think for an existing entity that doens't normally think. info_player_* are good choices.
Senban
Posts: 19
Joined: Sat Apr 14, 2007 8:04 pm

Post by Senban »

Wazat wrote:If you're going to do it by changes alone, then you must make sure you have every single control point and possibility covered. Clients connecting, disconnecting, dying, kill command... *everything*.
What happens if a player powers down their computer mid game, or their ISP shut's down or whatever?
Wazat wrote:Also, make sure that when a player joins, he joins dead and has to wait for the round to restart. If the new player pops right into the match to fight, then whenever a player dies he can just disconnect and reconnect to keep playing and that encourages abuse.
Good point.
Wazat wrote:BTW, when you said "daemon" I thought "demon" as in the fiend monster. I imagined an invincible super-powerful fiend that patrols the level by foot and quickly kills any player it finds. Could be something you release into the level right at the get-go, or only if a round goes past a certain time limit to finish off the stragglers. Unleash the army of fiends!

You'd just need some sort of level prowling code, or maybe just let the demon teleport near the location of random players when it can't see a target. The make it able to move extremely fast, jump very fast or climb walls, and kill with only a couple of slashes. Maybe even a spitting ranged attack.

That should take care of some of the players that like to drag these kinds of matches on forever.

*poof* Rawr! "Oh gawd mah camp'n strategy are not werkin!!!"

-Wazat
Maybe later...
Lardarse wrote:Very true. The more ways it can change, the more likely you are to screw up and miss one...

If you don't want to create an entity for this, then use the think for an existing entity that doens't normally think. info_player_* are good choices.
That's got certain effiency to it.
Wazat
Posts: 771
Joined: Fri Oct 15, 2004 9:50 pm
Location: Middle 'o the desert, USA

Post by Wazat »

Senban wrote:What happens if a player powers down their computer mid game, or their ISP shut's down or whatever?
Typically the player will time out and disconnect. This might happen immediately, or it may take a few minutes to happen. I'm not sure how quickly quake determines that it's lost the connection and goes through the motions of a client disconnect, but I seem to remember it being rather quick.
Lardarse wrote:Very true. The more ways it can change, the more likely you are to screw up and miss one...

If you don't want to create an entity for this, then use the think for an existing entity that doens't normally think. info_player_* are good choices.
That's got certain effiency to it.
Just be aware that you only need *one* entity to do the auditing. It's rather inefficient to have info_player_deathmatch do it since the typical map will have many, many dm spawns. info_player_start is a better choice, but by far the best way to do it is to simply have world.qc spawn a new entity on level start and set its think. Then there's no question as to whether it'll get spawned (some dm maps may lack an info_player_start or may have more than one) or how many times per frame it happens because you have full control. I generally prefer to be explicit in these cases, and spawning a new entity really isn't much work.

-Wazat
When my computer inevitably explodes and kills me, my cat inherits everything I own. He may be the only one capable of continuing my work.
Baker
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Post by Baker »

Stealth Kill wrote:Clanarena is very interesting.
How can play it? If i start a map it spawns me with no weapons. Are there any commands to start game?
It's multiplayer only. Bot support would be difficult as there are no items so no waypoints or intuitive bot ai would be easy to achieve.

You start with all weapons and ammo usually it is the blue team vs. the red team until one or the other is dead. You play traditionally best of 9 rounds.

You pretty much have to play it on a server like speaknow.quakeone.com or elsewhere. I'm sure there is Clan Arena in Quake 3 as well, it is one of the few mods that has maintained long term popularity.
Post Reply