* Add GNU Octave script for tuning singularity engine. startsingularityengine is now properly tuned & sets up radiation collectors. FTLize RadiationCollectorComponent. * Fix bugs with radiation collectors producing infinite power. * Ensure singularities don't instantly annihilate other singularities (causing new singularities to instantly dissolve) Technically found by a "bug" where a singularity generator would make multiple singularities, but this renders that bug harmless. * Tune singularity shield emitters to hopefully randomly fail less, and add an Octave script for looking into that * Fix singularity shader * Map in an unfinished PA into Saltern * Correct PA particles being counted twice by singularity calculations, add singulo food component * Hopefully stop "level 1 singulo stuck in a corner" issues by freezing it when it goes to level 1 from any other level * Apply suggestions on 'jazz' PR
66 lines
1.9 KiB
Matlab
66 lines
1.9 KiB
Matlab
# This is a script to be loaded into GNU Octave.
|
|
|
|
# - Notes -
|
|
# + Be sure to check all parameters are up to date with game before use.
|
|
# + This plots *worst-case* performance, the assumption is that it shouldn't ever randomly fail.
|
|
# + The assumption is that there is one emitter per shield point.
|
|
# + Keep in mind that to prevent the generator being destroyed, either shield must be above a limit.
|
|
# This limit is (level*2)+1.
|
|
# The timestep used for simulation is one second.
|
|
|
|
global emitter_state emitter_timer shield_energy
|
|
|
|
emitter_state = 0
|
|
emitter_timer = 0
|
|
shield_energy = 0
|
|
|
|
function shield_clamp ()
|
|
global shield_energy
|
|
# ContainmentFieldConnection.SharedEnergyPool
|
|
shield_energy = min(max(shield_energy, 0), 25)
|
|
endfunction
|
|
function shield_tick ()
|
|
global shield_energy
|
|
shield_energy -= 1
|
|
shield_clamp()
|
|
endfunction
|
|
function shield_hit ()
|
|
global shield_energy
|
|
emitter_count = 2 # one per connection side
|
|
receive_power = 6 # ContainmentFieldGeneratorComponent.IStartCollide.CollideWith
|
|
power_per_connection = receive_power / 2 # ContainmentFieldGeneratorComponent.ReceivePower
|
|
shield_energy += power_per_connection * emitter_count
|
|
shield_clamp()
|
|
endfunction
|
|
|
|
function retval = scenario (x)
|
|
global emitter_state emitter_timer shield_energy
|
|
# Tick (degrade) shield
|
|
shield_tick()
|
|
# Timer...
|
|
if emitter_timer > 0
|
|
emitter_timer -= 1
|
|
else
|
|
# Note the logic here is written to match how EmitterComponent does it.
|
|
# Fire first...
|
|
shield_hit()
|
|
# Then check if < fireBurstSize
|
|
if emitter_state < 3
|
|
# Then increment & reset
|
|
emitter_state += 1
|
|
# to fireInterval
|
|
emitter_timer = 2
|
|
else
|
|
# Reset state
|
|
emitter_state = 0
|
|
# Worst case, fireBurstDelayMax
|
|
emitter_timer = 10
|
|
endif
|
|
endif
|
|
retval = shield_energy
|
|
endfunction
|
|
|
|
# x is in seconds.
|
|
x = 0:1:960
|
|
plot(x, arrayfun(@scenario, x))
|