Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

From Town Hall meeting: Damage types

Huns Valen
Don't PM me here.
Join date: 3 May 2003
Posts: 2,749
06-17-2003 21:26
I brought up a question about splash damage (from explosives) and Phillip suggested that I open a thread, so here goes. In addition to llSetDamage() I think we should have:

llRadiusDamage(float radius, float damage, float fade, float ownerDamage);
  1. radius - Distance damage is done, in meters from the object center. Limited to 16 or 32 meters or something like that, so it isn't possible for people to build "nukes" that take out everyone in an entire sim.
  2. damage - At the center of the damage radius, this much damage is done.
  3. fade - Damage fades this much per meter travelling outward.
  4. ownerDamage - Range 0-1, this scales how much damage the owner suffers when the damage is done; this is done in Quake and other FPSes.


There is a way to do this now, and it's to create a huge volume around a projectile, texture it as transparent, and make it phantom. But... it's hackish and probably more expensive than just having a library call to do the same thing, and it's also more refined since damage can be scaled by distance.

Typical usage would look like this...
CODE

// --- This goes outside the state (global)
integer TTL; // Time-to-live
integer fusing; // Don't arm for this many seconds
integer secsAlive; // I've been alive for this many seconds

explode() {
// Insert llMakeExplosion or something here
if(secsAlive > fusing)
llRadiusDamage(8, .2, 1/8, .5);
llDie();
}


// --- This goes inside the state
state_entry() {
TTL = 10; // Max time-to-live: 10 seconds
fusing = 3; // Don't arm for this many seconds
llSetTimerEvent(1); // Do damage/TTL once per second
}

// Explode if we crash into something
collision_start(integer n) {
explode();
}

// Explode if we hit the ground
land_collision_start(integer n) {
explode();
}

// Do damge to people we pass, if fusing time is over
// Also: Die if TTL is exceeded
timer() {
secsAlive++;
if(secsAlive > fusing)
llRadiusDamage(3, .2, 1/8, .5);
if(secondsAlive > TTL)
explode();
}


The above would be for a BFG-style particle cannon that dings everyone for some health as it passes by. When it hits anything solid, it explodes. If it lives more than ten seconds, it explodes. Like a real-world missile, it has a fusing delay, so that if it accidentally runs into something before it gets very far, it doesn't kill the person who fired it.

Another possibility would be llSetAreaDamage(vector start, vector end, float damage, float interval). You call this and it sets an area to do so much damage at a certain interval in a defined cubic space. This could be used for "kill zones" (i.e. falling off a mountain, wandering into a nuclear reactor containment, crossing a force field, etc). As with llRadiusDamage() the size of the damage area would be limited so as to prevent abuse. This would have to be attached to an object of course.
Ama Omega
Lost Wanderer
Join date: 11 Dec 2002
Posts: 1,770
06-17-2003 23:22
While there are no limits on the amount of damage an item can do (ie any script can do 100% kill) then I am 100% against this idea. The only thing that keeps scripts that just kill everyone around limited at all right now is the complexity since any damage enabled projectile de-rezes upon inflicting damage. An easy way to kill off lots of people falls well into my range of BAD IDEA.

Now if damage caused was related to the energy in the object, the size, the mass or some other factor then this might be a possibility. However I think it should be limited so that it does less damage than a single target damage script can do, making it a choice - 'More damage to 1 target or less damage to more targets....'

I don't know the details of the ideal system, or if there is one. But I have said before and will say again - any system where any script can insta-kill a player is bad.
Wednesday Grimm
Ex Libris
Join date: 9 Jan 2003
Posts: 934
06-18-2003 08:46
I like this idea generally, specifically the bit about objects being able to do damage without dying (think swords).

But I also agree with Ama, and have been lobbying for some time now for damage as a function of velocity, mass and material, as opposed to some set value.
_____________________
Sarcasm meter:
0 |-----------------------*-| 10
Rating: Awww Jeeze!
James Miller
Village Idiot
Join date: 9 Jan 2003
Posts: 1,500
06-18-2003 08:49
I agree with Wednesday and Ama on this. I dont like having a set value, it should depend on the object.
Ope Rand
Alien
Join date: 14 Mar 2003
Posts: 352
06-18-2003 09:38
yeah its definitely waaay too easy to kill. this idea is cool, but we need more balance as well.
_____________________
-OpeRand
Huns Valen
Don't PM me here.
Join date: 3 May 2003
Posts: 2,749
06-19-2003 00:09
OK, how's this. Call it llSetRadiusDamage() instead, and have the object do the damage when it dies. The damage amount could be limited to .75 or something, so that it wouldn't be possible to kill someone in one shot, and someone who wants to make a BFG will have to go another route.
Gwydeon Nomad
Registered User
Join date: 1 May 2003
Posts: 480
06-19-2003 05:13
If you wanted to acomlpish a splash damage effect couldnt you just script a projectile to spray new projectiles in all directions on impact?
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
06-19-2003 05:27
how about taking the damage and coming up with a damage density, i.e you take up 1 cubic meter of a 5 cubic meter spalsh damage sphere, so you get smacked with 20% of whatever the damage is set to.

and if we wanted to get really fancy would make the density of the the blast damage varie, inversely proporitonal to the distance for the center of the blast. i.e. the smaller the distance to the center of the blast, the higher the damge density. probably some mildly crazy calculations in this but hey, it would be fun!

and yes, i agree with the others, damage should at least some how be tied into the mass and energy of the object, like lllPushObject.
_____________________
i've got nothing. ;)
Huns Valen
Don't PM me here.
Join date: 3 May 2003
Posts: 2,749
06-23-2003 00:10
From: someone
Originally posted by Gwydeon Nomad
If you wanted to acomlpish a splash damage effect couldnt you just script a projectile to spray new projectiles in all directions on impact?
Too expensive. No one wants to see the physics FPS in a sim go down to 3 because someone's missile spawned 30 projectiles all at once. Besides, that would be a lot more work than having the engine do splash damage with natively compiled code.

Someone else mentioned "mildly crazy" code to calculate distance from the blast center, it's not all that crazy...

a=abs(x2-x1)
b=abs(y2-y1)
c=abs(z2-z1)
distance = sqrt((a^2) + (b^2) + (c^2))

Also known as llVecDist(vector a, vector b)... it requires a little FPU action but SL doesn't run on anything without an FPU. :)
Ama Omega
Lost Wanderer
Join date: 11 Dec 2002
Posts: 1,770
06-23-2003 07:03
From: someone
Too expensive. No one wants to see the physics FPS in a sim go down to 3 because someone's missile spawned 30 projectiles all at once. Besides, that would be a lot more work than having the engine do splash damage with natively compiled code.
Exactly as it should be by now. I absolutly do not want it trivially easy or cheap to kill people in mass. Even though I think its too easy already.