Freelancer Community Network
Reminder: Internet Explorer 6 or below are NOT supported.
HomeHome
ForumForum
WikiWiki
DownloadsDownloads
ForgeForge
Multiplayer Connection Tutorial
Collapse/Expand Random Image
Collapse/Expand Login
Username:

Password:

Remember me



Lost Password?

Register now!
Collapse/Expand Chat
Collapse/Expand Who's Online
143 user(s) are online (76 user(s) are browsing Forum)

Members: 0
Guests: 143

more...
Collapse/Expand Donations
Monthly costs: -30€
Income (ads): +5€
Donations (last month): +0€

Current balance: 55€
(last updated 04/2021)

Please make a donation if you want to help keeping The-Starport online:

Thanks!
Collapse/Expand Links
Collapse/Expand Advertisement
There are currently 62 users playing Freelancer on 44 servers.
May. 29, 2023

Browsing this Thread:   1 Anonymous Users



 Bottom   Previous Topic   Next Topic  Register To Post

« 1 (2)


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
Offline
Just so we're testing the same thing, would you be able to send me your zone/encounter?

Posted on: 4/23 2:17
Top
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
Offline
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:

;Permutations of 1 enemies per spawn

;Perm 0, 1 MFs
[EncounterFormation]
ship_by_class = 1, 1, bmod_sc_heavy_fighters
pilot_job = scout_job
make_class = wanderer
formation_by_class = fighters
behavior = wander
arrival = all, -tradelane, -object_jump_gate
allow_simultaneous_creation = yes
zone_creation_distance = 0
times_to_create = infinite


[Creation]
;1-2 Enemy Cap

;Perm 0, 1-2 MFs
permutation = 0, 1


Code:

[zone]
nickname = Zone_Li03_Cheyenne_field
ids_name = 261217
pos = 61910, 0, -39659
rotate = 0, 30, 0
shape = ELLIPSOID
size = 17000, 10000, 30000
property_flags = 64
visit = 32
spacedust = asteroiddust
spacedust_maxparticles = 50
ids_info = 65930
sort = 25
toughness = 10
density = 10
repop_time = 300
max_battle_size = 10
pop_type = lootable_field
relief_time = 1200
encounter = bmod_area_fc_x_grp_scouts_1, 3, 1
faction = fc_x_grp, 1
Music = zone_field_asteroid_rock


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
Top
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
Offline
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
Top
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
Offline
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
Top
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
Offline
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
Top
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
Offline
Content.dll, 0BA57A, 3.0f, SpacePop "heartbeat" interval (seconds)

Posted on: 5/2 4:12
Top
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
Offline
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
Top
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
Offline
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
Top
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
Offline
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
Top
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
Offline
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
Top
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
Offline
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
Top
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
Offline
@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
Top
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
Offline
from this post by fox in my todo list:
Quote:

foxUnit01 wrote:
Quote:


Code:

    content.dll, C4C01, 500f, min distance from player position at spawn moment that an NPC patrol with arrival = cruise will fly to when spawned ~Gold_Sear, M0tah
    content.dll, C4C06, 2000f, max distance from player position at spawn moment that an NPC patrol with arrival = cruise will fly to when spawned ~Gold_Sear, M0tah


This poses a problem when spawn range is big. Instead, it should be from the spawn position, not player position.


Increasing these does help large spawn ranges, but it is annoying. It'd be nice if this behavior could be eliminated altogether. As it stands, even with higher ranges, there's a good chance high-range NPCs will end up cruising behind you, since this point is picked at spawn time and could be picked to the side of (or behind) your position at the time.

While trying to fix this problem, I found that NPCs won't spawn if the max spawn distance
Quote:

content.dll, 11BC68, 2500d, NPC max spawn distance in SP and MP ~Dev

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
Top
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
Offline
Quote:

@Ruppetthemuppet: I currently cannot display the 101 list, is this correct?


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
Top
« 1 (2)