View topic - [patch] dynamic damage based on range

 All times are UTC + 1 hour

 Page 1 of 2 [ 33 posts ] Go to page 1, 2  Next
Author Message
 Post subject: [patch] dynamic damage based on rangePosted: 26 Mar 2007, 04:09
 Damned Developer

Joined: 01 Jun 2006, 12:15
Location: Banned user for reason “Do not post pictures of people fucking cars”
 I thought this was a useful feature so I've made my first patch with some help from FLOZi. It adds four new TDF tags, dynDamageExp, dynDamageMin, dynDamageInverted and dynDamageRange. dynDamageExp=0 / >0 Exponent of the damage formula, 0 disables dynamic damage. Defaults to 0. 1 means linear scaling. edit: dynDamageMin = 0 / >0 Minimum damage value. Disabled when set to 0. ex: firstDamageValue = 500, dynDamageMin = 100, modifier will be 1/5 dynDamageInverted = 0 / 1 Inverts the curve (or line). edit: dynDamageRange = 0 / >0 If set it will use this value instead of the range value from the weapon in the calculation. Formulas: Damage = (1 - (1 / WeaponRange * TraveledDistance)^Exp * OrigDamage Damage = OrigDamage - (1 - (1 / WeaponRange * TraveledDistance)^Exp * OrigDamage (inverted) Graph: (clicky for a bigger picture) x = distance, y = damage. Red's the inverted one. This is with an exponent of 2. Patch: http://rattle.from-hell.net/spring/patc ... atch.patch If there are any issues such as ugly code tell me. There are some problems left in when using an inverted curve. When a weapon is fired from maximum range it should do ~100% damage. Instead it was doing only ~77%. No idea why... Last edited by rattle on 29 Mar 2007, 11:12, edited 2 times in total.

 Post subject: Posted: 26 Mar 2007, 04:21
 Moderator

Joined: 29 Apr 2005, 00:14
Location: #moddev - join it!
 I still think it would be better to make local copies of the damage array in the weapon itself rather than altering defs which should remain static... even if it means extra work.

 Post subject: Posted: 26 Mar 2007, 11:00
 Damned Developer

Joined: 01 Jun 2006, 12:15
Location: Banned user for reason “Do not post pictures of people fucking cars”
 It's not a big deal to change that, however as I pointed out the damages array direclty affects everything which is related to damage (size of scars, size of muzzle flares, etc.). I am working with the original values, this is why I added a backup array. Does anyone else think that this is bad idea? edit: Hmm it seems that this doesn't work with beam lasers. :(

 Post subject: Posted: 26 Mar 2007, 17:08
 Malcontent

Joined: 27 Feb 2006, 22:04
Location: Hurrrrrr.
 Nothing works with beam lasers >_>

 Post subject: Posted: 26 Mar 2007, 17:43
 Game Developer

Joined: 25 Jun 2006, 07:44
Location: Germany
 Yeah, we're already used to that.

 Post subject: Posted: 26 Mar 2007, 20:29

Joined: 04 May 2005, 14:09
Location: St. Paul, Minnesota, US (#64 at press time)
 there should also be one like 10 - (10x)^(1/2) for if you want it to drop off quickly and then slowly.

 Post subject: Posted: 26 Mar 2007, 22:03
 Damned Developer

Joined: 01 Jun 2006, 12:15
Location: Banned user for reason “Do not post pictures of people fucking cars”
 I'm being stupid again, I've tested this on XTA's annihilator weapon, that's what I thought at least. I edited the wrong weapon in the end because of XTA's stupid naming system. :P So nothing's wrong (I hope).

 Post subject: Posted: 27 Mar 2007, 11:31
 Damned Developer

Joined: 01 Jun 2006, 12:15
Location: Banned user for reason “Do not post pictures of people fucking cars”
 Still this doesn't get applied to beamlasers. Could someone tell me what method is called for beam lasers to do damage?

 Post subject: Posted: 27 Mar 2007, 13:14
 Moderator

Joined: 22 Aug 2006, 15:19
 Bonus points for making the tag accept arbitrary expressions in RPN, additional secret bonus for making it accept infix expressions, kudos for JITting them :)

 Post subject: Posted: 27 Mar 2007, 20:33
 Moderator

Joined: 29 Apr 2005, 00:14
Location: #moddev - join it!
 Suggestion: Add another tag, dynDamageRange, which is used in the calculation. Default is weapon range. This improves the flexibility of the curves we can produce quite considerably. Also, just checking, is the damage value automatically clamped after exceeding max range of the weapon? (to prevent -ve damages)

 Post subject: Posted: 27 Mar 2007, 21:39
 Damned Developer

Joined: 01 Jun 2006, 12:15
Location: Banned user for reason “Do not post pictures of people fucking cars”
 TraveledRange is limited to weaponDef->range, the damage would go into the negatives I think. I'll add the additional range tag.

 Post subject: Posted: 27 Mar 2007, 21:46
 Moderator

Joined: 29 Apr 2005, 00:14
Location: #moddev - join it!
 I was going to suggest you always clamp it to dynDamageMin, meaning you can't deal -ve damage.

 Post subject: Posted: 27 Mar 2007, 21:57
 Damned Developer

Joined: 01 Jun 2006, 12:15
Location: Banned user for reason “Do not post pictures of people fucking cars”
 It is if dynDamageMin is defined. Code:if (weaponDef->dynDamageMin > 0)   dynDamages[i] = max(weaponDef->damages[i] * weaponDef->dynDamageMin, dynDamages[i]);

 Post subject: Posted: 27 Mar 2007, 22:06
 Moderator

Joined: 29 Apr 2005, 00:14
Location: #moddev - join it!
 I know, but i mean always do it - dynDamageMin defaults to 0, so if its not set otherwise the damage is clamped to 0, preventing issues with dealing -ve damage.

 Post subject: Posted: 27 Mar 2007, 22:16
 Damned Developer

Joined: 01 Jun 2006, 12:15
Location: Banned user for reason “Do not post pictures of people fucking cars”
 Hmm... what's -ve damage? It's limited to "0" damage by default. Code:dynDamages[i] = max(0.0001f, dynDamages[i]); If it ever goes into the negatives it will be 0.0001 anyway.

 Post subject: Posted: 27 Mar 2007, 22:37
 Modeler

Joined: 28 Apr 2005, 20:07
Location: Next to the girl with kaleidascope eyes
 rattle wrote:Hmm... what's -ve damage? :? shortform for negative I belive

 Post subject: Posted: 27 Mar 2007, 22:37
 Moderator

Joined: 29 Apr 2005, 00:14
Location: #moddev - join it!
 -ve = negative And ok, was just checking.

 Post subject: Posted: 27 Mar 2007, 22:38
 Damned Developer

Joined: 01 Jun 2006, 12:15
Location: Banned user for reason “Do not post pictures of people fucking cars”
 That's good, I tend to forget things...

 Post subject: Posted: 28 Mar 2007, 02:23
 Moderator

Joined: 29 Apr 2005, 00:14
Location: #moddev - join it!
 Damn, I totally missed this before - dynDamageMin might (would be for me, anyway) be better off as an integer value rather than a %... Simpler to calculate a % of the original damage as an integer than to calculate an integer as a % of the original, well, not exactly, but its juist nicer, to me, anyway. That's why i was suggesting what i was suggesting before, hadn't read it closely enough. edit: also, could you upload the latest .patch for me to look over?

 Post subject: Posted: 28 Mar 2007, 03:52

Joined: 24 Oct 2006, 12:45
 This is a product of range and not flight-time, so high arc weapons won't be probably the best to use with this tag. Or am I missing something? The first thought I had when reading about these new tags was for perhaps tank-vs-tank and battleship-vs-battleship duels. I like the inverse curve especially in that case.

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 2 [ 33 posts ] Go to page 1, 2  Next

 All times are UTC + 1 hour

#### Who is online

Users browsing this forum: No registered users and 0 guests

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for:
 Jump to:  Select a forum ------------------ Spring    Community News       News Submissions    General Discussion    Help & Bugs    Game Lobby       Spring Clans       Lobby Clients    Tournaments    Linux    Mac OS X    Off Topic Discussion Content Creation    Game Development       Game Development Tutorials & Resources    Map Creation       Map Tutorials & Resources    Art & Modelling       Modelling & Texturing Tutorials & Resources    Project Subforums       Kernel Panic       Zero-K       Balanced Annihilation       Spring: 1944       Star Wars: Imperial Winter       XTA       Supreme Annihilation       Caydr's Projects       Evolution RTS       Argh's Projects       The Cursed       NOTA       Damned       Conflict Terra       Engines Of War       Spring Tanks       Journeywar       BattleTech: Legacy       Dune: Evolution       Progressive Annihilation       TA: Factions    Sound Effects & Music Development    News    Development       Dedicated Developer Discussion       New Developer Discussion       Infrastructure Development       Meeting Minutes    AI    Feature Requests    Lua Scripts       The Werewolf Game Site content    Site content       Banners       Welcome images       Videos       Videos - contributions       Screenshots       Screenshots - contributions