Spawn System (ALFA / ACR)

Ideas and suggestions for game mechanics and rules.
User avatar
AcadiusLost
Chosen of Forumamus, God of Forums
Posts: 5061
Joined: Tue Oct 19, 2004 8:38 am
Location: Montara, CA [GMT -8]
Contact:

Spawn System (ALFA / ACR)

Post by AcadiusLost »

Today I dug in on the spawn scripts Ronan left in the sourceforge repository back in June, after quite a while of stumbling around, I got them working for some basics (they were written in NWN1, before we knew much about some of NWN2's quirks).

This is the system outlined on the wiki under "Technical"

I've gotten it doing simple group spawns, %chance spawns, and placeable spawns so far, though I've not stringently tested many of the features yet.

I'm hopeful that we can get it cleaned up in reasonably short order, though I may have to get some assistance on testing things like time of day, day of month spawns/despawns and such- I'm not sure I'll have time to test all those functions exhaustively.
User avatar
ç i p h é r
Retired
Posts: 2904
Joined: Fri Oct 21, 2005 4:12 pm
Location: US Central (GMT - 6)

Post by ç i p h é r »

Great news, AL. Thanks for picking up the pieces.
User avatar
indio
Ancient Red Dragon
Posts: 2810
Joined: Sat Jan 03, 2004 10:40 am

Post by indio »

I haven't made a detailed report on the system Ronan recommended, but here it is, FWIW.

The spawn system does all we need it to do, but we need to add some PW functionality and focus it less on MMO-type worlds to make life easier.

It is very waypoint heavy...to spawn a single NPC is easy, but to spawn a group of random creatures can take placing 5 different WPs, each set with their own variables. However, you get better at this after time.

You can create conditional spawns from a trigger...a group will spawn once the trigger is sprung. What we need is for that trigger to only spring when conditions stored on the PC are met.

The NPCs are all spawned as you enter the area, creating slower loads than usual, but once things are spawned, it's less laggy than NESS.

The documentation is excellent.

The setup and first steps are easy, which is good for beginner builders.

It's a work in progress, but it's working now, it's been built for NWN2, it's based upon Knat's work (and that guy is a god of scripting), and it will be patched and added to as we go.

It comes with this fabulous GDR Skill system that is really worth it all on its own.


To sum up, this system is more thorough than Ronan's, largely because Ronan got busy. The reason he suggested it however is because the premises were similar. As such, I suggest anyone with the inclination to have a good look at it and report back here.

http://nwvault.ign.com/View.php?view=NW ... tail&id=20
Image
User avatar
AcadiusLost
Chosen of Forumamus, God of Forums
Posts: 5061
Joined: Tue Oct 19, 2004 8:38 am
Location: Montara, CA [GMT -8]
Contact:

Post by AcadiusLost »

Should I be shelving the work on Ronan's spawn system, then? When you had given the evaluation of exisiting spawn systems before, I was under the impression that they weren't going to be able to do what we needed, and that the preference was to develop our own system.

My impression generally is that we did a bit more reinvention of the wheel with NWN1/ALFA than we should have, so if the consensus view is that we should be using a system off the vault (and that we've found one that serves our needs), that's fine with me, I just need to know before I lose another 8+ hours of work on a system folks aren't interested in. The time could as easily be used in adapting the vault system to interface with things like the seamless AT scripts and such.

Can we get a tech meeting scheduled for this weekend, perhaps, so we can coordinate on priorities and needs?

It's also possible that we can merge in things we like from Ronan's system (single waypoint to spawn mixed groups) by adding a few functions of our own, though this may defeat the purpose of using Vault material somewhat (may dramatically complicate updates of the third-party material).
User avatar
ç i p h é r
Retired
Posts: 2904
Joined: Fri Oct 21, 2005 4:12 pm
Location: US Central (GMT - 6)

Post by ç i p h é r »

IMO, this is a core system for which we need to secure competency in ALFA, whether it's a full understanding of one we've written ourselves or of one we've adopted and modified to suit our needs. I'm certainly not an opponent of using vault content, but I'm very reluctant to adopt a 3rd party spawn system at this stage for a variety of reasons:

1. Our architecture and coding standards vary
2. Our features road map (what our server teams need) likely varies
3. On-going maintenance and support (for as long as ALFA is around) is extremely unlikely from a one man show
4. An ALFA spawn system foundation already exists

If we fail to secure the competency in ALFA necessary to maintain core systems lilke this, then it will just invite server teams to start hacking away at the code to make the system do what they want/need it to do, much like I witnessed with NESS and JAI in NWN1. And since Ronan has already laid a foundation for an ALFA system, I don't see it as overly practical to scrap his work in exchange for something written by someone else that we'll very likely have to rework (as AL suggested).

So, in short, what I'm saying is that I prefer to pick up where Ronan left off and AL has agreed to do that.
User avatar
indio
Ancient Red Dragon
Posts: 2810
Joined: Sat Jan 03, 2004 10:40 am

Post by indio »

Cool bananas.
Image
User avatar
AcadiusLost
Chosen of Forumamus, God of Forums
Posts: 5061
Joined: Tue Oct 19, 2004 8:38 am
Location: Montara, CA [GMT -8]
Contact:

Post by AcadiusLost »

Bah, there went a perfectly good excuse to dodge the workload of testing and polishing up the spawn system.

Guess I'll have to buckle back down on it. I'll try to get a test mod thrown together this week with some sample spawn waypoints for folks to try adjusting settings on.

Anyone had experience with using NWNx4 to profile script execution? I did a bit with NWN1/NWNx2 to spot laggy scripts in modules, not sure if it's similarly straightforward for NWN2/NWNx4, would appreciate advice in that regard.
User avatar
ç i p h é r
Retired
Posts: 2904
Joined: Fri Oct 21, 2005 4:12 pm
Location: US Central (GMT - 6)

Post by ç i p h é r »

Indio has always been willing to help test systems, so time permitting, perhaps he'll be able to assist you.

As for NWNx4 script profiling, Daeftan may have some experience that he can share with you, if he's still around. He was working with NWNx4 for our logging system. If need be, I can help. Consider me on standby.
User avatar
indio
Ancient Red Dragon
Posts: 2810
Joined: Sat Jan 03, 2004 10:40 am

Post by indio »

Yeah, I can definitely test the spawn system. No help with the profiler though, sorry.

AL, the thing with the spawn system should be about rationalising out tasks that really don't matter to a PW. Really, we need a few core functions to get started, to spawn NPCs in and to make quests persistent, and then e can add more as we go.

So if you want some help formulating a plan I'm happy to help.
Image
User avatar
AcadiusLost
Chosen of Forumamus, God of Forums
Posts: 5061
Joined: Tue Oct 19, 2004 8:38 am
Location: Montara, CA [GMT -8]
Contact:

Post by AcadiusLost »

The core of what we need is already there and coded, though a few important bits seem not to be doing what they're supposed to yet. By the end of the week I hope to have finished a "first pass" set of fixes, and made a test mod that you and/or others can more stringently use to see if other functionality needs fixing.

The functions that are suitably coded are the ones documented under the Spawn System Manual in the Technical section of the wiki. He's got a fair bit of code for the "in progress" ones there, seems this code is from the about the same time as that wiki edit.

Also, looking forward, if there are core functionalities that we need for the system, that aren't listed on the wiki, let me know so I can start thinking about how to accomplish them.

For example, do we want spawns activating when a DM client enters (assuming no PCs are present?) Seems the system was originally set to only respond to PCs, though I've temporarily changed it for testing purposes. What is the preference?


(as an aside, the dynamic spawn renaming is disabled, and will remain so until those functions are fixed for NWN2.)
Thangorn
Haste Bear
Posts: 2081
Joined: Fri Oct 01, 2004 1:00 pm
Location: Queenstown, New Zealand

Post by Thangorn »

might I just add, you guys rock.. I really wish I had time to assist but between a hefty dose of RL and keeping teh moonsea building on track it is extremely difficult.

I'm so glad we have dedicated people such as yourself who volunteer their hard-won free time to work these systems over..

good on you lot..
On indefinite real life hiatus

[22:52] <Veilan> obviously something sinister must be afoot if a DM does not have his social security number in his avatar name!
User avatar
AcadiusLost
Chosen of Forumamus, God of Forums
Posts: 5061
Joined: Tue Oct 19, 2004 8:38 am
Location: Montara, CA [GMT -8]
Contact:

Post by AcadiusLost »

As a brief update (found a few more hours to sink into it tonight):

I can spawn creatures, placeables, items, or waypoints.

One waypoint can a set group of blueprints if you want a consistent spawn.

Otherwise, you can add a list of blueprints and specify a number (or range of) random "pulls" from the list. (still all on one waypoint)

Random Facing works, but currently applies to all objects spawned from the waypoint collectively rather than individually (ought to be an easy fix).

So far the VFX on spawn-in (at the waypoint or on the object) seem to be working, though some give the flying question-mark appearance.

I can get random % chance spawning to work as well, by modifying one of the functions. Currently it's written to roll the random % chance once per game-day (24 game-hours). This is something we could allow more control over if there is a need, but Ronan's initial work suggested that we see the system slow down on it's local int access the more variables we start piling onto these poor waypoints. (the RandomFloat(fMin, fMax) in acr_tools_i seems to be screwy, should have a fix ready to commit shortly).


Now the less-good news:

Time of day spawning, spawn duration, despawning, # of respawns: this code is untested and/or not working currently. The ACR_time_i functions are giving me unexpected results, but I'm making some headway. I suspect the # of respawns thing is an incomplete system, as the ACR_ReportSpawnDeath is just a placeholder in this code version.

We have code for delaying respawns from a waypoint, but I don't see anything for delaying the initial spawn (though we can make sure it won't fire while a PC is in visual range).

Currently, spawns appear in a tight group, right on top of their waypoint- I'll need to write some location randomizing functions with parameter constraints if we want to simulate the kind of unpredictability we came to expect from NESS. I believe I read in the NWN2 forums, that createobject no longer nudges a creature to the neaest walkable area- currently I believe it's just failing if the recommended location is unwalkable. This could be a problem in exteriors, when we don't know what "Z" coordinate the ground would be for a given X and Y coordinate.

I haven't tried to push the system to watch for lag, I can't watch the CPU utilization well since I'm running the module from the DM client- I'm also testing with a pretty tiny mod (1 32x32 area, plus a few interiors).

I'm going to have to conquer the time issue before I get a test mod up, as until I do, it's trying to refresh spawns every heartbeat, (scripts keep thinking they are 140 days since last refresh).

I'll keep you folks posted, and welcome advice/recommendations.
User avatar
indio
Ancient Red Dragon
Posts: 2810
Joined: Sat Jan 03, 2004 10:40 am

Post by indio »

Outstanding news.

I'll stress again that I believe the most important functionality for the system is spawning in a persistent environment. That means a mob only spawns when a certain variable of a certain value is carried by the PC. That way quests are doable only once without the more meta-type constraints....a locked door, etc.

Check Mykael's spawner AL. He's got formation spawns, random spawn placements and a few other nice devices. It may be that his area_quiesce function could be used to despawn where necessary.
Image
Thangorn
Haste Bear
Posts: 2081
Joined: Fri Oct 01, 2004 1:00 pm
Location: Queenstown, New Zealand

Post by Thangorn »

createobject no longer nudges a creature to the neaest walkable area
my scripting is a little rusty since I'm unable to test scripts with NWN2 at present but..

Cant you send a getlocation argument first to check for the location's walkability/validity before using create object?
On indefinite real life hiatus

[22:52] <Veilan> obviously something sinister must be afoot if a DM does not have his social security number in his avatar name!
User avatar
AcadiusLost
Chosen of Forumamus, God of Forums
Posts: 5061
Joined: Tue Oct 19, 2004 8:38 am
Location: Montara, CA [GMT -8]
Contact:

Post by AcadiusLost »

Thangorn wrote: Cant you send a getlocation argument first to check for the location's walkability/validity before using create object?
I'd hope so, but if my experience with the Seamless AT scripting (admittedly, via NWN1), was any guide, it will let you create a location anywhere, including "off the map", under the walkmesh, over it, etc- and it will return a valid object. It's possible with the "different" functionality of CreateObject, we could just try creating the object there and then see if the object is valid, though there may be a need to delay the check to give the Create a chance to finish before testing (nontrivial if you're trying to spawn 12 goblins spread across a region of map)- we'd also be vulnerable to te code being broken if they "fixed" createobject down the line.

We'll see though, until I've written and tested a function for this, it's just speculation. I did try to use a similar means to empirically work out the X and Y bounds of an area for the Seamless AT scripts, but found it an exercize in futility.
Locked