Modding Help terrestrial_worlds.config threatRange crash bug?

Discussion in 'Starbound Modding' started by hairlessOrphan, Aug 5, 2016.

  1. hairlessOrphan

    hairlessOrphan Void-Bound Voyager

    I'm trying to mod my universe to expand the threat levels of all planet types, and it's causing weird intermittent crashes on the title screen.

    I've patched the threatRange to be [1, 6] for Garden planets and [2, 6] for all other land planets, and [2, 7] for all oceanic planets (ocean, toxic, magma). It seems to work just fine.*

    If I then change Forest and Desert planets to [1, 6], I'll sometimes get crashes on the title screen, and other times it'll work fine. I *think* it has to do with choosing a random planet to display on the title screen? That's the only thing that makes sense to me.

    * it is possible that [1, 6] is just straight-up illegal for planets on the title screen, but it's not trying to generate a Garden planet on the title screen, so I'm not seeing the crash...

    For reference:
    1) /player/ and /universe/ folders are deleted.
    2) terrestrial_worlds.config patched to change threatRange as mentioned above
    3) celestial.config patched to allow all planets to spawn on all stars (for all PlanetaryTypes and SatelliteTypes entries, Tier1 is still only ["garden"] but all other PlanetaryTypes/Tiers are [ ... all planet types ... ] and all other SatelliteTypes/Tiers are [ ... all non-oceanic planet types ... ]

    The stack trace:

    [16:59:11.606] [Error] Application: exception thrown, shutting down: (JsonException) Improper conversion to JsonArray from null
    [0] 13f841ee3 Star::captureStack
    [1] 13f840c6e Star::StarException::StarException
    [2] 13f7dc49a Star::JsonException::format<Star::String>
    [3] 13f7e3542 Star::Json::arrayPtr
    [4] 13f7e5c1b Star::Json::iterateArray
    [5] 13f7f4743 Star::jsonToStringList
    [6] 13fd2d4f4 <lambda_b281a88132011bb1da50e1fb4331058a>::eek:perator()
    [7] 13fd2c647 <lambda_9b90d835a31ab143b25cc55435178821>::eek:perator()
    [8] 13fd33041 Star::generateTerrestrialWorldParameters
    [9] 13f8db09e Star::CelestialParameters::CelestialParameters
    [10] 13f8ce911 Star::CelestialMasterDatabase::produceSystem
    [11] 13f8cd186 Star::CelestialMasterDatabase::produceChunk
    [12] 13f8c0965 <lambda_5d19a1acb183cfb675f6c83fec5499ae>::eek:perator()
    [13] 13f8c0bb7 <lambda_aaefc9877b118a050fceb7a5e12a87e5>::eek:perator()
    [14] 13f8b94da Star::LruCacheBase<Star::OrderedMapWrapper<std::unordered_map,Star::Vector<int,2>,std::pair<__int64,Star::CelestialChunk>,Star::BlockAllocator<std::pair<Star::Vector<int,2> const ,std::pair<__int64,Star::CelestialChunk> >,1024>,Star::hash<Star::Vector<int,2>,void>,std::equal_to<Star::Vector<int,2> > > >::get<<lambda_aaefc9877b118a050fceb7a5e12a87e5> >
    [15] 13f8d11de Star::CelestialMasterDatabase::scanSystems
    [16] 13f8ca229 Star::CelestialMasterDatabase::findRandomWorld
    [17] 13ffeac97 Star::TitleScreen::TitleScreen
    [18] 13f779a81 std::_Ref_count_obj<Star::TitleScreen>::_Ref_count_obj<Star::TitleScreen><std::shared_ptr<Star::playerStorage> & __ptr64,std::shared_ptr<Star::Mixer> >
    [19] 13f77ea40 std::make_shared<Star::TitleScreen,std::shared_ptr<Star::playerStorage> & __ptr64,std::shared_ptr<Star::Mixer> >
    [20] 13f785d6a Star::ClientApplication::changeState
    [21] 13f78c174 Star::ClientApplication::update
    [22] 13fec14e1 Star::SdlPlatform::run
    [23] 13fec169d Star::runMainApplication
    [24] 13f78eff6 WinMain


    Any idea what might be causing the crash? Apparently, I can't attach .rar or .patch files, so I'll try to find somewhere to upload the mod files if anyone wants to see the syntax, but they're standard patch: replace ops, and my JSON is ok.

    As a secondary issue, the reason I'm trying to change the threatRange to [1, 6] is it seems like the threatRange is calculated as "min < random <= max," which means that [1, 1] will generate threat level 1 worlds, but [1, 2] will only generate threat level 2 worlds, and [2, 6] will only generate threat levels 3,4,5,6. That's an observation from using [2, 6], scanning a few dozen stars (~100 worlds), and not finding any threat-level 2 worlds.

    This would mean it's impossible to generate threat-level 1 worlds UNLESS the planet is ONLY allowed to be threat-level 1 (because 0 appears to be an invalid number for the threatLevel range). Is this observation correct, does anyone know? If so, it'd be nice to have the threatRange calculate as "min <= random <= max" instead.
     
    Celestial Dragon likes this.

Share This Page