Converting GFX for Wargus

Post Reply
User avatar
b_o
Posts: 328
Joined: Sun Jan 01, 2012 12:07 pm

Converting GFX for Wargus

Post by b_o »

To convert GFX's for wargus, you first need to convert the GFX to an image through the "Graphics Converter" inside of WarDraft.
To do that, you first extract the GFX and the palette from maindat.war(WC2) or data.war(wc1) with WarDraft after the mods you wish to pull graphics from have been installed into wc1 or wc2 (There is a wc1 palette available in the resources thread as you cant really extract a complete palette from WC1) . Then you open the WarDraft graphics converter and select the extracted GFX and the palette you wish to convert. Now to make them ready for Wargus, you need to make sure you select "5" images per row, and check "use X/Y adjustment values in BMP", and set X & Y spacing to '0' (Note: graphics type should be set to 'standard' for WC2 files, I'm extracting from WC1 in this image. Use 'alpha standard' for WC2Alpha version, and 'alpha symbols' for WC1):
1.png
1.png (71.02 KiB) Viewed 8608 times
When you create the BMP, it is almost ready for Wargus. You need to open the BMP in a paint program, and make the background transparent if it isn't already, and save it as a PNG. That is about all there is to it. Usually, the rest of the work is done in the LUA files. If you don't have a GFX, but only a tall single column image, you can try using warDraft to convert it back to a GFX with the appropriate layout.txt, and then go back and export it appropriately with the settings mentioned above.

As far as the graphics are concerned, I think the only LUA files you really need to worry about are units.lua and anim.lua .
In units.lua the size of the frame in pixels is designated with something like this: "size", {32, 32}
Here is an example from unit.lua where I used a 32*32 spider:

units.lua:

Code: Select all

DefineUnitType("unit-spider", { Name = "Spider",
  Image = {"file", "wip/orc/units/spider32.png", "size", {32, 32}},
  Animations = "animations-spider", Icon = "icon-spider",
Wc2 sized units typically use images that are 72 pixels by 72 pixels:

units.lua:

Code: Select all

DefineUnitType("unit-spearman", { Name = "Orc Spearman",
  Image = {"file", "wip/orc/units/spearman.png", "size", {72, 72}},
  Animations = "animations-spearman", Icon = "icon-spearman",
Notice that Animations = "animations-spearman" points to the animations that are designated in anim.lua

In anim.lua, you mostly need to pay attention to the Move, Death, and Attack code, when it says "frame 0" it speaks of the first row in your image, which contains 5 images (image 0, image 1, image 2, image 3, and image 4). When it says "frame 5", it speaks of the second row, etc. The information to the right of the frame number is information which applies to that frame of animation(move, wait, play a sound, etc.). If you are merely rearranging the order of the animation there should be no problem, but if you need to add or remove to the total number of frames, you need to remember that the move's and waits need to add up correctly. So if you want to remove a frame of animation, you should take note of the move # and wait # before you remove it, and then redistribute the same amount elsewhere so that everything adds up correctly. If you change the total number of "wait" for a move sequence, an attack sequence, or a death sequence, it will change the speed of the unit and/or it's animation speed, but if you change the total number of "move", it will cause problems that you do not want to experience. Notice that I only use 5 rows of graphics for the movement animation of the orc spearman, and 3 rows for the death:

anim.lua:

Code: Select all

local SpearmanStill = UnitStill

local SpearmanMove = {"unbreakable begin",
"frame 0", "move 3", "wait 1",
"frame 0", "move 3", "wait 2",
"frame 5", "move 3", "wait 1",
"frame 5", "move 4", "wait 2",
"frame 10", "move 3", "wait 1",
"frame 10", "move 3", "wait 2",
"frame 15", "move 3", "wait 2",
"frame 15", "move 4", "wait 2",
"frame 20", "move 3", "wait 1",
"frame 20", "move 3", "unbreakable end","wait 2", }

local SpearmanDeath = {"unbreakable begin", 
"frame 35", "wait 3", 
"frame 40", "wait 3", 
"frame 45", "wait 100",
"frame 45", "unbreakable end", "wait 1",}

DefineAnimations("animations-spearman", {
  Still = SpearmanStill,
  Move = SpearmanMove,

Attack = {"unbreakable begin", 
"frame 25", "wait 10", 
"frame 30", "attack", "sound archer-attack", "wait 10",
"frame 0", "wait 44", 
"frame 0", "unbreakable end", "wait 1",},

Death = SpearmanDeath,})
Sometimes certain GFX's have an odd arrangement of frames, especially in WC1 units, and also in WC2 dwarves/goblins. You can leave them as is and merely edit the anim.lua to reflect those arrangements of frames. Or you can rearrange them in a paint program to make the animation code more uniform. If you want to rearrange them in the image, I suggest using "Graphics Gale": There is a free version here: http://www.humanbalance.net/gale/us/. First , with the BMP you've created with WarDraft graphics converter, open it in Graphics Gale, then enlarge the canvas to more than twice the width of the current image:
2.png
2.png (19.36 KiB) Viewed 8608 times
Select a "custom grid" of the appropriate size, typically 32*32 for WC1 units, and 72*72 for WC2 sized units.(note 72*72 is not a default option, you can specify your own grid sizes by selecting "setup" from the custom grid menu:
3.png
3.png (24.27 KiB) Viewed 8608 times
Then select "snap to grid":
4.png
4.png (18.13 KiB) Viewed 8608 times
Now you can select a row of frames and move it as a group:
5.png
5.png (25.67 KiB) Viewed 8608 times
Pull all of the death animation frames over to the side so you have room to arrange them:
6.png
6.png (21.63 KiB) Viewed 8608 times
Then get everything back on the left as it was when you started, but this time with the proper arrangement of frames. Select all of the frames(you may have to hold shift if you select them one at a time, but you can also drag while holding the mouse button down), then go to the "all frames" tab and select "crop" to trim the excess workspace you've created when you enlarged the canvas. And save it as a PNG. The final product should look like the files in the graphics folders of Wargus.
User avatar
Andrettin
Posts: 433
Joined: Sun Jun 30, 2013 9:58 pm
Location: Vienna, Austria
Contact:

Re: Converting GFX for Wargus

Post by Andrettin »

Awesome tutorial!
User avatar
Big Daddy
Posts: 118
Joined: Sun Jan 08, 2012 11:23 pm

Re: Converting GFX for Wargus

Post by Big Daddy »

What I've done in the past was apply a patch to Warcraft 2 DOS, and then run WarTool on it.

Clunky, yes, and perhaps primitive, but c'est la vie.

Perhaps Wartool can be expanded to include individual GFX's?
Post Reply