OpenXcom Forum

Modding => Tools => Topic started by: bohemond on May 02, 2020, 05:39:05 pm

Title: HandOb maker
Post by: bohemond on May 02, 2020, 05:39:05 pm
I recently made a tool for myself to make creating HandObs easier. It creates HandOb sprites and a FloorOb sprite based on a BigOb. It also positions the sprite correctly, which always takes me a long time. Well, that's why I made the tool. It exports in the single-file format, because that was just simpler to make.

A few pictures so you can see how it looks are included.

I tested it on a few random sprites I found on the forum and on a fire axe I made. That fire axe was actually what started it all. :)

As far as I can tell, it positions the HandObs correctly for both single-handed and two-handed weapons. There is a lot of options you can play around with to make it look reasonable.

It can export in 32bits, UFO palette and TFTD palette. The exported sprite will probably need some work.

It's VB.NET, and the code is a mess of course.

GitHub repository: https://github.com/bohemond-of-antioch/HandObMaker
Releases: https://github.com/bohemond-of-antioch/HandObMaker/releases
Documentation: https://github.com/bohemond-of-antioch/HandObMaker/wiki

It will probably require some .NET framework stuff to run. 4.5 or thereabouts, as far as installing that, you're on your own. If you encounter any other problems with running the program, I will try to help.


I'm releasing this under Creative Commons 0 license.
Title: Re: HandOb maker
Post by: efrenespartano on May 03, 2020, 12:28:28 am
Quote
This looks SO INTERESTING! I'm going to give it a try, will ease a lot the weapon sprite creation!

Thanks for making it and for sharing it.

Mate, your tool is freaking amazing. I'm (manly) crying of the joy. Works delightly. As you pointed, the sprite generated may need some love, but this ease many hours of work. Thanks a lot.

In words of my friend Hans Woofington "this is the best shit i have seen all year". Thanks for making our lives easier, you are a god among men.

https://tenor.com/view/blessing-from-the-lord-god-be-praised-monty-python-gif-13305700

I'm attaching a comparisation between a generated handOb and a handmade one of the same weapon.
Title: Re: HandOb maker
Post by: Anon011 on May 03, 2020, 12:57:21 am
Wow great job!
Title: Re: HandOb maker
Post by: kevL on May 03, 2020, 01:13:11 am
yeah wow. those transformations look superb! I tried doing some in Gimp a while back and it was a mess ...
Title: Re: HandOb maker
Post by: Hans Woofington on May 03, 2020, 01:20:21 am
oh my god! this is amazing!
thanks a ton for making this!
Title: Re: HandOb maker
Post by: bohemond on May 04, 2020, 01:51:28 am
Thank you, I'm glad that you like it.
Title: Re: HandOb maker
Post by: Dioxine on May 04, 2020, 03:50:44 pm
Great tool, 10/10. Cant eliminate some manual work on details, but gets rid of all the boring parts, and I guess it does it as good as it is possible for such software.
Title: Re: HandOb maker
Post by: robin on May 04, 2020, 09:15:03 pm
Really great tool!
Title: Re: HandOb maker
Post by: Yankes on May 04, 2020, 09:20:21 pm
Now expand it to creating units :D
Title: Re: HandOb maker
Post by: osd_daedalus on May 05, 2020, 12:44:03 am
Give this guy a Uber-Ethereal shroud and stick this thread!
Bravo, well appreciated! :-D

Just for the chronicles... sources will compile and run on Linux with mono, as long as mono-vbnc is installed, but will crash as you try to export FloorOb/HandOb.

EDIT: giving it a try again, it crashed while using resources from old UFO2000 assets (many of them are oversized according to your tool). I tried again on XComFiles resources and it works like a charm :D
So... yes, it works on Linux :D
Title: Re: HandOb maker
Post by: Docent on May 07, 2020, 02:45:56 pm
Wooooooooooowwww!!!!!!! It`s, it`s, it`s... Amazing!!!
Title: Re: HandOb maker
Post by: xcomfan on May 07, 2020, 06:18:35 pm
Now expand it to creating units :D

yes, might be like upgrandin in xpiratez from workshop--->factory  ;D ;D
Title: Re: HandOb maker
Post by: FilmFan84 on May 11, 2020, 12:43:58 am
@bohemond Thank-you sir!

This is a wonderful tool; it's even useful for people like myself over at OpenApoc as we need similar Handobs, but at higher resolution for X-COM: Apocalypse

Looking forward to seeing how you develop this tool

Probably my only request, and with Apoc in mind, can it be made to support generation of higher-res sprites as i'm struuggling to get it to work with 80x40px EquiPics?
Title: Re: HandOb maker
Post by: osd_daedalus on May 11, 2020, 01:18:27 am
Just to report some feedback...

I got some old sprite from Galactic weapon set from UFO2000, adjusted with Gimp, used HandObMaker to get HandOb and FloorOb by playing with options, lost my mind on palettes (btw thank you Meridian and ohartenstein23) and...
Not bad result, isn't it?  :)
(https://cdn.discordapp.com/attachments/330653502693179394/709165802477191218/unknown.png)

Have you loaded your source into Github / other repository with versioning system? I'd be happy to attempt to contribute to the code, or at least to report bugs (I got various crashes for "out of index")

ADD: by request, here's the bigOb/FloorOb/HandOb of that weapon. I'm uploading also the original Floor/HandObs from UFO2000 for comparison.
Disclaimer: if you are going to use them for a project, being it a UFO2000 derivative, it's under GNU GPL v2. *
* to check if sprites are on same license.
Title: Re: HandOb maker
Post by: Bobit on May 11, 2020, 03:04:38 am
The fact that you can take a random sprite from a completely different game and make it work...

If this were to be expanded to units by someone else they would need to know Visual Basic.
Title: Re: HandOb maker
Post by: bohemond on May 11, 2020, 09:42:17 am
@FilmFan84
Hmm, I don't know anything about OpenApoc, so I'll have to look it up. The size of the source image and output images can be increased without much trouble, but I'm not so sure it will look good. I'll try it. There is also the minor problem of the speed of the program. For larger images, it will slow down even more than it already is. But I think I can still optimize it.

@osd_daedalus
I haven't really made it robust, as I was just using it for myself and knew what to do. If you have a bug report, I guess you can post it here?
I don't have it in a versioning system, but maybe I'll convince myself to put it there one of these days.

@Yankes
I've tried coming up with something for units, but it's complicated. They end up looking like gingerbread aliens. So I'm not so sure it would be useful. The input would basically have to be images from all sides and even so, it probably won't come out looking all that great.
But maybe it can still work as a fast prototyping tool? Just the basic rotations, maybe some cutting up. I haven't tried making any units myself, so the process is unknown to me. If there really is a demand for that I can try to make it.
Title: Re: HandOb maker
Post by: Bobit on May 11, 2020, 05:01:03 pm
Is this video relevant for units? https://www.youtube.com/watch?v=bk0PXMgZgQg (https://www.youtube.com/watch?v=bk0PXMgZgQg)
Title: Re: HandOb maker
Post by: Yankes on May 11, 2020, 07:27:20 pm
The fact that you can take a random sprite from a completely different game and make it work...

If this were to be expanded to units by someone else they would need to know Visual Basic.
Or C#, as both work on same framework you could easy "translate" logic from one to another, and write new code in preferred one.


@Yankes
I've tried coming up with something for units, but it's complicated. They end up looking like gingerbread aliens. So I'm not so sure it would be useful. The input would basically have to be images from all sides and even so, it probably won't come out looking all that great.
But maybe it can still work as a fast prototyping tool? Just the basic rotations, maybe some cutting up. I haven't tried making any units myself, so the process is unknown to me. If there really is a demand for that I can try to make it.


Yup, simple conversion from 2D image to "3D" is impossible because you do not have import data like "what is behind" or "thickness" of final unit.
But one way this could be done by creating "texture", (similar as in normal 3D games) and you map each pixel to final pixel in graphic.
This would need lot of work to create this mapping, ((x,y) of image to (x,y,z) then create render for each side in (x,y)).
Title: Re: HandOb maker
Post by: osd_daedalus on May 11, 2020, 08:47:51 pm
@bohemond
You should put it on Github/similar, so we can report bugs, fork it and do pull requests  ;D

I see a lot of potential on this program...

Maybe not yet units from paperdoll sprite (I see it quite complicated and maybe would require more variables i.e. define  skeleton nodes), and maybe not yet HWPs, but I bet it can  work for particles too. I am thinking about new projectiles, rockets, energy blobs ecc...

About sprite size, I'd like the program to allow larger sprites too.
Looking forward for updates! And very very thank you, you just made me willingly to create items and I have no experience on this!


Ooook... I promise if I do new things, they'll go on Resources.
But i have to do that... (maybe I got carried away with the Big...)

Title: Re: HandOb maker
Post by: kevL on May 11, 2020, 10:24:33 pm
(maybe I got carried away with the Big...)

lol. Love the guy in the doorway :)

does he tip over when he shoots ...
Title: Re: HandOb maker
Post by: osd_daedalus on May 12, 2020, 06:58:58 pm
lol. Love the guy in the doorway :)

does he tip over when he shoots ...

lol, luckly (or sadly?) there isn't a knockback/recoil system that kicks your guys back as far as I know...


I tried to play a bit with the code, but just increasing the upper limits will return strange results, mainly handobs going out of boundaries. I guess many tweaks are needed for OpenApoc compatibility or anyway just to load bigger images which should be then auto-shrinked to fit the 32x48 box.

I have a question: there are buttons to flip/rotate the BigOb, could be possible to save these transform results on the BigOb image? I know it's out of purpose, but could save in some cases a step to return to image manipulation program to do the same thing there.
Title: Re: HandOb maker
Post by: bohemond on May 13, 2020, 02:40:30 am
I haven't found any good examples of OpenApoc item sprites. So I haven't started on it yet. But there will be more differences than just image size I imagine. The whole drawing routine is probably quite different.

I could put a save button for the BigOb, but the problem is that it would screw up the palette. So I'm not sure it would be of much use.
Title: Re: HandOb maker
Post by: osd_daedalus on May 13, 2020, 07:17:07 pm

I could put a save button for the BigOb, but the problem is that it would screw up the palette. So I'm not sure it would be of much use.

Right, makes sense.

I still haven't understood the Advanced Options - 3d profile function, could you please explain me about?  :)

Going technical, instead:

- bugreport: if you click "Find Center" while you haven't still loaded a BigOb, the application will crash due to a null reference

- I have noticed in the code there is the assembly System.Deployment in References, which is not implemented in Mono, but the application will work flawlessly anyway: are there lines of code using it? I tried to remove it from the References and still works.

Title: Re: HandOb maker
Post by: efrenespartano on May 15, 2020, 04:57:13 pm
If you make an unit creation tool, then I'll make you a new shrine. Drawing the unit spritesheet is probably one of the most frustrating things of OpenXcom modding.
Title: Re: HandOb maker
Post by: Bobit on May 15, 2020, 05:50:15 pm
I still think the video I posted was pretty relevant to this topic, because it shows you can take any 3d model and relatively easily convert it to OpenXCOM sprites. I didn't actually watch it, just skimmed through to see the images.

If that's true the only question that remains is: what's the easiest way to make a 3D model? And the community needs to agree on that to make a unit-maker everyone likes.

The images below are in blender and constructed  from a 3D sprite. It's not going to be as easy as items, of course, because units can't be rectangles that look the same on all sides. You probably do need to make a 3D model at some point in the process to make it obvious how it will turn out.
Title: Re: HandOb maker
Post by: bohemond on May 16, 2020, 04:09:25 pm
@Bobit
I don't think most people here do 3d models. Even so, isn't creating animated humanoid 3d units really difficult? Maybe it would be possible for tanks and such, with few animating parts, but for humanoid aliens, I don't know.

@efrenespartano
I haven't done any units myself, but looking at unit sheets, it does look like a difficult task.
How do you actually go about creating a unit? For the x-com soldier drawing routine. Do you create the animated sprite and then cut it up into pieces?

@osd_daedalus
I'll fix that.
The dependency is probably just some default, that I did not bother to clean up.
New version is almost ready with some improvements. I'll write a quick guide to the advanced options when I post it.
Title: Re: HandOb maker
Post by: efrenespartano on May 16, 2020, 10:56:18 pm


@efrenespartano
I haven't done any units myself, but looking at unit sheets, it does look like a difficult task.
How do you actually go about creating a unit? For the x-com soldier drawing routine. Do you create the animated sprite and then cut it up into pieces?

I usually look for some pieces and bits of spritesheets of units that I like (specially The X-Com Files) to use it as reference. I work on the old Paint.NET (It is not suitable to make graphics for OXC, but i'm quite used to it and I like it), so I have an existent spritesheet as bottom layer and I draw pixel by pixel on top of it. Making the head and the torso is quite easy, I just resize the torso and head of the paperdoll (the inventory unit) I'm trying to make the spritesheet, but the hardest thing is making the many many arms and legs in all of the different positions.
Title: Re: HandOb maker
Post by: xcomfan on October 03, 2020, 05:12:23 pm
Give this guy a Uber-Ethereal shroud and stick this thread!
Bravo, well appreciated! :-D

Just for the chronicles... sources will compile and run on Linux with mono, as long as mono-vbnc is installed, but will crash as you try to export FloorOb/HandOb.

EDIT: giving it a try again, it crashed while using resources from old UFO2000 assets (many of them are oversized according to your tool). I tried again on XComFiles resources and it works like a charm :D
So... yes, it works on Linux :D

Too bad sad, one again linux uners are cut out  :'( :'( :'( may i suggest some user of good will to compile it usin AppImage? (https://www.booleanworld.com/creating-linux-apps-run-anywhere-appimage/). I've very little linux knoledge, otherwise i'd already gave a shot...please let us know :)
Title: Re: HandOb maker
Post by: ohartenstein23 on October 03, 2020, 05:41:34 pm
This tool worked out-of-the box for me with a recent wine-staging on ubuntu 18.04. Have you tried using the wine version included in your repository and running the win .exe with it?
Title: Re: HandOb maker
Post by: xcomfan on October 07, 2020, 12:15:53 pm
This tool worked out-of-the box for me with a recent wine-staging on ubuntu 18.04. Have you tried using the wine version included in your repository and running the win .exe with it?

Thanks, but i don' want to install/bloat my system with wine. Moreover It's a very tiny program, would be a pity install wine exclusively for this  :'(

Please note that sprite must be must necessailry be 32x48, otherwise the program will crash
Title: Re: HandOb maker
Post by: Finnik on January 14, 2021, 04:08:39 am
As for unit creation - what about making an assembler-disassembler tool for unit sprite sheets? I mean, the thing that would collapse ripped parts into a set of pictures, as the game does, so you would be able to edit the assembled version inside of your tool (with the most basic image editing options, like Volutar's MCD Edit use for PCK editing).

(https://www.ufopaedia.org/images/thumb/1/1c/Mcdedit_pckedit.png/602px-Mcdedit_pckedit.png)

Like you would render it, and then rip it back to the game format.
This would allow modder adit assembled version of the unit frame per frame, with quickly switching from frame to frame. After all the required frames are done, we hit Export and take game-ready image asset. I would say it would be the best option for drawing complicated units.
Title: Re: HandOb maker
Post by: bohemond on February 27, 2021, 11:38:46 pm
That's an interesting idea Finnki, and something I might actually get motivated to do. I'll think about it.

I finally moved the code to GitHub and uploaded a new version.
The new version has a feature to save the 'projects' and a recent 'projects' list.
(I modified the first post)

I might get around to fixing all the crashes you guys reported later, but it's not exactly fun, so don't count on it.  :)
Title: Re: HandOb maker
Post by: Finnik on February 28, 2021, 02:12:32 am
That's an interesting idea Finnki, and something I might actually get motivated to do. I'll think about it.


That would really push OXC modding to the new limit.
Title: Re: HandOb maker
Post by: Finnik on April 07, 2021, 08:47:46 pm
Can we also unite 2 your great projects? Like adding sample soldier unit as background for handob generator to actually observe how it is held? And what about the ability to edit it right in your tool, so we can see both weapon and unit in background? Would be super useful!
Title: Re: HandOb maker
Post by: bohemond on April 24, 2021, 11:13:57 pm
I actually had sort of the same idea. If you look in the UnitSprite studio I already have a section 'item' prepared at the top. But I was not able to integrate the two in a satisfying manner.

I'll have to give it another shot, but they are very different tools and also in different programming languages.
Title: Re: HandOb maker
Post by: efrenespartano on April 26, 2021, 09:23:31 pm
Howdy!

Mate, dunno if it's a bug or something on my side but could be possible to save the handOb and floorObs in the OXC palette like on UnitSprite Studio? Every time I save a sprite it removes the palette and I need to fix it.

Just a minor hindrance, otherwise the tool works delightful. Keep up the good work!  ;D
Title: Re: HandOb maker
Post by: bohemond on April 29, 2021, 09:32:36 pm
I'm not sure if someone is using this for TFTD, but I guess I would have to include that palette too and make it possible to choose which is active.

I guess it's a bother to have to change the palette every time, I'll do something about it.
Title: Re: HandOb maker
Post by: spectrefps on May 22, 2021, 10:36:32 pm
Awesome tool! I recently made some custom/enhanced versions of the stock human-tech guns, but hit a block when trying to make decent-looking HandObs/FloorObs sprites for them. I am TERRIBLE at making/editing sprites (really, my attempts look complete rubbish T_T). This tool, through arcane magic, makes beautiful rotated and floor sprites!! :D

I have a few questions so far:

1. If you click on the image in the top left, it seems to change the 'center' of the sprite. In your experience, is it worth it to change this 'center' position so that the hands are 'holding' the pistol-grip (on a rifle) or does it look better if it is centered (not worrying about where the grip is)? In the example screen shots it looks like you have the 'center point' in the center of the sprite, even though the 'grips' of the weapons are further back.

2. With the "Mask Hand" setting, I noticed that on some of the sprite rotations, the green "masking line" (when "Mask hand" is enabled) goes completely across the whole length of the sprite (on the 2 horizontal-facing sprites) instead of ending at the "grip point". Is this intended? Also, what would happen if we left the Mask Hand setting disabled (like in your example pics)? Would the soldier sprite still cover them up properly, or would the weapon sprite "show through" the soldier's arms/hands when holding it?

3. Is it okay to leave the background color "white" or transparent when exported or should we make it a 'flat image' and use that 'index 0 green' color using something like GIMP (what I currently use to edit sprites)?

Sorry for the load of questions! I am loving this tool so far and it makes the hardest part of making sprites (especially for an un-talented sprite artist like me) much less daunting! ^O^
Title: Re: HandOb maker
Post by: bohemond on May 28, 2021, 07:08:58 pm
1. The eight boxes with the generated sprite show the grip position. It's very faint, I might have to improve that. That little square shows where the soldier's hand will be. The problem is with two handed weapons. Because of the way the soldiers hold them while shooting and standing.
So for single handed, it's better to use the grip position.
For two handed, center usually works better.

2. This one is difficult. I think it's again dependent on handedness of the item. It will probably work better for single handed items. Unfortunately my best advice is try it with and without and look carefully if the right pixels are visible in the right places.
I can now appreciate why Finnik wanted me to integrate some kind of unit view in the tool, that would certainly help with this issue.

3. The exported image is not in OpenXCom palette. That's something that I'm planning to change, but for now, you have to load it in an image editing software and use the battlescape palette and take care that the background is the 'index 0 green'.
Title: Re: HandOb maker
Post by: Finnik on July 15, 2021, 09:15:55 am
Might be an idea that would help two handed weapon issue - make a button that would display some item, like laser rifle, on the position where the game would render it. Might be also worth making switch between idle and fire states
Title: Release: Integration with UnitSprite Studio
Post by: bohemond on March 12, 2022, 10:19:20 am
New version released (on github):
Integration with UnitSprite Studio
Significant performance improvement
Stability improvement
UFO and TFTD palette support

Releases moved to GitHub: https://github.com/bohemond-of-antioch/HandObMaker/releases

Integration with UnitSprite Studio:
More on that at https://openxcom.org/forum/index.php/topic,9524.0.html

Palettes:
Exports only in UFO Battlescape and TFTD Battlescape 0. I do not really see the point of having more options. Matching indexes is done with simple closest RGB.

Documentation:
Finally got around to describing the Advanced Options: https://github.com/bohemond-of-antioch/HandObMaker/wiki
Title: Re: HandOb maker
Post by: Yankes on March 12, 2022, 11:45:25 am
I see that your tool is now must have, with option to make better profiles you can now easy mass produce graphics.
And adding front texture and back texture is simply cherry on top :)
Title: Re: HandOb maker
Post by: The Offensive Lemon on April 23, 2022, 10:52:09 pm
When I try to download the exe from GitHub, Avira warns me of a file "containing the pattern of 'HEUR/AGEN.1221906'."

This didn't happen with UnitSprite Studio.  What gives?
Title: Re: HandOb maker
Post by: bohemond on April 25, 2022, 12:02:42 am
That's got to be a false alarm.
You can build it yourself if you want to be extra careful. The project is in Visual Studio 2019.
Title: Re: HandOb maker
Post by: The Offensive Lemon on April 25, 2022, 02:10:10 am
That's got to be a false alarm.
You can build it yourself if you want to be extra careful. The project is in Visual Studio 2019.

Oh, turns out I can just tell Avira it's a false alarm.  I feel like I should have known that.
Title: New minor version
Post by: bohemond on August 30, 2022, 05:37:01 pm
I've released a new version with some improvements to the Advanced Options and also a bugfix for FloorOb generation.
Release and documentation of new features is on github (https://github.com/bohemond-of-antioch/HandObMaker).
Title: Re: HandOb maker
Post by: Finnik on October 21, 2022, 09:30:58 am
Nice, thank you. Your tools are must-have for modding!