itslunaranyo / copper

a single-player refinement mod for id software's quake
GNU General Public License v2.0
41 stars 17 forks source link

Runaway Loop Error on sm227_colossus #17

Closed 4LT closed 12 months ago

4LT commented 1 year ago

I think it's a matter of opinion whether this falls on the mod author or engine programmer (or map author), although I don't think engine coders should be expected to keep bumping the instruction budget for compatibility reasons (break on everyone else's engine) and mod authors, I expect, will just keep flying closer and closer to the sun.

Anywhoo

The error occurs when discharging the thunderbolt in the pool of water after allowing a sufficient number of fish to spawn. Stack trace:

STORE_F    503(STAT_VIEW2) 20.0 13(?)                
   m_fish.qc : fish_die
   combat.qc : Killed
   combat.qc : T_DamageApply
   combat.qc : T_Damage
   combat.qc : T_RadiusDamage
w_lightning.qc : W_FireLightning
   player.qc : player_light1
  weapons.qc : W_Attack
  weapons.qc : W_WeaponFrame
   client.qc : PlayerPostThink
<NO FUNCTION>
runaway loop error
Host_Error: Program error

I think the easy solution, which fixes this particular instance but not the general case, is to defer execution of the body of the health < -30 check to the next frame. The engine would then enter each fish's think function separately, so you'd be far from hitting the execution limit.

Sorry if suggesting solutions in the issue sounds patronizing, I don't mean it to be, I just compulsively try to come up these things. I'm sure you know best how to resolve this.

itslunaranyo commented 12 months ago

With a combination of deferring fish gibbing one frame into their own thinks (genuinely good idea, thank you) and making CanDamage/T_RadiusDamage a little bit more efficient I am able to discharge 304 rotfish to death at once in a testmap. It's hard to test perfectly in sm227_colossus because that many rotfish at once seems to brute force the physics into letting fish eventually clip through each other or wind up embedded in the floor or void, which is its own set of problems that might be outside my purview.

but 304 > 297 so I'm calling this fixed in 1.31