FractalUK / KSPInterstellar

KSP Instellar Mod for Kerbal Space Program
115 stars 67 forks source link

Microwave fixes #72

Closed Boris-Barboris closed 9 years ago

Boris-Barboris commented 9 years ago

There was a problem with updating microwave network stats. Recievers didn't know about changing values of transmitters. The list of transmitters was parsed (from WarpPlugin.cfg) by reciever only during startup (no dynamic power changing), wich is bad. There was also a trivial problem of waste heat generated independently of reciever gain amount. There is no need to poke file system so frequently also. Now the lists of microwave emitters and relays are part of the addon, wich updates them once per 40 frames. WarpPlugin.cfg code in Microwave... classes was deleted. Instead, persistent values needed for background power computations are switched to float type and saved using standard KSP PartModule mechanics. Relay optimal way search algorithm call frequency has changed to once per 10 physic steps. It may be decreased, but it's viable only for fast-rotating crafts. Assuming the computational cost of this procedure (MicrowavePowerReceiver.GetConnectedTransmitters), i would recomment evading every physics frame recalculations.

More testing is advised, but i didn't changed much really. Only architectural changes.