Lamron
Benevolent Dictator
Posts: 5,214
|
Post by Lamron on Feb 4, 2008 2:06:47 GMT -5
RedRock mentioned in another thread that people might like to see what goes into developing a new custom weapon for the server. So I'm going to try to give a non-technical overview of our last project, the Crossbow. AIGAD can jump in wherever to explain how he works his magic. This will probably be a fairly long explanation, so I'm going to do it in sections over the next couple of days. The Crossbow took six weeks of collaboration to complete, but it was fairly straightforward. The Pulse Rifle was by far the hardest project we've done. It took over two months of intense and frustrating work. I don't even want to attempt to explain that one, I'm just glad its done!
===================================================
First we start with a concept. This includes finding pictures of the real item for reference, deciding which set of hand positions are we going to use, deciding what parts of the model need to have animated movement for firing, and figuring out what parts of the model need their own surface names so they can be drawn or hidden independently. AIGAD and I discuss this back and forth by E-Mail until we have a pretty good idea of what we're trying to do. There are certain things I need to have as part of the model files so I can script the functionality, so I have to let him know what I have in mind before he starts on the model.
As we're working, we send our work-in-progress back and forth to each other. We're working on different parts of the project, but they have to proceed in parallel because so many details from each half impact the other. So we really can't just do our own thing, and join it together at the last minute.
Here's the project division:
AIGAD: (<= He'll have to describe this part of the process!)
-Model. This is the actual solid shape of the object created using special design software. -Animation. Moving parts on the model (firing, reloading, etc.) -Textures. These are pictures that are wrapped around the different parts of the model to give it color/design. -Shader. This tells the game which parts of the texture goes on which parts of the model, and how they should be lighted.
Lamron:
-.tik files These files tell the game how to use the model and texture information to put the object into the game. This also tells the game that the object is a weapon and has all the characteristics for damage, movement, firing type/speed. This also controls which sounds are used for the weapon and how it recoils when fired. It also controls the muzzle flash that is shown at a bone in the model called "tag_barrel" and spawns ejected shells at "tag_eject". (neither applied to the Crossbow). Three .tik files were needed for the the Crossbow. One for the weapon in your hand, one for the arrow in flight, and one for the arrow sticking out of something.
-state file. This handles taking player commands and generating the correct action or animation. Basically the player sends something like "attackprimary" and the state file makes all the actions needed for that happen. It also handles forced events like reloading when you're empty and death animations. This probably the part of my stuff that takes the longest time to complete. I have to write new sections to handle the special needs of this weapon for firing and reloading, since it is unlike any of the stock game weapons.
-sound. Sometimes as easy as ripping the sound from other games, or other internet sources. The Crossbow requires a complex, carefully timed four-part reload sound, so I ended up making it myself with sound editing software. The same for the arrow impact sound.
-special weapons menu. I have to get a good in-game picture of the weapon, then cut it out of its background. It then gets superimposed onto another background so they all look the same. The menu script I wrote a while back has to be updated to allow you to pick the new weapon of the menu. The script uses your view angle to determine where you are looking, then shows the correct picture on the menu. This step can take a bit of time to make it look good, but I'm basically just adding to a well-established special weapons menu script we've been using for a long time.
|
|
|
Post by vinsanity on Feb 4, 2008 10:38:35 GMT -5
It amazes me that any of this actually works. I appreciate the effort as I truly enjoy the results.
|
|
a Silly Person
New Member
Always remember that you're unique. Just like everyone else.
Posts: 1,370
|
Post by a Silly Person on Feb 4, 2008 11:46:57 GMT -5
Thanks for the suggestion Redrock and another big thanks to Lamron for taking the time to try and explain how some of the magic works. I say try not because I have doubts about Lamron's ability to describe what he and Aigad are doing, but because some of us, myself included, will never understand how all of this works. We just know that it is not very easy. I am pretty sure that it is not as simple as "grabbing the tank and lifting it up to slide a few crates under it to keep us out", is it Lamron?
|
|
RedRock
LPmember
Never ask what kind of computer a person uses--if it's a Mac, he'll say; if not, why embarrass him?
Posts: 4,968
|
Post by RedRock on Feb 4, 2008 14:20:58 GMT -5
Thank you, very very much, for the explanation. I will never do anything even close to that, but I thought it would be good for us to see what you two have been doing. I was totally unaware that all this was going on "behind our backs" and for months and months. I knew Aigad did the art for the R.E., but I had no idea he was helping with other projects, or that it was all this labor and time and creativity intensive. I think in some ways, you two do not get all the recognition and applause that you are due--you just make this look too too easy, and that makes it easy for us end-users to take it for granted or dis it when it isn't exactly perfect or doesn't turn out as envisioned (the murdering Medic "bot" comes to mind, LOL). I hope you enjoy doing it, because from here the process looks like a lot of hard, tedious work. So, thank you thank you thank you, and wow wow wow, way to go!!!! I look forward to future installments of the explanation, as time permits!
|
|
AIGAD
LPmember
Posts: 404
|
Post by AIGAD on Feb 4, 2008 23:06:26 GMT -5
Yep, Like Lamron said, we find a picture of reference. From there we go over the basic mechanics on how the mod will work and what will be the best way to approach the project effectively. Though, Lamron usually has a plan put together at the beginning. I start out making a prototype model which I like to call a "graybox" model. This model is pretty much just the basic geometry that has all the surface names, shaders, bones, and functionality that Lamron needs to do his scripting voodoo. Graybox with basic texture and size comparison... I use two 3D programs to make the weapon or mod. 3dsMax is what I use to do all the modeling in. LightRay3d is what I use to "rig" the model with bones and also do any animations there might be. LR3d is also what I use to make the necessary 3d file formats that the game requires. Once I hand those over to Lamron, he usually puts together a PK3 that has the weapon selectable in a map that lets you see in 1st and 3rd person. This is very helpful in many ways... Here we can do heavy testing on the project and see what sort of conflicts we might run into. We can actually see what the weapon is going to look like in game when we start working on the positioning, animations (like the dreaded Pulse Rifle!), and creating the final texture. In the past few projects we've learned that... 1. If the project is going too smoothly...somthing is terribly wrong! 2. and when somthing terribly wrong happens, there is always a way around it! So, it always nice to get all the kinks worked out before we start adding the polished details. During the texture process, I use Photoshop and 3dsmax. In 3dsmax, I put a white texture on the model and render out either a lightmap or an ambient occlusion map. Below is an example of a light map that I used for the crossbow. This map provides accurate information for shading the model and also acts as a template for "coloring" the texture. In Photoshop, I add the light map as an overlay to the colored texture to create the final texture. Final texture... I hope that covers it. I'm not very good at explaining things unless I have visuals!
|
|
Lamron
Benevolent Dictator
Posts: 5,214
|
Post by Lamron on Feb 4, 2008 23:06:52 GMT -5
Part 2: Usually, AIGAD will send me a basic model so I have something to work with while he's refining the end product. So at this stage I'm working with a rough model, but I'm going to use the final version in these pictures because it looks nicer. (and because I've already deleted the test version ) First I write a basic .tik weapon file so I can get the model into the game and start checking things like angles, hand postions, etc. Then I start working on the firing animation. I'm going to let you in on a secret; the Crossbow doesn't actually have any animation. It just sits there with NO moving parts (I planned this way back in the concept stage). So I have to produce the illusion of firing an arrow. Lets take a look at the model itself: You might notice something strange about it. There are TWO strings and TWO bows. Each part of the model has what's called a "surface" name. This name is referenced in the shader so it knows what texture to put where. The forward bow and the forward string where given the name "Bow_Fired" and the bent bow and cocked string are named "Bow_Ready". There's also "Arrow2" and names for all the other parts of the model. When you raise the weapon, my script hides (makes invisible) the surface "Bow_Fired" so that only "Bow_Ready" is visible. When the state file detects that you are trying to fire this weapon, I have it hide surface "Bow_Ready" and surface "Arrow2". Then it unhides surface "Bow_Fired" so it looks like the string and bow have snapped forward and the arrow is gone. The firing sound is played and a little recoil is applied to make everything jump a little. This makes for a pretty convicing illusion of firing animation, since on a real crossbow it moves almost too fast to see anyway. The entire model is always there, just different parts are shown/hidden at different times. Getting the firing to look good was one of the easiest parts of the scripting, since I had planned to use this method from the very beginning, and AIGAD had set up all the surfaces to make it workable. My weapon .tik says that this weapon's "magazine" only holds one "round" of ammo. So each time you fire it, the game automatically forces the state file to try to reload it. Next: Reloading
|
|
|
Post by vinsanity on Feb 5, 2008 0:56:04 GMT -5
incredible.... simply incredible.
|
|
Lamron
Benevolent Dictator
Posts: 5,214
|
Post by Lamron on Feb 5, 2008 3:35:34 GMT -5
Part 3:
The state file automatically forces a reload after the crossbow fires because its one-round-magazine is empty. The syntax the state file uses isn't flexable enough for me to do what I need, so I made a fake Crossbow reloading function that actually just starts another script and passes info to it. The scripting language gives me the flexability I need for functions too complex for the state file to handle, so I frequently use this method to step out of its limitations.
Since we don't have any actual hand motions for reloading, the sound plays a big part in "selling" the simple visuals. I use a freeware sound editor called "Audacity". This lets me combine tracks and edit the sound in several ways. I need four sounds here: creeking for the bow being bent back, click as it locks into place, short wood on metal sliding sound for slipping the arrow into place, and a tick for the end of the slipping. So I go looking for sounds on the internet that are close to what I want. There are foley sounds libraries available for movie and media productions, but I'm looking for free ones so the choices are limited.
It took me quite a while to put the different sounds together in a way I was satisfied with. Each track has to be edited for volume, speed, timing, pitch, fade in, direction, etc. Its basically a lot of trial and error while sitting in front of the speakers with my eyes closed playing the sounds over and over again until I can imagine the reloading actions happening and think it will be convincing to others hearing it.
There is a short delay before the script starts, so you'll have time to watch the arrow fly (and admire the Crossbow in its fired postion). Then the sound file starts playing and I time the other events to syncronize with the sound. At 1.0 second into the sound, the creeking is done and the click! sound happens. At that point, the "Bow_Fired" is hidden and the "Bow_Ready" is unhidden. So that makes the bow look like the bow is back and the string is locked into place. Then, at 2.1 seconds the slip-tick is done playing and I unhide the "Arrow2" so the arrow looks like its back into place.
Then my script hands control back to the state file where I tell the weapon that the reload is done and that there is now one "round" in the "magazine" and the player is free to fire it or change weapons. This hand-off between the state file and my script and back again is why you can't switch weapons while you're reloading. At a couple of places in the reload sequence I do health=0 checks to see if we need to abort and let the state file take over death animations.
The scripting for this part is easy. The visuals are basically reversing the hide/unhide functions used in the firing. The sound and the timing are what make it appear believable for the player using it.
Next: Projectiles
|
|
Death's Shadow
LPmember
I have become Death. The destroyer of worlds.
Posts: 3,184
|
Post by Death's Shadow on Feb 5, 2008 9:54:40 GMT -5
wow.. very interesting stuff here..
Thank you again Lam and Aigad
|
|
|
Post by I...Died...Again!!! on Feb 5, 2008 12:37:28 GMT -5
I think there should have been a warning like the one they use for mythbusters. "Warning Scientific Content". My head hurts and I have no clue.. can only imagine what your eyeballs must feel like. lots of eye drops I presume.
|
|
Killer_Monkey
New Member
Even a creepy little undead Monkey can kill!!
Posts: 199
|
Post by Killer_Monkey on Feb 5, 2008 14:25:41 GMT -5
wow that is just crazy....and i never knew that the weapons had writing on them...do they really have the names of the people who created them??? but thats so totally cool...thx for the explanation
|
|
Lamron
Benevolent Dictator
Posts: 5,214
|
Post by Lamron on Feb 5, 2008 16:36:29 GMT -5
Part 4:
Now we get into some of the tricky stuff. For the first time we have a projectile that doesn't just disappear when it hits something and damage anyone nearby (+ some explosion visuals). So there wasn't any stock game examples to work from or previous mods to adapt to this.
AIGAD provided an arrow model to match the dummy attached to the Crossbow.
Experimenting showed me what problems existed and what I needed to do to solve all those problems. I won't bore you with all the different things I tried that failed. Here's basically what I needed to do once I figured out how to make it all work.
Crossbow: The weapon .tik has to be written to define this as a projectile weapon and tell it which .tik to spawn/launch when the weapon is fired. The type of ammo is set here also so you can pick up more from dropped weapons. At this point I finalized the settings for movement speed and zoom power.
Arrow in flight: The projectile .tik is where I set the speed, how gravity effects it, deceleration (if applicable), amount and type of damage done on impact, and if this is a bounce type model (grenades) or an explode-on-impact type (mortars). I also set which explosion model to use.
Explosion: Normally, this is the visual effects for the explosion, and the damage amount/radius done. Then it disappears a fraction of second later. This doesn't give me nearly enough control, so I created a dummy explosion that has no visual effects and does no damage. Its sole purpose is to start another script and pass on the location and angel information before it disappears.
Arrow Impact Script: By this time, the arrow model you saw in-flight is long gone. So the first thing I need to do is spawn another dummy arrow at the point of impact, using the location and angle info received from the Explosion. AIGAD and I played with the arrow's bounding box so it would look like it had partially penetrated the wall when it was placed at the point of impact. The model is made "notsolid" so that players don't get hung up on arrows sticking out of things. Then the impact sound is played. The thunk-boinng sound is another I created by adjusting and combining other sounds. Its a tiny bit on the cartoonish side, but I think it sounds cool in the game.
The script checks to see if the impact point is a player. If it is, the dummy arrow model is removed, so that we aren't left with floating arrows when the player falls down.
You might be starting to get an idea why these projects can several weeks to complete. ;D
Next: Death Animation
|
|
Killer_Monkey
New Member
Even a creepy little undead Monkey can kill!!
Posts: 199
|
Post by Killer_Monkey on Feb 5, 2008 16:47:16 GMT -5
yeah i can already tell....how long does it take you to type those explanations....but you must be a fast typer...but again wow...it must take some time
|
|
|
Post by Sgt_Blueberry on Feb 5, 2008 16:50:00 GMT -5
Some of this I understand and most of this I don't. What I do find most impressive is that you two do this in your spare time so that a group of middle aged bored guys (myself inculded) can enjoy playing on your server. Thank you very, very much !!!!!!!
|
|
Killer_Monkey
New Member
Even a creepy little undead Monkey can kill!!
Posts: 199
|
Post by Killer_Monkey on Feb 5, 2008 16:57:37 GMT -5
yeah i thank you lots cuz for us young GURLS kicking butts of guys who are bored and think im a guy is a way to get a giggle out....thx
|
|