Sunday, June 28, 2009

Animating with the md3 file format.

This is a description how the md3 fileformat worked in player-animation in Quake 3 and still works in World of Padman. That is not exactly news, and if you're already familiar with it you can stop reading this right now. If you're not familiar with the system and want to look into animating with it or are just interested in how the game works this might be of value to you and can give you a basic understanding of the animation system. This is not a tutorial that tells you exactly what to do though.

There are a couple of differences to the way recent games handle animations and how Quake 3 did it. Todays games have the basic model that is loaded into the game and a (invisible) seperate skeleton that deforms each part.
This allows things like ragdoll effects, where the model reacts dynamicly to the environment. It also allows animations that only move specific parts of the model, like the arms in a shooting animation, while the leg bones play a totally different animation.
In Quake 3 and WoP all this is precalculated onto the model. The skeleton never leaves the animation program instead the position of every point of the model is saved for each animation step and exported. This leads to larger filesizes and undynamic animations.


The three pieces of the PadKing player model.

Because of this, each model in Q3/WoP can only play one animation at any point. So what do you do if you want the playermodel to shoot and run at the same time? You could make a sepcific "shooting while running" animation. But even if you went ahead and tried to create a shooting animation for each case of standing, running, walking, walking crouched, crouched, and swimming you wouldn't have covered each case because you would need a version for each exact frame of that animation to have a fluid animation. And then you would only have covered the shooting, but what about switching weapons, playing a taunt etc.?
For this reason Quake 3 split the models into three sperate parts, the legs, upper body and head.


Upper.md3 contains three different tags.

Each of them are connected with a "tag". For example the upper body model would have a "tag_head" positioned at the neck while the head model also got a tag_head where it would meet the neck. The head is now placed onto the upper body so that both tags align perfectly. If the tag_head in the upper body is moved in an animation the head adjusts to that and rotates with the neck. There are also tags for the torso and a tag for the weaponmodel within the according models. The head is not animated in itself at all, so only its position changes based on the torso model, there is for example no animation for a mouth. This is not a limitation of the md3 system though, it's just how Quake 3 and WoP use the system and I guess it could be changed by a coder.


Secondary animation added by the engine.

With this system in place now the legs play the running animation while the upper body plays the shooting or idle animation. Which is a big improvement over Quake 2 which only actually played one animation for the whole model as far as I know, so players didn't have a shooting animation when running, there just appeared a shot from their gun with no movement of the arms.
The disadvantage in Quake 3/WoP however is, that the upper body doesn't "know" what the lower body is doing. So you won't see shoulders or the head moving together with the running animation like they would in reality.
For WoP this means that Padman's cape can't really be animated because real animation would happen when he jumps, runs, or swims which are all animations of the lower body, not the torso/cape. The reason why you can't just define the cape as part of the lower body is that there is also a bit of secondary animation that Quake 3 adds automaticly. If for example a player looks up the torso model is rotated back a bit and the head rotates into the viewing direction. If you would put the cape into the leg model now it would fit the upper body IF the upper body looks straight ahead, not up or down or to the side. Once the torso is rotated the cape would still stay in place which would just be broken. This secondary animations of looking around etc. ads alot of life to the characters which do have a stiffness problem already with the upper body not really reacting to running animations etc. so you probably wouldn't want to make it worse by cutting this secondary animation out even if a waving cape would be pretty. ;)
Doing a strong random waving animation for the cape could maybe work ok for standing and running if you get it just right, but once you throw in running backwards having to use the same animation you can just forget about that. ;)

As I mentioned in my post about the PadKing model which I created and animated for WoP I made up the model specificly to allow a cape animation by putting a belt around the cape keeping the upper part still, while the lower part can be animated with the legs. I also put his sword on his back so he can grab it and wave it around as a taunt which wouldn't be possible if I had put the sword onto the lower body, like the sabre PiratPad carries for example.
If you want to complain about the sword just hovering on his back, there's a magnet hidden under the his cape which is just strong enough to hold it in place btw. ;)

I hope this post helped a bet if you want to look into animations for WoP or another tech 3 game.

Tuesday, June 9, 2009

Killerducks

A while ago Mr.KiLLERDUCK asked me for some pictures of Killerducks, and since Killerducks are awesome I rendered a few.
They're just the regular in-game model, except for the wheels which I rounded up a bit, so they're pretty lowpoly. They should work well in smaller sizes for things like board avatars or signatures, though.



Just remember: Do not feed the Killerducks.

Friday, June 5, 2009

The creation of the PadKing player model

PadKing is the first player model I have done for World of Padman and actually the first playermodel I have ever done period.
However, I had done a number of static models and their textures for the game, so the model creation wasn't the real problem. We just didn't have any team member who could have animated it. The few animators that were interested in helping WoP out had no experience with the md3 file format we use, so I looked a little deeper into that to find out what they had to know about animating it.

I got two or three different animators to the point of correctly exporting those animations, and then...never heard of them again. Since I knew the theory now at least and had very basic animation experience I thought I'd try my luck to animate a model myself. I decided to create my own character to test animation with because we were still looking for animators and I wouldn't want to throw my half-done work away or block someone from animating the main WoP models. If my animation wouldn't turn out that great I could still release the character as an unofficial download since the character wasn't known yet.

PadKing enjoying himself on PadCrash

Now, the standard Quake 3 animations are a special case, there is no skeletal animation system in the game so all animations are predefined in the model. Which also means every model only plays one animation at a time. Each model could only play a running OR shooting animation in a practical way and for that reason the player characters are actually made up of three seperate models. Legs, torso and head. This way the torso plays the shooting animation while the legs play the running or any other of their animation. It is not a perfect solution because it means torso and legs don't interact. Arms don't move with the running motion and hands couldn't touch the foot because they lack the information of the foot's location.

For the WoP models this means Padman's cape doesn't float while running and PiratPad can't pull his saber. Since I can't allow technology to beat me that easily I designed my first model in a way that allowed my character to do both. This lead to the PadKing design, who sports a longer cape than Padman which is seperated by a belt put above the cape. This way the lower part of the cape can be animated with the legs. I also put a sword on his back which his hands can grab because it is part of the same model.

Once the model was done Ente was coincidentally working on a new version of his PadCastle map, so PadKing made his first cameo as a statue on that map.

For the animation part I started of with Quake 3 animations as reference, because I had never really done animations like that before and I needed a starting point. I didn't import the Quake 3 animations onto PadKing though. I just analyzed them and then did some from scratch, because a) I wasn't sure about the copyright b) I don't see PadKing doing backflips really and c) I want to create content not just copy it. Some of the animations might be pretty similar to Quake 3 animations others not.

When I was done and thought the animation was good enough for WoP I presented it to the team. I wouldn't have forced PadKing into the game if the team didn't like him since it wasn't my job to do animations before. But the team did like the model and animations and now you can look forward to Mr. fancy cape in WoP 2.0. Hooray!

Wednesday, June 3, 2009

"Harm's Westernset Week" roundup

Last week I ran "Harm's Westernset Week" on twitter, each day posting a new rendering of a mapobject I did for that map. I thought I should collect all those pictures in one place, so here we go:



We also published some screenshots of Harm's Westernset a while ago Which also show most of the mapobjects in tiny form. The sheriff's star isn't shown in any shot yet though, it will replace the gold coin jump pads.


"Harm's Westernset" map will be played in the new "Capture the Lolly" gamemode which is part of the upcoming World of Padman 2.0 release.

Monday, May 25, 2009

Changing heads in World of Padman

This is a copy & paste from a moddb blog entry that's nearly a year old, but I thought I should place it here, too. It's still all true though, especially the "World of Padman 2.0 coming (hopefully) later this year" part, it's just not the same year anymore. ;)

Since we just posted a news about different headmodels on different skins in World of Padman 2.0 coming (hopefully) later this year, I thought I would write a bit about how it's working and why we implemented it.
So the basic concept is, that by chosing a different skin for a model, like Padman for example, you're not only chosing the skinfile but, if the skin is set up accordingly, the head also switches to a different one.

Padman always used many different skins which gave him a totally different appearance and character. Still the geometry of the model only allowed changes to a certain degree. So that was one reason for me to push Ente a bit to get this head feature implemented. ;) I wanted to bring it a step further and bring even more diversity into the skins with not too much extra work. Looking at how important the face/head is to identify a person, this means you can pretty much create a new character without having to animate anything at all. The new character just has to share the body with a previous model, but the body is often enough defined mainly by the skin anyways.

What makes creating just a head over a whole new model much easier, other than the fact that the head is less work to model than is modeling a whole body of course, is the fact that Q3's "md3" format has the playermodel split up in 3 parts anyways. These parts are the head, the upper and the lower body. This was before skeleton animation in games became widely popular, which has some major advantages over the way Q3 handles animations with md3's, but for this case it also means that heads in the md3 format are not animated at all. They are only automaticly rotated by the game into the direction the player watches, they don't have any real animation, which makes it easy for us to create some.

I hope this feature encourages some modellers to create some heads for skinners or skin them themselfs without having to get a grip on Quake 3 animations for that, which I've seen alot of people get annoyed with. ;)

The way the game choses that headmodel is pretty straightforward. My first thought was that we could add a command in the skinfile that defines the head, but as raute, our coder, told me, the skinfile gets actually only loaded after the models. So how we're doing it now is just using the filename. If you select the blue stonepad skin for padman, the game first checks if there is a head_stonepad_blue.md3 in the padman directory, if there is none it goes on to head_stonepad.md3, which in our case exists and gets used, otherwise it would use the head.md3 model like usual which is padmans normal head.

So if you're planning some skins with crazy heads for WoP 2.0 already, you could just start in the current WoP and then test your new head with the /headmodel command and have the skin/head up and running when WoP 2.0 finally comes out.