Weapon DED & Weapon bob

edited 2013 Feb 13 in General
Hello,

In need of a little assistance.

I have just been setting up a DED file for a new in game pistol model. Everything is set up exactly how I want it and works well.

The weapon idle state needs 4 frames due to a flashing light. Its basically set up so the state 'PISTOL' move onto another 3 states and back again. one of the sub models has a texture change over these states to create a flashing light. This works fine in game and does as it should.

However, the anomaly is when doomguy moves about the automatic weapon bobbing is jerky.

After some messing about it is indeed caused by the extra frames or longer tick count. For instance the animation may run over 4 ticks (1 tick a frame). I could just have 1 frame, but at 4 ticks which results in the same problem.

Im guessing the weapon bobbing only uses 1 frame (orignal default). So it effectifly only updates the weapon sway each time frame 1 or the original state name is reached. Whatever the reason, is there anything I can do to fix this behaviour such as increasing the frames the weapon bob processes?

If this can not be fixed would an animated texture work rather then changing it manually over set frames/states? Not sure if the engine supports this on models. Something like the way nukage is animated?

Thanking anyone in advance for any help.

Comments

  • You could use the model flag worldtime or Skin tics and Skin range, or combination of them.
    Model {
    State = "PISTOL"
    Flags = worldtime;
    Inter = 0.0;
    Interpolate = {10.0 0.0};
    Skin tics = 4;
    Sub { File="pistol_base.dmd";  Frame="ready_01"; }
    Sub { File="pistol_light.dmd"; Frame="ready_01"; Skin range = 4; } 
    }
    
    * Model {
    Inter = 0.5;
    Interpolate = {10.0 0.0};
    Sub { Frame="ready_02"; }
    Sub { Frame="ready_02"; }
    }
    

    In this example the Skin tics and Skin range change the texture of the pistol_light.dmd every 4 tics. The worldtime flag makes it possible to have long model animation sequences in 1 tic thing states. Inter controls the position of the frames in the animation and Interpolate controls the length. The second value in the Interpolate is some offset (but I have never used it, so I don't really know what it does).

    Also you may want to check the wiki about model definitions: http://dengine.net/dew/index.php?title=Model
  • This is interesting, not used 'Worldtime' or 'Skin Tics' before :)

    I think I understand how this works, used 'Inter' before and stuff.

    However, slightly confused how the 4 textures are displayed in sequence. First of all I presume they are assigned to the MD2 model it self such as using the MD2 tool.

    It looks like in this bit texture 1 is displayed for 10.0 (As defined in Interpolate)
    Inter = 0.0;
    Interpolate = {10.0 0.0};
    Skin tics = 4;
    Sub { File="pistol_base.dmd";  Frame="ready_01"; }
    Sub { File="pistol_light.dmd"; Frame="ready_01"; Skin range = 4; }
    

    Then moving onto this bit, the next texture is displayed because of 'Inter = 0.5' and again for 10.0 by interpolate.
    * Model {
    Inter = 0.5;
    Interpolate = {10.0 0.0};
    Sub { Frame="ready_02"; }
    Sub { Frame="ready_02"; }
    }
    

    So what about the 2nd and 3rd texture, Im guessing thats what 'Skin tics' does, but bit confused how that effects things. Should there not be another 2 model sequences that just increase the 'Inter' count and specify length with 'Interpolate' ?

    Finally, can I specify the skin file name to use, or must it be defined on the model by MD2 tool ?

    Sorry for all the questions, im slowly learning all this stuff.
  • The Worldtime, Inter and Interpolate were for just about model frames, not exactly changing the texture in this example. The Skin Tics and Skin Range would handle the texture change. Skin Tics changes how many tics a texture is displayed, and Skin Range is how many textures will be used by the texture animation.

    If your model only has 1 idle/ready frame, then you only need the Skin Tics and Skin Range. But if you have more than 1, then it's useful to use the Worldtime flag. I only used 2 frames in the example, so that it wouldn't get overly long.

    Yea, it's a good idea to assign the textures/skins to MD2 or DMD file.
  • Ok, cool!

    I pretty much understood this, and has solved the main issue of the weapon bob being jerky with more then 1 tick worth of animation.

    However, in my experiments one thing does not seem to be working.

    Say I use MD2 tool and add 4 skins to my lights sub model, 0,1,2,3. I use the following code and change the 'Skin tics' to set how fast I want to textures cycle.

    Model {
    Scale XYZ { 1 1 1 }
    Offset XYZ = { 12 -4 25 }
    State = "PISTOL"
    Skin tics = 0.5;
    Sub { File="pistol_gun.md2"; Frame="Frame1"; }
    Sub { File = "pistol_gun_lights.md2"; Frame="Frame1"; Skin range = 4;}
    }
    

    This is no problem and works a treat.

    So say I want to be awkward and have texture 1 stay on longer as thats when the light is on full bright. Then cycle through the other three textures faster. I cant use this method as I can only set 1 speed for them all.

    So instead I use this code

    Model {
    State = "PISTOL"
    Flags = worldtime;
    Inter = 0.0;
    Interpolate = {10.0 0.0};
    Sub { File="pistol_gun.md2"; Frame="Frame1"; }
    Sub { File = "pistol_gun_lights.md2"; Frame="Frame1"; Skin File = "t_w_pistol_gun_lights_1";}
    }
    
    * Model {
    Inter = 0.3;
    Interpolate = {3.0 0.0};
    Sub { Frame="Frame1"; }
    Sub { Frame="Frame1"; Skin File = "t_w_pistol_gun_lights_2"; }
    }
    
    * Model {
    Inter = 0.5;
    Interpolate = {3.0 0.0};
    Sub { Frame="Frame1"; }
    Sub { Frame="Frame1"; Skin File = "t_w_pistol_gun_lights_3"; }
    }
    
    * Model {
    Inter = 0.8;
    Interpolate = {4.0 0.0};
    Sub { Frame="Frame1"; }
    Sub { Frame="Frame1"; Skin File = "t_w_pistol_gun_lights_4"; }
    }
    

    This also works, but only changing the first 'Interpolate' seems to make a difference, effecting all sub states. Changing the values on a sub state such as in my example 'Interpolate = {3.0 0.0}; makes no difference. So im left with only changing the overall speed of all the lights and not individual speeds ?

    Not sure if I am missing something here?

    Also, im still a little confused what the flag 'worldtime' actually does. When not used things speed up dramatically, so I presume the 'Interpolate' is ignored?

    Anyway, any thoughts would be appreciated. This has been so much help so far, so thanks. Really appreciate it.
  • Ok, have been messing about with this even more. Pretty much understand it all now. Ignore my post above!

    Still having one small issue though thats abit annoying.

    Is there a way to make the animation start again from the beginning ? For instance I use the code suggested
    Model {
    State = "PISTOL"
    Flags = worldtime;
    Inter = 0.0;
    Interpolate = {10.0 0.0};
    Skin tics = 4;
    Sub { File="pistol_base.dmd";  Frame="ready_01"; }
    Sub { File="pistol_light.dmd"; Frame="ready_01"; Skin range = 4; }
    }
    
    * Model {
    Inter = 0.5;
    Interpolate = {10.0 0.0};
    Sub { Frame="ready_02"; }
    Sub { Frame="ready_02"; }
    }
    

    During Frames 'ready_01' and 'ready_02' the weapon is moved up and down a little and looks like Doomguy is breathing. When the gun is fired, it goes through its stuff and ends up in a position exactly like 'ready_01'. The engine now goes into 'PISTOL' state. However, it seems like the 'breathing' effect has continued to be processed and so rather then starting at Frame 'Ready_01' it may have animated through to Frame 'ready_02' which results in the animation having a jerk straight to that position after firing.

    If the animation started from the beginning as soon the state 'PISTOL' is processed then there would be no jerky movement. The Flag 'worldtime' effects this but must be used to be able to animate over one state.

    Hope that made sense lol

    Any help appreciated
  • No, there is no way to "restart" a worldtime model animation. As the name suggests, the timer which drives the animation is the global world time, which, continues irrespective of the mobj/player-weapon's state (as you noted). Worldtime animation is intended as an alternative method for animating map objects defined with a single contiguous state[range], allowing the animation's length to differ from that defined by the states. As such worldtime animation is mostly suited for scenery objects, like torches and other decorations.
  • Thanks Danj,

    I thought this may have been the case, but its always good to ask just in case.

    Still I have learned lots here and overall the main problem I had has been solved.

    Thanks for all those above.
Sign In or Register to comment.