Looking for formulas

Discussion in 'Coding' started by Xyaminou, Feb 18, 2016.

  1. Xyaminou

    Xyaminou Member

    Messages:
    1,369
    Likes Received:
    156
    Trophy Points:
    0
    I am looking for the formulas behind these parameters:

    "Horsepower Weight Penalty" "0.0" //amount of max throttle reduction as vehicle weight exceeds Max Weight
    "Horsepower Health Modifier" "0.0" //amount of max throttle reduction as health is destroyed
    "Horsepower Armor Modifier" "0.0" //amount of max throttle reduction as armor is destroyed

    According to Bob2 the formula for Weight Penalty is:
    Total HP = "HorsePower" - ( TotalWeight - MaxWeight) * Penatly

    However after some testing I am convinced that it is not.
     
  2. Lazybum

    Lazybum :D Staff Member Moderator

    Messages:
    4,827
    Likes Received:
    190
    Trophy Points:
    0
    If I remember correctly, I think it was beerdude who said it, the window between not moving and actually moving is rather small.

    Still though, playing with horsepower is a horrendous idea, what with horsepower being tied to torque(hill climbing) and acceleration.
     
  3. ViroMan

    ViroMan Black Hole (*sniff*) Bully

    Messages:
    8,382
    Likes Received:
    4
    Trophy Points:
    0
    "Horsepower Weight Penalty" "0.0" I messed with that a smiggion back in the day when you could overload a tank via script and it didn't seem to do anything. loading up 3 nukes with full armor didn't lower tank speed. :(
     
  4. Smithy

    Smithy Developer Staff Member Administrator

    Messages:
    333
    Likes Received:
    68
    Trophy Points:
    0
    This is correct however there's a bit more that goes into it:
    • TotalWeight = chassis script value "massoverride" + total combined weight of weapons and armor equipped
      • This makes it especially annoying to get good values because totalweight can vary a lot.
    • MaxWeight = engine script value "Max Weight"
    Click here to view google sheet containing examples. (Read-only in case someone decides to troll.)
    You'll notice with current maxweight setting it is impossible for you to exceed it. I haven't done any testing in-game but that how it is implemented. Hopefully this helps you.
     
  5. Xyaminou

    Xyaminou Member

    Messages:
    1,369
    Likes Received:
    156
    Trophy Points:
    0
    Oh I see, so basically there was 1800 weight missing from my maths, no wonder it was off.

    Just attempting to implement one of my idea which consist of removing weight limit and instead have tanks Horse Power lowered by the amount of stuff you put on it.
    However with that formula I'm not sure I can get an interesting curve, so we'll see.
     
    Last edited: Feb 19, 2016
  6. Tama

    Tama Developer Staff Member Web Developer

    Messages:
    684
    Likes Received:
    74
    Trophy Points:
    0
    If you want to make a new curve, post a proposed formula here; it wouldn't take long to hand you a steam branch with that so that you can design whatever you think is best.

    Edit: Note that for handling, we want to have a constant physical weight for the tanks, specified seperately. But HP and such like should be based on the weight of your loadout, not the weight the physics system uses.
     
  7. Tama

    Tama Developer Staff Member Web Developer

    Messages:
    684
    Likes Received:
    74
    Trophy Points:
    0
    Actually, perhaps it's better to come up with well-specified cheat commands, like: "set the HorsePower of my current tank to X", so that you can determine what the formula should become.
     
  8. Xyaminou

    Xyaminou Member

    Messages:
    1,369
    Likes Received:
    156
    Trophy Points:
    0
    Wasn't there a reload scripts command at some point? would it be possible to do that instead? I have already tested different amount of HP to get a grasp on how tanks react, so I'm fine. As for the formula I think I have one that's producing a satisfying curve.
    I'll post it later, need to clean up some stuff.
     
  9. Smithy

    Smithy Developer Staff Member Administrator

    Messages:
    333
    Likes Received:
    68
    Trophy Points:
    0
    Code:
    vehicle_flushscript
    // this allows reloading the script variables from disk over an existing vehicle state
    // This is useful for tuning vehicles or updating old saved game formats
    Think this is the command you're looking for. It's important to note that it will not update engine values, so you'll have to rebuild your vehicle. (It set's the values to the chassis script IIRC)
     
  10. Trickster

    Trickster Retired Developer

    Messages:
    16,576
    Likes Received:
    46
    Trophy Points:
    0
    The horsepower stuff didn't work before. Firstly, the weight penalty one was actually based off the mass of the vehicle, not what you customised. But because of a strange bug, if you recustomised your vehicle it would just add that mass on again. If you remember a while ago when there was a bug with gas turbine not being able to move once recustomised, it was because of this.

    On top of that, the way throttle reduction works is nigh-on pointless, it simply isn't fit for purpose. Chances are you want a situation whereby it slows the vehicle down or something, but in actual fact it just makes it impossible to accelerate. This meant (when I used the system in relation to overheating) that if a tank overheated while at max speed, it could just continue to roll around, but if it happened while it was stationary then it would be stuck. This was especially a problem when I had the fission engine version which overheated passively to push people into being mobile with it.

    I think the long and short of what I'm saying is, throttle reduction is a piss poor system and doesn't work, and the above script stuff is probably still linked to all that. I think you'd be best explaining what you want to achieve and then try and see if that's possible or can be implemented.
     
  11. Lazybum

    Lazybum :D Staff Member Moderator

    Messages:
    4,827
    Likes Received:
    190
    Trophy Points:
    0
    What trickster said.

    I'd like to point out you can stay in your vehicle in a vehicle flush if you modify the values the engine overwrites to be the same as in the engine text, but something happens that doesn't allow a 1:1 transfer from vehicle script to engine script. I really hate how the engine script overwrites anything other then speed, it makes life rather harder then it needs to be.
     
  12. Xyaminou

    Xyaminou Member

    Messages:
    1,369
    Likes Received:
    156
    Trophy Points:
    0
    Well the basic idea is simple, limit the weight by having it affect vehicle's speed and acceleration.
    In-game it would mean a wider variety of designs, let the players figure out if they want lighter but faster load-outs, or deal a lot of damage but move slower.
    It would for example allow the use of reactive armor at the cost of speed.

    The curve would have to be something like the bottom graphic in this spreadsheet:
    https://docs.google.com/spreadsheets/d/1MTPQfMbpGjoY1z6dhC_cezhurxiMnuQNa8wa8qV66ew/edit?usp=sharing
     
  13. Lazybum

    Lazybum :D Staff Member Moderator

    Messages:
    4,827
    Likes Received:
    190
    Trophy Points:
    0
    It'd be better to change the modifier to affect max speed rather then horsepower if you want to slow things down. Actually if it was made so it could change the max speed by + or - 10, a 20 max speed difference, that'd be pretty sweet. Or whatever feels right, maybe +-20% instead? For that plus minus effect it'd probably work better to change the max weight to something like ideal weight, which would be around the middle weight allowance of a tank.

    I'm fiddling with this because it's been awhile since i messed with horse power, but really it doesn't feel like much til you can't climb a hill. I used a be med with 3phase, it has 2000 hp. It takes about 4 seconds to hit max speed, every 500 hp off takes an additional second. Except at 1000 it can't climb a hill at a stop. I was testing on canyon's mild hills too, not even arid's steep drop offs. Are these 2 seconds really worth it? Does it really have impact? Having your handling go to shit for this is frustrating, I don't think this is worth it.

    I should note that hp does affect gear shifting, but that's actually a moot point when nothing in empires shifts gears, everything is stuck in first. The shifting values are set way to high.

    I feel like it might come up, technically you could increase hp a lot and adjust axel ratio in the scripts to offset it so you had a higher range to play with if you really wanted to, but it still amounts to the same 2 seconds I bet.
     
  14. flasche

    flasche Member Staff Member Moderator

    Messages:
    13,299
    Likes Received:
    168
    Trophy Points:
    0
    wouldnt playing with friction/traction simulate weight differenes better? in the end rolling resistance the weight dependent force you need to overcome. ofc only if you can limit speed this way.

    i never changed any value in any script, just asking.
     
  15. Lazybum

    Lazybum :D Staff Member Moderator

    Messages:
    4,827
    Likes Received:
    190
    Trophy Points:
    0
    friction is something changeable, its the surface properties. I never worked with it but viroman has. He said you can give excellent grip and what not, but I don't think that's an easy change to do and I don't think it actually affects speed much, just how well it grips the ground, so more for handling then anything. Because of that I would never have that as a variable that can be modified, tiny tweaks can have big differences in how a tank handles and this is why no one wants to work on tank handling, it really is a special type of hell.
     
  16. flasche

    flasche Member Staff Member Moderator

    Messages:
    13,299
    Likes Received:
    168
    Trophy Points:
    0
    well actually not surprising, in the end friction isnt rolling resistance, i could have guessed. vehicle physics is something special i assume? you couldnt just add a weight dependent force in the opposite direction/reduce the pulling force? i know this is outside scripter-scope and probably easier said than done ^^

    just because weight affecting horsepower (as the engines power) sounds off.
     
    Last edited: Feb 20, 2016
  17. Lazybum

    Lazybum :D Staff Member Moderator

    Messages:
    4,827
    Likes Received:
    190
    Trophy Points:
    0
    Mmm from what I remember pretty much all of the vehicle handling stuff isn't actually available in the source code, it some engine stuff. This is why it's hard to actually do stuff with, because we can't have a programmer find out what it actually does.

    I couldn't say it can't be done, but it certainly sounds really hard. Though what you mention sounds like this variable in the vehicle handling script, I think it's called airdrag. It's not actually in the empires scripts, but it can be placed in and it does do something apparently, but I think the effect rather small.

    I know weight affecting hp sounds off, but with the way it works it makes sense. 2 ton 150 hp engine will move slower then a 1 ton 150 hp engine yeah? I mean what tank has a horsepower of 2000? empires does, because it's just numbers. Don't think too hard about it is what I'm getting at, in the end it does do what mr x wants but I personally don't think it's worth the effort.
     
  18. flasche

    flasche Member Staff Member Moderator

    Messages:
    13,299
    Likes Received:
    168
    Trophy Points:
    0
    do you feel thats low or high? i thought its a little low, but according to wiki a m1 abrams has about 1500hp :D

    air drag could work but it might also cause odd behavior when powersliding or even only turning
     
  19. Lazybum

    Lazybum :D Staff Member Moderator

    Messages:
    4,827
    Likes Received:
    190
    Trophy Points:
    0
    Well to be fair it's more for high speed like 40 mph or something, like i said the effect is minimal, assuming it actually works. I think it did, but not really 100% on it.


    In short you want something that doesn't exactly exist in a convenient form, and I really don't think it'd be easy or even possible to simply add in what you want. Not a programmer here, but vehicle handling is kinda black boxed for programmers to begin with.

    This is why I'm advocating not messing with anything regarding handling at all for tanks. The thing players will notice and won't make people mad is simply changing the top speed. And it's so much easier to deal with.
     
  20. flasche

    flasche Member Staff Member Moderator

    Messages:
    13,299
    Likes Received:
    168
    Trophy Points:
    0
    yeah you are probably right. also even with a speed reduction there be a sweet spot and the different builds around it probably wont be this differnt afterall.
     

Share This Page