Author Topic: DelayCommand and Encounters  (Read 673 times)

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
DelayCommand and Encounters
« Reply #15 on: February 16, 2014, 08:12:06 pm »


               I'll post the code now, which is acaos' implementation, not mine. It's pretty dense, so I'll post some example encounters and area enter scripts with do-once string sets a bit later, to make it more comprehensible. The system has evovled over time to allow various different setups. In the most recent iteration, in our Abyss areas, we set it to use one tag of waypoint per trigger, both for ease of visibility, and for ranged attacker waypoints specifically. It's had a lot of functionality built into it, but in ways that are not terribly end-user friendly so much as they are efficient. More later, here's the pastebin:

ac_encounter

That's the script that fires from the trigger's onenter. No other scripts, though there are lots of variables on the trigger set in the toolset, and more variables set on either trigger or area once the area is entered.

Funky
               
               

               


                     Modifié par FunkySwerve, 16 février 2014 - 08:12 .
                     
                  


            

Legacy_leo_x

  • Sr. Member
  • ****
  • Posts: 403
  • Karma: +0/-0
DelayCommand and Encounters
« Reply #16 on: February 17, 2014, 10:27:35 am »


               Very cool.  Thank you for sharing!

In practice is the 0.1 delay between spawns enough to reduce spawn lag or do you override that a lot?
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
DelayCommand and Encounters
« Reply #17 on: February 17, 2014, 04:10:43 pm »


               No overriding that I'm aware. We don't get TOO much spawn lag to begin with, as we apply most itemprops/effects dynamically on either hide, weapon, or creature, instead of dumping a bunch of items on them, with the exception of mobs that need armor, shield, or helm to achieve the right look. Either way, no spawn hiccups for us to speak of.

Here are a bunch of example triggers. Aside from the listed variables, the only thing on the trigger at the time its set down in the toolset is the above-linked script in onenter. The rest is handled by a do-once setup in the area enter scripts, which I will pastebin after each relevant set of variables.

Myconids (one of the first places we used this system - just sets triggers to Active and specifies a respawn period of 60 minutes - rest done in enter)
EncActive int 1
EncRespawn int 3600

Myconid onenter

Pit of Moliation - Second Deep (new vars showcased here include Chance, which is the chance the trigger will stay active and respawnable, Include, which is the bitmask I mentioned (I wound up cycling the first 4-5 bits a lot when area layout permitted - I only used higher bits when there was a lot of overlap requiring it), TargetSpread, which specifies whether the spawns are spread out over mutliple waypoints of those available, SpreadLimit, which limits the number of randomly chosen candidate waypoints they're spread over, and TargetWaypoint, which is both the default waypoint tag and the number of GetNearestByTag-ed waypoints to check (and skip, if it starts with a number other than 1). Allows us to scan only those nearby for the Include bitmask. Not the most efficent strictly speaking, but a bit more end-user friendly. We were still tinkering:

EncActive int 1
EncChance int 87
EncInclude int 1
EncRespawn int 3600
EncTargetSpread int 1
EncTargetSpreadLimit int 2
EncTargetWaypoint string mol_enc#1-6

This one, still in Second Deep, highlights how we do a set-piece encouter, in this case a group of Meenlock Spitters, using the EncCategory string (see the onenter script for the rest):

EncActive int 1
EncCategory string SPIT
EncChance int 100
EncInclude int 8
EncRespawn int 3600
EncTargetSpread int 1
EncTargetSpreadLimit int 2
EncTargetWaypoint string mol_enc#1-9

Here's the onenter. Note at this point that we've started doing other things, like priming secret triggers, from onenter. Keeps the mod tidy and until the vars are actually needed. We also condensed down to one script, instead of the two from myconids.

mol_onenter

Here's three encounters from Elysium Fortress of the Sun (boss area), highlighting a number of variant setups, and a boss spawn:

EncActive int 1
EncChance int 80
EncInclude int 2
EncTargetSpread int 1
EncTargetSpreadLimit int 2
EncTargetWaypoint string ely_enc#1-3


EncActive int 1
EncChance int 80
EncInclude int 4
EncTargetSpread int 1
EncTargetSpreadLimit int 2
EncTargetWaypoint string ""

boss encounter:

EncActive int 1
EncChance int 100
EncInclude int 16
EncTargetSpread int 0
EncTargetWaypoint string ely_enc#1-2

Here's the onenter:
elysium_enter

I think we actually did that one before pit of moliation, as we were still setting loot variables directly on placeables at that point. Anyway, that shows a boss encounter setup, along with random encounter spawning, and that area, the Fortress of the Sun, also highlights the tiering mechanism of the system - new spawnsets are used once x number of encounters have triggered. We usually use quite a bit fewer tiers of spawnsets that you see there.

Here's one from the Elemental Plane of Air, a wide-open, no bosses, free-ranging area set:
EncActive int 1
EncChance int 90
EncRespawn int 720
EncTargetSpread int 1
EncTargetSpreadLimit int 2
EncTargetWaypoint string ele_enc#3-6

Only thing of note there is that the waypoints are typically set to NOT spawn at the two nearest - due to the wide-open nature of the area set. At that point we were setting the variables directly on the area - ick. No area entry paste for that, as a result.

And lastly, some encounters from one of our Abyss layers, the Gaping Maw:

Gaping Maw, the Screaming Jungle
EncActive int 1
EncChance int 63  
EncIndex int 2 (on enc 2, using melee and ranged 2)
EncRespawn int 3600
EncTargetSpread int 1
EncTargetSpreadLimit int 3
EncTargetWaypoint string aby_enc_melee_2#1-*

Lemoriax miniboss enc trigger 5
EncActive int 1
EncCategory string MINI
EncChance int 100
EncIndex int 5 (on enc 5, using melee and ranged 5)
EncRespawn int -1
EncTargetSpread int 1
EncTargetSpreadLimit int 3
EncTargetWaypoint string aby_enc_melee_5#1-*

Demogorgon's Chambers final (boss) trigger 12:
EncActive int 1
EncCategory string BOSS
EncChance int 100
EncIndex int 12 (on enc 12, using melee and ranged 2)
EncRespawn int -1
EncTargetSpread int 1
EncTargetSpreadLimit int 3
EncTargetWaypoint string aby_enc_melee_12#1-*

Those highlight the spawn system as we're moslty using it nowadays. With larger area sets, we would make a bunch of preconfigured triggers, 1-15 or so, and waypoints tagged to match, which would get used in each area. The default waypoint is for meleers. The ranged attackers would be set on aby_enc_ranged numbered waypoints to match. The #1-* tells it to check all waypoints of the appropriate tag in the area. As you can see in the area enter script, ranged attackers are designated a special set of ranged waypoints to use with @, like we used to do for special encounters. The I is the Index number, matching the one set on the trigger, and the melee waypoint's number as well:
aby_enter

Hope that was of use to you.

Best,
Funky
               
               

               
            

Legacy_leo_x

  • Sr. Member
  • ****
  • Posts: 403
  • Karma: +0/-0
DelayCommand and Encounters
« Reply #18 on: February 17, 2014, 07:04:54 pm »


               Thanks for taking the time to share all that up.  The vars really help get a better notion of how things work.  You've definitely give me some ideas on things to try.

I do have a couple more questions:

Is the scaling aspect of the system something you use much or do you have expected party sizes?  For me I'm pondering area instancing...each with encounters designed for larger groups.  My server is pretty small so it really has to support soloists and party groups that maybe reach half-dozen players.  I'm not sure how best to tackle this.

On the difficulty level escalation, is this for another system?  I couldn't see how it was factoring into the encounter system.

EDIT: Add a few more details.
               
               

               


                     Modifié par pope_leo, 17 février 2014 - 07:12 .
                     
                  


            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
DelayCommand and Encounters
« Reply #19 on: February 17, 2014, 08:18:57 pm »


               Spawn lags are almost always client-side caused by graphic. Too high poly models (illithids from CEP are those I have experiences with), or too bad graphic card and too high details set, etc.

I use trigger based encounters too but I use simplet targetting than Funky. As I see it, Funky's approach might include less waypoints per area, but requires way more planning where to place them and which ones to use for which trigger-encounter. My trigger-encounter search for a waypoint with a tag #tag_of_trigger#_WP. In case there is more of those waypoints it automatically chooses farthest, which duplicates the behavior of the bioware encounter. Later I added the possibility to set different waypoint for each creature in spawn - this is done via a integer value such as 1 and the my trigger-encounter then seeks #tag_of_trigger#_WP1. Its perhaps bit more labour intensive but offers high flexibility.

here is my trigger-encounter setup leo:

MIN_GROUP_1 int 2
MAX_GROUP_1 int 5
NPC_GROUP_1 string "sh_golem_guard1,sh_golem_guard1,sh_golem_horror1"
MIN_GROUP_1_1 int 1
MIN_GROUP_1_2 int 1
MAX_GROUP_1_1 int 1
MAX_GROUP_1_2 int 1
WP_GROUP_1_1 int 1
WP_GROUP_1_2 int 2
RESPAWN int 500

explanation: two two golems will be spawned on a preset positions, will be spawned always but there wont be more than two of them ever, the 0-3 helmed horrors will be spawned either into player face or on the farthest waypoint depending whether I set up the default waypoints or not.

no scripting needed and almost every values are optional so the basic trigger-encounter looks like this:

NPC_GROUP_1 string "sh_goblin1,sh_goblin2,sh_goblin3"

> spawns 1-2 goblins (randomly chosen from the list) on the farthest waypoint or into players face, respawn is 360 sec

Just giving you thoughts. I am also willing to share this, but I guess you will want to bake something in middle '<img'>
               
               

               


                     Modifié par ShaDoOoW, 17 février 2014 - 08:19 .
                     
                  


            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
DelayCommand and Encounters
« Reply #20 on: February 17, 2014, 09:15:09 pm »


               

ShaDoOoW wrote...

Spawn lags are almost always client-side caused by graphic. Too high poly models (illithids from CEP are those I have experiences with), or too bad graphic card and too high details set, etc.


This is not my experience, though it matters less than it used to, with newer computers. There's a hefty object-creation lag invoved as well, which was pretty easy to notice in our drow areas - all the creatures spawning there have 4-8 pieces of gear. 10 of those at a go, and you definitely get  a server, not a client, hiccup (or did, back in the day, on a crappier server). They're on the old bioware encounter system, though, so they also all spawn at once.

Funky
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
DelayCommand and Encounters
« Reply #21 on: February 17, 2014, 09:29:24 pm »


               

pope_leo wrote...

Is the scaling aspect of the system something you use much or do you have expected party sizes?

We do SOME scaling, and more now that we used to, but with a minimum expected party size of 5 or so (if you're level-appropriate, you need that many just for the various class mixes you need). The system can definitely handle much more scaling than we do pretty easily - most likely the best way would be via onenter.

 For me I'm pondering area instancing...each with encounters designed for larger groups.  My server is pretty small so it really has to support soloists and party groups that maybe reach half-dozen players.  I'm not sure how best to tackle this.

The number of spawns is controlled in the area enter script, so you could pretty easily handle it there - even put it outside the do once so it rechecks whenever a pc enters and spawns accordingly.

On the difficulty level escalation, is this for another system?  I couldn't see how it was factoring into the encounter system.


No, that's for this system - that was the bit I said was showcased by the Fortress of the Sun Area. It has around 6 different 'difficulty' tiers, which are basically upgrading encounters based on the number tripped, with the last being the boss.

It works pretty well, so long as you draw your triggers nice and broad so that fast-moving pcs don't accidentally bypass any. We had to redraw a number, and still (if rarely) have issues. We mostly do set-piece encounters instead of the difficulty scaling nowadays, though it's still fully functional, and I'd probably still use it for areas with encounters that got harder the more you stuck around prior to area respawn - just not for set bosses, which is still how Elysium works.

Please don't hestitate to ask if you have more questions. I can send you a few areas by way of example, if you want to peep them. They just require CEP 2.3, by and large, though we take them right out of the temp0 directory, since the er****g utility no longer works on our mod (compiler issues).

Funky
               
               

               
            

Legacy_leo_x

  • Sr. Member
  • ****
  • Posts: 403
  • Karma: +0/-0
DelayCommand and Encounters
« Reply #22 on: February 18, 2014, 11:06:42 am »


               @ShadoOow Thanks for the ideas.

FunkySwerve wrote...
The number of spawns is controlled in the area enter script, so you could pretty easily handle it there - even put it outside the do once so it rechecks whenever a pc enters and spawns accordingly.


That would be simpler than my original plan.  My only concern is that some of my players are on slower connections and are really slow through transitions.  So there will be people that won't wait, start fighting a weaker encounter.  That's pretty minor tho and could probably be worked around pretty easy by summing all the players in any of a run's areas.

FunkySwerve wrote...
No, that's for this system - that was the bit I said was showcased by the Fortress of the Sun Area. It has around 6 different 'difficulty' tiers, which are basically upgrading encounters based on the number tripped, with the last being the boss.


Ok, I missed that.  It makes more sense to me know. I could see this as a nice way of discouraging farming/camping, overspawing, etc.

FunkySwerve wrote...
Please don't hestitate to ask if you have more questions. I can send you a few areas by way of example, if you want to peep them. They just require CEP 2.3, by and large, though we take them right out of the temp0 directory, since the er****g utility no longer works on our mod (compiler issues).

Funky


I am curious if you have any retrospective on how the encounter system ended up influencing area design.  I imagine at your spawn/party levels you have to keep things pretty spacious in general.

I would love to take a look at an area, but don't go through a lot of trouble.  I think I have a good idea on what's going on now.

If you're curious, this is where I'm at after all your help/feedback/ideas: https://github.com/j...s/pl_drow_1.lua all the spawns are just for testing/illustration.

I'm mocking up my system in Lua rather than NWScript, because I really want to do config style files rather than set local vars directly.  I think it's pretty readable, except ':' is like the C++ '.' operator.  I'll either keep everything in Lua or use them to prime waypoints with local vars on mod load or something for a NWScript system.
               
               

               


                     Modifié par pope_leo, 18 février 2014 - 11:09 .
                     
                  


            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
DelayCommand and Encounters
« Reply #23 on: February 18, 2014, 12:55:47 pm »


               Hm.  In general, I think it was mostly the converse - our area design influenced how the system was set up.

We began with a pretty stringent set of requirements for area design. We do try to keep things spacious, adhering for the most part to best practices when it comes to where to put placeables and where not. Most of our areas are built to be linear in playthrough, at least ones with bosses/set loot/accomplishments, though we try to make them not obviously so via use of keys and locks, etc.

Placing ranged attackers can be a niusance, since, while you want them where they can't be easily meleed, you also want them where the party can't easily seperate them from the melee combantants in the encounter. That's resulted in a lot of switchback designs and chokepoints in places where the party can't easily backtrack. It was the desire to be able to place them carefully vis a vis the meleers in the encounter that lead to our current arrangement in the encounter system.

Similarly, in boss encounters, we began using giant 'boss push' triggers to keep the party members from getting too much milage out of convoluted area design by seperating them from their minions. You can sometimes do this via area design, but porting the pcs into a final fight area gets pretty tired pretty quickly. Yeah, the push trigger is a bit metagame, but it's not apparent unless the players are already metagaming by abusing the limits of NWN's ai. We generally have it warn them and zap them with rapidly increasing amounts of damage to quickly get them out of places we don't want them. Also, the push triggers aren't strictly a part of the encounter system - I just mention them because it's another example of area design driving trigger design.

Likewise, the desire to be able to slap down the same triggers for wide-open 'farming' areas lead to the mutability of the waypoint setup. Being able to use a single tag waypoint for all the spawn points in an area is very convenient, when you don't need to be able to see what waypoints relate to which triggers. If you do, however, I like to use premade templates, using waypoints of different appearances, so that you can easily spot the different encounters' waypoints.

Desire to keep the overall object count down originally drove the bitmask approach to waypoints, but it can make seeing the larger picture in the toolset difficult - a typical sort of tradeoff between useability and efficiency. It only matters while you're still tweaking spawn positions to keep them from appearing in odd places, though (it's amazing how unpredictable this can be, if you're spawning in a lot of mobs of varying sizes).

Good question, but as far as I can see, it's all been the other way 'round, with design shaping the tools. Which I guess is how you ideally want it, anyway, rather than the tools you have limiting your design.

Here's a link to the area files for Elysium and Gaping Maw:

Click Me

Funky
               
               

               


                     Modifié par FunkySwerve, 18 février 2014 - 12:58 .
                     
                  


            

Legacy_leo_x

  • Sr. Member
  • ****
  • Posts: 403
  • Karma: +0/-0
DelayCommand and Encounters
« Reply #24 on: February 18, 2014, 07:17:37 pm »


               Thank you, it's really generous of you to share those.

I love the boss push triggers and am going to start using that.

After all the monsters have been spawned, I'm curious how you handle PC targeting.  I tried a fairly crude scaling system in the past, but it was susceptible to a kind of mob blob effect.  Monsters would target the encounter spawner. If that was a tank that could handle them, PCs win, if not it started a domino effect.
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
DelayCommand and Encounters
« Reply #25 on: February 18, 2014, 09:14:13 pm »


               We use a minimally modified bioware x2 ai. It directs bosses to ignore BBoDs, and has them target taunters (we use an event script for taunt using nwnx, to allow variants based on persuade and bluff - bluff turns aggro away). We do some other basic crowd control, but some of the core (and very crude) ai targeting remains, based on hated classes.

One of my longer-term ambitions for nwn is a Dragon-Age style aggro system, though hopefully a bit more generalizable - unsure how I'll handle aggro points for each ability in the game, with so many more. Been considering one using SpellIds in a certain range (maybe 500 total, in an unused chunk - weve plenty of unallocated space over 33000 or so), where the critter just attacks the highest SpellId number adjusted by some divisor for distance. Any aggro activity would then scan for effects in that range and reassign a higher effect id, stripping the old one. Might even just go based on damage and assign a higher flat value for instakills - perhaps based on hp of the foe insta'd. I'd love to discuss it further if you want to work on such a system together (my time is limited these days). Not sure how I'd want to treat support classes.

Funky