Author Topic: UnitSprite Studio  (Read 32132 times)

Offline Thorir

  • Squaddie
  • *
  • Posts: 5
  • Newbie on classic XCOM - a Doomer in fact.
    • View Profile
    • Moddb profile
Re: UnitSprite Studio
« Reply #45 on: March 21, 2022, 05:28:36 pm »
Theoreticaly can I create separated sheets for each weapon? Frankly speaking my ultimate goal here is to assemble NPC sprites with different arms for Doom... ::)

Offline bohemond

  • Sergeant
  • **
  • Posts: 44
    • View Profile
Re: UnitSprite Studio
« Reply #46 on: March 22, 2022, 10:42:12 am »
Yes, you can. A sprite sheet for a single item will be 256x40. You might also want to take a look at HandOb maker (https://openxcom.org/forum/index.php/topic,8160.0.html), which easies creation of these sprite sheets.

But I'm hardly qualified to help with modding and especially the graphical side of things. If you ask about creating item sprites in the Help section, I'm sure you will get much better advice than I can give.

Offline Thorir

  • Squaddie
  • *
  • Posts: 5
  • Newbie on classic XCOM - a Doomer in fact.
    • View Profile
    • Moddb profile
Re: UnitSprite Studio
« Reply #47 on: March 22, 2022, 12:12:57 pm »
That's already more than enough for a solid start. Thank you for your help!

Offline The Offensive Lemon

  • Sergeant
  • **
  • Posts: 10
  • Praise the Ł É Ɱ Ö Ñ, for the Ł É Ɱ Ö Ñ is eternal
    • View Profile
Re: UnitSprite Studio
« Reply #48 on: April 19, 2022, 05:20:43 am »
I'm trying to load a spritesheet into the program, attached below (xcom.png), but I get this error:

Quote
An error has occured during loading of the file: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

I'm pretty sure everything checks out, from the size of the image to the exact colors used.  I don't know what I could be doing wrong.

EDIT: In case it helps, the image was saved with paint.net with 8-bit bit depth, Median Cut quantization, dithering level 0, transparency threshold 128, not interlaced.

I also created another image file (fuck.png) with UnitSprite Studio, saved it, and loaded it again without problems.  I did not touch that one with paint.net.
« Last Edit: April 19, 2022, 05:36:29 am by The Offensive Lemon »

Offline Alex_D

  • Colonel
  • ****
  • Posts: 498
    • View Profile
Re: UnitSprite Studio
« Reply #49 on: April 20, 2022, 12:56:15 am »
I think the image "xcom.png" needs to be reduced to 256 colours.

Offline The Offensive Lemon

  • Sergeant
  • **
  • Posts: 10
  • Praise the Ł É Ɱ Ö Ñ, for the Ł É Ɱ Ö Ñ is eternal
    • View Profile
Re: UnitSprite Studio
« Reply #50 on: April 20, 2022, 02:15:47 am »
I think the image "xcom.png" needs to be reduced to 256 colours.

I figured setting the bit depth to 8 bits would do that... fuck.png has the same bit depth, after all.

EDIT: If I change the bit depth to something other than 8, USS tells me:
Quote
An error has occured during loading of the file: Unsupported image format!

Also, weirdly enough, if I put in the first attachment (gkjkgjkgkjgkjgkhgk.png), which also has bit depth 8, it works.
« Last Edit: April 20, 2022, 02:34:56 am by The Offensive Lemon »

Offline bohemond

  • Sergeant
  • **
  • Posts: 44
    • View Profile
Re: UnitSprite Studio
« Reply #51 on: April 21, 2022, 11:12:29 pm »
I've identified the problem. The xcom.png image has a palette with only 67 colors, because it's saved with optimized palette. The function that tries to identify the palette expects there to be 255 colors, hence the index out of range error. I did not account for this feature of PNG.

I'm not sure if there is a point in fixing this, as the optimized palette sprite will not work in-game anyway. I'll fix it if I see a simple way to do it.

In the meantime, I've attached your spritesheet saved with UFO Battlescape not-optimized palette.

Offline The Offensive Lemon

  • Sergeant
  • **
  • Posts: 10
  • Praise the Ł É Ɱ Ö Ñ, for the Ł É Ɱ Ö Ñ is eternal
    • View Profile
Re: UnitSprite Studio
« Reply #52 on: April 22, 2022, 05:17:37 pm »
I've identified the problem. The xcom.png image has a palette with only 67 colors, because it's saved with optimized palette. The function that tries to identify the palette expects there to be 255 colors, hence the index out of range error. I did not account for this feature of PNG.

I'm not sure if there is a point in fixing this, as the optimized palette sprite will not work in-game anyway. I'll fix it if I see a simple way to do it.

In the meantime, I've attached your spritesheet saved with UFO Battlescape not-optimized palette.

Thanks a lot!  If I may ask, how did you un-optimize the palette?  I can't seem to do that in paint.net.

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9078
    • View Profile
Re: UnitSprite Studio
« Reply #53 on: April 22, 2022, 09:27:36 pm »
Don't use paint.net, it can't do it.

There's a long list of image editors that can do it: photoshop, gimp, asesprite, irfanview, and many many more.
See https://openxcom.org/forum/index.php/topic,7781.0.html

Offline bohemond

  • Sergeant
  • **
  • Posts: 44
    • View Profile
Of Tanks and Chryssalids
« Reply #54 on: October 23, 2022, 01:03:13 am »
New version is released and on github.

Support for Drawing routines:
2 - XCom HWP
7 - Chryssalid
8 - Celatid
9 - Silacoid

New features:
You can edit the Item sprite directly in the studio
Pixel operations preset for fixing the common problem of left <-> right arm switch
More shortcuts for selecting layer (numbers 1 through 9)
New Single frame sprite can be created with custom size and palette

Bugfixes:
Color shift now works properly for complicated Drawing routines
Loading of non 8 byte aligned images
Item layers are handled with better performance

Notes:
The new drawing routines are not tested in game, please report if you spot any problem.
Only Soldier(0) and Floater(1) drawing routines support display of items, so you have to load up one of those to use item editing.

Offline gaffer

  • Captain
  • ***
  • Posts: 60
    • View Profile
Re: UnitSprite Studio
« Reply #55 on: October 23, 2022, 01:58:18 am »
Many thanks Bohemond!

Offline Finnik

  • Commander
  • *****
  • Posts: 508
  • Finnik#0257
    • View Profile
Re: UnitSprite Studio
« Reply #56 on: October 23, 2022, 11:53:27 am »
Thank you!

Offline b

  • Sergeant
  • **
  • Posts: 49
    • View Profile
Re: UnitSprite Studio
« Reply #57 on: December 26, 2022, 10:38:08 pm »
Has anybody gotten this to work on Linux? 

Offline efrenespartano

  • Commander
  • *****
  • Posts: 765
  • I know a lot about the law and other lawyerings.
    • View Profile
Re: UnitSprite Studio
« Reply #58 on: December 28, 2022, 02:46:41 am »
With Falko's tools down, there is no way to properly create 2x2 units. Cutting them without the aforementioned tool is nearly impossible. God Bohemond, could be possible to add the option to create large units on your tool?

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11721
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: UnitSprite Studio
« Reply #59 on: December 29, 2022, 12:23:36 am »
With Falko's tools down, there is no way to properly create 2x2 units. Cutting them without the aforementioned tool is nearly impossible. God Bohemond, could be possible to add the option to create large units on your tool?

I wholeheartedly second that wish, if this is within the scope of your program.