Reminder: Internet Explorer 6 or below are NOT supported.





There are currently 62 users playing Freelancer on
44 servers. | May. 29, 2023 |
The Starport Forum Index
>
The Shipyard
>
Speciality Modding
>
Trying to understand how NPC spawning works?
Browsing this Thread:
1 Anonymous Users
Re: Trying to understand how NPC spawning works? |
||||
---|---|---|---|---|
Home away from home
![]() ![]() Joined:
2009/8/16 2:58 From Qld, Aus.
Group:
Registered Users FLServer Admins Trusted Speciality Developers Senior Members
Posts:
2035
![]() |
Just so we're testing the same thing, would you be able to send me your zone/encounter?
Posted on: 4/23 2:17
|
|||
|
Re: Trying to understand how NPC spawning works? |
||||
---|---|---|---|---|
Just popping in
![]() ![]() Joined:
2009/8/19 4:03 From Qld, Aus.
Group:
Registered Users
Posts:
12
![]() |
Yeah sure thing, posting my encounter (bmod_area_fc_x_grp_scouts_1) and the zone (Cheyenne Asteroid Field in Colorado) below
Note we made our own custom fighter classes we're using for ship_by_class so you'll want to set those back to whatever vanilla fighter class instead Code:
Code:
Let me know if you'd have rather I just send you the files by the way instead of the relevant snippets ![]()
Posted on: 4/24 8:17
|
|||
|
Re: Trying to understand how NPC spawning works? |
||||
---|---|---|---|---|
Home away from home
![]() ![]() Joined:
2009/8/16 2:58 From Qld, Aus.
Group:
Registered Users FLServer Admins Trusted Speciality Developers Senior Members
Posts:
2035
![]() |
Snippets are fine, thanks. I'll give that a go later.
As an aside, I see that as post #17 at 17:17. ![]()
Posted on: 4/24 8:23
|
|||
|
Re: Trying to understand how NPC spawning works? |
||||
---|---|---|---|---|
Home away from home
![]() ![]() Joined:
2009/8/16 2:58 From Qld, Aus.
Group:
Registered Users FLServer Admins Trusted Speciality Developers Senior Members
Posts:
2035
![]() |
First off,
toughness is not used in zones, so one more thing to forget about (sort , too).Secondly, longevity is read & tested, but doesn't seem to have any effect.After the first encounter is created, every five seconds or so (presumably related to SpacePop, LOWEST in Freelancer.ini, didn't track it down any further than that) there's a (density - ships) / repop_time chance of creating another ship/encounter (didn't test which). Of course, if ships >= density nothing is created; ships is the current number of ships in the zone (or perhaps vicinity). I only tested that in a non-overlapping zone, presumably overlapping zones have the sum I found earlier come into play.
Posted on: 5/1 14:02
|
|||
|
Re: Trying to understand how NPC spawning works? |
||||
---|---|---|---|---|
Just popping in
![]() ![]() Joined:
2009/8/19 4:03 From Qld, Aus.
Group:
Registered Users
Posts:
12
![]() |
Huh, so you reckon repop_time isn't related to time at all, but is only a variable in the chance to spawn? That would explain why stuff seems so random - it's literally always been a chance every 5 seconds, not a cooldown.
Thanks Adoxa, this is terrific to learn. I'll try following your formula you've uncovered and see if things start doing what I'd expect. Looking at what I have set up now, I can see that in a certain field in my mod, I have Density 16, Repop Time 420 - so without any enemies present, that would be 16 divided by 420 for 0.038 or a 3.8% chance for anything to spawn, every 5 seconds. Thinking about it, this makes a ton of sense why sometimes I get dry runs that seem to last forever, and other times, I just seem to luck out and get constant spawns. Excellent investigating, thank you so much for saving my sanity here. Is there any way to adjust how often that chance pops? Make it roll every minute or two instead? EDIT: I see now that I can experiment with the Spacepop value you noted, I might try setting it to BELOW_NORMAL, NORMAL, HIGHEST so on and see what happens if anything. Being able to adjust when the chance is rolled in any way would help smooth out this randomness a lot - having the chance be rolled every minute or thirty seconds, but a lot higher chance to spawn, for instance, would be a lot more reliable to balance with. Same as being able to adjust that per zone/encounter/whatever for different spawn rates, but that's icing on the cake. EDIT: Also, lol at the #17 at 17:17 - I'm same timezone as you so I saw it the same ![]()
Posted on: 5/2 2:44
|
|||
|
Re: Trying to understand how NPC spawning works? |
||||
---|---|---|---|---|
Home away from home
![]() ![]() Joined:
2009/8/16 2:58 From Qld, Aus.
Group:
Registered Users FLServer Admins Trusted Speciality Developers Senior Members
Posts:
2035
![]() |
Content.dll, 0BA57A, 3.0f, SpacePop "heartbeat" interval (seconds)
Posted on: 5/2 4:12
|
|||
|
Re: Trying to understand how NPC spawning works? |
||||
---|---|---|---|---|
Quite a regular
![]() ![]() Joined:
2008/2/14 21:37 From İstanbul, Turkey
Group:
Registered Users Wiki editors $$$ Supporters $$$
Posts:
176
![]() |
Absolutely incredible work adoxa, thankyou for this! I've added the SpacePop offset to the Limit Breaking page. Presumably the formula is similar for
relief_time only that it occurs during encounters rather than between them?
Posted on: 5/2 6:59
|
|||
|
Re: Trying to understand how NPC spawning works? |
||||
---|---|---|---|---|
Home away from home
![]() ![]() Joined:
2009/8/16 2:58 From Qld, Aus.
Group:
Registered Users FLServer Admins Trusted Speciality Developers Senior Members
Posts:
2035
![]() |
It seems when a battle ends (or perhaps when there are no more ships), a timer starts, at heartbeat intervals; no ships will spawn during the
relief_time .
Posted on: 5/2 7:06
|
|||
|
Re: Trying to understand how NPC spawning works? |
||||
---|---|---|---|---|
Home away from home
![]() ![]() Joined:
2009/8/16 2:58 From Qld, Aus.
Group:
Registered Users FLServer Admins Trusted Speciality Developers Senior Members
Posts:
2035
![]() |
I had
density = 4 & max_battle_size = 8 ; loading a game had five ships; during a battle another three eventually spawned, thus it seems max_battle_size is pretty much what it says.Now I'll let you do more experimental tests...
Posted on: 5/2 9:04
|
|||
|
Re: Trying to understand how NPC spawning works? |
||||
---|---|---|---|---|
Home away from home
![]() ![]() Joined:
2010/2/17 20:45 From Germany
Group:
Registered Users Senior Members
Posts:
511
![]() |
density is a soft cap. If there's space for still 1 more ship to spawn, the game still may throw an entire encounter into the zone.density_restriction on the other hand is a hard limit on an npc's ship-class from the encounter files.Also it should be noted the game does behave differently if you spawn into a zone via connecting/loading/docking/jumping, and when you fly into one. @adoxa I noticed especially there that the game can spawn encounters with 18 ships max. With a little weird thing here. Spawning into a zone of those encounters spawns them fine. When flying in the zone, the server dies. But when I have the encounter with 17 ships, the server survives it.
Posted on: 5/2 22:08
|
|||
How to create .SUR files - Tutorial | ||||
|
Re: Trying to understand how NPC spawning works? |
||||
---|---|---|---|---|
Just popping in
![]() ![]() Joined:
2009/8/19 4:03 From Qld, Aus.
Group:
Registered Users
Posts:
12
![]() |
The 18 ship crash thing is good to know, thanks Skotty.
Adoxa, thank you again for putting the pin on this; I can say now after a week this seems a totally solved issue. Your formula and understanding is bang on target in every way I can confirm, and your offset for the spawning interval heartbeat has worked perfectly. This has completely changed our mod overnight a thousand times for the better, and we now have perfect control over what spawns when and tons of room for nuance in the future. Thank you so much! It's the difference between night and day, and I'm super grateful to you for helping us get there. Just going to pop in the right google search words in case someone's trying to search engine find this in the future - this is how Freelancer NPC spawning works!
Posted on: 5/7 22:23
|
|||
|
Re: Trying to understand how NPC spawning works? |
||||
---|---|---|---|---|
Home away from home
![]() ![]() Joined:
2009/8/16 2:58 From Qld, Aus.
Group:
Registered Users FLServer Admins Trusted Speciality Developers Senior Members
Posts:
2035
![]() |
@Beagle: glad it worked out.
@Skotty.: do you have a crash offset? Although if it's a stack overflow it might not help much. Is replication just a matter of high density/size?
Posted on: 5/8 0:55
|
|||
|
Re: Trying to understand how NPC spawning works? |
||||
---|---|---|---|---|
Quite a regular
![]() ![]() Joined:
2015/1/18 12:56 From The Hague, EU
Group:
Registered Users
Posts:
115
![]() |
from this post by fox in my todo list:
Quote:
While trying to fix this problem, I found that NPCs won't spawn if the max spawn distance Quote:
is below 2500. The following patch fixes this: Code: content.dll, C1771, 7A --> EB = allow NPC max spawn distance below 2500 ~Gold_Sear @Ruppetthemuppet: I currently cannot display the 101 list, is this correct?
Posted on: 5/11 12:13
|
|||
|
Re: Trying to understand how NPC spawning works? |
||||
---|---|---|---|---|
Quite a regular
![]() ![]() Joined:
2008/2/14 21:37 From İstanbul, Turkey
Group:
Registered Users Wiki editors $$$ Supporters $$$
Posts:
176
![]() |
Quote:
My bad! I broke the list up into pages by category a few days ago, and in doing so broke the existing link. Here's the new one: https://wiki.the-starport.net/FL%20Binaries/limit-breaking/ Unfortunately the wiki search module isn't as good as I'd hoped, so I may end up recombining it or at least consider new/clearer categories for the offsets here.
Posted on: 5/13 10:34
|
|||
|