Questions on a few things.

Discussion in 'Coding' started by Lazybum, Jan 20, 2015.

  1. ViroMan

    ViroMan Black Hole (*sniff*) Bully

    Messages:
    8,382
    Likes Received:
    4
    Trophy Points:
    0
    2 gears what?
     
  2. Lazybum

    Lazybum :D Staff Member Moderator

    Messages:
    4,827
    Likes Received:
    190
    Trophy Points:
    0
    Code:
    	//When it shifts up it goes to the highest one it can find, then proceeds to shift down from there. 
    	//So effectively you have 2 gears if you want it to work like a normal transmission
    	//Will not shift up to any value below 1
    From my own little comments. I don't know why it works like that, but it is pretty easy to find out if you make the gears have a big difference. It's pretty funny to make an engine that accelerates faster as it nears max speed.

    Also here's something else. Most of this seems reliable, but it's anyone's guess if it's 100% accurate.
    Code:
    Talking about the shifting rpms
    	//Won't exceed max rpm, so max rpm has to be higher than shift up.
    	//How fast it gets to shift up seems to be independent of anything, 
    	//so use low numbers if you want it to shift at a low speed, higher to shift up at a higher speed. 
    	//Speed and rpm are linked in a constant fashion, so shift points are the same on flat ground or going up a hill
    
    	//Maxrpm, gear, max speed, horsepower, don't seem to effect when it shifts up.
    	//Axelratio is the only thing that really changes how fast it hits the shifting point.
    Edit: does anyone know why when I have the vehicle and engine scripts match making a new tank does not handle like the one that was flushed? I found a decent enough compromise for slowing heavy acceleration, really it hits 16-18 then slowly goes up from there, but it's hard to really show anyone when I can't get the engines to work.

    Editedit: I almost want to say it's ignoring any changes I make to gears, but that can't be right. changes to other settings effect the new tank, but when it comes to gears it's like first gear gets replaced by some high number in the engine script, but engine scripts don't mention gears at all...
     
    Last edited: Feb 13, 2015
  3. ViroMan

    ViroMan Black Hole (*sniff*) Bully

    Messages:
    8,382
    Likes Received:
    4
    Trophy Points:
    0
    When you flush scripts... you HAVE to get a new vehicles. The current vehicle scripts overwrite your vehicle. SO if your engine script says HP 500 and your vehicle script says HP 200... HP 200 overrides all current vehicles of that type. Newer vehicles created after that use the correct engine script>vehicle script setup. There is also a few physics hickups. For this reason I always test vehicles on maps with water I can ditch tank into before I flush scripts. Shifting is the same. Engine script shifting will get overridden with vehicle script shifting.


    ALSO don't use audio to determine when it shifts. Audio playback of shifting is independent of actual shifting.
     
    Last edited: Feb 13, 2015
  4. Lazybum

    Lazybum :D Staff Member Moderator

    Messages:
    4,827
    Likes Received:
    190
    Trophy Points:
    0
    I got all of that, What I was doing was basically putting all the values that an engine had right into the vehicle script so I wouldn't have to constantly get a new vehicle. There is literately no difference between the engine and the vehicle script.

    I was determining when shifting happened by just having a high difference between 1st and 2nd. Acceleration immediately drops when it shifts up. I also found out after I made the post above that it's using shift down to determine when to shift up. Try it sometime, comment out shift up and it will still shift up when you expect it to.

    I didn't know that it would disregard some stuff. I swear it tosses out any gearing you put in, which makes no sense when there isn't anything gearing related in the engine script. At this point I don't know what to do if I can't touch the gears, the only thing I could deal with is changing axel ratio but it won't do what I want it to do most likely, gears tend to not have much variance between them.

    I had this in the heavy tank script, the only other difference was I had the torque for all the wheels set to 1. Please note that you could take of a 0 off of maxrpm, axel ratio, and both shifts and the vehicle would function exactly the same.
    Code:
    	"engine"
    	{	
    
    		"horsepower"		"2000"		// engine power
    		"maxrpm"		"200000"		// max rounds per minute
    		"maxspeed"		"30"		// forward mph
    		"maxReverseSpeed"	"20"		// backward mph
    		"autotransmission"	"1"		// true for auto, false for manual
    //		"throttleTime"		"0"
    		"axleratio"		"80"		// ratio of engine rev to axle rev; Drag: The higher this ratio the faster the engine will rev (--> faster gear changing); Rule of thumb: The smaller the wheels and the more axles there are, the lower this value should be (afaik)
    		"gear"			"5"		// 1st gear (max 6 gears) Drag: Likely to be used as "the backwards gear" The higher the values the stronger the gear, exact nature of gear system unknown atm
    		"gear"			"1"		// 2nd gear
    //		"gear"			"3"		// 3rd gear
    //		"gear"			"1"		// 4th gear
    //		"gear"			"1"		// 5th gear
    
    		"shiftuprpm"		"10000"		// max RPMs to switch to a higher gear; Drag: Unsure if this is used, probably overwritten in vehicle_engines.txt
    		"shiftdownrpm"		"8000"		// min RPMs to switch to a lower gear; Drag: Unsure if this is used, probably overwritten in vehicle_engines.txt
    
    	}
     
    Last edited: Feb 13, 2015
  5. ViroMan

    ViroMan Black Hole (*sniff*) Bully

    Messages:
    8,382
    Likes Received:
    4
    Trophy Points:
    0
    "torquefactor" What do you have it set for each axle? Also... I think you broke rpm. I ran into some issues at higher rpms don't remember what though. bah... just post yer script and I will try it tomorrow and give comments.

    lol 80 on axleratio? you mad bro... MAD!
     
    Last edited: Feb 13, 2015
  6. Lazybum

    Lazybum :D Staff Member Moderator

    Messages:
    4,827
    Likes Received:
    190
    Trophy Points:
    0
    Well I got it all to work. New vehicles magically multiply the gears for whatever reason, it's about 3 and I have no idea why. I was also going off the assumption that not much was effecting gear changing, but how high the gear it is shifting to affects what you should set shiftingrpm to. For some reason the shifting rpms are mislabeled, shiftdown is what changes when you shift up.

    It doesn't exactly play well when commenting out shifting rpms from the engine text and try to have it use whatever is in the vehicle scripts. But I figured out a close enough approximation for it to work, it uses much lower values in engine scripts then the vehicle scripts.

    At the very least I'm certain it never uses more than 2 gears and for the least frustration you have to have shift up no less than 15 mph. Oh, when it shifts up is directly tied to the speed, if it doesn't seem that way it's because you have a rather high first gear and the speed is carrying over when it does shift up.

    Here's a download link with the relevant heavy stuff, it's done so it won't mess up your stock game. Bonus is it can actually get up that hill on arid. Also has a heavy tank that can drift pretty well, it's possible to get it to drift without even touching the handbrake, though you need scout speed to get maximum fun.

    https://www.dropbox.com/s/ijxra6c1j4mo0na/slow heavy scripts.7z?dl=0
     
  7. Trainzack

    Trainzack Member

    Messages:
    385
    Likes Received:
    5
    Trophy Points:
    0
    Did you pull a Spartacus and forget to test with fakelag?
     
  8. Lazybum

    Lazybum :D Staff Member Moderator

    Messages:
    4,827
    Likes Received:
    190
    Trophy Points:
    0
    Well to be honest, yes. I didn't think it was super necessary because I wasn't touching the handling part at all, just how fast it accelerates.

    I did test it after I read your post though with a ping of 240, it worked fine. Even the drifting tank worked fine. Though I did spin out a couple of more times than usual with the drifting heavy, it was still much better than old 3phase heavys though so I won't complain.
     
  9. ViroMan

    ViroMan Black Hole (*sniff*) Bully

    Messages:
    8,382
    Likes Received:
    4
    Trophy Points:
    0
    ha.. you set torque to 1 for all axles. You know that is effectively multiplying the HP right? Your supposed to bring it equal to 1 over all the axles. Same with brakes.

    also I duno about this...
    front: "radius" "26"
    middle: "radius" "24"
    middle: "radius" "24"
    back: "radius" "26"
    are you taking care of the height differences in the QC file?
     
  10. Lazybum

    Lazybum :D Staff Member Moderator

    Messages:
    4,827
    Likes Received:
    190
    Trophy Points:
    0
    I did that due to something spartacus said, raising the torque to 1. I was messing with weight at the time and forgot to revert the change when I decided weight messed with too much.

    I never touched the radius of the wheels, it's like that in the regular heavy tank script.
     
  11. ViroMan

    ViroMan Black Hole (*sniff*) Bully

    Messages:
    8,382
    Likes Received:
    4
    Trophy Points:
    0
    so you copied over that part of the QC for the wheel alignment and didn't change it too right?
     
  12. ImSpartacus

    ImSpartacus nerf spec plz

    Messages:
    8,598
    Likes Received:
    7
    Trophy Points:
    0
    nf_heavyTank.qc

    Code:
    $modelname NF/Vehicles/Ground/TankHeavy/nf_heavyTank.mdl
    
    $cdmaterials NF/Vehicles/Ground/TankHeavy/
    $origin 0 0 0 -90
    
    $scale 1.25
    $body "Body" "nf_heavyTank_reference.smd"
    $surfaceprop "metal"
    
    $keyvalues { 
       vehicle_exit { 
         "exit1" "upright" } 
    } 
    
    $collisionmodel "nf_heavyTank_physBox.smd" {
         $concave
         $Mass 2000
    }
    
    $texturegroup skinfamilies
    {
    	{ "nf_heavytank" }
    	{ "nf_heavytank_forest" }
    	{ "nf_heavytank_snow" }
    	{ "nf_heavytank_desert" }
    }
    
    $attachment "base" "base_rig_base" 0 0 0
    $attachment "turret" "base_rig_turret" 0 0 0 rotate 0 90 0
    $attachment "cannon" "base_rig_cannon" 0 0 0 rotate 0 90 0
    
    //Post 1.25 scale
    $attachment wheel_fr "base_rig_base" 60 120 42
    $attachment wheel_03r "base_rig_base" 60 0 42
    $attachment wheel_02r "base_rig_base" 60 -120 42
    $attachment wheel_04r "base_rig_base" 60 -240 42
    
    $attachment wheel_fl "base_rig_base" -60 120 42
    $attachment wheel_03l "base_rig_base" -60 0 42
    $attachment wheel_02l "base_rig_base" -60 -120 42
    $attachment wheel_04l "base_rig_base" -60 -240 42
    
    //exit positions
    $attachment "exit_pos_1_1" "base_rig_base" -115.00 -60.00 20.00 rotate 0 0 0
    $attachment "exit_pos_1_2" "base_rig_base" 115.00 -60.00 20.00 rotate 0 0 0
    $attachment "exit_pos_2_1" "base_rig_base" -115.00 -60.00 20.00 rotate 0 0 0
    $attachment "exit_pos_2_2" "base_rig_base" 115.00 -60.00 20.00 rotate 0 0 0
    
    $attachment "homing_beacon" "base_rig_base" 0.00 -70.00 50.00 rotate 0 0 0
    
    //location to let off smoke when the vehicle is damaged
    $attachment "smoke_damage" "base_rig_base" 0 -176 76
    
    $include "nf_heavyTank_shared.qci"
    
    $sequence idle "nf_heavyTank_reference.smd" fps 1
    So yeah... dem wheelz gotta be samezzz
     
  13. Lazybum

    Lazybum :D Staff Member Moderator

    Messages:
    4,827
    Likes Received:
    190
    Trophy Points:
    0
    What's this about copying qc files? I thought it would just use whatever the heavy tank scripts said. And spartacus it's the imperial heavy that has the strange difference. The radius for all the nf heavy wheels is 52.

    I'm also finding out it is really hard to get both the nf and be heavy to shift at the same point. I didn't know the nf one needs more power to move around.
     
  14. ImSpartacus

    ImSpartacus nerf spec plz

    Messages:
    8,598
    Likes Received:
    7
    Trophy Points:
    0
    ohhhh, ok. It's not much better.

    Yeah, I need to fix that. :/

    Code:
    $modelname Imperial/Vehicles/Ground/TankMed/imp_mediumTank.mdl
    
    $cdmaterials Imperial/Vehicles/Ground/TankMed/
    $origin 0 0 0 -90
    
    $scale 1.25
    $body "Body" "imp_medTank_reference.smd"
    $surfaceprop "metal"
    
    $keyvalues { 
       vehicle_exit { 
         "exit1" "upright" } 
    } 
    
    $collisionmodel "imp_medTank_physBox.smd" {
         $concave
         $Mass 2000
    }
    
    $texturegroup skinfamilies
    {
    	{ "imp_mediumtank" }
    	{ "imp_mediumtank_forest" }
    	{ "imp_mediumtank_snow" }
    	{ "imp_mediumtank_desert" }
    	{ "imp_mediumtank_urban" }
    }
    
    $attachment "base" "base_rig_base" 0 0 0
    $attachment "turret" "base_rig_turret" 0 0 0 rotate 0 90 0
    $attachment "cannon" "base_rig_cannon" 0 0 0
    
    //wheels - base_rig_wheelL01, base_rig_wheelL02, etc
    $attachment wheel_fl "base_rig_wheelL01_1" 0 0 -2 rotate 0 180 0
    $attachment wheel_fr "base_rig_wheelR01_1" 0 0 -2 rotate 0 180 0
    
    $attachment wheel_02r "base_rig_wheelR02_1" 0 0 -2 rotate 0 180 0
    $attachment wheel_03r "base_rig_wheelR03_1" 0 0 -2 rotate 0 180 0
    $attachment wheel_04r "base_rig_wheelR04_1" 0 0 -2 rotate 0 180 0
    $attachment wheel_05r "base_rig_wheelR05_1" 0 0 -2 rotate 0 180 0
    $attachment wheel_06r "base_rig_wheelR06_1" 0 0 -2 rotate 0 180 0
    $attachment wheel_07r "base_rig_wheelR07_1" 0 0 -2 rotate 0 180 0
    $attachment wheel_08r "base_rig_wheelR08_1" 0 0 -2 rotate 0 180 0
    
    $attachment wheel_02l "base_rig_wheelL02_1" 0 0 -2 rotate 0 180 0
    $attachment wheel_03l "base_rig_wheelL03_1" 0 0 -2 rotate 0 180 0
    $attachment wheel_04l "base_rig_wheelL04_1" 0 0 -2 rotate 0 180 0
    $attachment wheel_05l "base_rig_wheelL05_1" 0 0 -2 rotate 0 180 0
    $attachment wheel_06l "base_rig_wheelL06_1" 0 0 -2 rotate 0 180 0
    $attachment wheel_07l "base_rig_wheelL07_1" 0 0 -2 rotate 0 180 0
    $attachment wheel_08l "base_rig_wheelL08_1" 0 0 -2 rotate 0 180 0
    
    $attachment wheel_rl "base_rig_wheelL09_1" 0 0 -2 rotate 0 180 0
    $attachment wheel_rr "base_rig_wheelR09_1" 0 0 -2 rotate 0 180 0
    
    // Eye Positions
    /*
    //this is the driver who controls the cannon, his eyes are attached to the cannon
    $attachment "vehicle_driver_eyes" "base_rig_cannon" 0.00 -45.00 30.00 rotate 0 0 0
    //this guy is sticking up out of the hatch, he can use the attached MG or his own weapons
    $attachment "vehicle_pos_2_eyes" "base_rig_hatch.1" -5.00 -10.00 30.00 rotate 0 0 0
    //these passengers sit on the top of the turret and use their own weapons
    $attachment "vehicle_pos_3_eyes" "base_rig_turret" -45 -25 65.00 rotate 0 -90 0
    $attachment "vehicle_pos_4_eyes" "base_rig_turret" 45 -25 65.00 rotate 0 90 0
    $attachment "vehicle_pos_5_eyes" "base_rig_turret" -45 0 65.00 rotate 0 -90 0
    $attachment "vehicle_pos_6_eyes" "base_rig_turret" 45 0 65.00 rotate 0 90 0
    $attachment "vehicle_pos_7_eyes" "base_rig_turret" -45 25 65.00 rotate 0 -90 0
    $attachment "vehicle_pos_8_eyes" "base_rig_turret" 45 25 65.00 rotate 0 90 0
    */
    
    // Actual Passenger Positions (these don't matter if the passenger isn't visible)
    /*
    $attachment "vehicle_pos_1_feet" "base_rig_base" 0 0 0 rotate 0 0 0
    $attachment "vehicle_pos_2_feet" "base_rig_hatch.1" -5.00 -10.00 -33.00 rotate 0 0 0
    $attachment "vehicle_pos_3_feet" "base_rig_turret" -45 -25 -2.00 rotate 0 -90 0
    $attachment "vehicle_pos_4_feet" "base_rig_turret" 45 -25 -2.00 rotate 0 90 0
    $attachment "vehicle_pos_5_feet" "base_rig_turret" -45 0 -2.00 rotate 0 -90 0
    $attachment "vehicle_pos_6_feet" "base_rig_turret" 45 0 -2.00 rotate 0 90 0
    $attachment "vehicle_pos_7_feet" "base_rig_turret" -45 25 -2.00 rotate 0 -90 0
    $attachment "vehicle_pos_8_feet" "base_rig_turret" 45 25 -2.00 rotate 0 90 0
    */
    
    //handles where certain types of weapons will be fired from when fired by the player in the seat of 'passenger<seat number>'; types: 0=gun,1=cannon,2=arty cannon,3=missile launcher,4=grenade launcher,5=bomb bay
    $attachment "b_weapon_passenger0_type0" "base_rig_cannon" 0.00 -45.00 30.00 rotate 0 -90 0
    $attachment "b_weapon_passenger0_type1" "muzzle" 0.00 0.00 0.00 rotate 0 -90 0
    $attachment "b_weapon_passenger0_type2" "muzzle" 0.00 0.00 0.00 rotate 0 -90 0
    $attachment "b_weapon_passenger0_type3" "base_rig_cannon" 20.00 -45.00 30.00 rotate 0 -90 0
    $attachment "b_weapon_passenger0_type4" "base_rig_cannon" 20.00 -45.00 30.00 rotate 0 -90 0
    //$attachment "b_weapon_passenger1_type0" "base_rig_hatch.1" -5.00 -10.00 30.00 rotate 0 0 0
    
    
    //exit points
    $attachment "exit_pos_1_1" "base_rig_base" 96.00 -40.00 16.00 rotate 0 0 0
    $attachment "exit_pos_1_2" "base_rig_base" -96.00 -40.00 16.00 rotate 0 0 0
    $attachment "exit_pos_2_1" "base_rig_base" -96.00 -40.00 16.00 rotate 0 0 0
    $attachment "exit_pos_2_2" "base_rig_base" 96.00 -40.00 16.00 rotate 0 0 0
    
    $attachment "homing_beacon" "base_rig_base" 0.00 0.00 60.00 rotate 0 0 0
    
    //location to let off smoke when the vehicle is damaged
    $attachment "smoke_damage" "base_rig_base" 0 -115 60
    
    $include "imp_mediumTank_shared.qci"
    
    $sequence idle "imp_medTank_reference.smd" fps 1
    
     
  15. ViroMan

    ViroMan Black Hole (*sniff*) Bully

    Messages:
    8,382
    Likes Received:
    4
    Trophy Points:
    0
    Sorry lazy I totally confused your playing with tanks scripts to be the new light tank. lol.
     
  16. Lazybum

    Lazybum :D Staff Member Moderator

    Messages:
    4,827
    Likes Received:
    190
    Trophy Points:
    0
    I think I have to give up, I can't get the nf heavy tank to work right. I don't get it either, I give it more power in first gear yet the default heavy have an easier time getting up that hill in arid. It's too much of a pain to to get things to shift when you want them when you have to use the same shifting value for both nf and be.
     
  17. ViroMan

    ViroMan Black Hole (*sniff*) Bully

    Messages:
    8,382
    Likes Received:
    4
    Trophy Points:
    0
    aww now someone else sees the pain I went through. Getting things to drive nice and play right on a flat surface or even a bumpy area is easy. Getting them to climb hills while not being an out right power house tank that can go from 0 to max speed in 5 seconds on a strait away is a different matter.
     
  18. Lazybum

    Lazybum :D Staff Member Moderator

    Messages:
    4,827
    Likes Received:
    190
    Trophy Points:
    0
    But I got that to happen, at least with the be heavy. The nf one is just wonky, none of it makes sense. I will say if it's going that fast it most likely isn't shifting up at all, and again new vehicles multiply whatever you put in the gears, I'll need to check but I'm mostly certain 1st gets multiplied by something close to 3 and and 2nd get multiplied by at least 5. So second has to be much lower than you'd expect for it work like you want it to.

    I say I give up, but I know I'm going to attempt it again. I think I have to play with the wheel radius and position, I think that's what's giving me problems but that's going to be the biggest pain to adjust.
     
    Last edited: Feb 14, 2015
  19. ViroMan

    ViroMan Black Hole (*sniff*) Bully

    Messages:
    8,382
    Likes Received:
    4
    Trophy Points:
    0
    I did tell you about torque multiplication yes?
     
  20. Lazybum

    Lazybum :D Staff Member Moderator

    Messages:
    4,827
    Likes Received:
    190
    Trophy Points:
    0
    Yes... what's that in reference to? Uping the torque didn't help my problem of being unable to get up hills.
     

Share This Page