Author Topic: Improving Warlat  (Read 49466 times)

Offline fois

  • Grunt
  • ***
  • Posts: 245
  • Chicken
    • View Profile
Re: Improving Warlat
« Reply #15 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.
« Last Edit: November 14, 2019, 06:34:09 AM by fois »

Offline jaiaeiararhe

  • Peon
  • **
  • Posts: 18
    • View Profile
Re: Improving Warlat
« Reply #16 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?
« Last Edit: November 14, 2019, 07:44:29 AM by jaiaeiararhe »

Offline Delete mine too

  • Death Knight
  • *********
  • Posts: 2652
  • http://meatspin.com
    • View Profile
    • http://meatspin.com
Re: Improving Warlat
« Reply #17 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......

Offline Lambchops

  • Ogre Mage
  • ********
  • Posts: 1541
    • View Profile
Re: Improving Warlat
« Reply #18 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.


its gooder to hax hard and NEVER get caught!

Offline jaiaeiararhe

  • Peon
  • **
  • Posts: 18
    • View Profile
Re: Improving Warlat
« Reply #19 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?
« Last Edit: November 14, 2019, 03:54:37 PM by jaiaeiararhe »

Offline d0ng3rdik

  • Grunt
  • ***
  • Posts: 52
    • View Profile
Re: Improving Warlat
« Reply #20 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

Offline jaiaeiararhe

  • Peon
  • **
  • Posts: 18
    • View Profile
Re: Improving Warlat
« Reply #21 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.
« Last Edit: November 14, 2019, 04:26:47 PM by jaiaeiararhe »

Offline Lambchops

  • Ogre Mage
  • ********
  • Posts: 1541
    • View Profile
Re: Improving Warlat
« Reply #22 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.
its gooder to hax hard and NEVER get caught!

Offline jaiaeiararhe

  • Peon
  • **
  • Posts: 18
    • View Profile
Re: Improving Warlat
« Reply #23 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!
« Last Edit: November 14, 2019, 07:30:34 PM by jaiaeiararhe »

Offline Lambchops

  • Ogre Mage
  • ********
  • Posts: 1541
    • View Profile
Re: Improving Warlat
« Reply #24 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:

its gooder to hax hard and NEVER get caught!

Offline jaiaeiararhe

  • Peon
  • **
  • Posts: 18
    • View Profile
Re: Improving Warlat
« Reply #25 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?
« Last Edit: November 14, 2019, 08:35:26 PM by jaiaeiararhe »

Offline fois

  • Grunt
  • ***
  • Posts: 245
  • Chicken
    • View Profile
Re: Improving Warlat
« Reply #26 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.

Offline jaiaeiararhe

  • Peon
  • **
  • Posts: 18
    • View Profile
Re: Improving Warlat
« Reply #27 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?
« Last Edit: November 15, 2019, 05:56:53 AM by jaiaeiararhe »

Offline (PLS DELETE MY ACC)

  • Axe Thrower
  • ****
  • Posts: 439
    • View Profile
Re: Improving Warlat
« Reply #28 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
http://www.youtube.com/watch?v=_LC4YCh9Hg0
TOTALLY UNBIASED CHOP VIDEO

NOTHING (EXCEPT FOR A SUPER FRESH ADMIN) CAN STOP THE VANIMAL!

Offline fois

  • Grunt
  • ***
  • Posts: 245
  • Chicken
    • View Profile
Re: Improving Warlat
« Reply #29 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


« Last Edit: April 04, 2020, 07:24:52 PM by fois »