se1:Serious Sam Weapons

From SeriousEngine.com

Jump to: navigation, search

index http leapfrog wireless audio video http police academy 2 movie page illinois mattoon movie theater http movie final fight lebanese porn movies letorelnocna

Serious Sam Weapons

Weapons in Serious Sam are created as any other models. They can either be multipart models joined via attachments to single model (like Rocket launcher or shotguns) or can be single models without attachment. Advantage of multipart models is less memory consumption (vertex animations used in Serious Engine can consume much memory) and still high polygon count. This is achieved with attachment triangles. They represent guides when creating and parenting models into single weapon model and they dont render in game.

Some weapons (like shotguns) have hand model with triangles as main model, other models (like handle, barrel...) are attached onto it in Serious Modeler. Other weapons models like Rocket launcher, Grenade Launcher... consist of attachment triangles which are animated and controled either in game code or in 3D application. Since triangles consist of very low polygon count its memory consumption in game is very small. This gives opportunity for artists to have high polygon count weapon models with many details and still weapon model wont have impact on game performance.

Weapons animations are either premade in 3D application or combination of animations and game code (like Cannon or Grenade launcher).

Weapons consist of 2 models (or it can be single model with additional animations). First model is weapon that will be used in first person view (double shotgun with hands holding it) and second one (called weapon item) is used in third person (player model uses weapon item), as item in Netricsa and in game as weapon model that player can collect.

  • Image 01* shows weapon model (1) and its item model(2).

Image:Image01.jpg

Image01-Weapon and weapon item


To save memory both models consist of same attachment models (handle, barrels, trigger...).

Weapon models have set of standard animations like draw/redraw, fire, reload, idle, etc. Those animations can be removed or new ones can be added with Serious Sam SDK. Some weapons have animatins that are used only in multiplayer (like shotgun's firefast which is only used in Deathmatch mode). Animations speed can be altered in Serious Modeler, tho they are adjusted to match sounds and effects in game. If you want to drastically change speed and weapon's behaviour some adjustments need to be done in code also.

Weapon's sounds are wav files stored in folder called Sounds (in weapon's folder). If you change sounds, note that sound names must not be changed (unless you change them in code). Adding new sounds must be done inside weapon's .es file.

Every weapon model with hand geometry (colt, knife, shotguns and minigun) uses same hand texture (hand.tex) stored in Models/Weapons folder.

We will review *Double shotgun* model. As said earlier, it consist of hand and 4 attachment triangles guides for 4 attachment models, Handle, Barrels, Reload switch and Shell ammunition.

Image:Image02.jpg

Image02-Double shotgun model


Double shotgun have another model, controled in code, with 2 animations. First animation is default holding ammunition shells (Image03)

Image:Image03.jpg

Image03-Hand with ammunition


and second one is reloading shotgun. First animation is never shown because model isnt rendered (controled in code). Second animation is played once weapon is fired. This shows Engine's capability to have complex animation without impact on memory usage. If right hand would be part of main model, it would take memory needed to store mapping attributes and geometry and it have only 1 animation. With use of multipart and multi models weapon model occupies less memory.

Take a look on Image02, those triangles are pretty big. When you create new model from 3d object, Serious Modeler calculates precission from bounding box of objects geometry. The bigger those triangles are their coordinates will be more precise once model is created. By default, when you create new model, it is created in HIGH quality (HI_QUALITY YES line in script). It means that model have 16bit precision for it's vertices. This precision however takes more memory. In order to save memory, models consisting only of triangles can be made as LOW quality (change line HI_QUALITY YES to HI_QUALITY NO in script). Animations wont be perfectly smooth, some glitches may occur but memory consumption is much lower. For this reason we made those attachment triangles bigger( e.g. more precise), to compesate in case of low quality models.

In order to render weapon model in game, Engine uses attachment names. Naming attached models is thus crucial. Double shotgun have 4 attachment (Handle, Barrels, Switch and Ammo). First we are going to add handle.mdl. In Tools panel (Q) under Attachment tab (Image 04),

Image:Image04.jpg

Image04-Attachment tab


click on model selection button (1), and select handle.mdl. In attachment name field (2) change NO NAME to HANDLE. You should end with something like on Image05.

Image:Image05.jpg

Image05-First attachment


Now we will use attachment triangles to define position and rotation of attached model. Open Attachment tab in Tools Panel (*Q*). To position attachment models Serious Modeler uses attachment triangles as guides for position and rotation. Disable texure rendering (*E*) and enable wireframe rendering (*W*) and finally disable Visibility of Handle attachment in Attachment tab. On Image05_2, Handle triangles is circled red.

Image:Image05 02.jpg

Image05_02-Attachment guides


In attachment tab under Vertices line, 3 vertices value are shown (circled on Image05_02). They represent 3 vertices of attachment triangle. With them position and rotation of attachment is defined. We will now use interactive controls in Serious Modeler to assign those vertices to Handle attachment. Put mouse cursor over bottom vertex (No 1 on image05_02) and press 1 on keybard. This tells Modeler to track this vertex as "Center", put mouse cursor over Vertex No 2 and press 2 on keyboard, you defined "Front". This tells Modeler where front of model is. Finally put mouse cursor over vertex No 3 and press 3 on keyboard. We defined "Up" of attachment triangle. If you swap Front and Up, model will be rotated 90 degrees upward. We have assigned attachment guide for Handle. What ever you do in animation with this triangle (rotate, translate) it will have impact on attachment model. Another thing you can do is to manually adjust positions and rotations of attachment model. Enable visibility of attachment model and take a look at bottom of Attachment tab. There are 2 lines (first is for translate offsets) and second for rotation offsets. With them finetuning of models position and rotation is possible. Those values arent animatable tho. Enable texture rendering (*T*) and disable wireframe render (*W*) and adjust position if necessary.

Repeat adding attachment models (located in folder where weapon is). Dont forget to name attachment correctly or they wont be rendered in Engine. When you finish weapon should look like on Image06.

Image:Image06.jpg

Image06-Double shotgun with all attachments


When finish adding all attachments, you need to hide attachment triangles from rendering. Best way is to have all those triangles in single surface/material called Attachment or similar. In Rendering tab, cycle with *TAB* until current surface is Attachment and click on Invisible checkbox to disable its rendering.

Adding animations to weapon model is the same as for any other model. Make animation in 3d application, export frames and add those frames in model's script. Bellow is part of %NOP%DoubleShotgun weapon script, with Firefast animation (used in deathmatch mode of game).


DIRECTORY MODELS\Weapons\DoubleShotgun\Frames\Fire\      -path to folder with frames
ANIMATION FireFast               -animation name used in Engine
SPEED 0.03                  -speed per frame in seconds
02.lwo                  -list of frames
03.lwo
04.lwo
05.lwo
06.lwo
07.lwo
08.lwo
09.lwo
10.lwo
11.lwo
12.lwo
13.lwo
14.lwo
15.lwo
16.lwo
17.lwo
18.lwo
19.lwo
20.lwo
21.lwo
22.lwo
23.lwo
24.lwo
25.lwo
26.lwo
27.lwo
28.lwo
29.lwo
30.lwo
31.lwo
32.lwo
33.lwo
34.lwo
35.lwo
01.lwo

Serious Modeler script is powerfull way to add and modify animations. If you need faster animation change SPEED line, you can combine animations into single animation, either using MACRO animations or by adding frames from different animations in frames list. You can remove unnecessary frames from animation etc..

When finished with attachments, animations, LOD its time to create Weapon Item model. As said earlier it can be same model as Weapon with extra ITEM animation or totally new model that uses same attachments as Weapon model. For Colt, Knife, Minigun and shotguns we used new model that consisted of only triangles from Weapon Model. Another difference between Weapon model and its Item model is that Weapon model can be position anywhere (bellow virtual floor, which is enabled/disabled with F), Weapon item must be above floor and centered around XZ axis. Reason for this is that this model's rotation is controled in code, if model is offseted its rotation will look akward. Image07 shows Double Shotgun Item model loaded with Axis drawing enabled.

Image:Image07.jpg

Image07- %NOP%DoubleShotgun Item model


Note that model is place slightly above virtual floor. Rendering axis in Modeler is accesed with *X* shortcut, pressing X again enables rendering of axis for attachment models. With axis rendering enabled, press (*R*) to enable model's rotation, this will gives clear picture how Item model is rotated in game and in Netricsa. Attachments offsets can be easily adjusted in Attachment Tab.

Finally we need to create or adjust weapon's .amc file. Its located in Weapons folder. Same as for Player model this file is used so game will know of what models weapon model is created when adding it to Player. Bellow %NOP%DoubleShotgun.amc is listed.

    {

      Attachment: 4         -weapon's number in Player's body model.
      {
        Model:   TFNM Models\Weapons\DoubleShotgun\DoubleShotgunItem.mdl      - name of main model
        Texture: TFNM Models\Weapons\DoubleShotgun\Ammo.tex         - texture used

   
        Attachment: 0
        {
          Model:   TFNM Models\Weapons\DoubleShotgun\Dshotgunhandle.mdl      - name of 1st attachment model in Item
          Texture: TFNM Models\Weapons\DoubleShotgun\Handle.tex         - texture used
        }

        Attachment: 1
        {
          Model:   TFNM Models\Weapons\DoubleShotgun\Dshotgunbarrels.mdl      - name of 2nd attachment model in Item
          Texture: TFNM Models\Weapons\DoubleShotgun\Barrels.tex      - texture used
        }

        Attachment: 2
        {
          Model:   TFNM Models\Weapons\DoubleShotgun\Switch.mdl         - name of 3rd attachment model in Item
          Texture: TFNM Models\Weapons\DoubleShotgun\Switch.tex         - texture used
        }

      }


    }

With .amc file, you can easily change weapon's look or create new weapons combining parts from different weapons, like adding Rockets to Minigun or sniper to shotguns.

This basically sums it.

Personal tools