About Lanaya

Talk all you want about Defense of the Ancients here.
User avatar
h3rmit
Aura Tree
Posts: 27
Joined: Sat Aug 27, 2016 12:15 am
Has thanked: 3 times
Been thanked: 21 times

About Lanaya

Postby h3rmit » Sat May 24, 2025 10:53 am

I decided to start a discussion thread about Lanaya, a forgotten hero that has been unplayable since 2018, when Warcraft III patch 1.30.1 was released.

The issue was recently brought back into spotlight in a thread about another bugfix.

EdteOfChaos2 wrote:@h3rmit If you're changing the map, I'd also suggest simply removing Lanya from the taverns and -random pool (assuming it's too hard to fix the crashing, this is the next best option)


Q. Lanaya has been broken for years. Why is she still in the map?

Lanaya works correctly in all other versions of Warcraft III, so I've been hesitant to completely remove the hero. After all, this map version is the most faithful to the original 6.83d released by IceFrog, and I'd like to keep it that way.

Q. Why hasn't it been fixed yet?

Crashing (like Phantom Lancer) would have been easy to test and fix. Unfortunately, in the case of Lanaya, it's not a crash - it's a "desynchronization" (or "desync" in short). It's a difference in the game state between players, and it's the sole responsibility of Warcraft III, not the map.

Warcraft III was designed in an era of slow internet connections. In an effort to accommodate this, it has a decentralized design, where every player keeps the entire game state locally (e.g. HPs, mana, positions of all units, etc), and only their actions are transmitted to the other players (e.g. "click at location X,Y"). Each player's computer is running the exact same code (same Warcraft and map) and is expected to produce the exact same results as the others, given the exact same input of actions. To ensure that all players are aligned, Warcraft III periodically sends a small checksum of the entire game state to the other players.

Patch 1.30.1 must have broken something like a spell, attribute, or random number generator, causing it to be calculated in a non-deterministic and unpredictable way, producing different results in different computers - hence the "desynchronization" between players. The bot disconnects the players cause they have drifted off into a different universe, seeing a different world unfold. It's a sort of a butterfly effect. If in one universe I receive 99 damage and survive, but in the other universe it's 101 damage and I die, then history will start changing course.

Due to their nature, desyncs cannot be reproduced and tested locally in Single Player. To even witness the bug with my own eyes and verify it, I had to pick Lanaya in a Multiplayer game and get reported for it.

The process of narrowing down the bug is completely blind and solely relies on trial and failure. In every iteration, I have to:

  • Study the map's code related to Lanaya and make a random guess about which of the otherwise perfect-looking commands could be secretly broken.
  • Try removing it and re-package the map.
  • Deploy it on a test bot, join a lobby and wait for hours until a player shows up to test.
  • Go back and forth to the current public game's lobby, in hopes I can chat and find a volunteer or two.
  • Play the test game for quite some time to determine if it desyncs or not. The appearance of the desync is completely random and doesn't easily happen with just 2-3 players.

Q. So what's the current status?

Thanks to some tests I ran with the help of a few volunteers (kobz, Mush-), I was able to pinpoint the issue to be related to Lanaya's Refraction bonus damage. This overly compicated spell seems to rely on something that is broken in Warcraft III 1.30.1, but works fine in all other versions. I haven't yet found what it is, specifically.

So the current options are:

  • Run another ~100 tests with volunteers until the exact cause of the problem is uncovered, make a fix and re-run a few tests to verify that the fix is stable.
  • Add a Warcraft III version detection and nerf Lanaya by removing her Refraction bonus damage if the Warcraft's version is 1.30.1. But then nobody will ever bother again and the bug will remain there forever.

Completely removing Lanaya from the map isn't really an option, and it won't provide any actual benefits at the present.

I'd appreciate to hear everyone's thoughts on the matter here, and not be randomly asked in lobbies or in-game about it.

EdteOfChaos2
Forest Walker
Posts: 229
Joined: Sun Sep 15, 2019 8:24 pm
Has thanked: 47 times
Been thanked: 59 times

Re: About Lanaya

Postby EdteOfChaos2 » Sat May 24, 2025 10:05 pm

Mostly, desyncs are caused by unsafe use of GetLocalPlayer(), usually when attempting to display SFX to only one person.

Haven't looked at the code, I doubt it's that hard to fix anyways. But there's no benefit to leaving the hero in the current map as is. Just allowing people to troll games. Keeping Lanaya in the game isn't remaining faithful to Icefrog, because Icefrog's versions didn't crash when you use the hero.

User avatar
h3rmit
Aura Tree
Posts: 27
Joined: Sat Aug 27, 2016 12:15 am
Has thanked: 3 times
Been thanked: 21 times

Re: About Lanaya

Postby h3rmit » Sun May 25, 2025 12:04 am

EdteOfChaos2 wrote:Mostly, desyncs are caused by unsafe use of GetLocalPlayer(), usually when attempting to display SFX to only one person.


True. But this isn't one of those cases. If it was, the map would have been desyncing in all Warcraft III versions for a decade.

The investigation so far has narrowed down the desync to a few UnitRemoveAbility() and SaveInteger() commands. Which makes no sense by itself, since these commands are used thousands of times in the map without causing a desync. It's as if Warcraft III itself has an issue with a specific buff/skill.

Astros
Protector of Nature
Posts: 3408
Joined: Wed Jan 16, 2013 9:40 pm
Has thanked: 205 times
Been thanked: 239 times

Re: About Lanaya

Postby Astros » Sun May 25, 2025 2:15 am

It's awesome you are putting effort into it and I'm sure it's more of a personal challenge for you but truthfully, there's no reason to fix it.

Lanaya has always been one of the more difficult heroes in the game and would unlikely be chosen with the current pool of players. I'd say bottom 5% of chosen heroes.

That would only lead to 2-3 players at best who would ever choose it.

Everyone knows it is banned at this point so the only negative would be if someone unluckily randoms it, which by now, many just treat it as part of the game to random it and have to burn 200 gold.

I guess if you REALLY wanted to preserve it and I'm not sure the difficulty in it but what about just creating a new spell for Lanaya and remove refract?

User avatar
h3rmit
Aura Tree
Posts: 27
Joined: Sat Aug 27, 2016 12:15 am
Has thanked: 3 times
Been thanked: 21 times

Re: About Lanaya

Postby h3rmit » Mon Jun 02, 2025 11:41 pm

It's been an entire week of testing and debugging. I've set up a local environment to run 2 Warcrafts and 2 WC3Connect clients at the same time, and I've performed more than 50 tests to debug what is actually happening with Refraction.

The design of Refraction is very poor, and there are several mistakes in it that have remained there probably since its creation. It's a wonder it didn't break sooner.

1. Refraction bonus damage charges are zeroed the first time you miss.
2. The game attempts to remove the buff of bonus damage in every hit Lanaya initiates, from the moment she learns the skill onwards, for the entire game, regardless of whether she's using Refraction or not.

Bonus damage charges are supposed to be consumed only if the hit lands, so a check if GetEventDamage()>0 is used. However, this check is done inside a EVENT_PLAYER_UNIT_ATTACKED event, when an attack is initiated and before any damage happens. GetEventDamage() is only used in EVENT_UNIT_DAMAGED events elsewhere in the map code. Essentially, IceFrog wanted to preserve bonus attack charges when you miss. Instead, he achieved the opposite: you lose all remaining charges when you miss.

Now, when called from a EVENT_PLAYER_UNIT_ATTACKED event, GetEventDamage() seems to have an inconsistent behavior across different Warcraft III versions:

Warcraft III 1.26
GetEventDamage() always reports 0.000, but the condition "GetEventDamage()>0" is always true.

Warcraft III 1.27a
GetEventDamage() always reports 0.000, but the condition "GetEventDamage()>0" is always true.

Warcraft III 1.28.5
GetEventDamage() always reports 0.000, but the condition "GetEventDamage()>0" is always true.

Warcraft III 1.29.2
GetEventDamage() always reports 0.000, and the condition "GetEventDamage()>0" is always false.

Warcraft III 1.30.1
GetEventDamage() mostly reports 0.000, but sometimes reports 18,524,496,640,000,000,000,000,000,000.000 instead. The condition "GetEventDamage()>0" is mostly false, but sometimes returns true. Looks broken and unreliable, and is most probably the root cause of desyncs.

I will be aiming for a simple fix: For this broken check to be removed and the bonus damage charges to be decremented on every hit, missed or not. This doesn't match the original intention behind Refraction's design, but it's far more advantageous to the hero than the way it was actually implemented so far (charges zeroed on first miss).

Rather than trying to preserve the intention, the suggested fix is the closest to what actually happens now.
For example, if you have 5 bonus attack charges, make 5 attacks and miss 2 of them:
  • What IceFrog's intention was: all 3 landed attacks to have the bonus damage, and you'd have another 2 charges.
  • What IceFrog actually implemented: Any random number of attacks between 0 and 3 will have the bonus damage, and no charges will be left.
  • What I'm going to implement: all 3 landed attacks will have the bonus damage, and no charges will be left.

Secondly, I'll try to remove the buff just once, when the charges run out. It's ridiculous to have a buff removed on every hit for the entire game (even when the buff isn't there!), and it's prone to cause more problems in the future.
These users thanked the author h3rmit for the post (total 2):
freshP (Thu Jun 05, 2025 11:48 pm) • GodSaveTheQQs (Tue Jun 03, 2025 9:52 pm)

GodSaveTheQQs
Armored Tree
Posts: 58
Joined: Tue Jun 09, 2015 9:16 pm
Has thanked: 178 times
Been thanked: 20 times

Re: About Lanaya

Postby GodSaveTheQQs » Tue Jun 03, 2025 9:54 pm

Big respect for your effort, time and love for this game brother. It's a miracle we still have a person like you who has the skills to fix bugs and improve an 25 year old game. Thank you in advance.

Frank
Forest Walker
Posts: 185
Joined: Thu Sep 13, 2012 12:54 pm
Has thanked: 1 time
Been thanked: 14 times

Re: About Lanaya

Postby Frank » Tue Jun 03, 2025 11:47 pm

This is big! I might come back to ENT just to play my favourite hero again :)

User avatar
RichardCoffee
Treant
Posts: 252
Joined: Wed Aug 10, 2022 1:49 am
Has thanked: 17 times
Been thanked: 28 times

Re: About Lanaya

Postby RichardCoffee » Wed Jun 04, 2025 12:35 pm

Thanks for fixing. I'm reporting a glitch happened where 2-3 heros became statues and couldn't move or cast spells at all during a fight for about 10-20 seconds:

(42:18 / Allied) Lumberjackk: WTF
(42:20 / Allied) spudd_3113: uhh
(42:22 / Allied) spudd_3113: ???
(42:24 / Allied) spudd_3113: cant move
(42:25 / Allied) Lumberjackk: how tf am i stuck


http://storage.entgaming.net/replay/vie ... 254194.w3g


At least it's not DCing, didn't happen often, and we were able to move afterwards. But seems there are potential weird bugs still.

(On another note, you know what I'd literally pay money to see? If you could somehow interfere with MH in a new update and make it unusable. I know this is probably a dream scenario since it's too complex. But I'd grab popcorn out to see what happens with players like andek ('ShaDoW_death") afterwards.)

User avatar
h3rmit
Aura Tree
Posts: 27
Joined: Sat Aug 27, 2016 12:15 am
Has thanked: 3 times
Been thanked: 21 times

Re: About Lanaya

Postby h3rmit » Thu Jun 05, 2025 2:28 am

I watched the replay carefully. I can't really tell what happened, and I certainly can't pin it on Lanaya.

Observations

1. There were two enemy skills that could immobilize players in your team in an area, on their own: Techies' Stasis Trap and Medusa's Stone Gaze.
2. You all happened to be in the same area, sufficiently close to be covered by the effect of either.
3. The players that reported the issue were all in the same team, and in consecutive slots (the last 3).
4. Pudge reported to have been moved to a disadvantageous spot unwillingly (?) at the edge of the map.
5. The issue was reported in the game's chat the exact moment after the blue player (Medusa) was kicked from the game using -kickafk 1.

Possible explanations

Completely thinking out of the box, I believe the following could be far-fetched, yet plausible explanations:

Theory #1:
An invisible, phantom stasis trap went out without an animation and immobilized you all in an area.

Theory #2:
A phantom Stone Gaze, also without an animation or sfx, that was not invoked by Medusa, was somehow cast on that area.

Theory #3:
Lanaya is broken in a completely unforeseen manner, and causes players on her team to freeze.

Theory #4:
The map malfunctioned the moment the blue player, who is responsible for sending stats to the bot, was kicked from the game.

Theory #5:
The bot faced some temporary network issue, high load or other type of malfunction and didn't transmit the actions of the players in the 3 last slots, locking them in place, in a fashion similar to lagging. Could also be related to the closing connection of the leaver.

My personal opinion

The timing of the blue player getting kicked and the bug appearing does not seem coincidental to me. Out of a 53-minute game, it only happened exactly when -kickafk 1 was issued.

However, it's still too early to make any definite deductions. There were too many factors at play in that game. Let's play Lanaya in more games, to gather more hints if it ever happens again, or rule it out as coincidental/unrelated.

P.S.: Dealing with maphacks at the map level is not just "complex". It's impossible. It's the underlying engine (Warcraft III) that's exploitable, and there's nothing to be done for this at the map level. It's like asking to fix a leak in your car's engine by sitting in the driver's seat and driving in a different fashion.

freshP
Resource Storage
Posts: 12
Joined: Mon Jul 16, 2018 4:10 pm
Has thanked: 1 time
Been thanked: 2 times

Re: About Lanaya

Postby freshP » Thu Jun 05, 2025 11:54 pm

You dense mfer!
How did you even narrow this down? I know you explained, but I also know this took many hours of meticulous work. Sick job!


Return to “Defense of the Ancients”

Who is online

Users browsing this forum: No registered users and 6 guests