Home Crush your enemies... and create an EMPIRE!!! Space Empires V -- BUY NOW!!!

User login

  • Create new account
  • Request new password

Navigation

  • news
    • archive
    • blogs
    • books
    • forums
    • recent posts
    • groups
  • image galleries
  • projects & downloads
  • search
  • create content
  • news aggregator

Search

Who's online

There are currently 4 users and 151 guests online.

Online users

  • GambitUK
  • Disco Stu
  • Theace
  • crazydog

Languages

  • English English
  • French French

Browse archives

« September 2008  
Mo Tu We Th Fr Sa Su
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30          
Home » news » forums » Support & Feedback » Scenarios & Mods » SE:V MODs

Linear Math...

Submitted by Gideon on Tue, 2006-12-19 12:48. SE:V MODs

I am going to attempt to post two examples of the math I have used in my personal mod to do weapon damage with. If this posts successfully (it errored out last time) feel free to use this information however you want.

WARNING: What follows is math. If math angers/frustrates you, then this will probably piss you off.

This is the math for a weapon to reduce damage according to linear dropoff.

Definitions:

f(m) is damage modifier from levels.

f(p) is percentage of m which applies, as expressed by a number from 0.00 (for 0%) to 1.00 (for 100%).

f(r) is the percentage of the range of the weapon as it relates to its maximum possible range, as expressed by a number from 0.00 (for 0%)
to 1.00 (for 100%). Example: If the max range is 60, then 30 is 50% of 60 (or one half), so r = 0.5.

f(m) = damage by level * (p)

f(p) = 1 - (a * r)

f(r) = range formula

Notes:

a is the ammount of damage lost. a = 0.4 = 40% damage damage lost.

Script function definitions:

Power is the formula command for exponents. Power (A, B) means A to the power of B. Squareing something would be Power (A, 2).
Cubing would be Power (A, 3). Another text notation for this would be A^B.

iif is an if - then - else command. iif(A, B, C) = if A is true, do B, otherwise do C.

Min is take the minimum of two values. Min(A, B) = take the minimum of A or B, whichever is lower.

So, iif([%Range%] Min(90, (([%Level%] - 1) * 10) + 30), 10000, 0)
(23 + (([%Level%] - 1) * 5)) - (([%Range%] / 10) * 1.67) - iif([%Range%] > Min(90, (([%Level%] - 1) * 10) + 30), 10000, 0)

Simplified formulas:

iif([%Range%] <= Min(90, (([%Level%] - 1) * 10) + 30), (20 + (([%Level%] - 1) * 15)) - (([%Range%] / 10) * 1.67), 0)
iif([%Range%] <= Min(90, (([%Level%] - 1) * 10) + 30), (23 + (([%Level%] - 1) * 15)) - (([%Range%] / 10) * 1.67), 0)

Work:

iif([%Range%] <= Min(100, (([%Level%] - 1) * 10) + 30), (20 + (m)) , 0)

f(m) = (([%Level%] - 1) * 15) * (p)

f(p) = 1 - (0.5 * (r))

f(r) = [%Range%] / Min(100, (([%Level%] - 1) * 10) + 30)

Result:

iif([%Range%] <= Min(100, (([%Level%] - 1) * 10) + 30), (20 + ((([%Level%] - 1) * 15) * (1 - (0.5 * ([%Range%] / Min(100, (([%Level%] - 1) * 10) + 30)))))) , 0)
iif([%Range%] <= Min(100, (([%Level%] - 1) * 10) + 30), (23 + ((([%Level%] - 1) * 15) * (1 - (0.5 * ([%Range%] / Min(100, (([%Level%] - 1) * 10) + 30)))))) , 0)

This allows for a more organic and consistant damage dropoff accross all levels, but requires additional testing.

‹ Using Troops to defend against boarding actions Modelling ships.... ›
» login or register to post comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Mod Designer

linear pt 1

Submitted by Gideon on Tue, 2006-12-19 12:57.

deleted

» login or register to post comments
Mod Designer

Ahhh...to heck

Submitted by Gideon on Tue, 2006-12-19 12:57.

deleted

» login or register to post comments
Rilbur's picture

Problems

Submitted by Rilbur on Tue, 2006-12-19 13:06.

You may be having issues with the < and > signs. Either use "escape HTML" format under Input Format, or replace all such symbols with &l t; and &g t; (remove the spaces to make them format correctly into < and >)
_______________________
There are 10 types of people in the world:

Those that understand binary, and those that don't.

» login or register to post comments
Mod Designer

Got it working

Submitted by Gideon on Tue, 2006-12-19 13:09.

I got it working. I can make the post, and then edit the subject. When editing the subject, I can put in the text I want and it seems to take it.

The whole text is too long to post at one go, even using the break command, so I had to split it up between two subjects. This one covers linear decay, the other one covers an exponential decay curve.

» login or register to post comments

Perhaps this would be better

Submitted by Mylon on Wed, 2007-01-17 23:24.

Perhaps this would be better illustrated with a few graphs. Mind explaining what this formula does in simpler terms? It's difficult to make out what the formula does, given all of the parenthesis.

» login or register to post comments
Mod Designer

breakdown

Submitted by Phoenix-D on Thu, 2007-01-18 01:02.
Note before anyone uses ANY of this: SE5 math can be VERY ODD. Test your formulas! 100 - 5 + 5 + 100 does NOT equal 0 in SE5 terms, for example. iif([%Range%] <= Min(100, (([%Level%] - 1) * 10) + 30), (20 + ((([%Level%] - 1) * 15) * (1 - (0.5 * ([%Range%] / Min(100, (([%Level%] - 1) * 10) + 30)))))) , 0) The If statement just means the range is set 100 or 30 + ten per level, whichever is lower. 20 + ((([%Level%] - 1) * 15) * (1 - (0.5 * ([%Range%] / Min(100, (([%Level%] - 1) * 10) + 30))))) That's what's left. Base damage is 20. That's modified twice. First by the weapon's tech level. ([%Level%] - 1) * 15 means it gains 15 damage per level. That's multiplied by the range modifier. 1-(0.5 * ([%Range%] / Min(100, (([%Level%] - 1) * 10) + 30) Ok. What this says is as the range increases, damage drops. AND the better your tech level, the less it drops. At level 1, your damage is cut in half once you get past range 30. At level 2, that its cuts cut in half past 40, at level 3 50, etc until you reach 100. No matter your tech level, your damage will be cut in half at range 100. It isn't a sharp cut off; the formula gradually decreases the damage with range. That's just the easy spot to explain how the formula runs. So at level 1 and range 30 it works out like so: 20 base damage. Range modified works out to: 1-(0.5 * ([30] / Min(100, (([1] - 1) * 10) + 30) or 1-(0.5*([30]/30) = 0.5 20 * 0.5 = 10. So the weapon has 20 damage at Range 0, decreasing smoothly until Range 30, where it has 10 damage. Note: this is a ridiculously short range. Most ships in stock SEV are almost 20 units WIDE..
» login or register to post comments

Math Error?

Submitted by Riptokus on Thu, 2007-01-18 01:27.

Phoenix-D wrote:
Note before anyone uses ANY of this: SE5 math can be VERY ODD. Test your formulas! 100 - 5 + 5 + 100 does NOT equal 0 in SE5 terms, for example.

You meant -100 - 5 + 5 + 100, Right? If not, then that's probably your error. You start at 100, Subtract 5 for 95, plus 5 for 100 again, then add another 100 and it defenatly doesn't equal zero Eye-wink

» login or register to post comments
Mod Designer

Yeah

Submitted by Phoenix-D on Thu, 2007-01-18 22:59.

Yep. Typo. Smiling

» login or register to post comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Now on STEAM

Now on STEAM!Space Empires V via STEAMSpace Empires IV via STEAMSTEAM online by Valve Corporation

Popular content

Today's:

  • Ship Capture Issues
  • Space Empires V
  • Hows the current AI?
  • Space Empires V and VI: Expansions and the Future: Tell the Company What's on Your Wish List
  • SE5 Multimedia Pack

All time:

  • Space Empires V and VI: Expansions and the Future: Tell the Company What's on Your Wish List
  • Space Empires V
  • Gritty Galaxy Fleet Clash
  • Damn Dirty Bugs/Annoyances
  • Space Empires V: General Thoughts, Observations, and Suggestions

Last viewed:

  • Tutorial Problems and ...
  • Space Empires V Editor 1.5
  • How does this work?? (Get function)
  • GidMod, Status Update...
  • Disallowing a specific component from being used in a Mount.
(c) Strategy First, Inc. All rights reserved.