Survival.lua

Discuss and unveil current Marathon projects.
User avatar
megabyte
Vidmaster
Posts: 1006
Joined: Feb 15th '07, 02:43
Location: Asympotatoes, Mars
Contact:

I was browsing the pfhorums the other day and I can across this topic. It inspired me to write a lua script that turns any map into a game of survival.

Description from S7:
This script is playable on any map. The goal is to live as long as possible. It becomes more difficult with each round due the the increasing number of monsters spawned. I would advise playing this with a friend. When ever your friend dies you can find their body on the overhead map or the radar. Once you arrive at their body, you hit the action key to revive them. Be careful because once everyone dies the game ends.
Don't forget to host as a gametype!



Download Here
Last edited by megabyte on Feb 9th '10, 19:02, edited 1 time in total.
Its just like the story of the grasshopper and the octopus. All year long the grasshopper kept burying acorns for winter while the octopus mooched off his girlfriend and watched TV. Then the winter came, and the grasshopper died, and the octopus ate all his acorns and also he got a racecar. Is any of this getting through to you?
Favorite quote
ASYMPOTATOES http://asympotatoes.blogspot.com/
[viral]
User avatar
Dugit
Vidmaster
Posts: 1803
Joined: Mar 22nd '09, 16:33
Location: Hampshire, UK
Contact:

Increasing number of monsters spawned... so if I have 10 Trooper spawn points, the script would allow 2 to spawn at first, say, then rising up to 10 in say, a few minutes?

Should I merge this with a map, or have it separate?

Anyway, thanks for this. It'll help the Survival Project's cause greatly.
Last edited by Dugit on Feb 9th '10, 19:20, edited 1 time in total.
Polyplicity my second (less sucky) net pack. Go on. Download it. You know you don't want to.
Marathon Aeon- My scenario in the works ~on Simplici7y

riveting six-vertice amnesty ratifications
User avatar
The Thug
Vidmaster
Posts: 1014
Joined: Jul 9th '07, 22:20
Contact:

The monsters are not spawned according to any pre-placed spawn points. As Megabyte points out, this script works on any map, even maps with no alien spawns.
Childhood is not a race. It's a journey.
User avatar
Dugit
Vidmaster
Posts: 1803
Joined: Mar 22nd '09, 16:33
Location: Hampshire, UK
Contact:

I've played this on Marius, and it seems to have some problems. For example, sometimes a monster might fall into a polygon where it would be difficult or impossible to kill them, thus the game stops. Can you script something that slowly increases the general number of monsters spawned, using predetermined spawn points- e.g., every 30 seconds, a batch of say, five monsters will appear. The next 30 seconds, 6?
Last edited by Dugit on Feb 9th '10, 19:59, edited 1 time in total.
Polyplicity my second (less sucky) net pack. Go on. Download it. You know you don't want to.
Marathon Aeon- My scenario in the works ~on Simplici7y

riveting six-vertice amnesty ratifications
User avatar
treellama
Vidmaster
Posts: 6110
Joined: Jun 2nd '06, 02:05
Location: Pittsburgh
Contact:

Well, I can answer for him: Lua cannot currently access the spawn points.

I read through the script and there will be other problems as well. Respawning your friends in multilevel or 5D maps, for instance. Still, pretty ambitious!

It would be cool to get the XBLA survival maps working. They use monster spawn points with the total available and respawn rate set to 0 (I need to check again to confirm my aging memory); I suggest using this approach for your survival project just for consistency. Of course, you'd have to wait for a new version of the engine and a corresponding Lua script.
Last edited by treellama on Feb 9th '10, 20:02, edited 1 time in total.
User avatar
Dugit
Vidmaster
Posts: 1803
Joined: Mar 22nd '09, 16:33
Location: Hampshire, UK
Contact:

So, for now, it's just monsters spawning in closets, and they open after periods of time? Yeah, I suppose so. Anyway, thanks again. [MGrin]
Polyplicity my second (less sucky) net pack. Go on. Download it. You know you don't want to.
Marathon Aeon- My scenario in the works ~on Simplici7y

riveting six-vertice amnesty ratifications
User avatar
megabyte
Vidmaster
Posts: 1006
Joined: Feb 15th '07, 02:43
Location: Asympotatoes, Mars
Contact:

Dugit wrote:I've played this on Marius, and it seems to have some problems. For example, sometimes a monster might fall into a polygon where it would be difficult or impossible to kill them, thus the game stops. Can you script something that slowly increases the general number of monsters spawned, using predetermined spawn points- e.g., every 30 seconds, a batch of say, five monsters will appear. The next 30 seconds, 6?
I tried to have it check each polygon to make sure that they only fall in ones that are easy to access. I'll try and fix this.
Treellama wrote:I read through the script and there will be other problems as well. Respawning your friends in multilevel or 5D maps, for instance. Still, pretty ambitious!
What are these other problems you speak of?
Its just like the story of the grasshopper and the octopus. All year long the grasshopper kept burying acorns for winter while the octopus mooched off his girlfriend and watched TV. Then the winter came, and the grasshopper died, and the octopus ate all his acorns and also he got a racecar. Is any of this getting through to you?
Favorite quote
ASYMPOTATOES http://asympotatoes.blogspot.com/
[viral]
User avatar
Dugit
Vidmaster
Posts: 1803
Joined: Mar 22nd '09, 16:33
Location: Hampshire, UK
Contact:

Megabyte wrote:I tried to have it check each polygon to make sure that they only fall in ones that are easy to access. I'll try and fix this.
So, the script can read whether a polygon would fit a monster (so it wouldn't stuff a hunter into a wall mounted switch)? Can height restrictions be implemented on the spawning?
Polyplicity my second (less sucky) net pack. Go on. Download it. You know you don't want to.
Marathon Aeon- My scenario in the works ~on Simplici7y

riveting six-vertice amnesty ratifications
User avatar
megabyte
Vidmaster
Posts: 1006
Joined: Feb 15th '07, 02:43
Location: Asympotatoes, Mars
Contact:

If the switch is a large enough proportion of the map to contain a monster then you have a problem with the map you chose: its tiny or your switch is insanely deep. I have height restrictions in the script now and they have been there but I didn't check for it during the spawning phase. To fix it until the next release, which is coming soon hopefully, change line 118 to

Code: Select all

if (p.area/TOTALAREA)>=(1/(20*ROUND)) and p._spawn then
Last edited by megabyte on Feb 10th '10, 17:21, edited 1 time in total.
Its just like the story of the grasshopper and the octopus. All year long the grasshopper kept burying acorns for winter while the octopus mooched off his girlfriend and watched TV. Then the winter came, and the grasshopper died, and the octopus ate all his acorns and also he got a racecar. Is any of this getting through to you?
Favorite quote
ASYMPOTATOES http://asympotatoes.blogspot.com/
[viral]
User avatar
megabyte
Vidmaster
Posts: 1006
Joined: Feb 15th '07, 02:43
Location: Asympotatoes, Mars
Contact:

I have reworked the section that checks for spawnable polys. It starts at the hill, should be accessible on every net map, and checks to see what polys the player can move to and iterates outward. This method stops guys from spawning outside of windows and other unreachable places.

Check it out on S7
Its just like the story of the grasshopper and the octopus. All year long the grasshopper kept burying acorns for winter while the octopus mooched off his girlfriend and watched TV. Then the winter came, and the grasshopper died, and the octopus ate all his acorns and also he got a racecar. Is any of this getting through to you?
Favorite quote
ASYMPOTATOES http://asympotatoes.blogspot.com/
[viral]
User avatar
megabyte
Vidmaster
Posts: 1006
Joined: Feb 15th '07, 02:43
Location: Asympotatoes, Mars
Contact:

The script now takes solid lines into account and will not spawn monsters outside of windows!. Don't forget to host with aliens off.

Check it out on S7
Its just like the story of the grasshopper and the octopus. All year long the grasshopper kept burying acorns for winter while the octopus mooched off his girlfriend and watched TV. Then the winter came, and the grasshopper died, and the octopus ate all his acorns and also he got a racecar. Is any of this getting through to you?
Favorite quote
ASYMPOTATOES http://asympotatoes.blogspot.com/
[viral]
User avatar
Dugit
Vidmaster
Posts: 1803
Joined: Mar 22nd '09, 16:33
Location: Hampshire, UK
Contact:

I've been having problems playing Survival.lua solo (v3)- after the first couple of rounds, where 3 are spawned, no more than 3 are ever spawned again (a line of text comes up saying '...a nil value'), unless if one of the monsters is a S'pht'Kr Defender.

What is going on?
Polyplicity my second (less sucky) net pack. Go on. Download it. You know you don't want to.
Marathon Aeon- My scenario in the works ~on Simplici7y

riveting six-vertice amnesty ratifications
User avatar
megabyte
Vidmaster
Posts: 1006
Joined: Feb 15th '07, 02:43
Location: Asympotatoes, Mars
Contact:

Could you tell me which maps you've been having this problem on?
Its just like the story of the grasshopper and the octopus. All year long the grasshopper kept burying acorns for winter while the octopus mooched off his girlfriend and watched TV. Then the winter came, and the grasshopper died, and the octopus ate all his acorns and also he got a racecar. Is any of this getting through to you?
Favorite quote
ASYMPOTATOES http://asympotatoes.blogspot.com/
[viral]
User avatar
Dugit
Vidmaster
Posts: 1803
Joined: Mar 22nd '09, 16:33
Location: Hampshire, UK
Contact:

Oh... it's working now.

What happened there?

Edit: So I assume making a polygon Monster Impassable will affect this script? So I can have monsters spawning on predefined ledges only?
Last edited by Dugit on Feb 14th '10, 10:50, edited 1 time in total.
Polyplicity my second (less sucky) net pack. Go on. Download it. You know you don't want to.
Marathon Aeon- My scenario in the works ~on Simplici7y

riveting six-vertice amnesty ratifications
User avatar
Hopper
Mjolnir Mark IV
Posts: 585
Joined: May 10th '09, 17:02
Contact:

Dugit wrote:So I can have monsters spawning on predefined ledges only?
Megabyte wrote:It starts at the hill ... and checks to see what polys the player can move to and iterates outward.
As I understand it, if your "predefined ledges" are all accessible from a common hill, you could manage it without redoing the script. Tie the ledges together with hallways (possibly hidden in 5D space), mark one ledge as the "hill", and use impassible polys between each ledge and the killing floor.

With a little bit of Lua knowledge, you could replace the iterative process with a static list of polygon numbers. The loop on line 29 is the bit to replace with lines of the form:

Code: Select all

Polygons[76]._checked = true; Polygons[76]._spawn = true;
Since the spawning area can be isolated from the rest of the level, you could combine this with traditional monster caches, although monsters wouldn't respawn on the ledges until the rest of the level was cleared out. Changing line 126 of the script to:

Code: Select all

if m.valid and not m.player and m.polygon._spawn then
might work out better, so that monsters respawn when the spawning zone, not just the entire level, is empty.
Aleph One:  Download 1.2.1         Plugins:  Vasara  ·  more
User avatar
interion
Cyborg
Posts: 331
Joined: Oct 20th '07, 18:34
Contact:

It seems like Survival.lua is all anyone ever hosts these days. After playing a bunch of games I noticed a couple gameplay issues. Near the end of every round, there would be a long pause while we checked that everyone had been revived. People who were low on health would ask that someone kill them and then revive them to restore them back to full health. Then we'd have to wait while everyone checked in and announced they were ready for the next round. Of course, sometimes someone went ahead and killed the last alien by mistake, or because they weren't listening, and then the group was screwed going into the next round.

To keep the action going, and minimize all this tedious work between rounds, I made a few simple modifications to my own copy of the script.

1. All dead players are revived at the start of a new round
2. All players are restored to full health

Of course the players could already do that as I explained before, but these changes keep the game flowing.

I also found that around round 9 or 10 the beginning could be a little overwhelming with all of the aliens spawning at once, so I added some bonus health to help players survived the initial onslaught. Each additional round adds 10% to the players base health, so by round 11 you're starting with 2x (yellow bar).

I also added an incentive to revive players. You get an extra 60 hp (40% base) when you revive a player. This also helps those times where the player who needs to be revived is in a dangerous part of the map. If you can reach them without dying you should get enough health to get out of the open and back to a safe location.

I'm attaching a copy of my changes. If you like hosting Survival.lua and think these will improve the game, feel free to download my modified copy of the script or add these changes to your own copy.

Code: Select all

if monsters==0 then
        -- Revive and restore health at end of each round, top-02/21/2010
        for x in Players() do
            if x.dead and not x._revived then
                x._revived=true
            else
                x.life=150
            end

            -- Bonus life
            x.life = x.life + x.life * (.1 * ROUND)
        end

        ROUND=ROUND+1

        spawn()
    end
Attachments
Survival_Mod.zip
(1.57 KiB) Downloaded 280 times
User avatar
megabyte
Vidmaster
Posts: 1006
Joined: Feb 15th '07, 02:43
Location: Asympotatoes, Mars
Contact:

In the coming version, I'm adding a compass pointing to the nearest dead player, a readout of who the nearest dead guy is(in red letters for more visibility), and a bonus 5 points(monster kills) for a revive. I'll include an alternate script that includes revives at the end of each round.
Its just like the story of the grasshopper and the octopus. All year long the grasshopper kept burying acorns for winter while the octopus mooched off his girlfriend and watched TV. Then the winter came, and the grasshopper died, and the octopus ate all his acorns and also he got a racecar. Is any of this getting through to you?
Favorite quote
ASYMPOTATOES http://asympotatoes.blogspot.com/
[viral]
User avatar
irons
Vidmaster
Posts: 2651
Joined: Mar 1st '06, 20:44
Location: (.Y.)
Contact:

In my experience, the most visible colors are white, yellow, and green. Red, while cool and everything, blends in with more stuff than you realize at first.
underworld : simple fun netmaps // prahblum peack : simple rejected netmaps
azure dreams : simple horrible netmaps // v6.0!!!: thomas mann's greatest hits : simple simple netmaps
User avatar
xilef
Cyborg
Posts: 186
Joined: Jul 6th '08, 22:30
Contact:

Personally I think there should be a 5 second timer between rounds, for a "setup" moment, because people usually leave the last monster alive whilst healing, restocking ammo, etc.
Last edited by xilef on Feb 22nd '10, 13:14, edited 1 time in total.
Inguinal Falx
Born on Board
Posts: 32
Joined: Oct 8th '08, 14:01
Contact:

In my experience, the most important element of regrouping towards the end of a round is getting into position. Most games are lost when the last alien is killed unexpectedly and players in a bad spot get overwhelmed by the new wave of enemies. I think the automatic revive/full health will save a lot of time but players will still probably have to check to make sure everyone is set before the next round begins.

I had two suggestions for future versions of the script. One is serious. One is a bit out there:
1. End game stats that would include the number of players you revived and how many times you were revived by others.
2. This might not be possible (or desirable), but I thought it would be fun to have a new, very powerful weapon that would appear later in the game (say, Round 10 when things start to get nasty) and would only contain one round (e.g. one rocket). One lucky player could find this Mother Of All Bombs and use it on the alien mob. One shot per round.
gyffes
Born on Board
Posts: 42
Joined: Dec 6th '06, 22:10
Contact:

Survival is a nice change of pace, but it sure makes the "let's grab 10 spare minutes to game" game difficult.


Not sure a compass is needed but I like Tim's changes -- 'though I think with the "revive other players" bonus, having an auto-refresh and auto-increment that's based on nothing is less needed (and, in fact, reduces the drive to revive, as it were). Anything that actively encourages the cooperative aspects of coop would be a boon.


Megabyte wrote:In the coming version, I'm adding a compass pointing to the nearest dead player, a readout of who the nearest dead guy is(in red letters for more visibility), and a bonus 5 points(monster kills) for a revive. I'll include an alternate script that includes revives at the end of each round.
User avatar
xilef
Cyborg
Posts: 186
Joined: Jul 6th '08, 22:30
Contact:

Megabyte wrote:In the coming version, I'm adding a compass pointing to the nearest dead player, a readout of who the nearest dead guy is(in red letters for more visibility), and a bonus 5 points(monster kills) for a revive. I'll include an alternate script that includes revives at the end of each round.
What will stop me from killing my buddy and reviving them repeatedly for points?
User avatar
CryoS
Vidmaster
Posts: 1721
Joined: Jul 1st '07, 09:56
Location: The Dungeon
Contact:

perhaps 1 revive per round per player, remove revives for player kills (ie team killing) will work?
Last edited by CryoS on Feb 23rd '10, 18:40, edited 1 time in total.
What are you, if not seven different shades of stupid?
gyffes
Born on Board
Posts: 42
Joined: Dec 6th '06, 22:10
Contact:

Xilef wrote:What will stop me from killing my buddy and reviving them repeatedly for points?



Common sense? Eventually your buddy will find your address and come punch you in the throat...
User avatar
interion
Cyborg
Posts: 331
Joined: Oct 20th '07, 18:34
Contact:

Annotations are a big problem on some maps. Would it be possible to delete them all at the start of the game so it's easier to see dead players on the map?
Image Image
Post Reply