# Tachiegen

#### (A tachie generator)

- Basic tutorial
- Advanced usage
- Male characters
- Credits

## Summary

Tachiegen provides an easy way for non artist to design character graphics (aka "sprites" or "tachie") for their games.

Initially I developped it to help create tachie for the game Heartache 101.

But it's been used to create the character graphics for all my own games, too.

Tachiegen allows you to develop one or more tachiesets each containing one or more tachie for one character at a time and export them as individual .png files.

The initial tutorial will guide you through the steps needed to define the graphics for a demo girl, suitable for the usage in a small screened game like Heartache 101.

If you need to create character images for games with larger screen sizes - specifically ren'py's default 1280x720 resolution - or want more control over the export-format in general have a look at Advanced usage.

Finally, there's a male template, too.

After downloading tachiegen.zip, you should extract it into a fresh folder, the result would probably look somewhat like this:
You get a python-script named "tachiegen.pyw" along with two directories named "doc" and "data".

## Basic tutorial

Let's they you're creating a "Heartache 101" route for a girl named Hanako. She's currently attending the same school as our PC ("Kazuhiko") and thus wearing the same school uniform as all the built-in characters.

The only difference is that - for whatever reason - her's is fairly worn out, probably handed down from an elder sister.

She has a long braided tail of green hair, dark blue eyes and is wearing a pair of rose-tinted glasses.

One of the game events will be showing her in a dresslike party-outfit. And in her ending she'll be shown as a young woman in her early twenties wearing a pinkish dress.

We will be defining tachie for her NEUTRAL, UNFRIENDLY and LOVESICK moods in her worn-out school uniform and a few more for her wearing other outfits as well.

Let's begin at the start by double-clicking on the tachiegen.pyw script mentioned above.

The first time you run tachiegen, you will be presented with the following dialog:

In this dialog you can define default paths for both the resulting tachie and saving the tachie definition files.

Additionally, if you don't want to see the visual aid telling you the height of your current tachie, you could uncheck the "visualize height" checkbox.

So, if you're using windows, your username (for whatever reason) happens to be demo, and you'd like to save the definitions somewhere under your Documents folder, and the resulting graphics somewhere under Pictures ... the result might look like this (press "OK" if you're done - don't worry you'll find this dialog box under "Options > Preferences" in case you want to change them):

After pressing OK. Your screen will look something like

At the left you see a preview of the currently active tachie. You might have noticed the up-pointing arrow to her left, which indicates her height (in cm as the author is European and Heartache 101 is set in Japan anyway, if some one asks nicely I might add feet/inches as well).

The right side starts with some global stuff followed by Drop- and Checkboxes defining her looks and her outfit.

Let's have a look at the "global stuff" now ...

You'll notice that the Charname is currently "nobody" ... please change this to "hanako" - that's her name, after all!

Next come two lines labeled "Set/Outfit" and "Mood" currently showing that we are working on the "neutral" mood of her "default" set.
Which is fine, for now.

The slider labeled "Size" let you define her height. To the right of that slider you'll see her height in pixels as well in cms and a hint text compairing her to well known built-in chars from Heartache 101.
As Hanako is a first year, and small even for her age we'll move that slider a bit more to the left (making her even smaller) 147cm would be fine.

Please notice how the hint text changes when you move that slider, and how the preview's size is changing too.

Now it's time to change her hairdo, her expression and pose. That's what the tabbed editor in the lower right is for.

Note that the currently selected tab is "Face", which allows you to adjust her facial expression. Initially she looks a bit too over-exited for NEUTRAL, doesn't she? So let's adjust the dropboxes labled "eyes", "Mouth", "Eyebrows" and "Blush" to reflect her current mood - which is NEUTRAL. You might want to get rid of that overly visible nose, too.
Like that, maybe:

The next two tabs are about her hairdo. First you might like to change her "Front Bangs" on this page

(I didn't change the default, but you go ahead and try.)

Now for the main hair, which is defined using the next tab (surprisingly named "Hair")

Please select "Long braided tail" - this will be needed later

There's a few tabs left ... let's try out the one labeled "Outfit", shall we?

This section of the editor looks deceivingly innocent, but in fact is quite powerful. For instance: the first dropdown "Outfits" defines which type of outfit you're going to design.
There's "Dress", "Onepiece" and the default of "Top & Bottom". If you play with these options, you'll notice how the rest of the editor will change for each of these.

For now please stick with "Top & Bottom", as this we want to desing a school uniform for our Hanako.

As long as you do stick with "Top & Botton", the second dropbox ("Tops") will ask you to define the top to be used for the outfit. "School" is fine for now, but the other choices would again dramatically change which options you got offered for poses and stuff.

After those options you'll find a dropbox labeled "Bottoms" - for a school uniform you'd probably stick with a "Short skirt" or maybe a "Medium skirt".

Since Hanako is supposed to be attending "Hayauchi High", we'll go with the "School" uniform top and the "Short skirt" bottom. But how about we change her pose to "Folded arms"? And we probably should change her chest size to "Small" to.
Like that:

Quite nice, huh?

Now for her glasses. Next to the "Outfit" tab there's one labeled "Accessories" ... we'll check the first check-box and - voila!

Now for some colors ...
What we wanted for her was a worn out uniform, long green hair, dark blue eyes and the glasses are supposed to be "rose-tinted".

Tachiegen makes recoloring stuff fairly easy. Just click on something you want to change the color of - like for example the top of her uniform and ... this dialog opens:
.
Currently, the recoloring method is set to "none" meaning we're still using the default coloring. Let's have a look at the other options
You can choose between using RGB or HSL colorspaces - or a variant of HSL which should work better for human skin colors. For the worn-out look we should pick "HSL" editing since this would let us change the base color ("H" = hue), the satuation ("S") and the litghtness ("L") directly. Give it a try by selecting "HSL":

You'll notice three slider which allow you to change the hue, satuation or the lightness of the currently selected part. Initially all three sliders are set at the center positon of 0, indicating that nothing shall be changed. Above the sliders is a checkbox labeled "Enhance brightness", which we won't be needing right now. It might come in handy if you'd ever want to give your character a brightly colored dress or something.

For now, what we want to achieve is a "washed out" look of her uniform. Slide the "S" slider a bit to the left, decreasing the saturation (i.e. make the part a bit "more greyish") then slide the "L" slider a bit to the right and making the part look lighter.
You get an immediate preview in the upper left corner of the recoloring dialog and you could use the "Apply" button to check how your settings will affect the picture as a whole.

Once your satisfied click on "OK" to close the recoloring dialog, than click on her skirt to recolor that part of her clothing. (You don't have to set skirt and jacket to exactly the same shade - maybe her skirt was washed a few times more than her jacket, or the other way around?)

Let's have a look at the results so far:

Now for the glasses ... remember we wanted them to be a bit "rose tinted"? Click on the lenses.
Once you selected either HSL or RGB you'll notice an additional slider labeled "A" (for "alpha channel").
This is because lenses are considered to be "transparent" to some extend, i.e. you can see through them (duh). The "A" slider allows you to adjust the transparency of transparent parts.

You might try and achieve a "rose tinted" effect using HSL mode, but it's probably easier to change to RGB mode. Just add a little red and take away a little green and maybe a little blue, too. Oh, and let's make the glasses a tiny bit more transparent, shall we? We want to see her eyes!

By the way: did you notice the checkbox "Start with gray"? We didn't need it for the lenses, but it might be useful in cases where you want to use RGB mode but have to change something very colorful to something of a completely different color.

Let's have a little fun with her hair. Click somewhere on the braided tail, pick RGB mode, select "Start with gray", slide "G" a bit to the right and "B" as well as "R" a bit to the left - like this:

Oh. There's a new button in the recoloring dialog this time - it's labeled "Highlights".
How about we click on that one and see what happens?
Another recoloring dialog appears, this time labeled "Recoloring Hair (highlight)".
Let's change the method to "RGB" and ...

OK. This really needs some explaining.
First, since we selected "RGB" there's the "Start with gray" and "Enhance brightness" checkboxes on the top and the "R", "G", "B" and "A" sliders at the bottom.
You can use all these to define a secondary recoloring to be applied as "highlights" to her hairdo.
The "low" and "high" sliders let you define which parts of her hair shall be considered "highlights".
As for the "mountain range" above these two sliders - this is the histogram of the original part, which might be helpful in chosing the best setting for "low" and "high".

Maybe an example will help understanding? Let's say we want to add some yellowish highlights to her hair.
Take the "R" and "G" sliders up a bit and tune down "B" quite some way, then move the "low" and "high" sliders inwards so that "high" is still right of most of the "mountains" and "low" is somewhere after the first few big ones. Notices how this affects the preview picture!
More then half of the picture's disappeared. And the rest is showing a light blonde.
Now click on "Apply". You'll notice how the preview of the parent dialog has changed:

How does the resulting hair look?
Hmm. Maybe we overdid it, just a bit. But that's not a problem. Just click on one part of her hair again, than re-open the highlight dialog.
Reduce the "alpha channel" a bit, toning down the highlight effect.
Better, huh?

Now let's try and recolor her eyes. You could open the recoloring dialog by click on her eyeballs and but you'll probably find that pretty difficult because of that glasses she's wearing. But there's another way to do it.

Namely, there's a tab in the editor that we haven't used yet. It's labeled "Coloring". Please select this tab now.
What you get is a bunch of buttons one for each recolorable part of the tachie (in fact there's one button for each possible part that exists in the template, no matter if your actual tachie uses it or not.
Anyway - you might one to click on all those buttons if you're curious - but right now all we need is the one labeled "eyes" (somewhat in the middle). Click it.
(I used HSL mode, shifted the base color from brownish to blue, raised the saturation quite a bit and might them a bit darker.)

What you say? Ain't she cute?

After you're satisfied with how her NEUTRAL mood tachie looks let's save our work and export this tachie.

Click "File > Save"
You'll be prompted with a file-dialog letting you chose where to save your tachie definition. The path and filename should be preset to whatever you specified in the "Options > Perferences" for the path and "hanako.tachie" for the filename.

After saving the tachie definition file, let's have a look at the end-product. Click "File > Export" - you're prompted to choose a folder for the results. Default is the one you provided in the preferences. Choose the folder and click "OK"

Now you should have a file named "hanako.tachie" in the save file folder, and a "hanako-neutral.png" in the folder you specified for the export:

NOTE: you might notice that her picture is slightly larger then the value you specified for her height. That's because her height is calculated "without hair" while the resulting graphics allow room for any possible hairstyle and pose.

One single expression is not enough! Let's allow her to get UNFRIENDLY and even LOVESICK ... rememeber when we talked about the "global stuff"?
Noticed the two buttons labled "manage" after the dropboxes for "Set/Outfit" and "Mood" respectively? Click on the later of those. You will see the following dialog:

In the top row there's a Dropbox and a button named "Add" let's click on the small triangle of the dropbox.
You're presented with a list of the other named moods (dislike, unfriendly ... lovesick) pick "unfriendly" and click "Add"
Note that "unfriendly" has been added to the list box. Also note that this listbox is automatically sorts dislike et.alt. in the natural way.
Now click "OK". The "Manage Tachie in Current Set" dialog will close and you'll return to the main screen.
Note that the "Mood" dropbox now says "unfriendly". Let's change her eyes and her mouth to something less friendly. Like this, maybe:

Note: the named modes a taken from the game Heartache 101, for which this tool initially was designed for. They are equally important for one of my own games, too. But even if you're not designing characters for one of these they might be a nice starting point. Of course it's entirely up to you whether you want to use them or not.

Let's compare her "unfriendly" expression to her "neutral" one. Just change the value of the "Mood" dropbox back and forth a few times and watch her face change ...

Now for her "lovesick" expression ... click on the manage button again, pick and add "lovesick", then close the manage dialog.
You might note how her tachie is copied from the "neutral" mood. The generator always tries to pick the mood closes to the one you've added and copy that over to the new one, defaulting to "neutral".
This time we should change her facial expression to something like this (and don't forget to make her blush):
Hmm. How about we change her pose a bit to emphasize how exited she really is to see us? Click on the "Outfit" tab and switch to using "Individual arms".
Two important things happened. You get two more checkboxes, one for each arm. Both of them currently set to show her arms "behind back". The other thing that happened is, that her chest size has changed to "medium".
That's one thing to keep in mind when working with "Tachigenerator": the chest size is not something that's presetable independant of every other aspect. In fact it might change whenever you change her outfit or pose.
Anyway. Correct her size, then put her "right" arm to her mouth like she's nervously trying to hide her smile.

Please save and export this version ... you will get three .png files this time, one for each mood.

For a real project you'd now normally add tachie for many more expressions, too. But that wouldn't teach us anything new. So let's just give her another outfit to wear. For this we'll use the other button labled "manage" ... click it, please.
It looks similar to the one we used for adding new moods ... but the dropbox is replaced by just an edit control this time. Well, there's just no such thing as predefined sets like there is with moods (OK, there's the "default" set, but that's it).

Let's give her a nice party-outfit for after school activity (type "party" in the edit control and click "Add" please).
Note that the current outfit dropbox has changed to "party" and you are presented with a copy of the tachie for the "neutral" mood of her default set. Every new set by gets a mood named neutral.

No more school uniform! Time for something else! If you'd try to put her into a dress you'll notice that there is no dress with a small chest ... well ... let's just pick a bare armed outfit with a medium long skirt. I recolored it to almost black activated the "flower" stamp which I colored yellow and put her arms behind her back.
Cute, huh?

But how about she wears her tail behind her back this time? Just to show off that nice "dress" of hers? There's an option on the "Hair" tab if you selected "Long braided tail" for doing just that:

Normally, you'd add a few more expressions to this set, too. Or maybe another outfit or two? Like a swim suit or a P.E. uniform or whatever you feel like. Feel free to play around as much as you like.

For our tutorial we'll just add one more set, maybe for an ending or such.
It's been a few years since we last seen our Hanako, she's grown a bit (well she's still no giant ...), changed her hairstyle ...
Maybe we run into her on a beach, whie she's wearing a pink dress and some shades (rose tinted ones, of course!) and she's got some tan, too?
Wait. Something's just wrong. Look at those shadows! The one her arms are casting over her dress are way to dark, and the one on legs is completely off.
Less noticeable, but equally wrong: the shadow of her front bangs are just as wrong as the others. Let's fix all of these!
First, click on the shadow on her skirt to open the recoloring dialog for that shadow (or select the "Shadow" button from the "Coloring" tab).
There's a special checkbox just for shadows labeled "Apply as shadow". Please activate this and then click "Apply".
Oh! What happened?

Well technically, the program knows two different ways to put transparent layers over other things, the default method is just to use normal alpha blending like every one else does. The other method takes whatever pixels are already there and "multiplies" them with the pixels from the shadow. In most cases the resulting effect works much better with shadows. (For backwards compatability to tachie created with earlier versions this has to be turned on manually).
Go ahead and turn on "Apply as shadow" for the "Skinshadow" and "Hairshadow" colorings, too:
If you're not satisfied with the results, you still can fine tune shadow colors like anything else, of course.

OK. Now we have three different versions of our Hanako wearing a school uniform, a nice dress-like outfit for a night out in town and some beach wear for an ending. We definitely should save our progress and have a look at the resulting pictures!
Repeat saving and exporting like you did before and than have a look at the resulting .PNG files:

The file names are built from the character name, with set and mood both appended ("default" will be surpressed).

You can now add other moods to the three sets and other outfits too, of course ... whatever you like! (In other words: the basic tutorial just ends here ;) )

## Advanced usage

Up to now you always started tachiegen by double-clicking the python-script. This will allow you to create female character graphics for a game like "Heartache 101".

If you want to design graphics for a different resolution or a different kind of game - or even male characters, you need to manually invoke tachiegen.py using the command line interface.
Click "Start > Run" or use the WINDOW + R keys to launch cmd.exe like this:
Now change into the directory where you installed tachiegen:

In order to know how to which template to use and how to work with it, tachiegen has to load a .json file containing these informations.
Tachiegen 6.0 ships with (at least) the following definitions:

"default.json" is used whenever we do not supply an explicit definition. "female-renpy.json" and "male-renpy.json" create graphics usable for ren'py projects, while the "sgsc" variants are specifically targeting Sour Grapes / Sweet Cherries.

So, how do we use these? Close the program if it's currently running, then type

    python tachiegen.pyw female-renpy

in a cmd.exe like this:

Press enter to start tachiegen and load our "hanako.tachie" from the basic tutorial.
Looks pretty familiar, huh?

The main difference is that the image is quite a bit larger (even she's still supposed to be 146cm in size). Everything else is still working the way it did when we used "tachiegen" alone.

What happens if we export the sprites? (Please use a fresh directory for this or you might get confused.)
The first thing you'll notice is that there's more images being generated this time. Specifically, each individual graphic is exported twice: in addition to her normal picture you'll find a close-up with a "side " prefix.
These close-ups are meant to be used as side images for ren'py projects. Like in this example from my own game "The Last Lesson":

Another difference you might notice is that the files have been exported using a different naming scheme in order to better support ren'py's notion of image attributes. And, of course, the images should be noticably larger than those we exported before.

Now for "female-sgsc". If you close "tachiegen" then run

    python tachigen.pyw female-sgsc

then load "hanako.tachie" and export it; you'll get this result:
Yikes. Whatever happened to our poor Hanako?

As I said, this version is specifically designed for creating character graphics for "Sour Grapes / Sweet Cherries", but if you find it useful for other ren'py games, too - be my guest.
In short, "Sour Grapes" needs four versions of every tachie and there's a lot of them. So, in order to save disc space, I decided to make use of a feature in ren'py named Layered Images.
How does it work? Simply put, tachiegen seperates the faces (which normally change the most) from the rest of the images (which in most cases don't change between expressions) and then tells ren'py how to put things back together (reusing unchanged .PNGs whenever possible). That's done by writing the "recipes" for each image into a .RPY file ("hanako-images.rpy" in our example) which looks something like that:
Read: Define a layered image called "hanako-default", which consists of three parts ("base", "face" and "top"). There's three versions of her face (face0, face1 and lovesick) but only one version each for "base" and "top" layers (base0 and top0).

For those who want to take a closer look at it, here's the full script.

Note: Tachiegen's export feature is quite versatile and configurable. If you need a specialized version for your project, please do contact me.

There's another nice to have feature of tachiegen I'd like to show you: you can script tachiegen using the following syntax:

    python tachiegen.pyw <definition> --export <tachie> [...] <target-dir>

For example, if you'd like export "Hanako" using the "female-sgsc" definition file and sending the results to a subdirectory "sgsc-exports" you'd do it like this:

This comes in pretty handy if for some reason you'd like to re-create all of the character graphics for your program, or if you frequently make quite a few matching changes to numerous tachie definitions and don't want to manually export every single one of them.

## Male characters

The remaining two versions "male-renpy.json" and "male-sgsc.json" are using Kevincalanor's male tachie template for designing male character graphics, targeting the same platforms as their female counterparts.

Let's give them a quick look. (I won't be digging too deep, since there isn't anything new compared to working with the female version, only that the female version is much, much more complex than the male one).

When you start

    python tachiegen.pyw male-renpy

you will be greeted by this young guy here:

Of course you can edit him in much the same way as we did with the girl in the basic tutorial, like this for example:
(You can export him, too - but there's no real need to show that here.)

## Credits

Tachiegen is a program by Garage.
The latest version is published here.

Female template based on HTC-TachieWorkshop.psd, HexComet_HTCModel.psd and other stuff by Kevincalanor and a few (minor) additions be me

Male template based on HTC_MaleTachie by Kevincalanor.