Page 2 of 4

Re: Alternative LoS (instead of base game's 20)?

Posted: Tue Apr 28, 2026 7:21 am
by tyronec
Have had a report of a problem with the 9 tile LOS mod in a medieval game.
My opponent said he could see the whole of my army when my LC were moved, even though none of them were within 9 tiles. Clearly this has happened because he told me correctly about the movements of my army while it was out of visibility range, it seems to have been a momentary fault, I am playing several games with the mod in Ancients and Medieval and have not seen this happen. However even if it happens just once it could have a significant impact on a game.

Re: Alternative LoS (instead of base game's 20)?

Posted: Tue Apr 28, 2026 8:30 am
by Karvon
tyronec wrote: Tue Apr 28, 2026 7:21 am Have had a report of a problem with the 9 tile LOS mod in a medieval game.
My opponent said he could see the whole of my army when my LC were moved, even though none of them were within 9 tiles. Clearly this has happened because he told me correctly about the movements of my army while it was out of visibility range, it seems to have been a momentary fault, I am playing several games with the mod in Ancients and Medieval and have not seen this happen. However even if it happens just once it could have a significant impact on a game.
That is an issue with the original release, fixed in V2 which was posted about 2 weeks ago.

The problems are on the initial turn of the game the LOS isn't limited and troops normally hidden in woods and marsh are also visible. I think after the first turn, it works

I have been using V2 in my games for HOML and it's working fine.

Regards

Karvon

Re: Alternative LoS (instead of base game's 20)?

Posted: Tue Apr 28, 2026 8:45 am
by tyronec
That is an issue with the original release, fixed in V2 which was posted about 2 weeks ago.

The problems are on the initial turn of the game the LOS isn't limited and troops normally hidden in woods and marsh are also visible. I think after the first turn, it works

I have been using V2 in my games for HOML and it's working fine.

Regards

Karvon
I have just checked it and we are on V2 on the multiplayer screen.

Re: Alternative LoS (instead of base game's 20)?

Posted: Tue Apr 28, 2026 11:19 am
by Karvon
Hmm, that is strange. I've not had any reports of issues with V2 so far in CT nor in any of my HOLM games.

Karvon

Re: Alternative LoS (instead of base game's 20)?

Posted: Wed Apr 29, 2026 5:01 am
by kronenblatt
tyronec wrote: Tue Apr 28, 2026 7:21 am Have had a report of a problem with the 9 tile LOS mod in a medieval game.
Only happened in Medieval games?
Karvon wrote: Tue Apr 28, 2026 11:19 am Hmm, that is strange. I've not had any reports of issues with V2 so far in CT nor in any of my HOLM games.
How many Medieval games are there in CT? The majority being Timewarp or regular?

Re: Alternative LoS (instead of base game's 20)?

Posted: Wed Apr 29, 2026 5:28 am
by tyronec
Only happened in Medieval games?
Yes, only happened once in my 4 games and no reports from any others playing the HOML.

Re: Alternative LoS (instead of base game's 20)?

Posted: Wed Apr 29, 2026 8:35 am
by Karvon
Five of my games in CT have been time warp.

I have not sat down and counted how many in total are in each category. I'll take a look tomorrow.

So far, I have not received any negative feedback since we updated to V2.

Karvon

Re: Alternative LoS (instead of base game's 20)?

Posted: Fri May 01, 2026 1:11 pm
by tyronec
Another report of the same problem, at the first move can see the whole of both armies.
Medieval again.
Screen-00000024.jpg
Screen-00000024.jpg (703.53 KiB) Viewed 3797 times

Re: Alternative LoS (instead of base game's 20)?

Posted: Fri May 01, 2026 1:14 pm
by kronenblatt
How many tiles is the LoS lit up on the map?

Re: Alternative LoS (instead of base game's 20)?

Posted: Fri May 01, 2026 1:17 pm
by kronenblatt
kronenblatt wrote: Fri May 01, 2026 1:14 pm How many tiles is the LoS lit up on the map?
And the problem applied for both sides? If not, which side (A or B)?

Re: Alternative LoS (instead of base game's 20)?

Posted: Sat May 02, 2026 1:03 am
by Karvon
I have played about a dozen games of Medieval using Low LOS V2 and not had any problems so far, so clearly this isn't a common issue. Some of the screenshots I've seen are clearly not the whole board, but more than 9 squares. At 9 squares, you should be able to see from your most forward deployed lights to the enemy's most forward deployed lights.

Karvon

Re: Alternative LoS (instead of base game's 20)?

Posted: Sat May 02, 2026 4:59 am
by tyronec
It is not my screenshot so I don't have any more information.
However two players have reported the same problem so I accept what they say that there is an occasional issue.

Re: Alternative LoS (instead of base game's 20)?

Posted: Sun May 03, 2026 1:28 am
by Karvon
I checked the current script with a couple of AI, ChatGTP and Claude. Both of them pointed out potential issues. Claude corrected a suggested fix by ChatGTP, so I'm going with it. Here's what Claude reported:

The Bug: IsAITurn() Returns Wrong Value on Turn 1
The problem is in the ResetViewDistance function's condition on line 50:
bsfif (IsMultiplayer() == 1 || IsAITurn() == 0) // MODDED: HUMAN PLAYERS
{
SetAttrib(me, "LOS", MODDED_LOS); // 9 tiles
}
else // AI
{
SetAttrib(me, "LOS", MODDED_LOS_AI); // 20 tiles (vanilla)
}
The intent is:

Human player turn → restrict LOS to 9 tiles (MODDED_LOS = 90)
AI turn → give full LOS (MODDED_LOS_AI = 200)

The condition uses IsAITurn() == 0 to detect a human turn. On Turn 1, before any turn has fully "started" from the engine's perspective, IsAITurn() may not yet return a reliable value — it can return 1 (or a truthy non-zero value) even during the human player's setup/deployment phase, because the engine may internally consider the initial state to be "AI's turn hasn't been handed over yet," or the turn flag simply hasn't been set.
The result: on Turn 1, the else branch fires for the human player, assigning MODDED_LOS_AI = 200 (20 tiles, full vanilla range) instead of MODDED_LOS = 90 (9 tiles). The LOS limit appears to not work.
Also worth noting: IsDeploying() is used elsewhere in the script (e.g. in BonusTimerCheck at line 104 and CanUnitEverGoHere at line 274) to guard against the pre-game deployment phase. ResetViewDistance has no such guard. If it is called during the deployment/setup phase when IsAITurn() is unreliable, it silently applies the wrong LOS value, and that value then persists into Turn 1's opening state.

The Fix
Add a check for IsDeploying() and/or use GetCurrentSide() as a more reliable indicator of whose turn it is:
bsfFUNCTION ResetViewDistance(me)
{
if (IsDeploying() != 1) // Only apply LOS limits after deployment
{
if (IsMultiplayer() == 1 || IsAITurn() == 0) // Human players
{
SetAttrib(me, "LOS", MODDED_LOS);
}
else // AI
{
SetAttrib(me, "LOS", MODDED_LOS_AI);
}
}
else
{
// During deployment, reset to base/vanilla LOS so nothing is broken early
SetAttrib(me, "LOS", MODDED_LOS_AI);
}
SetAttrib(me, "CoverLOS", GetBaseAttrib(me, "CoverLOS"));
}
Or alternatively, replace IsAITurn() == 0 with GetCurrentSide() == 0 (the player side), which should be more reliably set from the very start of the game:
bsfif (IsMultiplayer() == 1 || GetCurrentSide() == 0) // Human player's side

Summary
IssueDetailRoot causeIsAITurn() is unreliable at game start / during deployment phaseEffectResetViewDistance branches into the AI path for human players on Turn 1, giving them full (unrestricted) vanilla LOSSecondary issueNo IsDeploying() guard, unlike many other functions in the scriptFixAdd IsDeploying() guard and/or switch to GetCurrentSide() == 0 for the human player check

Claude gave me a copy of the script, including its suggested changes. I'm going to do some testing with it, and if it seems OK, will update the various mods to V3 and send them to RBS.

Karvon

Re: Alternative LoS (instead of base game's 20)?

Posted: Sun May 03, 2026 2:21 am
by Karvon
I have updated both Medieval and Ancients to V3, incorporating the suggested fixes. Initial testing shows the mods are working, so nothing's been broken. As the bug is an occasional one, I guess we'll have to wait and see whether the patch actually has taken care of the issue or not. In any case, I've sent copies to Richard, so hopefully these will be available ingame soon.

Karvon

Re: Alternative LoS (instead of base game's 20)?

Posted: Mon May 04, 2026 9:59 am
by rbodleyscott
Karvon wrote: Sun May 03, 2026 2:21 am I have updated both Medieval and Ancients to V3, incorporating the suggested fixes. Initial testing shows the mods are working, so nothing's been broken. As the bug is an occasional one, I guess we'll have to wait and see whether the patch actually has taken care of the issue or not. In any case, I've sent copies to Richard, so hopefully these will be available ingame soon.

Karvon
These are now available for in-game download.

Re: Alternative LoS (instead of base game's 20)?

Posted: Mon May 04, 2026 4:54 pm
by kronenblatt
Karvon wrote: Sun May 03, 2026 1:28 am The Bug: IsAITurn() Returns Wrong Value on Turn 1. The condition uses IsAITurn() == 0 to detect a human turn. On Turn 1, before any turn has fully "started" from the engine's perspective, IsAITurn() may not yet return a reliable value — it can return 1 (or a truthy non-zero value) even during the human player's setup/deployment phase, because the engine may internally consider the initial state to be "AI's turn hasn't been handed over yet," or the turn flag simply hasn't been set.
OK, let's hope this works. But sounds strange because "||" means "or" so with:

if (IsMultiplayer() == 1 || IsAITurn() == 0)

it should hold true in multiplayer games (IsMultiplayer() == 1), whether IsAITurn() == 0 or something else. Assuming of course that IsMultiplayer() works as I anticipate to work. :)

Re: Alternative LoS (instead of base game's 20)?

Posted: Mon May 04, 2026 10:48 pm
by rbodleyscott
kronenblatt wrote: Mon May 04, 2026 4:54 pm
Karvon wrote: Sun May 03, 2026 1:28 am The Bug: IsAITurn() Returns Wrong Value on Turn 1. The condition uses IsAITurn() == 0 to detect a human turn. On Turn 1, before any turn has fully "started" from the engine's perspective, IsAITurn() may not yet return a reliable value — it can return 1 (or a truthy non-zero value) even during the human player's setup/deployment phase, because the engine may internally consider the initial state to be "AI's turn hasn't been handed over yet," or the turn flag simply hasn't been set.
OK, let's hope this works. But sounds strange because "||" means "or" so with:

if (IsMultiplayer() == 1 || IsAITurn() == 0)

it should hold true in multiplayer games (IsMultiplayer() == 1), whether IsAITurn() == 0 or something else. Assuming of course that IsMultiplayer() works as I anticipate to work. :)
As far as I can see the logic is correct. This code means it should use the reduced LOS in both sides' turns in Multiplayer, and on the non-AI turn in single player. Which I think was what was wanted.

Re: Alternative LoS (instead of base game's 20)?

Posted: Tue May 05, 2026 4:48 am
by kronenblatt
rbodleyscott wrote: Mon May 04, 2026 10:48 pm
kronenblatt wrote: Mon May 04, 2026 4:54 pm
Karvon wrote: Sun May 03, 2026 1:28 am The Bug: IsAITurn() Returns Wrong Value on Turn 1. The condition uses IsAITurn() == 0 to detect a human turn. On Turn 1, before any turn has fully "started" from the engine's perspective, IsAITurn() may not yet return a reliable value — it can return 1 (or a truthy non-zero value) even during the human player's setup/deployment phase, because the engine may internally consider the initial state to be "AI's turn hasn't been handed over yet," or the turn flag simply hasn't been set.
OK, let's hope this works. But sounds strange because "||" means "or" so with:

if (IsMultiplayer() == 1 || IsAITurn() == 0)

it should hold true in multiplayer games (IsMultiplayer() == 1), whether IsAITurn() == 0 or something else. Assuming of course that IsMultiplayer() works as I anticipate to work. :)
As far as I can see the logic is correct. This code means it should use the reduced LOS in both sides' turns in Multiplayer, and on the non-AI turn in single player. Which I think was what was wanted.
Good, thanks. And since that syntax:

if (IsMultiplayer() == 1 || IsAITurn() == 0)

was in there already before, I’m unfortunately hesitant that the adjusted version actually fixes the problem in question; this occasional glitch. But let’s hope that Claude is right. 8)

Re: Alternative LoS (instead of base game's 20)?

Posted: Tue May 05, 2026 6:12 am
by rbodleyscott
kronenblatt wrote: Tue May 05, 2026 4:48 am
rbodleyscott wrote: Mon May 04, 2026 10:48 pm
kronenblatt wrote: Mon May 04, 2026 4:54 pm

OK, let's hope this works. But sounds strange because "||" means "or" so with:

if (IsMultiplayer() == 1 || IsAITurn() == 0)

it should hold true in multiplayer games (IsMultiplayer() == 1), whether IsAITurn() == 0 or something else. Assuming of course that IsMultiplayer() works as I anticipate to work. :)
As far as I can see the logic is correct. This code means it should use the reduced LOS in both sides' turns in Multiplayer, and on the non-AI turn in single player. Which I think was what was wanted.
Good, thanks. And since that syntax:

if (IsMultiplayer() == 1 || IsAITurn() == 0)

was in there already before, I’m unfortunately hesitant that the adjusted version actually fixes the problem in question; this occasional glitch. But let’s hope that Claude is right. 8)
I think it will fix the bug for Multiplayer, but probably not for single player. Time will tell.

Re: Alternative LoS (instead of base game's 20)?

Posted: Sat May 09, 2026 7:58 am
by Karvon
Unfortunately, V3 has not squashed the first turn bug. A test MP game I'm playing replicated the problem on turn 1. I will have another look at the alternative code I got and do some testing with that.

Karvon