Modding Help SOLVED - Fatal crash when loading a dungeon with a custom door in it

Discussion in 'Starbound Modding' started by Grimstuff, Jun 15, 2017.

  1. Grimstuff

    Grimstuff Void-Bound Voyager

    I'm having a rather strange issue that I can't seem to find anything wrong that would be causing it.

    I'm trying to do some custom dungeon building with some custom tileset assets. All of them work and function flawlessly.. except for custom doors for some reason. Even when just verbatim renaming vanilla doors and adding them to my tileset.. it leads to the fatal error, which seems to be some sort of deep memory error and gives little useful info.
    Code:
    [22:11:20.910] [Info] Chat: <server> Lets do the space warp again
    [22:11:21.608] [Error] Fatal Error: Access violation detected at 006A2DC0 (Write of address 88000B03)
    [0] 2d9e7a Star::captureStack
    [1] 2da0b2 Star::fatalError
    [2] 2d5972 Star::SignalHandlerImpl::sehTrampoline
    [3] a05350 __RTDynamicCast
    [4] 6a1157 std::make_shared<Star::Tiled::Tileset,Star::Json>
    [5] 6a65f9 Star::TilesetDatabase::readTileset
    [6] 6a0486 Star::LruCacheBase<Star::OrderedMapWrapper<Star::FlatHashMap,Star::String,std::shared_ptr<Star::Tiled::Tileset const >,Star::BlockAllocator<std::pair<Star::String const ,std::shared_ptr<Star::Tiled::Tileset const > >,1024>,Star::hash<Star::String,void>,std::equal_to<Star::String> > >::get<std::shared_ptr<Star::Tiled::Tileset const > (__cdecl*)(Star::String const &)>
    [7] 6a372c Star::TilesetDatabase::get
    [8] 3d60a1 Star::Dungeon::TMXTilesets::TMXTilesets
    [9] 3d3a24 std::_Ref_count_obj<Star::Dungeon::TMXTilesets>::_Ref_count_obj<Star::Dungeon::TMXTilesets><Star::List<Star::Json,std::allocator<Star::Json> > >
    [10] 3d4334 std::make_shared<Star::Dungeon::TMXTilesets,Star::List<Star::Json,std::allocator<Star::Json> > >
    [11] 3d498b Star::Dungeon::TMXMap::TMXMap
    [12] 3d4127 std::make_shared<Star::Dungeon::TMXMap const ,Star::Json>
    [13] 3d81b4 Star::Dungeon::TMXPartReader::readAsset
    [14] 3c2cd5 Star::Dungeon::Part::Part
    [15] 3b7107 std::_Ref_count_obj<Star::Dungeon::Part const >::_Ref_count_obj<Star::Dungeon::Part const ><Star::DungeonDefinition * &,Star::Json const &,std::shared_ptr<Star::Dungeon::ImagePartReader> >
    [16] 3be5da std::make_shared<Star::Dungeon::Part const ,Star::DungeonDefinition * &,Star::Json const &,std::shared_ptr<Star::Dungeon::TMXPartReader> >
    [17] 3cf7ee Star::Dungeon::parsePart
    [18] 3c147d Star::DungeonDefinition::DungeonDefinition
    [19] 3beb0d std::make_shared<Star::DungeonDefinition,Star::MapMixin<Star::FlatHashMap<Star::String,Star::Json,Star::hash<Star::String,void>,std::equal_to<Star::String>,std::allocator<std::pair<Star::String const ,Star::Json> > > >,Star::String>
    [20] 3d0c26 Star::DungeonDefinitions::readDefinition
    [21] 3c4fcc <lambda_fab381630aca2e218e1f837b76d16368>::operator()
    [22] 3bd47b Star::LruCacheBase<Star::OrderedMapWrapper<Star::FlatHashMap,Star::String,std::shared_ptr<Star::DungeonDefinition>,Star::BlockAllocator<std::pair<Star::String const ,std::shared_ptr<Star::DungeonDefinition> >,1024>,Star::hash<Star::String,void>,std::equal_to<Star::String> > >::get<<lambda_fab381630aca2e218e1f837b76d16368> >
    [23] 3cc23a Star::DungeonDefinitions::get
    [24] 7b767b Star::WorldTemplate::determineWorldName
    [25] 7b3ea5 Star::WorldTemplate::WorldTemplate
    [26] 6bddda std::_Ref_count_obj<Star::WorldTemplate>::_Ref_count_obj<Star::WorldTemplate><std::shared_ptr<Star::VisitableWorldParameters> &,Star::SkyParameters &,unsigned __int64 &>
    [27] 6c93bd std::make_shared<Star::WorldTemplate,std::shared_ptr<Star::VisitableWorldParameters> &,Star::SkyParameters &,unsigned __int64 &>
    [28] 6d0490 <lambda_10e0fa6c7ce35e1daae1bf9f24a9035a>::operator()
    [29] 6bf756 std::_Invoker_functor::_Call<<lambda_10e0fa6c7ce35e1daae1bf9f24a9035a> &>
    [30] 6c56b6 std::invoke<<lambda_10e0fa6c7ce35e1daae1bf9f24a9035a> &>
    [31] 6c1866 std::_Invoke_ret<std::shared_ptr<Star::WorldServerThread>,<lambda_10e0fa6c7ce35e1daae1bf9f24a9035a> &>
    [32] 6d5c5a std::_Func_impl<<lambda_10e0fa6c7ce35e1daae1bf9f24a9035a>,std::allocator<int>,std::shared_ptr<Star::WorldServerThread> >::_Do_call
    [33] 5e995a std::_Func_class<std::shared_ptr<Star::MaterialDatabase> >::operator()
    [34] 6d21c9 <lambda_69ab9e8f29e0ff082f6537ebd158a3b6>::operator()
    [35] 2d2132 Star::WorkerPool::WorkerThread::run
    [36] 2d6d6c Star::ThreadImpl::runThread
    [37] 748162c4 BaseThreadInitThunk
    [38] 77d00fd9 RtlSubscribeWnfStateChangeNotification
    [39] 77d00fa4 RtlSubscribeWnfStateChangeNotification
    
    Attached are the assets and dungeon I'm working with if anyone can find a problem with them. It's pretty much just the vanilla microdungeon template being used as a mission testingground. The door on the right (marshthatchdoor) is added from my tileset, and gives the crash if it's not removed. The vanilla door on the left loads fine. If I place my custom door in-game, it also works fine.

    I'm accessing it via the standard /warp instanceworld:examplemission
    Let me know if I need to add any more of my mod's assets in there for it to load, i tried to keep it lightweight.

    Like I said, all my jsons are validating, I've copied the resources direct from vanilla reference, all other objects are working even interactables.. I'm pretty stumped.
     

    Attached Files:

    Last edited: Jun 15, 2017
  2. Grimstuff

    Grimstuff Void-Bound Voyager

    Oh dear lord. After a couple hours of bashing my head against this I think I finally solved it.

    Looks like Tiled quit stepping up the "tilecount" property of the tileset JSON as I added new stuff for some reason, it was stuck to "tilecount" : 26, while the tileset actually had two or three more than that. I'm not sure why only the door specifically broke since it actually a lower ID than other objects I tested succesfully, but maybe it's just whichever gets loaded last in memory or something. I'll take it regardless.

    But yeah, seems the tilecount property needs to be set 1 higher than your actual number of tiles you have in a tileset. Hopefully this helps someone else googling this issue someday.
     
  3. projectmayhem

    projectmayhem Ketchup Robot

    Would you mind making a little tutorial on how you added to a tileset? Id love to add some of my custom objects into my mods microdungeons
     
  4. Grimstuff

    Grimstuff Void-Bound Voyager

    Sure np. It's done with the latest Tiled editor, so if you're still using 0.15 or whatever the Starbound-friendly version is, go ahead and download the archive of the new 1.0 version to use with it. Still keep the old one if you got it though as it works better for general mapping in SB.

    Pretty much File -> New.. Tileset. Select 'Collection of Images' and save it as a .JSON in your Starbound\assets\packed\tilesets\packed\customname folder. I use the extracted packed folder instead of the mod folder cuz Tiled gets whiney if it doesn't have all the game's assets available to it. Just copy your modded files over to your mod folder after to test n release em.

    From there click the + icon at the top and add the image you want Tiled to use for your object. I haven't run into any problems using the actual item's graphics so far, except for multi-framed animated stuff like chests. Gotta make an extra graphic of only the 1st frame for those.

    You have to add custom properties to each item. Open up one of the vanilla tilesets and copy their properties to use as a template. It'll look like:

    [​IMG]

    To get the row and column spacing setup right, I had to open up one of the vanilla JSONs too and copy it's variables and paste them into mine. Doesn't matter too much though since it's just visual.

    And ya, make sure the tilecount line is counting up while you'll in there.
     
    Last edited: Jun 16, 2017
    projectmayhem likes this.
  5. projectmayhem

    projectmayhem Ketchup Robot

    Thank you :)
     

Share This Page