Warcraft II Forum

Warcraft II => Mods & Development => Topic started by: aslfkjasfkahfsafahslh on April 14, 2015, 05:10:35 PM

Title: Improving Warlat
Post by: aslfkjasfkahfsafahslh on April 14, 2015, 05:10:35 PM
Warlat latency is quite slow. In Starcraft there is this program called "LatencyChanger", which allows to use "Singleplayer" latency when playing online (so it is much faster). It has 2 operation modes:

A) Reduce latency to certain number. Latency can be set between 1 and 5. 1 is Singleplayer latency, 2 is LAN latency, 5 is Battle.net.
B) In latency dialog in-game, reduce all options by 1, so Low latency becomes a new "Very low", High becomes Low, etc.

Warlat implements B). So is there some way that A) could be implemented for War2?

What Warlat does is write the following memory:

0x47862E - 0x90, 0x49, 0x90, 0x90
0x478632 - 0x89, 0x90, 0x90, 0x90

Result: It is now allowed to select the lowest possible latency mode that is possible through B).

What LatencyChanger does is write the following memory:

For mode A: 0x4D94EB - 0xB8, (latency value), 0x00, 0x00, 0x00, 0x90, 0x90
For mode B: 0x4859D7 - 0xBE, 0x01, 0x00, 0x00, 0x00, 0x90
Title: Re: Improving Warlat
Post by: Nox on April 14, 2015, 05:23:20 PM
Newb peoples dont understand the importance of latency, but there a certain point where everyone is good and units controls can easily decide who win and who lose.

Same for ressource management when you try to get peon out of gold mines and you cant because latency is too bad.

So latency is a really important probleme we have to fix.

Im glad you bring this probleme on the table.

PS: We also have to close different clients since they corrupt warlatency totally :(

I invited you to take a look at this thread: http://forum.war2.ru/index.php/topic,665.0.html (http://forum.war2.ru/index.php/topic,665.0.html)
Title: Re: Improving Warlat
Post by: aslfkjasfkahfsafahslh on April 14, 2015, 05:59:16 PM
Chat log with author of LatencyChanger

Spoiler
[23:21] <wqerqweqwe> hey
[23:21] <wqerqweqwe> you're the author of LatencyChanger
[23:21] <wqerqweqwe> right?
[23:22] <The-Winner> hi
[23:22] <The-Winner> yes
[23:22] <wqerqweqwe> you know there's a game called warcraft 2 battle.net edition
[23:22] <wqerqweqwe> which is pretty similar to SC
[23:22] <wqerqweqwe> in that game there is a program called "Warlat"
[23:22] <wqerqweqwe> that allows to reduce userlatency by 1 in latency dialog
[23:22] <wqerqweqwe> but this is still slow
[23:22] <wqerqweqwe> would it be possible to apply the "Singleplayer latency"
[23:22] <wqerqweqwe> or LAN Latency
[23:22] <wqerqweqwe> to this game?
[23:22] <wqerqweqwe> i disassembled Warlat and found how it works
[23:23] <The-Winner> Possibly.
[23:23] <The-Winner> In SC there are two values which determine latency
[23:23] <wqerqweqwe> yes, as far as i understand, latencychanger allows to do 2 things:
[23:23] <The-Winner> one is the value from the dialog, which can be reduced one below the values you can choose.
[23:24] <The-Winner> There is some other latency changer for SC that changes this value
[23:24] <The-Winner> the other value determines on which frames commands are executed.
[23:24] <The-Winner> It's computed from the game speed and certain hardcoded milliseconds values
[23:24] <wqerqweqwe> how did you find that value?
[23:25] <The-Winner> comes out as 2 for LAN and 5 for BNET if you have the fastest game speed
[23:25] <wqerqweqwe> so if i start a singleplayer game and search for "1"
[23:25] <wqerqweqwe> a LAN game and i search for "2"
[23:25] <wqerqweqwe> and a BNET game and i search for "5"
[23:25] <wqerqweqwe> i will find the value?
[23:25] <The-Winner> I think I searched for values which is fulfills bnet>lan>singleplayer
[23:26] <The-Winner> takes multiple rounds of searches and some experimentation to narrow it down
[23:26] <The-Winner> Changing that value itself didn't work well, since it got overwritten at an annoying point during the game start and must reliably be the same for all players
[23:27] <The-Winner> so I instead modified the code which reads that value to always return 2
[23:27] <The-Winner> I'm not certain that the values will be 2 and 5 for wc2
[23:28] <The-Winner> they might have tuned them, or perhaps wc2 game speeds are different
[23:28] <wqerqweqwe> so game speed affects the value too?
[23:28] <wqerqweqwe> wc2 has different speed options from sc
[23:30] <The-Winner> yes, it's computed by dividing some millisecond value by the duration of a frame (42ms on fastest)
[23:30] <wqerqweqwe> so on bnet, no matter what latency, that value is always 5?
[23:31] <The-Winner> the value doesn't depend on the latency setting from the dialog
[23:31] <The-Winner> but it depends on the game speed
[23:31] <wqerqweqwe> so for lowest dlay you have to both change the dialog and this value?
[23:31] <The-Winner> yes
[23:32] <The-Winner> but if you go below the latency of the network you'll introduce lag
[23:32] <wqerqweqwe> yeah
[23:33] <wqerqweqwe> so "5" is only when playing at fastest in bnet?
[23:33] <The-Winner> since the network mode dependent value also reduces the variance of the latency and not just the latency, it's better to reduce it
[23:33] <wqerqweqwe> and when playing at slow speed in bnet, the value is different?
[23:33] <The-Winner> yes
[23:33] <The-Winner> at least that's what I remember. It's been a long time since I looked into that stuff.
[23:35] <wqerqweqwe> then it's possible to find it by just going in singleplayer, messing around with speed and just checking for changed values?
[23:35] <wqerqweqwe> i'm trying to find it atm
[23:36] <The-Winner> most memory searchers allow you to search for values which increased/decreased since the last search
[23:36] <wqerqweqwe> so i decrease speed and search for increased value?
[23:36] <The-Winner> if you start a bunch of games in singleplayer/lan/bnet and do searches between each, that should narrow it down
[23:37] <The-Winner> I think I kept the speed at the same value always
[23:37] <The-Winner> but changing it might narrow it down further
[23:37] <wqerqweqwe> but game speed options in singleplayer are different from game speed options in bnet
[23:37] <wqerqweqwe> in war2, "fastest" speed in singleplayer is much slower than "fastest" in bnet
[23:37] <The-Winner> I think on singleplayer the value is always 1, regardless of speed
[23:38] <The-Winner> and even on bnet, changing you probably need to change the speed by several notches to change the value
[23:48] <wqerqweqwe> found a few values which are "1" in singleplayer and "5" in bnet
[23:48] <wqerqweqwe> but changing them seems to do nothing
[23:50] <The-Winner> I had to change the code reading the value for some reason. But I think that wasn't required for the basic working, only to make the game start reliably in multiplayer
[23:51] <The-Winner> But perhaps it's not 5 in WC2
[23:51] <wqerqweqwe> i found 1 value which is always "1" in singleplayer and always "2" in LAN
[23:51] <wqerqweqwe> tried changing it
[23:51] <The-Winner> I'd try a generic bigger/smaller search instead of searching for concrete values
[23:51] <wqerqweqwe> and nothing changed
[23:52] <wqerqweqwe> what is the value type?
[23:52] <wqerqweqwe> it's a byte?
[23:53] <The-Winner> A byte search should work. A bigger size might work as well, since it's quite possible that the following bytes are always 0.
[23:58] <The-Winner> good night
[23:58] <wqerqweqwe> GN
Title: Re: Improving Warlat
Post by: Certified MENSA Genius Brain (smart) on April 14, 2015, 06:03:38 PM
What Warlat does is write the following memory:
0x47862E - 0x90, 0x49, 0x90, 0x90
0x478632 - 0x89, 0x90, 0x90, 0x90
can this give you a clue of where to look?
Title: Re: Improving Warlat
Post by: Delete mine too on April 14, 2015, 07:07:18 PM
Are those the values you got when you scanned the memory??

How complex did you get when you where scanning and using war2....

Scan for values in single player then scan when online?? I seen the chat with author. Did you do a unknown search and just scan for changes or no changes??? That would eliminate your problem with knowing which values to scan for...
Title: Re: Improving Warlat
Post by: GaNzTheLegend on April 14, 2015, 07:22:35 PM
Chat log with author of LatencyChanger

Spoiler
[23:21] <wqerqweqwe> hey
[23:21] <wqerqweqwe> you're the author of LatencyChanger
[23:21] <wqerqweqwe> right?
[23:22] <The-Winner> hi
[23:22] <The-Winner> yes
[23:22] <wqerqweqwe> you know there's a game called warcraft 2 battle.net edition
[23:22] <wqerqweqwe> which is pretty similar to SC
[23:22] <wqerqweqwe> in that game there is a program called "Warlat"
[23:22] <wqerqweqwe> that allows to reduce userlatency by 1 in latency dialog
[23:22] <wqerqweqwe> but this is still slow
[23:22] <wqerqweqwe> would it be possible to apply the "Singleplayer latency"
[23:22] <wqerqweqwe> or LAN Latency
[23:22] <wqerqweqwe> to this game?
[23:22] <wqerqweqwe> i disassembled Warlat and found how it works
[23:23] <The-Winner> Possibly.
[23:23] <The-Winner> In SC there are two values which determine latency
[23:23] <wqerqweqwe> yes, as far as i understand, latencychanger allows to do 2 things:
[23:23] <The-Winner> one is the value from the dialog, which can be reduced one below the values you can choose.
[23:24] <The-Winner> There is some other latency changer for SC that changes this value
[23:24] <The-Winner> the other value determines on which frames commands are executed.
[23:24] <The-Winner> It's computed from the game speed and certain hardcoded milliseconds values
[23:24] <wqerqweqwe> how did you find that value?
[23:25] <The-Winner> comes out as 2 for LAN and 5 for BNET if you have the fastest game speed
[23:25] <wqerqweqwe> so if i start a singleplayer game and search for "1"
[23:25] <wqerqweqwe> a LAN game and i search for "2"
[23:25] <wqerqweqwe> and a BNET game and i search for "5"
[23:25] <wqerqweqwe> i will find the value?
[23:25] <The-Winner> I think I searched for values which is fulfills bnet>lan>singleplayer
[23:26] <The-Winner> takes multiple rounds of searches and some experimentation to narrow it down
[23:26] <The-Winner> Changing that value itself didn't work well, since it got overwritten at an annoying point during the game start and must reliably be the same for all players
[23:27] <The-Winner> so I instead modified the code which reads that value to always return 2
[23:27] <The-Winner> I'm not certain that the values will be 2 and 5 for wc2
[23:28] <The-Winner> they might have tuned them, or perhaps wc2 game speeds are different
[23:28] <wqerqweqwe> so game speed affects the value too?
[23:28] <wqerqweqwe> wc2 has different speed options from sc
[23:30] <The-Winner> yes, it's computed by dividing some millisecond value by the duration of a frame (42ms on fastest)
[23:30] <wqerqweqwe> so on bnet, no matter what latency, that value is always 5?
[23:31] <The-Winner> the value doesn't depend on the latency setting from the dialog
[23:31] <The-Winner> but it depends on the game speed
[23:31] <wqerqweqwe> so for lowest dlay you have to both change the dialog and this value?
[23:31] <The-Winner> yes
[23:32] <The-Winner> but if you go below the latency of the network you'll introduce lag
[23:32] <wqerqweqwe> yeah
[23:33] <wqerqweqwe> so "5" is only when playing at fastest in bnet?
[23:33] <The-Winner> since the network mode dependent value also reduces the variance of the latency and not just the latency, it's better to reduce it
[23:33] <wqerqweqwe> and when playing at slow speed in bnet, the value is different?
[23:33] <The-Winner> yes
[23:33] <The-Winner> at least that's what I remember. It's been a long time since I looked into that stuff.
[23:35] <wqerqweqwe> then it's possible to find it by just going in singleplayer, messing around with speed and just checking for changed values?
[23:35] <wqerqweqwe> i'm trying to find it atm
[23:36] <The-Winner> most memory searchers allow you to search for values which increased/decreased since the last search
[23:36] <wqerqweqwe> so i decrease speed and search for increased value?
[23:36] <The-Winner> if you start a bunch of games in singleplayer/lan/bnet and do searches between each, that should narrow it down
[23:37] <The-Winner> I think I kept the speed at the same value always
[23:37] <The-Winner> but changing it might narrow it down further
[23:37] <wqerqweqwe> but game speed options in singleplayer are different from game speed options in bnet
[23:37] <wqerqweqwe> in war2, "fastest" speed in singleplayer is much slower than "fastest" in bnet
[23:37] <The-Winner> I think on singleplayer the value is always 1, regardless of speed
[23:38] <The-Winner> and even on bnet, changing you probably need to change the speed by several notches to change the value
[23:48] <wqerqweqwe> found a few values which are "1" in singleplayer and "5" in bnet
[23:48] <wqerqweqwe> but changing them seems to do nothing
[23:50] <The-Winner> I had to change the code reading the value for some reason. But I think that wasn't required for the basic working, only to make the game start reliably in multiplayer
[23:51] <The-Winner> But perhaps it's not 5 in WC2
[23:51] <wqerqweqwe> i found 1 value which is always "1" in singleplayer and always "2" in LAN
[23:51] <wqerqweqwe> tried changing it
[23:51] <The-Winner> I'd try a generic bigger/smaller search instead of searching for concrete values
[23:51] <wqerqweqwe> and nothing changed
[23:52] <wqerqweqwe> what is the value type?
[23:52] <wqerqweqwe> it's a byte?
[23:53] <The-Winner> A byte search should work. A bigger size might work as well, since it's quite possible that the following bytes are always 0.
[23:58] <The-Winner> good night
[23:58] <wqerqweqwe> GN

Hey thanks for sharing this, we should be looking to broodwar for useful stuff to make for warcraft 2 since they are built off the same source code.
Title: Re: Improving Warlat
Post by: iL on April 15, 2015, 04:11:40 AM
Interesting research, need to test that for different values.

Let me make a small console application for that purpose then
Title: Re: Improving Warlat
Post by: Delete mine too on April 15, 2015, 01:57:28 PM
I don't think this guy is comming back because of his name.
Title: Re: Improving Warlat
Post by: mousEtopher on April 15, 2015, 05:05:15 PM
Regardless, I think we can all agree this is something that's worth pursuing.
Title: Re: Improving Warlat
Post by: I hate naggers on April 15, 2015, 05:06:54 PM
I believe antihack + background hosting bots are more important. This is more of a tweak
Title: Re: Improving Warlat
Post by: Delete mine too on April 15, 2015, 07:22:37 PM
All he is saying there is lower settings then the lowest one we can choose. He made the point of single player and multiplayer. He was told before by the author that dropping below the network will cause lag. You ever think that's why the developer made it for war2??

If he can scan memory and diassemble the latency program how the fuck can't he set the memory value lower to see if it lags. I'm amazed with his work just puzzled on how he is so stuck on a simple process... right? Or am I reading wrong again LOL

I bet he is the war2injector guy......
Title: Re: Improving Warlat
Post by: xboi209 on April 15, 2015, 11:21:07 PM
There is only 1 reliable network setting lower than "Low Latency"

Just gonna throw some information out here:
http://wiki.teamliquid.net/starcraft/LatencyChanger (http://wiki.teamliquid.net/starcraft/LatencyChanger)
http://farty1billion.dyndns.org/euddb/?pg=entry&addr=0x006556E4&ver=1.16.1&plat=win (http://farty1billion.dyndns.org/euddb/?pg=entry&addr=0x006556E4&ver=1.16.1&plat=win)
https://code.google.com/p/vgce/source/browse/trunk/data/Blizzard/Starcraft/1161_Functions_All.txt (https://code.google.com/p/vgce/source/browse/trunk/data/Blizzard/Starcraft/1161_Functions_All.txt)
Title: Re: Improving Warlat
Post by: rqwlrlpqwl on November 13, 2019, 04:01:46 AM
So? Nobody took a look at this? As far as I know the author of this thread tried to find the values for 1 hour, but didn't and then never looked at it again. Not sure whether it's possible or not.

Keep in mind the DOS version of War2 had units respond very fast, however, in the BNE version that people use to play online now in RU it is extremely slow. Even when Warlat is on it's still extremely slow. It was almost instant in Kali with low pkt settings. For example a big problem is when you're trying to pull peons even with Warlat it fails a lot of the time, depending on how close they were to the gold mine... if we modify it it would only rarely fail.

Just go to single player, set the speed setting higher and see how fast units respond.

And microing is a joke. This game could take so much more skill.

BTW, I think in SC1 you can combine both modes A) and B) for even lower latency. Might be able to do the same here. So we already have B) but gotta find A).

One problem with implementing A) I think is that every single player in the match would need to have the patch auto-applied in order not to crash.
Like in SC1, game name could specify latency, for example "gow #L1", and then patch detects that and auto-changes latency to 1, and people know to only join it if you have patch.

Or everyone could be forced to update Combat.

@Lambchops
@iL
@fois
Title: Re: Improving Warlat
Post by: fois on November 14, 2019, 12:14:25 AM
Just been doing some testing, found out that warlat is kinda like a cheat... Anyone who is still playing with an old installation or CD-install etc. without warlat should better update, you can't really have a fair game against anyone using warlat lol

warlat can reduce the delay to just 26 frames, it's not bad. But yeah, LAN is even faster than that with just 12 frames delay.

video version: https://imgur.com/a/ZvfBIbI   ----  gif version: https://imgur.com/a/LF2fYuM


Would be nice to have the LAN settings on bnet too, but that would make the game incompatible so it's a problem and might not be possible without forcing everyone to use the same version.
Title: Re: Improving Warlat
Post by: afdkijsdijaisfj on November 14, 2019, 04:10:58 AM
We just need to do it like SC1, we need to make it so that the user can choose between latency modes 1-5 (1=Singleplayer, 2=LAN, 5=BNET) and also keep the Warlat "Extra Low" setting on top of that.

@fois

Did you find the memory values? If so, please tell us about them. They cannot be abused to cheat or anything since it would make the game incompatible, it would just make you drop and in that case you could also just terminate the .exe or disconnect your Internet... If you haven't found them, do you plan to try to find them?

Of course, the game will be incompatible if users have different "latency mode" settings. But actually we can solve that in multiple ways.

This means we must do like they did for SC1, we must make a patch that changes latency based on game name. So if game name is "gow noob#L2" it applies LAN latency to that game.

People without the fix would know NOT to join the game because of its name. Therefore there is no problem. In any case it would be easy to auto-announce "Latency patch enabled!" every time someone with the patch joins or something like that. So if an user joins and doesn't say that message people know to kick that user.

And we CAN force updates. It would be highly useful, for example for this latency purpose. Users here have expressed interest in keeping everyone forcibly updated to the latest War2Combat before or having other auto-update mechanisms. Can @iL use PVPGN to distribute the update?

Please tell me your thoughts on all of these ideas @fois.
Title: Re: Improving Warlat
Post by: fois on November 14, 2019, 06:31:01 AM
Yeah I found it, seems to work differently than sc1 though (LAN is 1 and bnet is using all kinds of different values...)

Change this:
0042111C      MOV AL, BYTE PTR [EAX+4AE7EC]

To this:
0042111C      MOV AL, 1

And you have no delay at all on bnet


It will probably work fine as long as you're not to far away from the other players, but my guess is that players from australia will lag if you lower the delay more than warlat is doing.

You need a player from europe and one from australia and let them play a test LAN game together via hamachi, if that works then we can continue to think about a solution for it.
Title: Re: Improving Warlat
Post by: jaiaeiararhe on November 14, 2019, 06:38:27 AM
Amazing job @fois

So if host has different value from player, is there a problem?

Have you seen if it works with no desync if you change the value on both host and player computer?

I tried it and it seems the higher the value is, the more latency there is, so we can have a custom latency setting.

Can it be used together with Warlat "Extra Low" for even lower latency?

In this cause can we also make the program auto enable both LAN and Warlat without user needing to change to high and then back to low?

Of course, Australia will lag when playing with Europe on LAN latency. This already was proven with SC1.

That is why in SC1 they had different latency values depending on game name, "#L2", "#L3"... And the "LAN latency fix", which was player-made, made it so latency was auto changed depending on game name.

So of course we can continue thinking about it even if Australia lags with Europe. This will be highly useful for 1v1 games when you know you're gonna play with someone nearby etc.

And if Australia wants to play with Europe, even though #L1 may lag, maybe #L2 or #L3 won't which is still a lot better than current Warlat!

Given what I stated above, don't you think we should proceed even if there's lag with far away players?

Could even make a program which always runs together with War2, checks if other players have patch installed, pings them before game starts, and then, if everyone has the patch installed, chooses the latency value automatically based on ping.

Keep in mind it's going to be more complex when there's more players.

For example 8 players. All players, including player A and B have low ping to everyone. But there is one exception - A and B have high ping to each other even though they both have low ping to everyone else. In this case high latency should be used or the game will lag!

Also, why would we need Hamachi? We can just change the memory value, it's a much better idea. I have a hunch War2 LAN mode might work differently from latency value 1 on bnet (bnet netcode may work different), so the test results from Hamachi may not even be useful. In any case we should also try 2, 3, 4, 5 etc... If you want to test it just keep Discord on and I will message you there.

P.S. How did you find the value?
Title: Re: Improving Warlat
Post by: Delete mine too on November 14, 2019, 08:18:08 AM
Its weird I sent this to lambchops a few weeks back and all of the sudden there is activity in this thread......
Title: Re: Improving Warlat
Post by: Lambchops on November 14, 2019, 08:35:41 AM
So? Nobody took a look at this? As far as I know the author of this thread tried to find the values for 1 hour, but didn't and then never looked at it again. Not sure whether it's possible or not.

Yeah a couple of people have directed me here recently.


The first thing I noticed is that this:

What Warlat does is write the following memory:

0x47862E - 0x90, 0x49, 0x90, 0x90
0x478632 - 0x89, 0x90, 0x90, 0x90

Is wrong.

Each set of 4 bytes is listed in reverse order, I assume because the OP did not understand the byte arrangement of dwords.

The bytes are consecutive so it actually writes:

0x47862E:  0x90, 0x90, 0x49, 0x90, 0x90, 0x90, 0x90, 0x89

the 0x89 at the end is actually just the existing valu that is already there, so its just:

0x47862E:  0x90, 0x90, 0x49, 0x90, 0x90, 0x90, 0x90

and the 0x49 is a DEC ECX

the rest are just NOP (no operation) instructions which just remove these 2 instructions:

0047862E                 jbe     short loc_47863B
00478630                 mov     ecx, 2

the DEC ECX is just a single byte opcode and there are no branch targets in the overwritten section so it can actually be at any point in the string of 0x90s, but if you included the 0x89 where it was originally listed you would definitely get a crash.


Change this:
0042111C      MOV AL, BYTE PTR [EAX+4AE7EC]

To this:
0042111C      MOV AL, 1

And you have no delay at all on bnet

Nice one, I never actually got around to looking for this bit.

The byte array at 0x4AE7EC has the granularity for the different game modes/speeds (3,4,4,5,6,7,9,12,19)

replacing at 0x42111C with:

0xB8,0x01,0x00,0x00,0x00,0x90

Will force the 1 value. This is actually a MOV EAX,1

Not that it really matters, but this is slightly faster than explicitly setting the AL register and means there is only one NOP instruction. The rest of eax is already zeroed by the proc at 0x4204D0 anyway.

If you didn't want to mess with the instructions ou could set values in the granularity array, but that works just as well.

That's if we want to use 1 ... might cause lag, but whatever value is desired it can be set in the second byte of the patch (currently 0x01).

Its weird I sent this to lambchops a few weeks back and all of the sudden there is activity in this thread......

Yeah ikr? Someone else just tagged me here and sent it to me on discord... cosmic.

Anyway if anyone wants to try it, just put the attached file in the plugin folder. It even makes the log on menus faster. Seems to work great, but we might have to dial it back a bit if there's lag in big games.


Title: Re: Improving Warlat
Post by: jaiaeiararhe on November 14, 2019, 11:12:32 AM
@Lambchops

Can you modify your plugin so that on init it does nothing, but rather on create game/join game it checks if game has for example "#L1" through "#L255" at the end (is that the max?), then for example if game name ends in "#L3" it sets the latency value to 3, if game name does not contain the special code then it resets the latency back to default. So this way you'd be able to play game with special latency, then join another game with normal latency and it would work on both. Also, when you create/join game with the code on it, make it say the message "Latency patch enabled!" to everyone in the lobby screen before game starts. So if someone doesn't say the message, we know we should kick this person for not having the patch so that the game works. You could do that with simulated keystrokes perhaps, I suppose it should be easy.

So for example join "old ef#L4" --> latency value is auto set to 4. After that join "nwtr" --> latency patch is disabled.

And could you also make it turn the Warlat "extra low" latency setting on automatically in all games so user doesn't need to go to menu? Both regular Warlat and this new patch can be combined for better effects (just tried, it works).

Lambchops, if you're gonna do it, please say so now, if you don't, then I might develop a program which does it myself. I'm just saying this so we can coordinate better.

Additional idea: Enable only if it detects everyone has said the message so it means everyone has it? Also, commands in lobby screen like "!lat 3" so you can change it depending on lag (latency bars? time it takes to change from Orc to Human?) or "!lat off" to disable the patch. Another advantage is you'd be able to turn it on if you see everyone has it, so you don't need to create a special game with limited player pool, but rather everyone joins your game and then you turn on if everyone has it. Maybe even in game commands to change while in game?

@fois
@Lambchops
What do you think about the ping idea? Doable with modifying wsock32 or if iL supplies us with IP addresses from PHP script?

@iL

Once patch development finishes so that it does what I stated above, are you putting it in new War2Combat? And could you make everyone auto update to new War2Combat by PVPGN?
Title: Re: Improving Warlat
Post by: d0ng3rdik on November 14, 2019, 01:51:02 PM
Lagged when I tested it. Unit response was still good. It was like playing on a slower speed
Title: Re: Improving Warlat
Post by: jaiaeiararhe on November 14, 2019, 04:01:50 PM
So far latency 1 worked without any lag with 1500km distance with the in-game menu on default "Low" setting, but lagged on the "Extra Low". Even on "Low", units responded a lot faster than with the current version of Warlat people use. But Europe<->USA latency 1 was laggy, even when the in-game menu was set to "High" latency. All tests were 1v1.

When one of the players didn't have the patch installed, there was an instant disconnect.

Latency 1 will be highly relevant and very useful, especially for playing 1v1 games between people who know they are nearby, so it definitely needs to be an option easily accessible by the user in the end product, without the need to swap files or anything like that.

Looks like delay is 5-10 frames when using both latency 1 and "Extra Low". That is pretty good. Fois said "26 frames" is "not bad". But pulling peons fails at an incredibly high rate with the old Warlat, and the delay for units to respond in a battle represents a huge portion of the total fight time, limiting unit control potential severely. That needs to be clarified in order for people to understand how much this new patch will change.

The way this game is played will change. Much more skill will be involved.
Title: Re: Improving Warlat
Post by: Lambchops on November 14, 2019, 07:07:21 PM
@Lambchops

Can you modify your plugin so that ....

@GuyWhoKeepsMakingSmurfNames

Yeah probably, but I have stuff to do right now.

Thanks for testing/feedback.

In the meantime here's the plugin rebuilt with different latency settings between 1-9 you can test with and try to find a happy medium if you want.

We need to be careful that this doesn't further fragment the community. I'm sure the LA guys can probably play each other with pretty low lat, but having Russians in the game is already hard enough latency-wise.

I'm thinking even with it set to 9 it could still be problematic, but we don't know until we try.
Title: Re: Improving Warlat
Post by: jaiaeiararhe on November 14, 2019, 07:24:39 PM
@Lambchops

Ok, I see. So should I start programming it myself or wait for you? If you tell me by when you expect to have it done I can make the decision. Don't mean to pressure you, I just wanna streamline this process so War2 community doesn't have to wait around forever (I don't wanna wait 2 months for you, 6 months for iL to put it in new Combat, ... I could save the first 2 months by writing it myself.)

I think it's very unlikely it fragments anything, case in point SC1, in iCCup where "LAN latency" is enabled by default and is a server supposedly for "pros" who you'd expect to be picky about latency, people from the various continents were playing together frequently. In any case people should have the freedom to choose all of this.

People rarely enable Warlat anyway. They play with the awful default latency. It's highly unlikely that this would fragment the community. And things would be even more likely to be fine anyway if we did the auto ping idea or the lobby commands one.

We don't need a medium, we need to change latency depending on who we're playing with so that we can have the most optimal game possible with each person!
Title: Re: Improving Warlat
Post by: Lambchops on November 14, 2019, 08:20:44 PM
I think you should def smoke some more meth, get really excited, come up with a whole bunch of complicated ideas then dissappear down a rabbit hole of failed attempts until you can't even find anyone willing to listen anymore.

or ... maybe

The game already interface has low/high/eh settings and all we really need to do is find the right point where people can still play without lag and pull peons/micro better.

But yeah definitely don't let me stop you from doing whatever you want to. Go for gold buddy  :thumbsup:

Title: Re: Improving Warlat
Post by: jaiaeiararhe on November 14, 2019, 08:28:51 PM
@Lambchops

Let's be rational here for a second. The game interface may have that but unless everyone uses the patch it would drop. With my easy-to-implement idea, the latency setting is specified in the game name like in SC1 and only people with the patch join so there are no drops or problems.

It's as simple as hooking join_game and create_game which your plugin library allows for, checking game name "#L3", "#L5" etc. and just changing latency based on that. You're talking about failed attempts but this can be coded in a short time and poses no practical problems. If you don't want to do it I will, because it makes perfect rational sense.

Just tell me if you're on board with doing what makes sense or you're essentially just gonna end up telling everyone to hop on warlat5.w2p or something because you "feel" that's better because of some imaginary fear of how the community will act or how things will work that doesn't stand to reason or comparison with similar games with similar systems.

I'm happy to discuss this with substantiated arguments so that we can all reach an agreement on what is best, it just seems none are being brought to the table.

Why would what worked for the SC1 plugin not work for the War2 plugin?

If two people know each other, know they live close and want to arrange a 1v1 together why would we stop them from using "#L1" and having much better micro? If people are gonna host a 4v4 they're gonna know to use either no code or "#L9" or whatever. Why force everyone on an unhappy medium which is gonna cause lag for some players and unnecessary delay for others?
Title: Re: Improving Warlat
Post by: fois on November 15, 2019, 03:39:28 AM
I don't like the idea of the custom named games and sending messages to the channel and having the host manually verify that all players have the patch, this is not going to work (it's way too complicated, no one will use it).

We need a zero-config solution that automatically detects if players got the patch + automatically checks the pings to apply the best setting for the lowest possible delay. That's going to be a lot of work, but if you want to try it then go ahead.



I like the idea with the automatic warlat on game start, I might have a look into that the next days.
Title: Re: Improving Warlat
Post by: jaiaeiararhe on November 15, 2019, 05:51:58 AM
I don't like the idea of the custom named games and sending messages to the channel and having the host manually verify that all players have the patch, this is not going to work (it's way too complicated, no one will use it).

I don't think that's the best solution either, but it's a pretty good one, and it's what they had over at SC1 for years. First of all maybe iL will auto-update Combat for everyone and then everyone's gonna have the new Combat. In that case you just host games with the latency setting you want in the game name and everything's fine!

Also the most immediate use of #L1 would be 1v1, it's no problem to set up there, you wanna 1v1 someone you know so you know they have patch for sure, live close enough for sure etc.

Of course it would be hard to setup for non-arranged big team games, but that's not the primary use case.

Could we automatize the check if everyone has the patch before enabling somehow, based on detecting the messages that have been sent or something?

We need a zero-config solution that automatically detects if players got the patch + automatically checks the pings to apply the best setting for the lowest possible delay. That's going to be a lot of work, but if you want to try it then go ahead.

Okay, glad to see you like one of my ideas. Please tell me how we could go about implement this.

iL would have to make PHP script with all IP addresses in a match and then I make a program that pings them, communicates with them and auto-coordinates latency based on that? On game port maybe? Since if it's UDP multiple programs can use it?
Title: Re: Improving Warlat
Post by: (PLS DELETE MY ACC) on November 15, 2019, 09:51:35 AM
Yeah probably, but I have stuff to do right now.
MAYBE WE WILL FIND A WAY TO MAKE IT A HACK, WHICH WILL GIVE YOU MOTIVATION
Title: Re: Improving Warlat
Post by: fois on November 15, 2019, 11:00:03 AM
Could we automatize the check if everyone has the patch before enabling somehow, based on detecting the messages that have been sent or something?


Probably yeah, the players need to check the connections between each other anyways and report the highest ping to the host (the host can't know what setting to choose otherwise).

Okay, glad to see you like one of my ideas. Please tell me how we could go about implement this.

iL would have to make PHP script with all IP addresses in a match and then I make a program that pings them, communicates with them and auto-coordinates latency based on that? On game port maybe? Since if it's UDP multiple programs can use it?


The game has a ping command (the Note bot that checks if your port is forwarded is using the ping command too), so maybe you can use that without any external ip list. Maybe lambchops knows if there is a list with all pings somewhere?


Just made a auto warlat plugin, It will automatically set Low Latency on each game start so you don't have to set it to Extra High and then to Low manually on your own.


Download Here (http://forum.war2.ru/index.php/topic,5714.0.html)


Title: Re: Improving Warlat
Post by: jaiaeiararhe on November 15, 2019, 11:11:05 AM
Probably yeah, the players need to check the connections between each other anyways and report the highest ping to the host (the host can't know what setting to choose otherwise).

Actually my "automatize the check" comment was regarding the situation we didn't do the ping thing and we relied on my other idea.
And how to communicate? Embed as game message?

The game has a ping command (the Note bot that checks if your port is forwarded is using the ping command too), so maybe you can use that without any external ip list. Maybe lambchops knows if there is a list with all pings somewhere?

Ok so how do we make a program that runs within each player's machine ping everyone else? Simulate game packets and then read the results? How do we know what IP to send the packet to?

Just made a auto warlat plugin, didn't test it much yet but seems to work fine on both of my pcs

If only one player in the game has it installed will it enable Warlat for everyone?
No compatibility problems with only one player having it in a game?
Title: Re: Improving Warlat
Post by: jaiaeiararhe on November 15, 2019, 12:48:37 PM
Ok what do you people think about this: If player joins game "gow #L1" with latency hack on, the patch spoofs your own name so you have a symbol at the end of it that indicates you have the patch on, then host kicks everyone without it and starts. Would cause any problems? Seems like a clean solution, no chat messages dirtying up stuff, no need to scroll up to check everyone's messages etc.
Title: Re: Improving Warlat
Post by: jaiaeiararhe on November 16, 2019, 07:57:04 AM
@Lambchops
You said my plugin idea was hard to develop but guess what.
I just found how to get ping from all players in the game, the game already has the ping for all players in some memory addresses.
I also found how to send a chat message to other players.
And I found how to read chat message log.
These are all the elements we need, the coding job is simple now.
So actually, let's dump the game name idea.

Let's just make a plugin which, before game start, calculates a latency to use based on worst case ping to any player, reports it to chat as "warlat5" for example right before game starts (for plugin compatibility in case a different version calculates based on ping value differently since we always trust worst case latency), then if every player sent a latency message then people use the worst case latency specified, but if one player didn't report a latency value, it means he doesn't have our patch so game just uses normal War2 latency.

Because War2 is P2P is required to do it like that.

That way we don't need game names, it's 100% compatible, it picks the most optimal latency possible for a game, and it's all automatic, transparent and requires zero effort from the user.

Here's some info
4D157C --> Ping in milliseconds for 2nd player in lobby screen for Top vs. Bottom game type (maybe only this address if you're host/player 1?) (does exact address depends on other settings like team size, resources setting, etc. or just game type TVB? In any case if you change the settings the ping ms value's address just moves by a little)
1E80084 --> Specify message to be sent as string here, then if you press "Enter" game will send that message (so just have to find function which triggers it)
Only one problem -- found the address for chat log but it's changing every game, have to track down a pointer to it.

You in or out @Lambchops? All this information proves the plugin now turns out to be 100x easier to develop than you expected, and not only that but will work optimally removing the drawbacks out of all previously suggested ideas and yet having even more advantages.

@fois helped find these addresses BTW.

P.S. If we found another way to communicate, like not game chat messages before game starts, then it would be 100% transparent and perfect.
Title: Re: Improving Warlat
Post by: jaiaeiararhe on November 16, 2019, 10:26:12 AM
Only one problem -- found the address for chat log but it's changing every game, have to track down a pointer to it.

Problem solved. Inject code at 00407E67, ESI will point to string of chat message being sent.
Title: Re: Improving Warlat
Post by: Lambchops on November 16, 2019, 08:45:49 PM
Glad you're having fun.

Server ping times are irrellevent. It's a p2p game, so in an 8 player game you have 56 different ping times to consider (yes they can be different from either end of the same connection). Also you need to be testing with UDP packets, ICMP is handled seperately by many servers.

You can find the address for the current chat text by following a couple of pointers, there is no need to inject code. I found that for tupac a while back when he made his color chat text thing.

If you want help making plugins I can advise you on how to adapt things to use the plugin framework.

Title: Re: Improving Warlat
Post by: jaiaeiararhe on November 17, 2019, 02:24:52 AM
Glad you're having fun.

Thank you, Lambchops.

Server ping times are irrellevent. It's a p2p game, so in an 8 player game you have 56 different ping times to consider (yes they can be different from either end of the same connection). Also you need to be testing with UDP packets, ICMP is handled seperately by many servers.

You misunderstood what I said. I'm not talking about ping times to war2.ru. I'm talking about ping time between player to player. The game stores it in memory, so there's no need for us to send custom packets to calculate it. And also, if you read carefully, I explained how I would get it to consider the 56 ping times. That's the point of auto-sending chat messages -- to exchange info on that.

If you want help making plugins I can advise you on how to adapt things to use the plugin framework.

Like what?
Title: Re: Improving Warlat
Post by: Lambchops on November 19, 2019, 01:04:06 AM

Like how about you stop making up a million smurf names and PMing me asking for help. If you use a bit of common courtesy and use real handle I may help, but until then stop wasing my time.

Title: Re: Improving Warlat
Post by: RipE[Eur0] on November 20, 2019, 12:37:37 PM
tell me how to get the automatic warlat on??
Title: Re: Improving Warlat
Post by: fois on November 20, 2019, 01:08:39 PM
tell me how to get the automatic warlat on??


Download this and extract it into your plugin folder: http://forum.war2.ru/index.php?action=dlattach;topic=883.0;attach=3429 (http://forum.war2.ru/index.php?action=dlattach;topic=883.0;attach=3429)

If you don't have a plugin folder then install combat 45: http://en.war2.ru/downloads/ (http://en.war2.ru/downloads/)
Title: Re: Improving Warlat
Post by: jaiaeiararhe on November 20, 2019, 01:33:38 PM
@fois Overlay is now ready and has everything necessary for its purpose, if you want to review the code before it starts being used it for tests go Discord
Title: Re: Improving Warlat
Post by: Buttercraft on April 01, 2023, 04:02:51 PM
Here is a pretty simple solution I think, respecting that lower latency is desired but smooth gameplay is basically the gold standard.

Keep a performance counter on rolling basis (20 seconds), if there is lag detected (>3%) in any period it bumps the latency up one (no reporting necessary, it's automatic)

After first increase the rolling timer gathers next samples over 30 seconds instead of 20 (for greater confidence).

After that 45 seconds (20, 30, 45 seconds), after three bumps it's "settled" the antilag feature won't attempt any more measures.
Title: Re: Improving Warlat
Post by: Charlie on May 22, 2023, 05:59:13 PM
So is there currently a way to play with lan latency over a PVPGN server like you can with Brood War 1.16.1?
Title: Re: Improving Warlat
Post by: Buttercraft on May 23, 2023, 02:52:36 PM
Yes it's an option in the default installer (standard or full version only, not lite)

War2 2.0.2.0 Lambchops > select "Auto War Lat"