[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4787: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4789: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4790: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4791: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3922)
InsideQC Forums • View topic - MultiDamage fix

MultiDamage fix

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

MultiDamage fix

Postby Orion » Mon Apr 23, 2012 6:43 pm

User avatar
Orion
 
Posts: 476
Joined: Fri Jan 12, 2007 6:32 pm
Location: Brazil

Re: MultiDamage fix

Postby Seven » Tue Apr 24, 2012 3:28 pm

Thank you very much Orion.
Seven
 
Posts: 301
Joined: Sat Oct 06, 2007 8:49 pm
Location: Germany

Re: MultiDamage fix

Postby Cobalt » Sat Apr 28, 2012 3:20 am

First off , bravo, great idea.

Second:

How did this work for anyone else? I put the code in, and at first no damage was given , but that was my mistake because I pasted wrong.
To me it looks like we are just taking the float [damage] and applying its same value to whatever other ent the trace hits? I would imagine the secondary damage would be less than the first, so would it not be better to reduce that value somewhat?

Also I noticed that you are pretty much walking through the entire entity list with the [ while (e) ] statements.
CPU resources can be saved if you use [while (e.takedamage) ] for example. Also its the same to just say [ If (e.multi_damage) ] than to check if its > 0.

After some more study, this code probably is ok for vanilla single player , but for deathmatch or teamplay it looks like it needs more tweaking because if you have multiple shotgun battles going on, we are clearing multidamage for any entity on the map every time a gun is fired, so that wont work out too well. I am going to try and add more to this and will repost later.
User avatar
Cobalt
 
Posts: 445
Joined: Wed Jun 10, 2009 2:58 am
Location: New England, USA

Re: MultiDamage fix

Postby Orion » Sat Apr 28, 2012 5:54 am

Notice that multi_damage was turned into a dot float, which is a float that belongs to an entity, so 2 entities will not take the same damage, unless if the pellets are spread half and half for both entities. The Shotgun firing works like this:

First it resets the multi_damage value of every entity (that was the only way I found, but I might try yours) to zero. Then it goes to the while loop, and shoot the desired amout of pellets. TraceAttack() will add to multi_damage the amount of damage each pellet does, for the trace_ent it hits, if damageable. If a pellet misses, the trace_ent won't receive additional multi_damage from that pellet.

Then it finishes the while loop, and applies the multi damage to every entity with multi_damage > 0, and each entity will have their own multi_damage values. So I think it should work well even on MP, but I dunno what could happen it 2 shotguns from different players are fired EXACTLY at the same frame, but this is very hard to happen. I think if 2 players shoot with the SG at a single enemy, at the very same frame, that enemy will get a multi_damage of 96, if no pellet misses. 96 because if 2 shotguns are fired at the same frame, then ApplyMultiDamage() will be called twice, doubling the damage from EVERY shotgun. This is indeed a bug. Hard to happen, but it is. I still haven't discovered a better way to handle multi damage, but this one I found somewhat acceptable atm.
User avatar
Orion
 
Posts: 476
Joined: Fri Jan 12, 2007 6:32 pm
Location: Brazil

Re: MultiDamage fix

Postby Cobalt » Sun Apr 29, 2012 1:57 am

User avatar
Cobalt
 
Posts: 445
Joined: Wed Jun 10, 2009 2:58 am
Location: New England, USA

Re: MultiDamage fix

Postby Orion » Sun Apr 29, 2012 3:07 am

User avatar
Orion
 
Posts: 476
Joined: Fri Jan 12, 2007 6:32 pm
Location: Brazil

Re: MultiDamage fix

Postby r00k » Sun Apr 29, 2012 4:44 am

I check this out and see how it works for me.
I remember something like this from the QIP days; Quake's hitscan scheme with damage_collectors.
r00k
 
Posts: 1111
Joined: Sat Nov 13, 2004 10:39 pm

Re: MultiDamage fix

Postby Cobalt » Sun Apr 29, 2012 7:08 am

User avatar
Cobalt
 
Posts: 445
Joined: Wed Jun 10, 2009 2:58 am
Location: New England, USA

Re: MultiDamage fix

Postby Orion » Sun Apr 29, 2012 6:15 pm

Impossible, it should be an entity, not a float. Also, your compiler will give you an error if you try that.
A possibility is using darkplaces' findfloat(), but it will only work on DP then.
User avatar
Orion
 
Posts: 476
Joined: Fri Jan 12, 2007 6:32 pm
Location: Brazil

Re: MultiDamage fix

Postby Cobalt » Mon Apr 30, 2012 2:48 am

User avatar
Cobalt
 
Posts: 445
Joined: Wed Jun 10, 2009 2:58 am
Location: New England, USA

Re: MultiDamage fix

Postby r00k » Tue May 01, 2012 3:21 am

EDIT: seems to work like a champ!

READ below(updated just as u were typing)...
need the nextent to catch triggers/doors behind opponents. ;)
Last edited by r00k on Tue May 01, 2012 3:59 am, edited 2 times in total.
r00k
 
Posts: 1111
Joined: Sat Nov 13, 2004 10:39 pm

Re: MultiDamage fix

Postby Orion » Tue May 01, 2012 3:48 am

Yeah, but what about shootable doors, buttons, monsters? These will take no shotgun damage with that code. :P
User avatar
Orion
 
Posts: 476
Joined: Fri Jan 12, 2007 6:32 pm
Location: Brazil

Re: MultiDamage fix

Postby Cobalt » Tue May 01, 2012 7:14 am

User avatar
Cobalt
 
Posts: 445
Joined: Wed Jun 10, 2009 2:58 am
Location: New England, USA

Re: MultiDamage fix

Postby r00k » Tue May 01, 2012 4:30 pm

r00k
 
Posts: 1111
Joined: Sat Nov 13, 2004 10:39 pm

Re: MultiDamage fix

Postby Cobalt » Wed May 09, 2012 3:59 pm

Hmm. Im gonna play around with my idea some more. I dont know why its not supplying damage from the ent to any of the triggers, can someone tell me why?

Again, kudos to the original poster for tackling this problem. I just like to take opportunities like this to push the envelope some more and see what else as far as improvements could be done because my mod is a Darkplaces only type mod.

One thing I noticed today was one of my bots shot another bot while jumping in mid air. I posted in another thread here a while ago about improved air-death scenes....not much interest seemed present, but I still plan to put some code in there that checks if the target is on the ground. (problem is if its touching a wall, its condidered onground via FL_ONGROUND) If we are on ground, (we may also benefit by doing a check for checkbottom() or droptofloor(), however droptofloor still actually drops the entity you are referencing to the floor, so I think the only way around that is to spawn another ent at the same origin and then check for droptofloor) we run the stock QC that picks a random death scene. If we are in the air, we could merely apply some force to the target via calculations from the associated code mentioned here, and this is where my spawned entity could come in handy as the ' source of the force ' so to speak. I mentioned how we need to compare vector forces because if the ent is heading into the bullets the ent will be effected proportionately by that force. The animation frames for the player actually have some frames that show the player angled back, but if you notice, you can hit the player in the back and it still may learch opposite the direction of the firing. This could be fixed somewhat in QC by merely changing the angle of the model, however I am guessing the engine still exclusively handles the 'pain frames', but I could be wrong.

Some interesting new effects become possible if this is done right. Consider shooting an ent in mid air with the ssg and see how far its pushed back with a proportional roll angle applied to the model, and the regular deathscenes either eliminated or randomly framed in with new code.

Alot of this idea would probably be a great addition for the GYRO mod, however I cant locate the author, I believe he is QuakeMatt? Any coders interested in working with me to make this a new GYRO feature let me know.
User avatar
Cobalt
 
Posts: 445
Joined: Wed Jun 10, 2009 2:58 am
Location: New England, USA

Next

Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest