Custom Asteroids

Custom Asteroids

21.6k Downloads

Unlimited Spawning in 64-bit KSP for Linux

Starstrider42 opened this issue · 9 comments

commented

When using the custom spawner, asteroids do not get removed from the game and just pile up. This bug does not occur with the stock spawner, though that may be because it sets the spawn rate based on the number of untracked asteroids.

commented

Hi, sorry for the lack of support. I'll be trying to fix the astrolice bug (which now appears on all OSes???) before the next release.

To answer your last question, files like *.csproj tend to be IDE-specific (e.g., a different editor might call them *.project, or call them *.csproj but use a different format), and they are ALWAYS machine-specific. My experience has been that committing such files for the repository causes work for anybody whose computer (in particular, file system) is set up differently from the committer's. It's a lesser of two evils thing.

commented

Yeah, I left I reply in the thread; similarly, I cannot reproduce this on x86_64 KSP for Linux. At least in a new game at high warp.

commented

Confirmed that I can't reproduce this in 64-bit KSP for Windows... 😦

commented

I've never been able to use this mod without reproducing this issue - I'm also on Linux x64.

On my first trip to the Mun, my game started slowing down massively after using time warp - which is when I noticed that there hundreds and hundreds of near Kerbin asteroids.

I can disable the custom spawner, but I'd prefer to have your system - just without the astrolice. :)

commented

If I nuke all references to distributions, things sort of start to work; at least I don't have the astrolice problem anymore. However, I'm seeing some other errors:

[LOG 11:40:36.256] CustomAsteroids: asteroid discovered at UT 127675469.769374
[LOG 11:40:36.257] CustomAsteroids: caught spawn of Ast. EXY-977
[LOG 11:40:36.257] CustomAsteroids: drawing orbit from mainBelt_outer
[EXC 11:40:36.258] ArgumentOutOfRangeException: RandomDist.drawLogUniform(): In a log-uniform distribution, all parameters must be positive (gave a = 0, b = 1)
Parameter name: a
    Starstrider42.CustomAsteroids.RandomDist.drawLogUniform (Double a, Double b)
    Starstrider42.CustomAsteroids.Population+ValueRange.draw ()
    Starstrider42.CustomAsteroids.Population.drawOrbit ()
    Rethrow as InvalidOperationException: CustomAsteroids: could not create orbit
    Starstrider42.CustomAsteroids.Population.drawOrbit ()
    Starstrider42.CustomAsteroids.AsteroidManager.editAsteroid (.Vessel asteroid)
    Rethrow as BadPopulationException: CustomAsteroids: Selected invalid population mainBelt_outer
    Starstrider42.CustomAsteroids.AsteroidManager.editAsteroid (.Vessel asteroid)
    Starstrider42.CustomAsteroids.SpawnCatcher.CatchAsteroidSpawn (.Vessel vessel)
    UnityEngine.Debug:LogException(Exception)
    Starstrider42.CustomAsteroids.SpawnCatcher:CatchAsteroidSpawn(Vessel)
    EventData`1:Fire(Vessel)
    ProtoVessel:Load(FlightState)
    Game:AddVessel(ConfigNode)
    ScenarioDiscoverableObjects:SpawnAsteroid()
    Starstrider42.CustomAsteroids.CustomAsteroidSpawner:Update()

Additionally, none of the asteroids are named correctly - and I do have:

RenameAsteroids = True

in GameData/CustomAsteroids/PluginData/Custom Asteroid Settings.cfg.

commented

From where I'm standing, it looks like there is probably a small bug in setting up your enums before parsing from the config files - I'm not sure why it only happens on Linux x64, but hopefully it'll be an easy and/or quick fix now that we've narrowed down where the issue is.

The fact that asteroids aren't being renamed I have no ideas on, however.

Let me know if you need any additional debugging information or other things to try.

commented

I seem to see a lot of this in the logs as the infestation starts (note that this is with the most recent experimental release - the one after v1.1.0):

[LOG 11:01:48.624] CustomAsteroids: asteroid discovered at UT 126125914.521019
[LOG 11:01:48.625] CustomAsteroids: caught spawn of Ast. KCJ-231
[EXC 11:01:48.626] ArgumentException: The requested value 'Gaussian' was not found.
    System.Enum.Parse (System.Type enumType, System.String value, Boolean ignoreCase)
    System.Enum.Parse (System.Type enumType, System.String value)
    ConfigNode.ParseEnum (System.Type enumType, System.String vectorString)
    ConfigNode.ReadValue (System.Type fieldType, System.String value)
    ConfigNode.ReadObject (System.Object obj, .ConfigNode node)
    ConfigNode.ReadObject (. field, .ConfigNode node)
    ConfigNode.ReadObject (System.Object obj, .ConfigNode node)
    ConfigNode.LoadObjectFromConfig (System.Object obj, .ConfigNode node, Int32 pass, Boolean removeAfterUse)
    ConfigNode.LoadObjectFromConfig (System.Object obj, .ConfigNode node)
    Starstrider42.CustomAsteroids.PopulationLoader.Load ()
    Rethrow as TypeInitializationException: An exception was thrown by the type initializer for Starstrider42.CustomAsteroids.PopulationLoader
    Starstrider42.CustomAsteroids.PopulationLoader.Load ()
    Starstrider42.CustomAsteroids.AsteroidManager..cctor ()
    Rethrow as TypeInitializationException: An exception was thrown by the type initializer for Starstrider42.CustomAsteroids.AsteroidManager
    Starstrider42.CustomAsteroids.SpawnCatcher.CatchAsteroidSpawn (.Vessel vessel)
    EventData`1[Vessel].Fire (.Vessel data)
    ProtoVessel.Load (.FlightState st)
    Game.AddVessel (.ConfigNode protoVesselNode)
    ScenarioDiscoverableObjects.SpawnAsteroid ()
    Starstrider42.CustomAsteroids.CustomAsteroidSpawner.Update ()
commented

If I nuke all references to Gaussian, it just picks a different thing to be upset about (Isotropic, I think.)

commented

So, after a few hours figuring out how to build a KSP mod and building CustomAsteroids myself, I don't see this issue anymore.

I made a few code changes - mostly adding debugging and catching more generic exceptions at one point - but I think the main issue was simply building it for 0.90.0.

I'll need to revert some of my changes and see if things still work.

As an aside - is there any particular reason there's no *.csproj comitted? I'm normally a Ruby dev, so I'm unfamiliar with best practices for C#; it took me a good while to put together a working *.csproj myself, and longer to figure out that I could ditch the IDE and use xbuild from the CLI. Would you be against a pull request that adds these build files to the repository?