. . . Posted June 8, 2024 Share Posted June 8, 2024 I just want to do it to see if I can get more performance by removing most stuff the game has to load as a test for myself to see what impact does all the textures and prefabs have on loading times for my poor hdd. Any help would be greatly appreciated Link to comment https://forums.kleientertainment.com/forums/topic/156736-is-there-a-way-to-prevent-the-game-from-loading-a-vanilla-textureprefab/ Share on other sites More sharing options...
_zwb Posted June 10, 2024 Share Posted June 10, 2024 Theoretically you can modify the PREFABFILES table defined in prefablist.lua to prevent loading a prefab 1 Link to comment https://forums.kleientertainment.com/forums/topic/156736-is-there-a-way-to-prevent-the-game-from-loading-a-vanilla-textureprefab/#findComment-1722549 Share on other sites More sharing options...
Wonderlarr Posted June 15, 2024 Share Posted June 15, 2024 On 6/8/2024 at 1:36 PM, . . . said: I just want to do it to see if I can get more performance by removing most stuff the game has to load as a test for myself to see what impact does all the textures and prefabs have on loading times for my poor hdd. Any help would be greatly appreciated Preventing it from loading would be quite the task, would deleting it instantly also work? You could do an AddPrefabPostInit("prefab", function(inst) inst:Remove() end) 1 Link to comment https://forums.kleientertainment.com/forums/topic/156736-is-there-a-way-to-prevent-the-game-from-loading-a-vanilla-textureprefab/#findComment-1725353 Share on other sites More sharing options...
. . . Posted June 16, 2024 Author Share Posted June 16, 2024 On 6/10/2024 at 8:08 AM, _zwb said: Theoretically you can modify the PREFABFILES table defined in prefablist.lua to prevent loading a prefab thank you. i will hopefully attempt this soon and see if it can work 23 hours ago, Wonderlarr said: Preventing it from loading would be quite the task, would deleting it instantly also work? You could do an AddPrefabPostInit("prefab", function(inst) inst:Remove() end) i don't think deleting it would work because the whole point is to make the game not even add the prefab/assets to speed up the game's initial loading time and loading times to get into worlds. whether it actually would speed up loading times or not i don't 100% know but thats why i want to try it because when i use mods that are huge like uncompromising mode, cherry forest, ect. that add a looooot of stuff it increases loading times by a fair amount so i imagine the game's own assets being less for stuff i dont care for not loading would speed up the loading time if more stuff increases loading times Link to comment https://forums.kleientertainment.com/forums/topic/156736-is-there-a-way-to-prevent-the-game-from-loading-a-vanilla-textureprefab/#findComment-1725744 Share on other sites More sharing options...
Wonderlarr Posted July 10, 2024 Share Posted July 10, 2024 On 6/15/2024 at 8:49 PM, . . . said: thank you. i will hopefully attempt this soon and see if it can work i don't think deleting it would work because the whole point is to make the game not even add the prefab/assets to speed up the game's initial loading time and loading times to get into worlds. whether it actually would speed up loading times or not i don't 100% know but thats why i want to try it because when i use mods that are huge like uncompromising mode, cherry forest, ect. that add a looooot of stuff it increases loading times by a fair amount so i imagine the game's own assets being less for stuff i dont care for not loading would speed up the loading time if more stuff increases loading times While the initial generation of the world would be the same, world loading is much much faster if there are fewer prefabs. You may wanna give it a try anyway. 1 Link to comment https://forums.kleientertainment.com/forums/topic/156736-is-there-a-way-to-prevent-the-game-from-loading-a-vanilla-textureprefab/#findComment-1734176 Share on other sites More sharing options...
. . . Posted July 26, 2024 Author Share Posted July 26, 2024 On 6/10/2024 at 8:08 AM, _zwb said: Theoretically you can modify the PREFABFILES table defined in prefablist.lua to prevent loading a prefab Hey again! Sorry for a late reply, I finally want to get to trying this out and I realized something... I have no idea how to modify a table hahaha... Would you happen to know how to do that by any chance to give me an example ? Link to comment https://forums.kleientertainment.com/forums/topic/156736-is-there-a-way-to-prevent-the-game-from-loading-a-vanilla-textureprefab/#findComment-1737867 Share on other sites More sharing options...
_zwb Posted July 27, 2024 Share Posted July 27, 2024 20 hours ago, . . . said: Hey again! Sorry for a late reply, I finally want to get to trying this out and I realized something... I have no idea how to modify a table hahaha... Would you happen to know how to do that by any chance to give me an example ? RemoveByValue(PREFABFILES, "acorn") This would be rather slow because RemoveByValue uses linear search 1 Link to comment https://forums.kleientertainment.com/forums/topic/156736-is-there-a-way-to-prevent-the-game-from-loading-a-vanilla-textureprefab/#findComment-1737984 Share on other sites More sharing options...
. . . Posted July 28, 2024 Author Share Posted July 28, 2024 @_zwb Thanks a lot that seemed to work for disabling the prefabs from loading completely as I was able to test and I did indeed get less (or a LOT less) loading time based on how many prefabs I removed even with my old HDD! Another question if you know how I can do this too! I'd like to prevent the game from loading skin assets to see if that would improve my loading time as well. Mostly the vanilla character skin assets because I exclusively play with mod characters I see the "skin_assets.lua" file but the thing inside of it with all the assets is local is there a way I can remove stuff from that? Or heck can I just disable all skins from loading at all if possible by doing something to it? I'd do anything for more loading time because I can't get a better PC and DST is practically all I really play lol Link to comment https://forums.kleientertainment.com/forums/topic/156736-is-there-a-way-to-prevent-the-game-from-loading-a-vanilla-textureprefab/#findComment-1738032 Share on other sites More sharing options...
_zwb Posted July 30, 2024 Share Posted July 30, 2024 (edited) On 7/28/2024 at 2:11 AM, . . . said: I see the "skin_assets.lua" file but the thing inside of it with all the assets is local is there a way I can remove stuff from that? Or heck can I just disable all skins from loading at all if possible by doing something to it? I'd do anything for more loading time because I can't get a better PC and DST is practically all I really play lol If you want to disable all skins: local assets = require("skin_assets") for i = 1, #assets do assets[i] = nil end Use at your own risk. Also, the binary search method for preventing prefabs from loading: local function BinarySearch(list, value) local low = 1 local high = #list while low ~= high do local index = math.ceil((low + high) / 2) if list[index] > value then high = index -1 elseif list[index] < value then low = index + 1 else return index end end end local file_to_remove = { "abigail", "acorn," } -- collecting indices first because binary search requires a sorted list, nil value holes will break that local index_to_remove = {} for _, prefab_file in pairs(file_to_remove) do local index = BinarySearch(PREFABFILES, prefab_file) if index then index_to_remove[#index_to_remove + 1] = index end end for _, index in pairs(index_to_remove) do PREFABFILES[index] = nil end On my device it takes less than a second to do this with 600 files so I really don't know how much of a difference this would make, you could check this by: local t1 = GetTime() -- insert code above local t2 = GetTime() print("Time to remove those files:", t2 - t1) Edited July 30, 2024 by _zwb code comment 1 Link to comment https://forums.kleientertainment.com/forums/topic/156736-is-there-a-way-to-prevent-the-game-from-loading-a-vanilla-textureprefab/#findComment-1738264 Share on other sites More sharing options...
. . . Posted July 31, 2024 Author Share Posted July 31, 2024 (edited) On 7/29/2024 at 8:57 PM, _zwb said: Also, the binary search method for preventing prefabs from loading: Hey, I tried using this new technique, but it seems it crashes the game for me? gamelogic.lua"]:432: attempt to index local 'world' (a nil value) I don't know what I did wrong all I did was add a GLOBAL for the PREFABFILES then it doesn't crash and added the prefabs I want to remove, but if this is too much effort to fix that's fine I will use the old RemoveByValue because that seemed to help too even if it's costly. Spoiler local function BinarySearch(list, value) local low = 1 local high = #list while low ~= high do local index = math.ceil((low + high) / 2) if list[index] > value then high = index -1 elseif list[index] < value then low = index + 1 else return index end end end local file_to_remove = { "antchovies", "antchovies_group", "diviningrod", "diviningrodbase", "migration_portal", "adventure_portal", "cotl_tabernacle", "archive_resonator", "scrapbook_notes", "scrapbook_page", "cookingrecipecard", "hats_lavaarena", "armor_lavaarena", "books_lavaarena", "hammer_mjolnir", "spear_gungnir", "spear_lance", "lavaarena", "lavaarena_abigail", "lavaarena_abigail_flower", "lavaarena_battlestandard", "lavaarena_beetletaur", "lavaarena_bernie", "lavaarena_blooms", "lavaarena_boarlord", "lavaarena_boaron", "lavaarena_boarrior", "lavaarena_center", "lavaarena_creature_spawn_fx", "lavaarena_crowdstand", "lavaarena_elemental", "lavaarena_eventstages", "lavaarena_firebomb", "lavaarena_floorgrate", "lavaarena_fossilizing", "lavaarena_groundlifts", "lavaarena_heavyblade", "lavaarena_lootbeacon", "lavaarena_lucy", "lavaarena_meteor", "lavaarena_network", "lavaarena_peghook", "lavaarena_portal", "lavaarena_rhinobuff", "lavaarena_rhinobumpfx", "lavaarena_rhinodrill", "lavaarena_snapper", "lavaarena_spawner", "lavaarena_trails", "lavaarena_turtillus", "quagmire", "quagmire_altar", "quagmire_altar_statue", "quagmire_beefalo", "quagmire_book_fertilizer", "quagmire_book_shadow", "quagmire_burnt_ingredients", "quagmire_casseroledish", "quagmire_coins", "quagmire_cooking_buff", "quagmire_crabtrap", "quagmire_crates", "quagmire_eventstages", "quagmire_evergreen", "quagmire_fern", "quagmire_fish", "quagmire_flour", "quagmire_food_burnt", "quagmire_foods", "quagmire_goatkid", "quagmire_goatmilk", "quagmire_goatmum", "quagmire_grill", "quagmire_hoe", "quagmire_key", "quagmire_lamp_post", "quagmire_mealingstone", "quagmire_mushrooms", "quagmire_mushroomstump", "quagmire_network", "quagmire_oldstructures", "quagmire_oven", "quagmire_parkspike", "quagmire_pebblecrab", "quagmire_plantables", "quagmire_plates", "quagmire_pond", "quagmire_portal", "quagmire_portal_key", "quagmire_pot", "quagmire_pot_hanger", "quagmire_safe", "quagmire_salt_rack", "quagmire_salts", "quagmire_sap", "quagmire_sapbucket", "quagmire_seedpackets", "quagmire_shadowwaxwell", "quagmire_slaughtertool", "quagmire_soil", "quagmire_spiceshrub", "quagmire_sugarwoodtree", "quagmire_swampig", "quagmire_swampig_house", "quagmire_swampigelder", "quagmire_syrup", "quagmire_traders" } -- collecting indices first because binary search requires a sorted list, nil value holes will break that local index_to_remove = {} for _, prefab_file in pairs(file_to_remove) do local index = BinarySearch(GLOBAL.PREFABFILES, prefab_file) if index then index_to_remove[#index_to_remove + 1] = index end end for _, index in pairs(index_to_remove) do GLOBAL.PREFABFILES[index] = nil end Edited July 31, 2024 by . . . Link to comment https://forums.kleientertainment.com/forums/topic/156736-is-there-a-way-to-prevent-the-game-from-loading-a-vanilla-textureprefab/#findComment-1738436 Share on other sites More sharing options...
_zwb Posted August 1, 2024 Share Posted August 1, 2024 3 hours ago, . . . said: Hey, I tried using this new technique, but it seems it crashes the game for me? gamelogic.lua"]:432: attempt to index local 'world' (a nil value) I don't know what I did wrong all I did was add a GLOBAL for the PREFABFILES then it doesn't crash and added the prefabs I want to remove, but if this is too much effort to fix that's fine I will use the old RemoveByValue because that seemed to help too even if it's costly. Hide contents local function BinarySearch(list, value) local low = 1 local high = #list while low ~= high do local index = math.ceil((low + high) / 2) if list[index] > value then high = index -1 elseif list[index] < value then low = index + 1 else return index end end end local file_to_remove = { "antchovies", "antchovies_group", "diviningrod", "diviningrodbase", "migration_portal", "adventure_portal", "cotl_tabernacle", "archive_resonator", "scrapbook_notes", "scrapbook_page", "cookingrecipecard", "hats_lavaarena", "armor_lavaarena", "books_lavaarena", "hammer_mjolnir", "spear_gungnir", "spear_lance", "lavaarena", "lavaarena_abigail", "lavaarena_abigail_flower", "lavaarena_battlestandard", "lavaarena_beetletaur", "lavaarena_bernie", "lavaarena_blooms", "lavaarena_boarlord", "lavaarena_boaron", "lavaarena_boarrior", "lavaarena_center", "lavaarena_creature_spawn_fx", "lavaarena_crowdstand", "lavaarena_elemental", "lavaarena_eventstages", "lavaarena_firebomb", "lavaarena_floorgrate", "lavaarena_fossilizing", "lavaarena_groundlifts", "lavaarena_heavyblade", "lavaarena_lootbeacon", "lavaarena_lucy", "lavaarena_meteor", "lavaarena_network", "lavaarena_peghook", "lavaarena_portal", "lavaarena_rhinobuff", "lavaarena_rhinobumpfx", "lavaarena_rhinodrill", "lavaarena_snapper", "lavaarena_spawner", "lavaarena_trails", "lavaarena_turtillus", "quagmire", "quagmire_altar", "quagmire_altar_statue", "quagmire_beefalo", "quagmire_book_fertilizer", "quagmire_book_shadow", "quagmire_burnt_ingredients", "quagmire_casseroledish", "quagmire_coins", "quagmire_cooking_buff", "quagmire_crabtrap", "quagmire_crates", "quagmire_eventstages", "quagmire_evergreen", "quagmire_fern", "quagmire_fish", "quagmire_flour", "quagmire_food_burnt", "quagmire_foods", "quagmire_goatkid", "quagmire_goatmilk", "quagmire_goatmum", "quagmire_grill", "quagmire_hoe", "quagmire_key", "quagmire_lamp_post", "quagmire_mealingstone", "quagmire_mushrooms", "quagmire_mushroomstump", "quagmire_network", "quagmire_oldstructures", "quagmire_oven", "quagmire_parkspike", "quagmire_pebblecrab", "quagmire_plantables", "quagmire_plates", "quagmire_pond", "quagmire_portal", "quagmire_portal_key", "quagmire_pot", "quagmire_pot_hanger", "quagmire_safe", "quagmire_salt_rack", "quagmire_salts", "quagmire_sap", "quagmire_sapbucket", "quagmire_seedpackets", "quagmire_shadowwaxwell", "quagmire_slaughtertool", "quagmire_soil", "quagmire_spiceshrub", "quagmire_sugarwoodtree", "quagmire_swampig", "quagmire_swampig_house", "quagmire_swampigelder", "quagmire_syrup", "quagmire_traders" } -- collecting indices first because binary search requires a sorted list, nil value holes will break that local index_to_remove = {} for _, prefab_file in pairs(file_to_remove) do local index = BinarySearch(GLOBAL.PREFABFILES, prefab_file) if index then index_to_remove[#index_to_remove + 1] = index end end for _, index in pairs(index_to_remove) do GLOBAL.PREFABFILES[index] = nil end It seems like you must load files calling the function "event_server_data", I guess some C-side shenanigans is happening here 1 Link to comment https://forums.kleientertainment.com/forums/topic/156736-is-there-a-way-to-prevent-the-game-from-loading-a-vanilla-textureprefab/#findComment-1738453 Share on other sites More sharing options...
. . . Posted August 6, 2024 Author Share Posted August 6, 2024 On 7/31/2024 at 9:02 PM, _zwb said: It seems like you must load files calling the function "event_server_data", I guess some C-side shenanigans is happening here Ya. it's very weird. I got rid of the one file in my mod calling that and the crash still happened. It's fine though, thank you very much for all your help! Link to comment https://forums.kleientertainment.com/forums/topic/156736-is-there-a-way-to-prevent-the-game-from-loading-a-vanilla-textureprefab/#findComment-1739530 Share on other sites More sharing options...
_zwb Posted August 6, 2024 Share Posted August 6, 2024 4 minutes ago, . . . said: Ya. it's very weird. I got rid of the one file in my mod calling that and the crash still happened. are you sure there's only one file calling that? 1 Link to comment https://forums.kleientertainment.com/forums/topic/156736-is-there-a-way-to-prevent-the-game-from-loading-a-vanilla-textureprefab/#findComment-1739531 Share on other sites More sharing options...
. . . Posted August 7, 2024 Author Share Posted August 7, 2024 (edited) Here's a quick mod I made it literally just has the code for removing the prefabs it gives the same crash. Idk if it's because I'm trying to remove event prefabs? This is the crash Spoiler [00:03:03]: [string "scripts/gamelogic.lua"]:432: attempt to index local 'world' (a nil value) LUA ERROR stack traceback: scripts/gamelogic.lua:432 in (upvalue) PopulateWorld (Lua) <395-702> savedata = table: 000000000E0AF630 profile = table: 000000004AE77040 savedata_overrides = table: 000000000E9C6B20 world = nil scripts/gamelogic.lua:976 in (upvalue) DoInitGame (Lua) <859-1055> savedata = table: 000000000E0AF630 profile = table: 000000004AE77040 was_file_load = false options = table: 0000000032167170 Levels = table: 000000004254D310 scripts/gamelogic.lua:1103 in () ? (Lua) <1099-1105> success = true world_table = table: 000000000E0AF630 =[C]:-1 in (method) SetPersistentStringInClusterSlot (C) <-1--1> scripts/shardindex.lua:59 in () ? (Lua) <45-63> load_success = false str = date_created = 1723063117 data = return { created=1723063117, saved=1723063117 } =[C]:-1 in (method) GetPersistentStringInClusterSlot (C) <-1--1> scripts/shardindex.lua:65 in (method) WriteTimeFile (Lua) <43-69> self (valid:true) = valid = true slot = 1 session_id = 76723DEAB55BC944 ismaster = true version = 5 server = table: 0000000032161770 isdirty = false shard = Master enabled_mods = table: 0000000032166E00 world = table: 0000000032161C20 callback = function - scripts/gamelogic.lua:1099 filename = shardindex_time onreadtimefile = function - scripts/shardindex.lua:45 scripts/shardindex.lua:328 in () ? (Lua) <327-329> =[C]:-1 in (method) SetPersistentStringInClusterSlot (C) <-1--1> scripts/shardindex.lua:31 in (method) Save (Lua) <19-41> self (valid:true) = valid = true slot = 1 session_id = 76723DEAB55BC944 ismaster = true version = 5 server = table: 0000000032161770 isdirty = false shard = Master enabled_mods = table: 0000000032166E00 world = table: 0000000032161C20 callback = function - scripts/shardindex.lua:327 data = return { enabled_mods={ ["Disable prefabs from loading"]={ configuration_options={ }, enabled=true } }, server={ clan={ admin=false, id="", only=false }, description="", encode_user_path=true, game_mode="survival", max_players=6, name="Test World", online_mode=false, password="", playstyle="survival", privacy_type=2, pvp=false, server_language="en", use_legacy_session_path=false }, session_id="76723DEAB55BC944", version=5, world={ options={ desc="The standard Don't Starve experience.", hideminimap=false, id="SURVIVAL_TOGETHER", location="forest", max_playlist_position=999, min_playlist_position=0, name="Survival", numrandom_set_pieces=4, override_level_string=false, overrides={ alternatehunt="default", angrybees="default", antliontribute="default", autumn="default", bananabush_portalrate="default", basicresource_regrowth="none", [**truncated**] filename = shardindex scripts/shardindex.lua:330 in () ? (Lua) <323-331> onsaved = function - scripts/shardindex.lua:327 =[C]:-1 in (method) SerializeWorldSession (C) <-1--1> scripts/networking.lua:326 in (global) SerializeWorldSession (Lua) <325-327> data = local savedata = {} local tablefunctions = {} tablefunctions["world_network_fn"] = function() return {persistdata={seasons={remainingdaysinseason=20,totaldaysinseason=40,season="autumn",elapseddaysinseason=0}}} end savedata["world_network"] = tablefunctions["world_network_fn"]() tablefunctions["mods_fn"] = function() return {["Disable prefabs from loading"]={active=true}} end savedata["mods"] = tablefunctions["mods_fn"]() tablefunctions["meta_fn"] = function() return {build_version="624447",level_id="SURVIVAL_TOGETHER",saveversion=5.151,build_date="2789",generated_on_saveversion=5.151,seed=1442021754,session_identifier="76723DEAB55BC944",build_time="13:59:39"} end savedata["meta"] = tablefunctions["meta_fn"]() savedata["ents"] = {} tablefunctions["ents_moon_al [00:03:03]: [string "scripts/gamelogic.lua"]:432: attempt to index local 'world' (a nil value) LUA ERROR stack traceback: scripts/gamelogic.lua:432 in (upvalue) PopulateWorld (Lua) <395-702> scripts/gamelogic.lua:976 in (upvalue) DoInitGame (Lua) <859-1055> scripts/gamelogic.lua:1103 in () ? (Lua) <1099-1105> =[C]:-1 in (method) SetPersistentStringInClusterSlot (C) <-1--1> scripts/shardindex.lua:59 in () ? (Lua) <45-63> =[C]:-1 in (method) GetPersistentStringInClusterSlot (C) <-1--1> scripts/shardindex.lua:65 in (method) WriteTimeFile (Lua) <43-69> scripts/shardindex.lua:328 in () ? (Lua) <327-329> =[C]:-1 in (method) SetPersistentStringInClusterSlot (C) <-1--1> scripts/shardindex.lua:31 in (method) Save (Lua) <19-41> scripts/shardindex.lua:330 in () ? (Lua) <323-331> =[C]:-1 in (method) SerializeWorldSession (C) <-1--1> scripts/networking.lua:326 in (global) SerializeWorldSession (Lua) <325-327> scripts/shardindex.lua:333 in (method) OnGenerateNewWorld (Lua) <322-334> scripts/gamelogic.lua:1123 in (field) cb (Lua) <1095-1125> scripts/screens/worldgenscreen.lua:146 in (method) OnUpdate (Lua) <124-155> scripts/frontend.lua:737 in (method) Update (Lua) <687-889> scripts/update.lua:95 in () ? (Lua) <33-138> and here's the sample mod if you want to try it yourself Disable prefabs from loading.zip Also, I had no client mods enabled and no other mods enabled either. I tried generating a no-cave world and a world with caves and joining both type of worlds that already existed and the same crash occurred each time. Edited August 7, 2024 by . . . Link to comment https://forums.kleientertainment.com/forums/topic/156736-is-there-a-way-to-prevent-the-game-from-loading-a-vanilla-textureprefab/#findComment-1739682 Share on other sites More sharing options...
_zwb Posted August 7, 2024 Share Posted August 7, 2024 Honestly I have no idea. 1 Link to comment https://forums.kleientertainment.com/forums/topic/156736-is-there-a-way-to-prevent-the-game-from-loading-a-vanilla-textureprefab/#findComment-1739703 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now