Jump to content

Piecing together the UFO unit frames


marshall

Recommended Posts

Okay, so I've extracted the unit images [uFO] to bitmaps.

 

I find that each frame is made up of 4 different image files [arm/arm/legs/head] rather than just 1.

I try to piece together the images to make up a complete frame but can't seem to find any pattern at all. I end up with misalligned body parts and total chaos with the arms overlapping. Even when I do get one half-right it has taken about an hour - and there are hundreds of images per unit!

 

Can someone please share with me the secret of putting the things together?

Link to comment
Share on other sites

A couple of days I was also messing with the units images also. I couldn't figure out how the game fits the different body parts together but I have a theory that I haven't had time to see if it works.

When creating a unit I think that Tactical simply superimposes the torso, legs and the 2 arms pictures one over the other. If you try this with the full forward (to be more easier, let's designate the positions as if you're look at a clock), 6'o clock position it works. However the trick is to determine where and how to place the arms (torso and legs fit better), particularly on the 2, 4, 7 and 9'o clock positions (facing diagonally). There's a sequence that must be followed, if the unit is facing 3'o clock, for instance, then the left arm goes first, followed by the torso/legs superimposed over it and finally the right arm.

If you do it this way it will work, although you'll have to calculate correctly where each body part must be placed on the center of the .bmp, otherwise the unit will look weird.

 

This is necessary for all X-COM units, plus some aliens. With the civilians and other aliens the pictures are already combined, saving a lot of work.

 

If you figure it out, please let me know. I'm working on a terrain mod and I need to replace some units later.

Link to comment
Share on other sites

If you cant program, you will have a long and boring future ahead where you put them together manually.

 

Stationary units are pretty different from moving units in terms of image offsets

 

stationary units are simply bodyPart+direction in terms of getting the right frame (in most cases)

 

moving units are bodyPart (could be different than the offset above)+animation frame+direction*8

 

oh, and if the unit is moving, you have to shift everything BUT the legs up or down based on what frame it is, otherwise when the unit animates it doesnt bob up and down and the legs separate from the body

Link to comment
Share on other sites

The arms are the problem, because there doesn't seem to be any logical pattern to where you attach them, pixel-wise.

 

The different image pieces aren't the same size and simply superimposing them (starting with any of the corner pixels as the origin) puts the images miles offset.

 

 

Not only that, but I don't want simple 'unarmed' units - I need to have every unit holding a weapon (I need the unarmed ones as well though).

Link to comment
Share on other sites

I must not understand what you mean, because if you attach the top-left pixel of an arm to the top-left pixel of the head that can't be in the right place?

 

And if you mean using the top-left pixel of the whole image as the origin for superimposing, that's definitely not putting the images in the correct place...

 

Perhaps we could look at compiling the first movement frame (facing north-east) of the Chrysalid, so that w're all looking at the same thing.

Link to comment
Share on other sites

The images are 32px wide and 40px high, and align perfectly if you select them that way. I know because I went through the tedious process myself creating these sort of GIFs:

 

https://ufopaedia.xcomufo.com/pics/celatid.gifhttps://ufopaedia.xcomufo.com/pics/chryssalid.gifhttps://ufopaedia.xcomufo.com/pics/cyberdisc.gifhttps://ufopaedia.xcomufo.com/pics/ethereal.gifhttps://ufopaedia.xcomufo.com/pics/floater.gifhttps://ufopaedia.xcomufo.com/pics/muton.gif

 

Each set of images conform to 8 frames per walk-cycle (except the Sectopod and Reaper which have only 4)

 

One other thing you'll find is that if you zoom to the pixel level, you'll see that the pixels around the shoulder of the arm, actually match up with the few pixels around the arm "socket" that it is to attach to.

Link to comment
Share on other sites

I think I'm starting to understand my earlier confusion now. Many thanks for all your helps!

 

So, the head can be one or two pixels disjoint from the legs, in which case I should base the image on the legs and move the head to fit?

Or start with the head and move the legs?

 

As for, say, holding a weapon, is there anything different to be done? Or do I just have to superimpose everything in the right order, and, if so, what is the order?

Link to comment
Share on other sites

I think it would be a good idea to think of the unit as segments. The torso and the legs. Then it'll just be a matter of pinning the torso onto the legs.

 

Draw the legs first. Then, readjust the torso's coordinate to it. When drawing the torso, draw the body, arms and the held object.

 

In most normal walk cycles, the body actually has 3 different pixel elevations, but there are 8 frames. The genius is that the pixel elevation for the last bit in the walk cycle flows on to the first frame. Let's say the first frame starts with 0.

 

The cycle will go:

 

0, 1, 2, 1, 0, 1, 2, 1

 

As the body moves with the legs, it'll look like the unit is rising and lowering with each step. If you base it off the upper body, I get the distrubing image of the unit skipping. :P

 

So, the order is this:

 

Legs, Body

 

The order for the body is a bit more complicated. One of the arms may have to go behind the body from time to time. Otherwise, it should be hidden arm, body, visible arm then held object. Or at least that's how it looks.

 

Okay, okay, I really can NOT explain why I spent hours and hours staring at the leg animation cycle.

 

- NKF

Link to comment
Share on other sites

So do I attach the arms to the head then the head/arms-combined to the legs (ie. arms are attached using head's origin)

or do I attach each piece seperately (ue. arms are attached using legs' origin) ?

 

ie. do the arms rise up and down with the head or do they stay level with the legs?

Link to comment
Share on other sites

This is about as good as I can explain the process:

 

If you export the PCK as a BMP with 8 images across, you can then select each part as a 32x40px box and then shift it down in increments of 41 (because there's 1px between each frame). You should only have to move them vertically and they'll align perfectly each time!

 

I've provided a picture as an example. I hope it makes sense:

 

https://ufopaedia.xcomufo.com/pics/sample.jpg

Link to comment
Share on other sites

It's not really "relative" to anything in particular. You could just as easily move all the parts up to match the left arm's position, it wouldn't really matter. As long as you stick to the 41px up/down shift, everything will be automatically aligned and then you only have to focus on which is in front and which is behind. Once you get the procedure down, it only takes a few minutes to create each walk-cycle.

 

I don't know if you've seen my GIF page, but you can use mine as a reference if you need to.

 

 

Note: I just use the legs as a base myself because it makes more sense to my brain to start from the bottom up :P

Link to comment
Share on other sites

The head will not always be in the correct place if you just shift it by exactly 41 pixels every time.

 

My point is that the head bobs up and down. Do the arms bob up and down with the head or do they stay in the same place relative to the legs?

Link to comment
Share on other sites

https://marshall.cannis.net/v1_1.jpghttps://marshall.cannis.net/v1_2.jpg

 

https://marshall.cannis.net/v2_1.jpghttps://marshall.cannis.net/v2_2.jpg

 

These images illustrate my confusion.

Each row is the first and second frame of the Chrysalid walking NE.

The first row has the arms relative to the legs, the second row has the arms relative to the head.

Note that the second frame is identicle for each case because the head is not offset for that frame.

 

I just wanna get this straightened out before I start putting the whole thing together.

I'm not sure what people mean by the 'body' and I think different people think different things. I consider the 4 elements of each frame to be 'left arm' 'right arm' 'legs' and 'head'.

 

I think the correct way is arms relative to legs but to be sure, I may have to do a complete walk anim for each method and compare them.

Pumpkinhead: in your gifs, what did you put your arms relative to?

Link to comment
Share on other sites

In most cases I didn't put them relative to anything, I just shifted them down 41px and they were automatically where they were meant to be. That's why I can pump them out so fast. But technically, it's the "head" that they should be attached to, because it would look weird to see the body bob up and down while the arms stayed still.
Link to comment
Share on other sites

If you did the shift by 41 pixels then they would be relative to the legs in your gifs.

 

I agree that attaching the arms to the head would make more logical sense but to be sure I guess I'm gonna have to do a complete anim cycle for each method and then compare them.

Link to comment
Share on other sites

Just trying to clear things up:

 

Head or body, it doesn't matter. The head and body (or torso would be a better word) are all in the same object. Now in Apocalypse the head and body are separate sprites altogether.

 

Try looking at your soldiers in a walk cycle and see which one looks the most natural. My guess the arms will be attached to the torso. As the torso bobs up and down depending on the legs, the arms will have to be offset the same amount of pixels anyhow. So, in a sense, they will be following the offsets given by the legs as well. If the upper body (and arms) didn't follow the legs, just imagine what would happen if your soldier decided to kneel. The legs will kneel, but the upper body will float in mid air. :P

 

I think all this object oriented nonsense is starting to get to me.

 

- NKF

Link to comment
Share on other sites

Below is a gif for each of the 2 methods (arms relative to legs [1], arms relative to torso/head [2])

 

https://marshall.cannis.net/v1.gifhttps://marshall.cannis.net/v2.gif

 

I think you'll agree that the first/left animation looks correct whereas the second one doesn't.

The first/left anim is in fact with arms relative to legs (which would be effected by doing the pixel shift that Pumpkinhead used, which is also the simplest for piecing them together)

 

Note that the above animations only have the first seven frames (rather than all 8) - I just couldn't be bothered to do the last one.

 

Does everyone agree? Any other comments?

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
×
  • Create New...