Hacker News new | ask | show | jobs
by mashlol 2462 days ago
I recently pre-ordered and got access to the original wc3 which they've since patched with updates.

I started working on a new custom map, which now has support for Lua and all kinds of new natives like UI natives that allow you to completely customize the UI.

Unfortunately, the debugging tools are abysmal. There is currently a player desync happening in multiplayer in my map (somehow different players disagree with their local emulation), but I am given absolutely zero information about it. No stack traces, there's no way to add breakpoints or logs, prints slow things down to a crawl and so aren't really reasonable to try to debug with either. I've done manual tests slowly by removing parts of code, but due to the random nature of the desync, it's really challenging to solve anything this way. Even if I remove some modules and can't get a desync anymore, doesn't mean it's fixed - it's possible I just never hit the specific circumstance that causes it.

Whenever errors occur during load, I just get an error dialog with an empty box. Whenever errors occur during runtime, it just stifles the error and continues without logging or warning or anything. Lua has `debug.traceback()` but it seems Blizzard has prevented calling it. It's like trying to code without a compiler, without stack traces and without a debugger. Very challenging.

I'm extremely excited for reforged, but I really hope there are better debugging tools added for Lua (perhaps for JASS as well, although I'm not as familiar with the need there). If anyone from Blizzard is reading this, I'd say that's my number one concern right now.

2 comments

The first thing I do is to wrap the entire Lua script in a pcall in order to intercept and display occurring exceptions.

As for desyncs there is https://www.hiveworkshop.com/threads/desync-checker-for-jass...

The archive contains text files which are very helpful in understanding which functions are responsible for desyncs.

The `pcall` thing is interesting, didn't think of that. Will it apply to anonymous functions as well? For example, if I wrap my main in pcall, and then set up trigger calls, I expect the pcall won't apply to whenever the trigger callbacks are hit.

As for the desync checker, I've been down that rabbit hole - I removed every async method from the codebase and still had desync issues. I am starting to suspect its an issue with some new native that I am not thinking of, but it's a very slow process to track it down, since I need to get ~5 random players in my game every time to test it, and even if no desync happens it doesn't really mean its solved.

Yea the trigger actions need to be wrapped in a pcall too.

Because of that I made a function for trigger creation which wraps the provided action in a pcall.

How did you get access to the original w3? I mean where did you get the keys?
Once you pre-order, you can log in via your battle.net account to get access. You can download the game from here: https://www.blizzard.com/en-us/download/
The issue is that it doesn't show in my Battle.net launcher. After I downloaded the game I was asked to enter the Key. Anyway I've purchased a key from a 3rd party seller/marketplace(g2a).
You can (could?) buy it straight from Blizzard, I did that a couple years back. It doesn't show in the Battle.net launcher, only in your games list on the website.