From Naevwiki
Jump to: navigation, search

With version 0.5.0, Naev has moved from the old security system to a presence model. The reason behind this is that the security index was misleading, in that the values displayed on the map could not be compared to each other (did not mean the same thing from one system to the next). Additionally, a new method of spawning faction ships has been implemented, working through Lua as opposed to presence fleets defined in XML.

The workings of presence

Presence is a scalar index of how strongly a faction is present in a system. The higher the presence index, the more and the bigger the ships for that faction that will show up.

Presence is generated by assets. Assets come in two varieties: real assets and virtual assets. Real assets are object in space, typically planets and stations. Virtual assets are not present on the playing field, they only serve to generate presence.

Each asset generates a certain amount of presence for a single faction. The generated presence may also "spill" over into neighboring systems, up to several jumps away. With distance from the generating asset, the presence added declines. This mechanic allows factions to have presence in systems just outside their own space.

Ship spawning

Ship spawning is handled in Lua. Each faction has its own spawn script, which allows for fine-tuned spawning behavior. The scripts can be found in ai/spawn.

Though the implementation of each spawn script is independent, most scripts use the common code found in ai/spawn/common.lua.

Spawn scripts are called periodically, the period being governed by the spawn scripts themselves. The spawn hook of each script must return a number, this number being the amount of seconds before the next call to the spawn script. When a spawn script is called, it is passed the total current presence in use by the faction, as well as the maximum presence allowed for the faction in this system. The latter value is the same value displayed on the galaxy map. It is up to the spawn script to manage spawn rates, actual presence use of ships and fleets, and adherence to the maximum cap.