When running the webclient without any macros defined, in either a .dms or .dmf, the movement is really jumpy and doesn't compare to how smooth Dream Seeker's is. There is a very annoying, noticeable pause that occurs after pressing a key, which delays the command.
If this bug affects the webclient in its default state, I have to wonder if it could be deep enough that fixing it could resolve other hidden defects somewhere. This is mostly just speculation, but I don't want to judge a bug by how minor it may seem on the outside. Although, this could make a bad first impression of the webclient, and deter some developers from using it, which is never a good thing.
Numbered Steps to Reproduce Problem:
1. Create a new project with no .dms or .dmf files.
2. Make an icon for the mob, so that you can see it move.
3. Add this code to the project:
client
verb
FixMacros()
if(connection == "web")
winset(src, null, {"command=".skin \\"eval('\
fixmacros();\
function fixmacros() \\\\\\{\
var macros = byond.getMacros();\
var fixedmacros = \\\\\\{\\\\\\};\
for(var m in macros)\\\\\\{\
fixedmacros\[m\] = macros\[m\].command;\
\\\\\\};\
byond.userMacros(fixedmacros);\
\\\\\\};')\\"""})
4. Compile and host, then connect through the webclient.
5. Move your mob around using the arrow keys and notice how jumpy it is.
6. Click on the FixMacros() verb in the panel, and try moving again. The movement should now be smooth, and much more like it is in Dream Seeker.
Expected Results:
The default macros behave the same in the webclient as they do in Dream Seeker.
Actual Results:
There is a delay before the commands run.
Does the problem occur:
Every time? Or how often?
It happens every time you press a key with a macro.
In other games?
It would happen in any game that uses the default macros.
In other user accounts?
Obviously.
On other computers?
Obviously.
When does the problem NOT occur?
It doesn't occur when you recreate the default macros in a .dms or .dmf file.
Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit the Build Index to download old versions for testing.)
I don't actually know.
Workarounds:
You can either recreate the default macros in a .dms or .dmf file, or you can use the code included above.
It seems to me that any jumpiness in macros would also be due to keyboard event handling, timing, and/or when they execute on the server. Refreshing the macros wouldn't seem likely to impact anything, except if it's some kind of weird issue with timers.
I did notice that the key repeat handler in macro.dart in our code would not be responsive to ticklag changes until after it's created. (The key repeater also doesn't clear itself once no keys are held.) This could be a possible explanation for why your JS code is fixing the issue, although it's kind of weird to me because the repeater shouldn't be created until something happens to trigger a need for it. I'll definitely have to look into this.