Preview Mod Upgrade Issues


Recommended Posts

  • Developer

Lots of breaking changes for modders, take note! If you run into any problems upgrading your mods, please discuss it here. :)

    [*]In-game mod management and mod info! Now all mods require a modinfo.lua which has lots of cool/important information in it. This will be shown to everyone who installs the mod, and also helps the game know if the mod is out-of-date or has been updated. See one of the sample mods for an example.

    [*]Atlases! All .tex files need to have an accompanying atlas definition in the form of an .xml. This will primarily affect inventory images as well. In many cases, where just a texture was specified (or automatic!) the atlas must now also be specified. (See the updated sampleprefab to see how inventory images are handled.)

      [*]UI elements need to have their atlases specified as well. (See sample below)

      [*]Recipes need to have their atlases specified as well. (See sample below)

      [*]Inventory items need to have their atlases specified. (See sample below)

    [*]inventoryimages path has changed to images/inventoryimages, so all mods with resources and recipes will need to shuffle their assets around.

    [*]Changed the way modmain is loaded during worldgen, so that it's easier to "inject" presets and other tweaks to the gen process. (See sample below)

UI element atlas code:

[FONT=arial]         inst.components.container.[/FONT][FONT=arial]widgetbgatlas = "path/to/atlas.xml"[/FONT][FONT=arial]         inst.components.container.[/FONT][FONT=arial]widgetbgimage = "image.tex" -- the image defined in the atlas[/FONT]
Recipe atlas code:

[FONT=arial]    local myrecipe = GLOBAL.Recipe( "myprefab", { Ingredient("wall_wood_item", 10), Ingredient("turf_carpetfloor", 10), Ingredient("slurtleslime", 10) }, RECIPETABS.TOWN, 2)[/FONT][FONT=arial]myrecipe[/FONT][FONT=arial].atlas = "images/inventoryimages/[/FONT][FONT=arial]myprefabatlas.xml" -- has 'myprefab.tex' specified inside it.[/FONT]
Inventory item code:

inst:AddComponent("inventoryitem")inst.components.inventoryitem.atlasname = "images/inventoryimages/myitematlas.xml"
Worldgen code sample:

[FONT=arial]GLOBAL.require("map/levels")[/FONT][FONT=arial]-- find an existing preset:[/FONT][FONT=arial]local darknes = nil[/FONT][FONT=arial]for k,level in ipairs(GLOBAL.levels.sandbox_[/FONT][FONT=arial]levels) do[/FONT][FONT=arial]    if [/FONT]level.id[FONT=arial] == "COMPLETE_DARKNESS" then[/FONT][FONT=arial]         darkness = level[/FONT][FONT=arial]         break[/FONT][FONT=arial]    end[/FONT][FONT=arial]end[/FONT][FONT=arial]-- do some kind of modification, like adding a new task[/FONT][FONT=arial]table.insert(darkness.tasks, "Guarded For a nice walk")[/FONT][FONT=arial]-- add a new preset:[/FONT][FONT=arial]local my_preset = GLOBAL.Level({[/FONT][FONT=arial]    id = "MY_PRESET",[/FONT][FONT=arial]    name = "My lovely preset!",[/FONT][FONT=arial]    tasks = {[/FONT][FONT=arial]              "Make a pick",[/FONT][FONT=arial]              "Easy Blocked Dig that rock",[/FONT][FONT=arial]              "Great Plains",[/FONT][FONT=arial]              "Guarded Speak to the king",[/FONT][FONT=arial]    },[/FONT][FONT=arial]    overrides = {},[/FONT][FONT=arial]})[/FONT][FONT=arial]table.insert(GLOBAL.levels.[/FONT][FONT=arial]sandbox_levels, my_preset)[/FONT]
Edited by Ipsquiggle
Link to comment
Share on other sites

  • Developer

Indeed! It is unfortunate timing that this system change followed right after the last one, but I sure hope this won't be a regular occurrence... :)I've already gone through the conversion process a dozen times in testing this stuff out, so definitely let me know if you have any problems!

Link to comment
Share on other sites

I've got my Sips mod working for the Test branch except for a few "Niggly" bits, I've done the U/V mapping for the .xml. except on the character select screen, Sips shows up as Wilson, with Wilson's Big picture, and Wilson's select screen images, If you can help me with this that'd be Wonderful! (Just as a notice: In-game the anims are all fine and everything so I think im right in assuming the .xmls are to blame here)Cheers

Link to comment
Share on other sites

Why are we loading modsettings.lua if it is no longer in use?Feature request: dependencies. Enable one mod impossible unless x mod also enabled. Disabling x mod automatically disables dependent mod.What are we doing about load order? I badly need a priority tag in modinfo.lua to prioritize load order. For example if I have a mod adding a component to every character, that mod needs to be loaded after all custom characters are loaded.Also strongly recommend different color values for when a mod is "not available" and "not enabled".The length of the string of the modname is quite limited in the mod screen display. I've got 3 mods with names cut off.Why are we giving a version number if it isn't displayed in mod screen display?

Edited by Heavenfall
Link to comment
Share on other sites

These instructions

local myrecipe = GLOBAL.Recipe( "myprefab", { Ingredient("wall_wood_item", 10), Ingredient("turf_carpetfloor", 10), Ingredient("slurtleslime", 10) }, RECIPETABS.TOWN, 2)    chestrecipe.atlas = "images/inventoryimages/myprefabatlas.xml" -- has 'myprefab.tex' specified inside it.
are unclear. It should be
local myrecipe = GLOBAL.Recipe( "myprefab", { Ingredient("wall_wood_item", 10), Ingredient("turf_carpetfloor", 10), Ingredient("slurtleslime", 10) }, RECIPETABS.TOWN, 2)    myrecipe.atlas = "images/inventoryimages/myprefabatlas.xml" -- has 'myprefab.tex' specified inside it.
Link to comment
Share on other sites

Edit: This was solved by adding Asset("ANIM", "data/anim/beard.zip"), to the summonbeard prefab instead.

This mod has been updated for the test branch. It creates a new tab with a recipe that allows you to summon a beard for any character. It works with "It's not a rock" update, but now crashes the game with no information in log.txt when used for anyone except Wilson.

https://dl.dropboxusercontent.com/u/32649007/HF_summonbeard.rar

If I add this to the character's asset list

	Asset("ANIM", "data/anim/beard.zip"),
then it works as before and does not crash. This was not necessary in It's Not a Rock. What has changed, and what can I do about it? Edited by Heavenfall
Link to comment
Share on other sites

Err, just to clarify, how much does this effect custom built characters? Assuming it will break them, how do I go about updating them to work with the new system?

Well I see they've already included the modinfo.lua in the sample character folder. Give me a minute and I'll see how things are.Edit: This is going to be fun. Edited by Xina42
Link to comment
Share on other sites

Nothing seems to work to add new image to world customization screen. So how to add new images to world customization screen?That samples and code fragments you posted here don't work at all. Folders from images are gone, don't know what path I should use now, no matter what I put in my mod folder game tries to load texture from customization.tex.

Edited by _Q_
Link to comment
Share on other sites

  • Developer

I've got my Sips mod working for the Test branch except for a few "Niggly" bits, I've done the U/V mapping for the .xml. except on the character select screen, Sips shows up as Wilson, with Wilson's Big picture, and Wilson's select screen images, If you can help me with this that'd be Wonderful! (Just as a notice: In-game the anims are all fine and everything so I think im right in assuming the .xmls are to blame here)Cheers

I'll have a look into this and let you know, thanks!
Link to comment
Share on other sites

Declared image in modmainAssets = { Asset("ATLAS", "mods/Map Settings/images/customisation/mushrooms.xml"), Asset("IMAGE", "mods/Map Settings/images/customisation/mushrooms.tex"),}Added my line to customise.lua:["mushrooms"] = {value = "default", enable = true, spinner = nil, image = "mods/Map Settings/images/customisation/mushrooms.tex"}, Getting the same error over an over again:WARNING! Could not set texture: 'mods/Map Settings/images/customisation/mushrooms.tex' from atlas 'data/images/customisation.xml'data/images/customisation.xml

Link to comment
Share on other sites

  • Developer

Why are we loading modsettings.lua if it is no longer in use?

Good catch, I forgot about that.

Feature request: dependencies. Enable one mod impossible unless x mod also enabled. Disabling x mod automatically disables dependent mod.What are we doing about load order? I badly need a priority tag in modinfo.lua to prioritize load order. For example if I have a mod adding a component to every character, that mod needs to be loaded after all custom characters are loaded.

This was on my todo, but it didn't make it in. I'll see if I can get something simple in so that your libraries will at least still work until I get a proper dependency solution in.

Also strongly recommend different color values for when a mod is "not available" and "not enabled".

Good call, thanks.

The length of the string of the modname is quite limited in the mod screen display. I've got 3 mods with names cut off.

Noted! Can you post the names for reference? We'll see if we can improve that...

Why are we giving a version number if it isn't displayed in mod screen display?

Again, just a feature that didn't reach completion for this release. Since right now updating mods is a purely manual process I didn't think there was much value in adding the version to the mod screen (correct me if I'm wrong!) but I did want to get mod developers in the habit of including this metadata.As always, thanks for your feedback. :)
Link to comment
Share on other sites

  • Developer

These instructions

local myrecipe = GLOBAL.Recipe( "myprefab", { Ingredient("wall_wood_item", 10), Ingredient("turf_carpetfloor", 10), Ingredient("slurtleslime", 10) }, RECIPETABS.TOWN, 2)    chestrecipe.atlas = "images/inventoryimages/myprefabatlas.xml" -- has 'myprefab.tex' specified inside it.
are unclear. It should be
local myrecipe = GLOBAL.Recipe( "myprefab", { Ingredient("wall_wood_item", 10), Ingredient("turf_carpetfloor", 10), Ingredient("slurtleslime", 10) }, RECIPETABS.TOWN, 2)    myrecipe.atlas = "images/inventoryimages/myprefabatlas.xml" -- has 'myprefab.tex' specified inside it.
Fixed. Thanks. :)
Link to comment
Share on other sites

  • Developer

If I add this to the character's asset list

    Asset("ANIM", "data/anim/beard.zip"),
then it works as before and does not crash. This was not necessary in It's Not a Rock. What has changed, and what can I do about it?
A lot of change changes under the hood which have necessitated using assets are related to asset loading; we've been combing over our prefabs and so forth looking for issues and problems. I don't know about this specifically, but I'm guessing that the bear was previous accidentally being loaded more often then it should, so it was "just working" before. Now you have to explicitly declare that you want that asset loaded, just as you would with other assets.

In general, you can often get away with not declaring assets that are "probably" loaded somewhere else by one of our prefabs, but that's not certain, and will probably be less true in the future as we optimize. It's always best to explicitly declare assets that your prefab uses, including animations, sound banks, textures, and also dependent prefabs using the 'prefabs' list (not the 'assets' list).

Link to comment
Share on other sites

  • Developer

[MENTION=39861]RobRichards[/MENTION], [MENTION=56156]Gigatoast[/MENTION], [MENTION=33765]Xina42[/MENTION], [MENTION=7222]DaverGamer[/MENTION]I'll put together a "character upgrade tutorial" this morning to make this as clear as possible. Sorry for the confusion. :(

Link to comment
Share on other sites

  • Developer

Declared image in modmainAssets = { Asset("ATLAS", "mods/Map Settings/images/customisation/mushrooms.xml"), Asset("IMAGE", "mods/Map Settings/images/customisation/mushrooms.tex"),}Added my line to customise.lua:["mushrooms"] = {value = "default", enable = true, spinner = nil, image = "mods/Map Settings/images/customisation/mushrooms.tex"}, Getting the same error over an over again:WARNING! Could not set texture: 'mods/Map Settings/images/customisation/mushrooms.tex' from atlas 'data/images/customisation.xml'data/images/customisation.xml

Looks like this part got missed. I'll get a fix in, thanks for reporting it.
Link to comment
Share on other sites

  • Developer

Dawnbreak - golden butterfly

Summons - chaotic buildable wormhole

Unlock all released characters

Thanks!

So once an asset is loaded it is available for everything in the client until the game is closed?

Not quite; assets are refcounted and then identified by name. So if, say, wilson prefab loads the beard build, then that resource is loaded and available by it's name, anything technically can access it. However, if the wilson prefab unloads (not something that really happens now, but may in the future), then the resource would be unloaded because "nothing else is using it", then anything else trying to access it by name would fail. (Also the build would be inaccessible before wilson is loaded.) However, if your prefab also says it uses the beard build, then both wilson and your prefab would have to be unloaded before the resource is freed.
Link to comment
Share on other sites

[MENTION=39861]RobRichards[/MENTION], [MENTION=56156]Gigatoast[/MENTION], [MENTION=33765]Xina42[/MENTION], [MENTION=7222]DaverGamer[/MENTION]I'll put together a "character upgrade tutorial" this morning to make this as clear as possible. Sorry for the confusion. :(

Don't worry about it Ipsquiggle! You and everyone have been so very helpful!
Link to comment
Share on other sites

[MENTION=39861]RobRichards[/MENTION], [MENTION=56156]Gigatoast[/MENTION], [MENTION=33765]Xina42[/MENTION], [MENTION=7222]DaverGamer[/MENTION]I'll put together a "character upgrade tutorial" this morning to make this as clear as possible. Sorry for the confusion. :(

Very much appreciated! Now I'll have to do another tutorial myself, haha. Not that I mind. It's fun and I absolutely LOVE the template making things easier as it is.
Link to comment
Share on other sites

  • Developer

[MENTION=39861]RobRichards[/MENTION], [MENTION=56156]Gigatoast[/MENTION], [MENTION=33765]Xina42[/MENTION], [MENTION=7222]DaverGamer[/MENTION]Tutorial is here! http://forums.kleientertainment.com/showthread.php?22670-Upgrading-character-mods-to-work-with-Public-Preview&p=221000#post221000Note that some of your issues may actually be caused by a bug which will be fixed in tomorrow's release. :)

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share