Hi!
Would it be possible to include fixes for slow super weapons in your next release? Normally it is not a problem but with slaughter maps with 5k and more more monsters such as Okuplok Map (oku2v31.wad) or Holy Hell Revealed (Doom 2 - Holy Hell Revealed v1.5 SD.wad) alt fire of Vindicator and Borsch become so slow that they are practically unusable. However slaughter maps are maps where Russian Overkill shines the best so it needs to be fixed.
The problem lies within use of A_SuperExplode. Ro_SuperExploder is a function that iterates over all actors and damages all monsters within your blast radius. However superweapons call this function hundreds of times. So if you have 50k actors and Vindicator does about 300 times during one altfire explosion then it means that this while loop in this code has to process 12M actors. The damage is dynamically calculated by the code max(0, (1 - diff_len / radius) * damage) which can return value of 0 if monster is outside of blast radius. After that mo.DamageMobj gets called regardless of max(0, (1 - diff_len / radius) * damage) result. This means that when you alt fire Vindicator in map Doom 2 - Holy Hell Revealed v1.5 SD.wad at the place where you initially spawn in map it does about 9 million calls to mo.DamageMobj however only about 8.8k of those 9m are actually dealing more damage than 0. This is very inefficient and slows PC down a lot. I did not make up these numbers myself. I got this information by actually measuring the amount of calls using a_log and sending it's output to text file where I could later count the number of certain log entries. So my first proposal is to change A_SuperExplode so that it would only call DamageMobj when damage is > 0.
The code for the fix is following:
- Code: Select all • Expand view
if(damage_dealt > 0){
mo.DamageMobj(
user,
user.target,
damage_dealt,
damage_type);
}
This alone already greatly speeds up all superweapon alt fires. However there is more that can be done to speed up RO in slaughter maps. Vindicator and Borsch do excessive amount of calls to A_SuperExplode. which means that even if previous fix decides not to damage monsters we still experience some slow down due to A_SuperExplode having to iterate over all actors for hundreds of times. I suggest to call it less times and compensate it with more damage output. This way those weapons still do the same amount of damage but wont use as much CPU time.
In Vindicator\Projectile.rxt find VindicatorMegadeath replace it with:
- Code: Select all • Expand view
Actor VindicatorMegadeath : Ro_SuperExploder
{
//ReactionTime 200
+NOINTERACTION
+FORCERADIUSDMG
var int user_blasttime;
var int user_blastratio;
var int user_blastpower;
States
{
Spawn:
TNT1 A 0 NoDelay { user_blasttime = 199; user_blastratio = 0; user_blastpower = 0; }
TNT1 A 2 {
if(user_blasttime % 3 == 0){
A_SuperExplode(18000, 384, "Superweapon", 0.1, true);
}
user_blasttime--;
Return A_JumpIf(user_blasttime <= 0,1);
}
Wait
TNT1 A 0 { user_blasttime = 35; }
TNT1 A 2 {
user_blastratio += random(96,110);
user_blastpower -= 100;
user_blasttime--;
if(user_blasttime % 3 == 0){
A_SuperExplode(21000-user_blastpower, 384+user_blastratio, "Superweapon", 0.1, true);
}
Return A_JumpIf(user_blasttime <= 0,"Null");
}
Wait
}
}
Compared to original code both calls to A_SuperExplode are wrapped inside if(user_blasttime % 3 == 0){ which basically tells to cause damage only every 3rd iteration. Since I did not change user_blasttime the animation is not 3 times shorter. It still lasts the same amount of time but does 3 times less calls to A_SuperExplode during that time. In A_SuperExplode call I multiplied damage by 3 in order to compensate for 3 times less calls.
Next, take Borsch\Projectile.txt and find BorschHoleDamager and replace it with this:
- Code: Select all • Expand view
Actor BorschHoleDamager : Ro_SuperExploder
{
ReactionTime 120
+FORCERADIUSDMG
+NODAMAGETHRUST
+NOINTERACTION
DamageType "Superweapon"
States
{
Spawn:
TNT1 A 3 NoDelay {
//A_Explode(8000,512,1,1,512);
A_Explode(12000, 512); // The kind of blast that kills.
A_SuperExplode(12000, 512, "Superweapon", 0.1, false);
A_SetAngle(Angle + 15);
A_Countdown;
}
Loop
Death:
TNT1 A 0
Stop
}
}
Here I reduced ReactionTime 3 times and increased one frame duration 3 times with TNT1 A 3 NoDelay. As a result animation lasts the same amount of time but does 3 times less calls to A_Explode and A_SuperExplode. To compensate for damage loss I also multiplied damage by 3 in those calls.
I also created zip file that contains those 3 tiles that I fixed so you dont have to manually edit everything, it's done for you. It only contains the fix itself, it is not a full standalone mode. You need to add those files into RO pk3 file. I do not recommend distributing it as separate file as it creates unnecessary confusion and gets lost over time. Add it to RO.pk3 and then distribute update RO.pk3 instead.
To see the difference load RO with Doom 2 - Holy Hell Revealed v1.5 SD.wad and and alt fire both Vindicator and Borsch with and without this fix. I suggest doing it in room where you spawn initially because it has only 1 monster and therefore you cant blame the slowness on amount of monsters on screen. Also note that both of these explosions are also demanding on graphics card so if animations cause lag with your computer (which can happen due to intel graphics card not being good with translucency) turn your face to opposite direction. Just do something that allows you to estimate the lag. I for example simply used to play around with free look by moving mouse. It can definitely be noticed when when frame rate drops to 1 frame per 2 sec.
You do not have the required permissions to view the files attached to this post.