Jump to content

New Asset Tools: Animations, Textures, Sounds And Layouts!


Ipsquiggle
 Share

Recommended Posts

It sounds like you've got it right though I've never expressed it in those terms so I may be overlooking. How I would phrase the process:

 

Prior to being processed by the buildanimations.py script, the build specifies the size and offset of a symbol, an anim keyframe specifies a transform matrix for a symbol. An animated object is a clump of quads of those particular sizes in the build, which are first offset by the value in the build (to change the reference point), and then further transformed by the animation. The quad is then UV mapped to a subtexture in its atlas, but that has nothing to do with the transformation of the geometry.

 

The script crunches down some of that directly into build.bin but that's the gist of it.

 

(Note: in actually a symbol's geometry is a cluster of triangles somewhat fitted to the graphic, but in terms of understanding the values in build and anim, think of them as quads.)

I see. Yes, that's what I meant with it (I just have a tendency to think in terms of maps and algebra).

But in the animation, which gets applied first, the matrix or the translation? I'm assuming the translation gets applied last, so that it has the semantics of a projective transformation:

%5CLARGE%5C%21%5Cbegin%7Bpmatrix%7D%7B%2

but I'd like to be sure.

(Note: in actually a symbol's geometry is a cluster of triangles somewhat fitted to the graphic, but in terms of understanding the values in build and anim, think of them as quads.)

You mean... they're a simplicial approximation? (sorry, I couldn't resist ;P)

Link to comment
Share on other sites

(Note: in actually a symbol's geometry is a cluster of triangles somewhat fitted to the graphic, but in terms of understanding the values in build and anim, think of them as quads.)

 

Aha~!

So that's why we sometimes get strange 'chunks' missing from textures - they're being applied to a sort of auto-generated funky-geometry plane... not just a 2-tri poly-square as you would expect.

Link to comment
Share on other sites

Aha~!

So that's why we sometimes get strange 'chunks' missing from textures - they're being applied to a sort of auto-generated funky-geometry plane... not just a 2-tri poly-square as you would expect.

My head hurts even thinking about how they put animations together. 

Link to comment
Share on other sites

So I'm obviously not with klie, but I've looked at the binary files more than any sane person ought to, so i think I can answer some of those lingering questions...

 

The build files are written as a series of 2 triangles, and each and every file I checked makes a square out of 6 vertices. They're tightly clustered around the build image where possible - I assume so they can pack more symbols into a single texture file. So if you wanted to draw over the original image using an existing build you can get cut off due to the boxes the build file uses even when the total texture file has miles of space. 

 

Take for instance, seeds. The build file actually draws the seeds using 3 boxes - one from the bottom to top in the middle, and two smaller ones on each side (about 2/3rds the way up). The way it's laid out in the texture, though, has more space. The other detail in the build file is the center of an object. This might make sense if you watch the spriter intro video (see http://youtu.be/Y5PBw4aCVNQ) since he demonstrates putting a center of rotation in and then spinning.

 

Animations use entire symbols - so those 3 boxes for a seed become a single square when the animation rotates it or moves it around (just how spriter treats your single image file). That image is then rotated, scaled and skewed around the center of the build and then translated in each frame.

 

To my knowledge, nothing is  "planes" - that applies to 3D animation. This appears to be just rectangles copying from a file into memory, then skewing, scaling and translating that rectangle into the video buffer (all 2D operations, but probably using your computer's 3D capable video card). They get depth by sequencing operations - not because they're using a full 3D geometry.  

As I recall, polyplanes do stuff like mapping a checkerboard unto a cylinder. That keeps it from looking stretched and off but it doesn't make sense for any work on a flat surface. I could be massively wrong - been a long time since I studied computer animation.

Edited by realitymeltdown
Link to comment
Share on other sites

The build files are written as a series of 2 triangles, and each and every file I checked makes a square out of 6 vertices. They're tightly clustered around the build image where possible - I assume so they can pack more symbols into a single texture file. So if you wanted to draw over the original image using an existing build you can get cut off due to the boxes the build file uses even when the total texture file has miles of space.

By series do you mean a sequence or are you implying a "sum" operation (justaposition, topological sum, etc.)? And by "series of 2 triangles" do you mean triangles of dimension 2 or are you counting them?

Do you know what's the operation mapping the vertices (the 0-skeleton of the simplicial complex, if you will) to the triangles?

 

They get depth by sequencing operations - not because they're using a full 3D geometry.

Yes, within an animation depth is simulated by an ordering sequence. The world itself is 3D, though, and the anims are treated as slices of planes in it for the sake of depth testing (that's why depth testing got completely screwed over when I was trying to offset an anim at the Lua level, for the Snail King mod).

 

As I recall, polyplanes do stuff like mapping a checkerboard unto a cylinder. That keeps it from looking stretched and off but it doesn't make sense for any work on a flat surface. I could be massively wrong - been a long time since I studied computer animation.

The concept is the same, whether we are talking about plane regions or 2-surfaces. In math terms, what matters is that they're locally diffeomorphic to the plane (and that normal vectors are well defined and don't vanish, except possibly in a set of null measure, such as 1-dimensional boundaries). Things like mapping a checkerboard onto a cylinder are just a consequence of the existence of such triangulation, by the simplicial approximation theorem.

Edited by simplex
Link to comment
Share on other sites

I've tried running the sampleprefab for the preview and it didn't seem to work.

The individual image files got errors like:

ERROR: Could not run 'C:\Program Files (x86)\Steam\steamapps\common\Don't Starve Mod Tools\mod_tools\compilers\..\buildtools\windows\Python27\python.exe C:\Program Files (x86)\Steam\steamapps\common\Don't Starve Mod Tools\mod_tools\compilers\compiler_scripts/image_build.py "C:\Program Files (x86)\Steam\steamapps\common\Don't Starve Mod Tools\mod_tools\..\..\dont_starve\mods\sampleprefab/images\inventoryimages\myprefab.png"'!

Might be due to the mix and match forward and back slashes.

 

The animation didn't appear to get compiled either - when I removed the myprefab_build.zip it breaks on startup (missing asset) and removing all the files inside didn't work either.

I tried manually compiling it, but got ERROR: Invalid number of arguments!

 

As for the rest, this thread's got way too much math already - not stuff that'll help anyone use these tools! We could discuss elsewhere if you're still intent on digging into it... as far as I can help anyway.

Link to comment
Share on other sites

As for the rest, this thread's got way too much math already - not stuff that'll help anyone use these tools! We could discuss elsewhere if you're still intent on digging into it... as far as I can help anyway.

Yes, the topic did diverge from "animation tools" to "a survey on the mathematical underpinnings of Don't Starve's animation subsystem". That would fit better elsewhere. But I don't see it as that off-topic, since it's a discussion that comes from the anim tool not being cross-platform and from its inability to edit existing animations.

  • Like 1
Link to comment
Share on other sites

Here's some handy, free options to make images and get them into Spriter:

Install GIMP http://www.gimp.org/

Install a plugin to export each layer as a PNG: http://registry.gimp.org/node/28268

Unzip it to "C:\Users\<username>\.gimp-<version>\plug-ins\export_layers.py"

 

Open GIMP, and hit new.

Make an image whatever size you want to work with (512x512 is plenty of space)

Put each part on a unique layer. Since they're each on a layer, you can line everything up and be sure everything fits together

Trim each layer using "Layer->Autocrop Layer"

Go to "File->Export Layers...."

Type "png" into the "File Format" box

Chose "C:\Program Files (x86)\Steam\steamapps\common\dont_starve\mods\<your_mod>\anim_source\<prefab_name>"

Hit "Export Layers"

Use the defaults, hit "Export"

Open Spriter.

Use "New Project"

Select your "anim_source/<prefab_name>"

Animate in spriter!

 

If you want to put your files in various places, I recommend making some .bat scripts to copy them from one space to the next so you can just click your way between each checkpoint

xcopy /s "C:\<path>\<your_mod>" "C:\Program Files (x86)\Steam\steamapps\common\dont_starve\mods\<your_mod>\anim_source\<prefab>"

You can also use command-line utilities; including halting if there's an error so you can read the problem. This script uses my (now unneeded) animation binary converter, takes the output (if there's no error) and zips the result (using the free 7z) and puts it into DontStarve's mod directory:

cd C:\DontStarve\BinaryConverterDontStarveBinaryConverter.exe outputIF %ERRORLEVEL% NEQ 0 PAUSE7z a -tzip "C:\Program Files (x86)\Steam\steamapps\common\dont_starve\mods\binaryconverter_sample\anim\sampleanim.zip" "C:\DontStarve\BinaryConverter\output\*"IF %ERRORLEVEL% NEQ 0 PAUSE

Anyway; hopefully all that comes in handy for anyone who wants to iterate quickly on all this, even though i can't test animations in the game itself. Yet :D

Edited by realitymeltdown
  • Like 1
Link to comment
Share on other sites

I thought I was dreaming when I saw this thread  :')  I'm so happy those tools have finally made their way to us modders, Thanks a lot!
I was immediately trying it and downloaded spriter, created some animations. I did everything the way it's described in the first post, but I always get the same error: "ERROR: Invalid number of arguments!"

I hope it's just me being stupid...

Link to comment
Share on other sites

I thought I was dreaming when I saw this thread  :')  I'm so happy those tools have finally made their way to us modders, Thanks a lot!

I was immediately trying it and downloaded spriter, created some animations. I did everything the way it's described in the first post, but I always get the same error: "ERROR: Invalid number of arguments!"

I hope it's just me being stupid...

Make a folder inside of your mod folder called 'exported' and make folders inside of it for each Spriter project. This should probably be cleared up in the main post. :p

 

When you run the game, everything should automatically be exported as the proper name.zip, atlas-0.tex and all.

 

Also, there seems to be an issue with resolution.

 

Yhpt8e7.jpg

Edited by debugman18
Link to comment
Share on other sites

Make a folder inside of your mod folder called 'exported' and make folders inside of it for each Spriter project.

 

When you run the game, everything should automatically be exported as the proper name.zip, atlas-0.tex and all.

Sorry I wasn't clear, I would like to convert my stuff without running the game. That's not working.

 

EDIT: And are you sure that your image actually has a better resolution than that? Or did you maybe scale up the images in Spriter?

Edited by Malacath
Link to comment
Share on other sites

Sorry I wasn't clear, I would like to convert my stuff without running the game. That's not working.

If you'd like to do it without running the game, do everything above, except instead of running the game, go to the mods tools folder, and run autocompile.exe and it will convert everything.

 

Edit: Yeah, the resolution of the images themselves is fantastic. And in actuality, I slightly shrunk the images in Spriter.

 

Edit 2: Actually, I'm not sure anymore. The textures used replaced the spider queen perfectly, but when I put them into Spriter, everything is very small.

 

73Df9JK.png

Edited by debugman18
Link to comment
Share on other sites

If you'd like to do it without running the game, do everything above, except instead of running the game, go to the mods tools folder, and run autocompile.exe and it will convert everything.

 

Edit: Yeah, the resolution of the images themselves is fantastic. And in actuality, I slightly shrunk the images in Spriter.

 

Edit 2: Actually, I'm not sure anymore. The textures used replaced the spider queen perfectly, but when I put them into Spriter, everything is very small.

 

73Df9JK.png

That's quite awful. Not only were they downscaled, but the resizing filter adopted was quite poor. This looks like linear interpolation.

Link to comment
Share on other sites

So the small size looks like the texture mapper. I made my images up to 256 by 256, but it's packing them into 128 by 64. It then comes out to half size... It's hard to tell if the animation widths look right - I notice many of the old parameters are left off (which means I fiddled with them for no reason)

Edited by realitymeltdown
Link to comment
Share on other sites

So the small size looks like the texture mapper. I made my images up to 256 by 256, but it's packing them into 128 by 64. It then comes out to half size... It's hard to tell if the animation widths look right - I notice many of the old parameters are left off (which means I fiddled with them for no reason)

So the converter is resizing everything when it makes the atlas?

Link to comment
Share on other sites

So my original png file is 512x512 (in case it's a power 2 thing).The actual content area is roughly 180x140. The build xml file produced says 512x512. When I open the resulting texture file, and save it to a png using the tex converter - I get a file 512x 256, with my image roughly 67x48. Since there's two images, I they're spaced really far apart  - makes me think the power 2 was a bad idea  and I'll go back to autocroping layers.

Link to comment
Share on other sites

  • Developer

I thought I'd share some comparison images with you guys.  I took Wilson's original hair image and I pushed it through Spriter with scaling turned on and off.  When scaling is turned off, the image looks much closer to the original source hair image but with scaling turned on, the image looks like the regular in game hair.  We scale the images to save memory.  Right now I'm inclined to keep the pipelines consistent but I'd love to hear people's feedback.

 

Here is the original image:

post-283016-0-71689000-1378845112.png

 

Here it is without scaling:

post-283016-0-22388000-1378845140_thumb.

 

Here is is with scaling:

post-283016-0-10913000-1378845136_thumb.


And in regards to what looks like your point filtered sprites, I'm not sure what's going on there but if you're willing to post your spriter project along with the accompanying images, I'd be more than happy to take a look.

 

Sorry about the trouble.

Link to comment
Share on other sites

I think the three things I want most right now for the animation pipeline are:
1 - a resize filter that doesn't make everything look... awful.

2 - support for Spriter's bones.

3 - a Mac (and Linux) version.

 

I really hope that at least 1 and 2 can be implemented soon.

 

Strange, though... when Cheerio converted the Snowmonster files, they seemed to compress nicely...

Is there something you're doing that others aren't?

Because the poor Beanlet came out like this:

http://forums.kleientertainment.com/index.php?/topic/26501-up-and-away-mod-collaboration-thread/page-77#entry318695

  • Like 1
Link to comment
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
 Share

×
  • Create New...