myxal

solved
Need help with sprite overreach

10 posts in this topic

Posted (edited)

Hi. First off, I apologise for mis- and dis-use of technical terms, I've never done game graphics before. (With that in mind, ELI5 ;) )

I'm trying to fix Afro1967's DST Freezer - specifically, the issue that the mouse prompt will change to open/close well outside the opaque area of the mod's sprite (this is really annoying around crockpots):

As I understand the code, the sprites for opened/closed freezer are in the anim/freezer.zip:

...
local assets=
{
	Asset("ANIM", "anim/freezer.zip"),
	Asset( "ATLAS", "images/inventoryimages/ui_freezer_3x4.xml"),
	Asset( "IMAGE", "images/inventoryimages/ui_freezer_3x4.tex"),
}

local function onopen(inst)
	inst.AnimState:PlayAnimation("open")
	inst.SoundEmitter:PlaySound("dontstarve/wilson/chest_open")

	inst.Light:Enable(true)
end

local function onclose(inst)
	inst.AnimState:PlayAnimation("closed")
	inst.SoundEmitter:PlaySound("dontstarve/wilson/chest_close")
	inst.Light:Enable(false)
end
...

So I put that into krane -> ktech -> imagemagick to look at the frames' alpha channel. There is a smudge in the lower left, but nothing like the huge area where I get the open/close prompt.

 

I tried cleaning up the png, using the new version to replace the tex file in freezer zip, but that didn't help (at least not much).

How should I go about fixing this? (Bonus points for mac/linux-compatible tools).

 

symbol0-1.png

symbol0-2.png

Edited by myxal
Marking solved

Share this post


Link to post
Share on other sites

I believe the image definetely needs more polishing and possibly could be that it was not quite positioned in the center while doing the anims. I'm not aware that the code has any effect on the onmouse hitboxes, 99% is the png not being competely clean or wrong-positioned spriter anims. 

1 person likes this

Share this post


Link to post
Share on other sites

Well, I ran the animation through krane, cleaned up the images, recompiled with scml (built from Corgi's fork, since Klei's mod tools are a mess), and... the animation is invisible :( 

Something must be wrong with one of the tools, and I suspect krane. (paging @simplex) The lua code refers to "closed" and "open" animations, but the exported scml has the animations named "closed_90s" and "open_90s". But even if I change the name (in the lua code), nothing is visible, the game just produces an unhelpful message:

[00:00:45]: AnimationFile::LoadFile Failed to open ../mods/workshop-790531664/anim/freezer.zip

Being desperate, I tried downscaling the png's (also making appropriate changes in the scml file by sed). No dice. If anyone wants to take a stab at it, here's the Spriter project: 

freezer-spriter.zip

freezer.zip - the new compiled animation (with shrunk png's) which fails to load.

freezer-repack.zip - the old build of the animation, with just the texture cleaned up (this works, but has the overreach issue)

freezer_enh.zip - the mod itself. Perishable v2 is required.

@Lampofulmine, what exactly is the "right" position of images in the spriter anim? Looking at this anim as well as that of the chest, the origin should be the point which will sit on the same place on the ground when the view is rotated, right? That appears to be OK. 

Screen Shot 2017-05-18 at 19.31.11.png

Edited by myxal
mmy mistake - freezer-repack.zip displays without issues even on lates build

Share this post


Link to post
Share on other sites

Success! I re-created the .scml from scratch in Spriter (using cleaned-up textures), compiled it, and the sprite now works fine! :) 

1 person likes this

Share this post


Link to post
Share on other sites
4 hours ago, Lampofulmine said:

Great to know ! :) So it was just a matter of redoing the spriter with the new designs uh !

 

Having looked at the scml file, simply disassembling and rebuilding the animation with new designs should have been enough (no Spriter needed), but something bugged out, probably in krane. The animation was thankfully trivial, I'd hate to have to do this for something significant  :wilson_shocked:- even the humble chest has half a dozen different animations, and stuff actually moves there! :wilson_curious:

Share this post


Link to post
Share on other sites

You using ktools as you are on... Mac or lynux ? Tbh I prefer having someone on a windows doing the compiling via the autocompling as its a tad more reliable than krane and ktech 

Share this post


Link to post
Share on other sites

Mac, used for both ktools and compiling tools (had to get Corgi's fork, because, well...). I think I'll play with this some more and report the krane issue to simplex if I can reproduce it.

 

Share this post


Link to post
Share on other sites
5 hours ago, Lampofulmine said:

Tbh I prefer having someone on a windows doing the compiling via the autocompling as its a tad more reliable than krane and ktech 

Actually, is there any other tool (even for windows), which can convert compiled animation back into spriter project? (Mod authors don't normally need such a thing, since they have the spriter project themselves..)

Share this post


Link to post
Share on other sites

that I'm aware of the ktools of simplex was the only thing I knew used for decompiling; i remember something called Handsome Matt tools or on those lines but probably was only for compiling

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now