Welcome, Guest! Login | Register

Half-Life Weapon Model Profiles [Print this Article]
Posted by: Spider
Date posted: Feb 22 2003
User Rating: N/A
Number of views: 15776
Number of comments: 0
Description:
This article details the two weapon models that were released with the Software
Developer's Kit. It will give you an idea of polygon limits, texture limits, the
skeletons and animations. It has specific information about 3D Studio Max and
requires some experience with it to understand this information. I've put together
a href="http://www.planethalflife.com/dl/dl.asp?planethalflife/wavelength/models/weapons.zip">Weapons
SDK that just has the weapon files to make it a smaller download, plus it
is set up to make compiling very easy.



Weapon models require three different versions: the ViewModel
that is seen from the player's viewpoint, the WorldModel that's
seen within the map, and the DMPlayer Model that is seen in other
player's hands during Multiplayer games. All have at least one animation, even
if it's just idle. Making weapons is similar to making other items or characters.
You make the model, create a template for skin, paint the skin, apply Physique
and fit it to the bones, export it, then compile it to an .mdl. The ViewModel
has a camera to help position the weapon correctly, but isn't exported to the
game.





Here's general information before detailing each model:

Models:

The WorldModel scale is slightly larger than DMPlayer, around 1.3 instead of 1.0,
even though the same model is being used. Then a modified version is made for
the ViewModel, with hidden faces removed to reduce the polygon count. Hands are
added to the ViewModel and hidden faces and even entire fingers can be removed
if they're not seen.





Smoothing Groups:

Smoothing Groups can be used to help smooth edges or accent areas. The included
images have assigned colors to each Smoothing Group to distinguish them and show
where they are assigned to each model.





Skins:


The skins are 256 color .bmp files, each having their own palette. Skins are set
up as Multi/Sub-Object textures in 3D Studio Max. Parts of the skin are applied
to specific faces of the model with the Edit Mesh Modifier. The UVW Mapping Modifier
then adjusts the skin to line up correctly. They are done the same way as any
other model, so here's a detailed Skin Texture
tutorial
to learn more about that.





Skeletons:


Weapons actually do have a skeleton. This is because the game engine only animates
skeletons, not individual vertices, so a simple bone skeleton is created for weapons.
The model is attached to the bones using Physique, a 3D Studio Max Modifier. Envelopes
are not created and there is no blending between links. Be sure to assign vertices
as rigid (green), not deformable (red). Bulge Angles and Tendons aren't used either.




The Biped in the DMPlayer Model is the same Biped used for multiplayer models.
This makes sense since now is when you attach the weapon to the multiplayer model.





Animations:


For the WorldModel and DMPlayer Models, the reference frame .smd is also used
for the skeletal animation .smd. Although there are 36 frames for the Gluon and
31 frames for the MP5, neither have any keyframes for animation. Only the ViewModel
needs to animate.





ViewModel Camera:

The camera is only used to help with animations, it doesn't go in the game. It's
Field of View is set the same as in the game: Lens 18 mm, FOV 90 degrees.

It's position is relative to the model's origin in World coordinates, and for
weapons using a Biped, it's near 0, 0, 64. The MP5 uses regular 3DsMax bones instead
of a Biped, and it's origin and camera are in different positions.





Here is each model's details:

MP5

ViewModel:















user posted image




user posted image
483 polygons, 386 vertices colored Smoothing Groups





WorldModel:















user posted image




user posted image
180 polygons, 94 vertices colored Smoothing Groups





DMPlayer Model:















user posted image




user posted image
180 polygons, 94 vertices colored Smoothing Groups







Gluon

ViewModel:















user posted image




user posted image
1444 polygons, 925 vertices colored Smoothing Groups





WorldModel:















user posted image




user posted image
187 polygons, 127 vertices colored Smoothing Groups





DMPlayer Model:















user posted image




user posted image
187 polygons, 127 vertices colored Smoothing Groups







Skins:


These are done differently than multiplayer model skins, although I would recommend
that you use the least number of files and make the dimensions a power of 2,
like multiplayer skins. The weapons have been done like the monsters, with alot
of skin files, and most divisible by 8. Below is a list of how many files were
used, and the total texture size.



MP5


ViewModel: 13 files, 78.1k

WorldModel: 2 files, 8.1k

DMPlayer Model: 2 files, 8.1k



Gluon


ViewModel: 21 files, 82.2k

WorldModel: 2 files, 38.1k

DMPlayer Model: 2 files, 38.1k







Skeleton: bones and dummies

Bones serve one simple purpose: to allow the game engine to animate the model.
You can use standard 3D Studio Max bones or a Biped from Character Studio. Weapons
only need a simple bones setup for moving parts on the weapon, plus the player's
hands.

A Dummy Object is a blue cube used as an invisible parent object to control
children objects attached to it. This helps to attach and animate complex hierarchies.
Bones can be locked onto a dummy during an animation, then released. This is
the common way to have hands holding and releasing a weapon during an animation.



Below are the skeletons used for the weapons in the ViewModels. Only ViewModels
need skeletons since they are the only one that animates.



MP5

ViewModel:










user posted image
Side view of model with bones.





Gluon

ViewModel:











user posted image
Top view of model, bones and dummies.







.qc file:

Here's a sample .qc file for the MP5 DMPlayer. The WorldModel and DMPlayer .qc
scripts are very simple:








$scale 1

$modelname models/p_9mmar.mdl

$cd models

$cdtexture worldmodel_mp5



$body studio "../DMplayer_mp5/reference_mp5"



$sequence idle "../DMplayer_mp5/reference_mp5"



The ViewModel .qc is more complicated and has other elements, defined below.



1> Body groups are the exported reference files. You can have one or several.
It seems the "studio" and "body" commands are used interchangeably,
although "studio" is the more common one:

$body studio "mp5sd"



$body body "egon_newgun"

$body body "egon_hands"



2> Attachment points are where sprite effects are spawned from. A bone or
dummy can be used for the point. In this example, "Gauss" is a dummy
object. These follow this format:

$attachment <#> <bone> <X> <Y> <Z> <axis>
<direction: 1 or -1>



$attachment 0 "Bone09" -14 1 -0.5 X -1

$attachment 0 "Gauss" -10 2.5 0 X -1



3> WorldModels have textures stored in separate files. This is done with
the $externaltextures command.



4> Events are external effects that are played on specific frames. The two
examples below show a sprite "20" and a sound "items/cliprelease1.wav".
The sprites appear at the coordinates that you set in $attachment. They follow
this format, as part of the $sequence command:

{event <#> <frame> [options]}



$sequence shoot "shoot1" fps 10 { event 5001 0 "20" }

$sequence reload "reload" fps 30 { event 5004 5 "items/cliprelease1.wav"
}







Animations:

Only the ViewModel needs to animate; the WorldModel and DMPlayer Models have
one idle animation, although it's not keyframed to actually move. I've listed
the animation name first in bold, then the animation filename without the .smd
extension.







MP5

ViewModel:

longidle: long_idle - 41 frames
idle1:
idle1 - 111 frames
grenade: grenadeshoot - 34 frames

reload: reload - 47 frames
deploy:
deploy - 16 frames
shoot: shoot1 - 7 frames
shoot:
shoot2 - 7 frames
shoot: shoot3 - 7 frames


WorldModel:
idle: wrld_mp5 - 31 frames


DMPlayer Model:
idle: reference_mp5
- 31 frames
Gluon

ViewModel:

idle1: egon_idle1(sway) - 61 frames
fidget1:
egon_fidget1(handle) - 81 frames
altfireon: egon_fire2altfire
- 46 frames
altfirecycle: egon_altfirecycle - 16 frames

altfireoff: egon_altfire2fire - 21 frames
fire1:
egon_firecycle1 - 16 frames
fire2: egon_firecycle2
- 16 frames
fire3: egon_firecycle3 - 16 frames

fire4: egon_firecycle4 - 16 frames
draw:
egon_draw - 16 frames
holster: egon_holster - 16 frames


WorldModel:
stayput: world_egon2
- 36 frames

DMPlayer Model:
stayput:
w_egon - 36 frames



Rate This Article
This article has not yet been rated.

You have to register to rate this article.
User Comments

No User Comments

You must register to post a comment. If you have already registered, you must login.

Latest Articles
3rd person View in Multiplayer
Half-Life 2 | Coding | Client Side Tutorials
How to enable it in HL2DM

By: cct | Nov 13 2006

Making a Camera
Half-Life 2 | Level Design
This camera is good for when you join a map, it gives you a view of the map before you join a team

By: slackiller | Mar 05 2006

Making a camera , Part 2
Half-Life 2 | Level Design
these cameras are working monitors that turn on when a button is pushed.

By: slackiller | Mar 04 2006

Storing weapons on ladder
Half-Life 2 | Coding | Snippets
like Raven Sheild or BF2

By: British_Bomber | Dec 24 2005

Implementation of a string lookup table
Half-Life 2 | Coding | Snippets
A string lookup table is a set of functions that is used to convert strings to pre-defined values

By: deathz0rz | Nov 13 2005


Latest Comments
knock knock
General | News
By: omega | Dec 22 2016
 
knock knock
General | News
By: MIFUNE | Oct 10 2015
 
New HL HUD Message System
Half-Life | Coding | Shared Tutorials
By: chbrules | Dec 31 2011
 
knock knock
General | News
By: Whistler | Nov 05 2011
 
Particle Engine tutorial part 4
Half-Life | Coding | Client Side Tutorials
By: darkPhoenix | Feb 18 2010
 
Particle Engine tutorial part 2
Half-Life | Coding | Client Side Tutorials
By: darkPhoenix | Feb 11 2010
 
Particle Engine tutorial part 3
Half-Life | Coding | Client Side Tutorials
By: darkPhoenix | Feb 11 2010
 
Game Movement Series #2: Analog Jumping and Floating
Half-Life 2 | Coding | Shared Tutorials
By: mars3554 | Oct 26 2009
 
Particle Engine tutorial part 5
Half-Life | Coding | Client Side Tutorials
By: Deadpool | Aug 02 2009
 
Particle Engine tutorial part 5
Half-Life | Coding | Client Side Tutorials
By: Persuter | Aug 02 2009
 

Site Info
297 Approved Articless
8 Pending Articles
3940 Registered Members
0 People Online (6 guests)
About - Credits - Contact Us

Wavelength version: 3.0.0.9
Valid XHTML 1.0! Valid CSS!