04-18-2021, 11:35 PM
(This post was last modified: 04-19-2021, 12:00 AM by qndel.
Edit Reason: Adding more stuff : P
)
Quote:BOSS LIGHT RADIIhttps://github.com/diasurgical/devilutio...b4b5b2dadd
All bosses in Diablo emit a light radius visible to players. If they move, their light radius moves as well. However, if you leave the level and re-enter, the bosses original positions will have a light radius on the floor, even when the boss' dead body is located at a different position on the level.
This was actually caused by a much more serious bug. RNG calls were diverging during entering the level for the first time and subsequent entries.
First cause was calling GetRndSeed a few times during first entry and storing the seeds in variables that were only used in debug builds - it was as if they forgot calling that function alone modifies the seed.
Code:
if (firstflag || lvldir == ENTRY_LOAD || !plr[myplr]._pLvlVisited[currlevel] || gbMaxPlayers != 1) {
HoldThemeRooms();
glMid1Seed[currlevel] = GetRndSeed();
InitMonsters();
glMid2Seed[currlevel] = GetRndSeed();
These didn't happen on reentering the level = RNG desync cause #1
Second one was a bit more tricky.
During first entry the game called
Code:
HoldThemeRooms();
Which set a flag that prevented monsters from spawning in some rooms.
This was missing from next level entries, the flags were restored in a different function but it happened after the function that was responsible for generating monsters.
Which means monsters saw different tiles as suitable spawn locations thus diverging the RNG calls even further.
That sounds pretty serious right? And nobody noticed during all these years? Well, the game mostly fixes the effects of the desyncs above by "magically" warping monsters to the places they had when the level was generated for the first time, however light radius stays in the "new" location. That's why the light was so broken.
It didn't break for quest monsters like Leoric and the Butcher, because their position was literally hardcoded, but issues with light are a material for another story Wink
Quote:When at full stealth level (-80% light radius), walls sometimes cannot be mapped even when the character is right next to them. Also, portions of the map for a level will appear as revealed very far away from the character's position. And, last of all, you won't see a monster one square away from you if it's at a diagonal angle. It won't see you, either.
Not seeing stuff diagonally is caused by light/vision shape being pretty much broken at 20% light
https://imgur.com/a/BGcVjpn
Here's original vs fixed
Stray automap tiles are a different issue, but it was easier to spot it while having low light radius, because they ended up in unexplored parts more often.
https://github.com/diasurgical/devilutio...0c5058409b
Only took 25 years to find the cause, turns out to be a simple typo where they passed X/X coords to a function responsible for revealing automap instead of X/Y.
This bug only happened in the call responsible for exploring the tile the player was standing at, that's why it mostly worked fine, only being easy to spot if the difference between X and Y coords was relatively big + it ended up exploring an unexplored part.
Quote:When being hit by a creature with knockback power (or a character with a knockback weapon) such as Diablo or a charging beast, you can be knocked back physically, but your light radius does not move unless your character makes some form of move (either walking or attacking). Thus, you can eventually be knocked outside of your own light radius and all creatures will disappear.
https://github.com/diasurgical/devilutio...07a2c9e7fb
The fix turned out to be pretty simple, just update player's light/vision
Quote:If you enter the caves via the cave mouth entrance near Wirt, you can run the mouse cursor over the stairs on level 9, and a small spot on the right side of the stairs will read "up to level 8." If you left click on that spot your character will begin walking towards the level 8 stairs (even if you can't see them on the map), unless the way is blocked by lava, grates, or some other obstacle. If you teleport onto that spot, your character will teleport all the way to the level 8 stairs and go up!https://github.com/diasurgical/devilutionX/pull/1583
dPiece 182 was the cause of that problem.
It occurs both in warp to town and level up and only warp to town was checking distance.
Code:
/** Specifies the dungeon piece IDs which constitute stairways leading up from the caves. */
int L3UpList[] = { 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, -1 };
Whenever you put the mouse over dPiece 182 in stairs to town, the code matches that dPiece with "level up" trigger and replaces cursmx/cursmy without any check - that's why teleporting/clicking actually targetted the stairs up
What is weird is that there actually was a distance check for most of the stairs that made sure the trigger that got matched was the one at that location but it wasn't used everywhere.
Distance from trigger check:
Crypt stairs up (first level)
Catacombs stairs up
Catacombs quick entrance
Caves stairs down
Caves quick entrance
Nest stairs up(first level)
Hell quick entrance
Missing distance check:
Church stairs up (Including ones to town)
Church stairs down
Crypt stairs up
Crypt stairs down
Catacombs stairs down
Caves stairs up (was the one causing problems)
Nest stairs up
Nest stairs down
Hell stairs up
Hell stairs down
Hell's entrance to dlvl 16
Applying the check to stairs up in caves fixes the issue
Quote:GOING UP AND DOWN STAIRSI actually don't consider it a bug, but a feature! There's a hardcore Diablo 1 mod named Crucible which changes game's balance and makes monsters super deadly. It's not unusual to stand inside a town portal and keep attacking while facing a dangerous enemy - that way you can teleport away by just stopping your attacks.
You will only descend a stairwell while you're in "walk" mode. Other actions, such as swinging or casting, will prevent you from descending a staircase.
Quote:STEALTH EFFECTS
When using items that reduce a character's light radius, a character will only activate monsters who are in that light radius. However, the character's light radius for attracting monsters depends upon the highest light radius the character had on a level until he/she exits the level. If the light radius is increased/decreased while on the level, it will alter the player's light radius, but not in terms of monster attraction - they will be attracted to the highest radius that existed at any time on the character. In other words, always have stealth equipment equipped BEFORE entering a level, and if you drop a stealth item, you'll have to leave the level and come back to use its effect on monster attraction again.
This description is actually a bit wrong.
https://github.com/diasurgical/devilutio...9889e8e2d3
It's caused by code in CalcPlrItemVals which gets called whenever you equip/unequip items
Code:
if (lrad < 10) {
ChangeVisionRadius(plr[p]._pvid, 10);
} else {
ChangeVisionRadius(plr[p]._pvid, lrad);
}
Deleting the check solves the problem.