aliens

Author Topic: [how to]Playing 40K with old xcom view and engagement ranges  (Read 4815 times)

Offline Rangerh

  • Colonel
  • ****
  • Posts: 126
    • View Profile
[how to]Playing 40K with old xcom view and engagement ranges
« on: October 11, 2022, 01:53:10 am »
EDIT :
found a way to automate the whole thing thanks to Notepad++ macro functionality, refer to this post for the How To :
https://openxcom.org/forum/index.php/topic,10806.msg152472.html#msg152472
and enjoy the rebalancing and more classic  xcom-isation of the view distance and focus on scouting and exploration for 40k 034 and Rosigma 2.0B


I was curious about changing the view distance and AI fighting to something closer to the original XCOM.
As there are way too many entries for me to waste my time into doing it manually as a mod just for a test, i decided to use the Notepad++ batch replacement system to do it super quick.

But in the end i was surprised to have actually a lot of fun, as it changes the gameplay when you don't see anymore where nearly every AI is on the map (and when the AI don't know where your troops are either), it adds more exploration element and level of tension.


If someone is interested by doing it to his own install, here's a "how to" tutorial :

FIRST backup your 40k and Rosigma_main folders so if you don't like the new (well old) view and engagement style you can go back easily to the normal 40K/Rosigma gameplay.

Now go to your ...\40k_033\Ruleset\ folder , for me it's
Quote
C:\OpenXcom WH40K\User\mods\40k_033\Ruleset

open the file difficulty_40k.rul and change
Quote
maxViewDistance: 60
into
Quote
maxViewDistance: 20

Then , make sure you have the always excellent Notepad++ ( https://notepad-plus-plus.org/ )
Once done, open Notepad++ and either press CTRL+Shift+F or press Search -> Find in Files to open the Find in Files dialogue.
At the line "Find what", type
Quote
visibilityAtDay: \d+
and the line "Replace with", type
Quote
visibilityAtDay: 20

At "Directory", set it to your ...\40k_033\Ruleset  , by example for me it is
Quote
C:\OpenXcom WH40K\User\mods\40k_033\Ruleset

On the bottom of that Find in File dialogue, you'll need to tick "Regular expression" (as the \d+ is a "regular expression" that will allows notepad++ us to search for any number whatever it is for the visibilityAtDay to replace them all by 20)

Then after doing it, click on the button "Replace in Files"
Wait until done (there are lot of those entries through multiple ruleset files)
Once done, at "Directory" change it to your ...\Rosigma_main\Ruleset ,for me it is
Quote
C:\OpenXCOM WH40K\User\mods\ROSIGMA-main\Ruleset

Again, press the button "Replace in Files" and wait until it's done.

Now for "Find what", replace by
Quote
visibilityAtDark: \d+
and the line "Replace with", put
Quote
visibilityAtDark: 20

Then press "Replace in Files" again, then change the directory to your ...40k_033\Ruleset\ and press again "Replace in Files"

That's all for the Viewdistance to bring it to the old xcom level, try it you'll see how it changes the gameplay.


Note, you may be very often shot from way beyond your xcom-like line of sight, that is because of the spotter/sniper system :
https://openxcom.org/forum/index.php/topic,5679.0.html
That is enabled in 40k/Rosigma and allow the AI to maphack a very lot (as just shooting a "spotter" and a lot of units have that role, will reveal your soldier to every enemies of the map.

Fortunately there's a way to disable this AI maphack cheat as while it works nice with 60 viewdistance, when playing on this kind of xcom-like engagement and view range 20 it will very quickly kill the fun of trying to setup your ambushes or walking into enemy lairs.

To remove this, you'll need to use the same "Replace in Files" functionality of Notepad++
MAKE SURE TO TICK "Match Case" for this, because you don't want SNIPER and sniper being considered the same in what will follow
At "Find what", replace by
Quote
spotter: \d+
and the line "Replace with", put
Quote
spotter: 0
that according to the documentation will disable the system.
Make sure to apply that for both 40K and Rosigma folders

To make sure to not screw up the many units with the sniper script, do the same with
At "Find what", replace by
Quote
sniper: \d+
and the line "Replace with", put
Quote
sniper: 0

Always make sure that "Regular expression" is ticked or the batch replacement would fail

Once you done, if you wish to batch replace -without- regular expression like that \d+ , make sure to tick "Normal" back instead of "Regular Expression"
« Last Edit: January 28, 2023, 04:03:38 am by Rangerh »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9094
    • View Profile
Re: [how to]Playing 40K with old xcom view and engagement ranges
« Reply #1 on: October 11, 2022, 09:22:20 am »
I will just add that `maxViewDistance: 60` is also NOT recommended by the OXCE devs.

Anything above 40 will seriously affect the engine's performance.

Offline Rangerh

  • Colonel
  • ****
  • Posts: 126
    • View Profile
Re: [how to]Playing 40K with old xcom view and engagement ranges
« Reply #2 on: October 18, 2022, 02:17:37 pm »
On my playthrough i have setlled with playing on a
Code: [Select]
maxViewDistance: 30It's far enough .

And i tweaked the visibility day and dark to keep with that viewdistance.
For those interested, here are the value you can batch replace with notepad++ in the 40k and rosigma ruleset files adapted from the original too big 60 to 30 view distance
the left is the default value and to the right the corresponding one for a 30 maxviewdistance
Quote
visibilityAtDay
120  -> 30
80  -> 30
60  -> 30
55  -> 28
50  -> 25
46  -> 23
45  -> 22
42  -> 21
40  -> 20
35  -> 17
30  -> 15
25  -> 13

visibilityAtDark
120 -> 30
80 -> 30
60 -> 30
45 -> 22
40 -> 20
35 -> 17
32 -> 16
30 -> 15
28 -> 14
25 -> 13
22 -> 12
20 -> 11
18 -> 10
9 -> 9

Note : when replacing start from the bottom and up to avoid some wrong double replacement.
And make sure to replace for both the 40k mod folder and the Rosigame one.

Ingame it works great with those values, the AI seems to actually be more reactive instead of always staying at long distance without trying to attack my position.
Just make sure to disable the spotter/sniper maphack from the AI as instructed in the 1st post to enjoy those better battles.

Offline Rangerh

  • Colonel
  • ****
  • Posts: 126
    • View Profile
Re: [how to]Playing 40K with old xcom view and engagement ranges
« Reply #3 on: November 10, 2022, 08:40:45 pm »
NOTE : that is only for 40K 0.33 and Rosigma 1.09D, further version of Rosigma will have different view distances, day and dark visibility settings, so don't use those macro for Rosigma version superior to 1.09D,  check the next post for newer version

Found a way to automate the process thanks to Notepad++ macro system (as trying to make it as a minimod would be pure masochism and taking way more time than i have), that as basic as the functionality unfortunately is (as you'll need to copy paste them instead of simply loading my macros) it will do the whole thing very fast and allow you to

- change the max view distance to 30 and carefully rebalance every troops individual day or dark view distance to take in account the new one.
and/or
- remove the additional maphack system given to the AI with the sniper/spotter OXCE function

Spoilerfor information the individual units day and dark view distance rebalance:
default 40k and Rosigma view distance was set to a humoungous 60
It will be replaced by 30

visibilityAtDay
120  -> 30
80  -> 30
60  -> 30
55  -> 28
50  -> 25
46  -> 23
45  -> 22
42  -> 21
40  -> 20
35  -> 17
30  -> 15
25  -> 13

visibilityAtDark
120 -> 30
80 -> 30
60 -> 30
45 -> 22
40 -> 20
35 -> 19
32 -> 18
30 -> 17
28 -> 16
25 -> 15
23 -> 14
22 -> 13
20 -> 12
18 -> 11
15 -> 10
9 -> 9

For a comparison in default UFO and TFTD, maxViewDistance was set to 20
And for units visibilityAtDay it was 20 for everyone and for visibilityAtDark it was 20 for aliens and 9 for the squaddies.

for this to work you NEED to have Notepad++ installed (as it's the best text editor you should have it anyways) :
https://notepad-plus-plus.org/downloads/

If you never had Notepad++ on your computer before, after installing, launch Notepad++ then quit it

Now go to
C:\Users\YourUSERName\AppData\Roaming\Notepad++\

If you never ever worked with Macro function of Notepad++, don't worry i put a detailled step by step tutorial , if you already know, just go download the file and copy paste their content where you know they have to be copy pasted.

With notepad++ , open the file named "shortcuts.xml" that is present there
At the beginning of the file you should see
Quote
<?xml version="1.0" encoding="UTF-8" ?>
<NotepadPlus>
    <InternalCommands />
    <Macros>
        <Macro name="Trim Trailing Space and Save" Ctrl="no" Alt="yes" Shift="yes" Key="83">
            <Action type="2" message="0" wParam="42024" lParam="0" sParam="" />
            <Action type="2" message="0" wParam="41006" lParam="0" sParam="" />
        </Macro>
    </Macros>

BETWEEN the last 2 </Macro> entries
Quote
        </Macro>
    </Macros>

Copy paste the content of the text files attached to this post (either from both, or from just one of them)
Close shortcuts.xml the file and save the changes.

Now this macro is setup if your installed 40_033 and Rosigram_main are installed to
C:\OpenXCOM WH40K\User\mods\40k_033\Ruleset\
C:\OpenXCOM WH40K\User\mods\ROSIGMA-main\Ruleset\

It's very likely you have installed it differently, in that case, open the shortcuts.xml you already edited, then press CTRL+F
It will bring the Find&Search window.
Click on the "Replace" tab, in front of "Find What", copy paste
Code: [Select]
C:\OpenXCOM WH40K\User\mods\40k_033\Ruleset\and in front of "Replace with", type the path where your openxcom is installed, by example if you have installed your openxcom in C:\Games\OXCE\ , you will then type
Code: [Select]
C:\Games\OXCE\User\mods\40k_033\Ruleset\
Then once you have things correctly setyp, click on the "Replace All" button

Do the same with adding at "Find What"
Code: [Select]
C:\OpenXCOM WH40K\User\mods\ROSIGMA-main\Ruleset\and your installed path in front of "Replace With", then click on the "Replace All button.

Close the "shortcuts.xml" and save the changes

Now load notepad++ again.
on the top menu click on "Macro"
You will notice there are 2 more macro
"disable AI Maphack 40k Rosigma" and "40K Rosigma max view distance 30"

click on the one you want to launch
You will have to click OK when asked (+/- 20 times on the max view distance macro)
Once you're done, you may want or not to click on the other macro to launch it (do NOT relaunch the macro you already used, as it would certainly break the carefully setup balancing completely)

When finished, either get rid of both macros (though you may want to re-use them if 40k or Rosigma are updated or you'll get back to the original mega huge view distance) in the Macro menu -> Modify Shortcut/Delete Macro , or simply quit and enjoy your xcom-ised 40k+Rosigam
« Last Edit: November 16, 2022, 07:43:15 pm by Rangerh »

Offline Rangerh

  • Colonel
  • ****
  • Posts: 126
    • View Profile
Re: [how to]Playing 40K with old xcom view and engagement ranges
« Reply #4 on: November 16, 2022, 01:14:43 am »
Update to fit for the new version of Rosigma, this will only work for 40k_033 + Rosigma 2.0 , do not use on previous versions
I also made a version in case you only play with the 40K _033 mod and do not have or want to play with Rosigma

NOTE : IF you applied the macro previously, remove your 40k_033 and ROSIGMA-main mods and reinstall the original untouched version
It's VERY important to never run the macros on the same modsfolders on which you have already previously run the macro because it will break completely the view distance balancing.

So Make sure your 40k_033 and ROSIGMA-main folders are the original version, if not redownload and reinstall them

for this to work you NEED to have Notepad++ installed (as it's the best text editor you should have it anyways) :
https://notepad-plus-plus.org/downloads/

SpoilerINSTALL step by step INSTRUCTIONS:

If you never had Notepad++ on your computer before, after installing, launch Notepad++ then quit it

Now go to
C:\Users\YourUSERName\AppData\Roaming\Notepad++\

If you never ever worked with Macro function of Notepad++, don't worry i put a detailled step by step tutorial , if you already know, just go download the file and copy paste their content where you know they have to be copy pasted.

With notepad++ , open the file named "shortcuts.xml" that is present there
At the beginning of the file you should see

<?xml version="1.0" encoding="UTF-8" ?>
<NotepadPlus>
    <InternalCommands />
    <Macros>
        <Macro name="Trim Trailing Space and Save" Ctrl="no" Alt="yes" Shift="yes" Key="83">
            <Action type="2" message="0" wParam="42024" lParam="0" sParam="" />
            <Action type="2" message="0" wParam="41006" lParam="0" sParam="" />
        </Macro>
    </Macros>

BETWEEN the last 2 </Macro> entries :

        </Macro>
    </Macros>

---IF YOU ONLY HAVE AND PLAY THE 40K MOD----
Copy paste the content of the text files "40K ONLY view distance rebalancing.txt" and "40K ONLY remove AI additional maphack.txt" (either from both, or from just one of them)
Close shortcuts.xml the file and save the changes.

----IF YOU HAVE BOTH 40K MOD AND THE ROSIGMA EXPANSION---
Copy paste the content of the text files "40K AND ROSIGMA view distance rebalancing.txt" and "40K AND ROSIGMA remove AI additional maphack.txt" (either from both, or from just one of them)
Close shortcuts.xml the file and save the changes.

Now this macro is setup if your installed 40_033 and Rosigram_main are installed to
C:\OpenXCOM WH40K\User\mods\40k_033\Ruleset\
C:\OpenXCOM WH40K\User\mods\ROSIGMA-main\Ruleset\

It's very likely you have installed it differently, in that case, open the shortcuts.xml you already edited, then press CTRL+F
It will bring the Find&Search window.
Click on the "Replace" tab, in front of "Find What", copy paste
C:\OpenXCOM WH40K\User\mods\40k_033\Ruleset\
and in front of "Replace with", type the path where your openxcom is installed, by example if you have installed your openxcom in C:\Games\OXCE\ , you will then type

C:\Games\OXCE\User\mods\40k_033\Ruleset\

Then once you have things correctly setyp, click on the "Replace All" button

Do the same with adding at "Find What"

C:\OpenXCOM WH40K\User\mods\ROSIGMA-main\Ruleset\
and your installed path in front of "Replace With", then click on the "Replace All" button.

Close the "shortcuts.xml" and save the changes

Now load notepad++ again.
on the top menu click on "Macro"
You will notice there are 2 more macro :
---IF YOU have installed the 40K ONLY version of the macros----
"40K ONLY disable AI Maphack" and "40K ONLY view distance max 30"

----IF YOU HAVE BOTH 40K MOD AND THE ROSIGMA EXPANSION---
"40K AND ROSIGMA disable AI Maphack" and "40K AND ROSIGMA  view distance max 30"

click on the one you want to launch
You will have to click OK when asked (+/- 20 times on the max view distance macro)
Once you're done, you may want or not to click on the other macro to launch it (do NOT relaunch the macro you already used, as it would certainly break the carefully setup balancing completely)

When finished, either get rid of both macros (though you may want to re-use them if 40k or Rosigma are updated or you'll get back to the original mega huge view distance) in the Macro menu -> Modify Shortcut/Delete Macro , or simply quit and enjoy your xcom-ised 40k+Rosigma

Spoilerthe rebalanced values:
max view distance will be 30
visibilityAtDay
120  -> 30
80  -> 30
60  -> 30
55  -> 28
50  -> 25
46  -> 23
45  -> 22
42  -> 21
40  -> 20
35  -> 17
30  -> 15
25  -> 13

visibilityAtDark
120 -> 30
80 -> 30
60 -> 30
45 -> 22
40 -> 20
35 -> 19
32 -> 18
30 -> 17
28 -> 16
25 -> 15
23 -> 14
22 -> 13
20 -> 12
18 -> 11
15 -> 10
12 -> 10
9 -> 9

For a comparison in default UFO and TFTD, maxViewDistance was set to 20
And for units visibilityAtDay it was 20 for everyone and for visibilityAtDark it was 20 for aliens and 9 for the squaddies.
« Last Edit: November 16, 2022, 07:44:27 pm by Rangerh »

Offline Rangerh

  • Colonel
  • ****
  • Posts: 126
    • View Profile
Re: [how to]Playing 40K with old xcom view and engagement ranges
« Reply #5 on: January 28, 2023, 04:02:00 am »
Update to fit for the new version of 40K and Rosigma, this will only work for 40k 034 + Rosigma 2.0B , do not use on previous versions
I also made a version in case you only play with the 40K 034 mod and do not have or want to play with Rosigma

NOTE : IF you applied the macro previously, remove your 40k and ROSIGMA-main mods and reinstall the original untouched version
It's VERY important to never run the macros on the same modsfolders on which you have already previously run the macro because it will break completely the view distance balancing.

So Make sure your 40k and ROSIGMA-main folders are the original version, if not redownload and reinstall them

for this to work you NEED to have Notepad++ installed (as it's the best text editor you should have it anyways) :
https://notepad-plus-plus.org/downloads/

SpoilerINSTALL step by step INSTRUCTIONS:

If you never had Notepad++ on your computer before, after installing, launch Notepad++ then quit it

Now go to
C:\Users\YourUSERName\AppData\Roaming\Notepad++\

If you never ever worked with Macro function of Notepad++, don't worry i put a detailled step by step tutorial , if you already know, just go download the file and copy paste their content where you know they have to be copy pasted.

With notepad++ , open the file named "shortcuts.xml" that is present there
At the beginning of the file you should see

<?xml version="1.0" encoding="UTF-8" ?>
<NotepadPlus>
    <InternalCommands />
    <Macros>
        <Macro name="Trim Trailing Space and Save" Ctrl="no" Alt="yes" Shift="yes" Key="83">
            <Action type="2" message="0" wParam="42024" lParam="0" sParam="" />
            <Action type="2" message="0" wParam="41006" lParam="0" sParam="" />
        </Macro>
    </Macros>

BETWEEN the last 2 </Macro> entries :

        </Macro>
    </Macros>

---IF YOU ONLY HAVE AND PLAY THE 40K MOD----
Copy paste the content of the text files "40K ONLY view distance rebalancing.txt" and "40K ONLY remove AI additional maphack.txt" (either from both, or from just one of them)
Close shortcuts.xml the file and save the changes.

----IF YOU HAVE BOTH 40K MOD AND THE ROSIGMA EXPANSION---
Copy paste the content of the text files "40K AND ROSIGMA view distance rebalancing.txt" and "40K AND ROSIGMA remove AI additional maphack.txt" (either from both, or from just one of them)
Close shortcuts.xml the file and save the changes.

Now this macro is setup if your installed 40 and Rosigram_main are installed to
C:\OpenXCOM WH40K\User\mods\40k\Ruleset\
C:\OpenXCOM WH40K\User\mods\ROSIGMA-main\Ruleset\

It's very likely you have installed it differently, in that case, open the shortcuts.xml you already edited, then press CTRL+F
It will bring the Find&Search window.
Click on the "Replace" tab, in front of "Find What", copy paste
C:\OpenXCOM WH40K\User\mods\40k\Ruleset\
and in front of "Replace with", type the path where your openxcom is installed, by example if you have installed your openxcom in C:\Games\OXCE\ , you will then type

C:\Games\OXCE\User\mods\40k\Ruleset\

Then once you have things correctly setyp, click on the "Replace All" button

Do the same with adding at "Find What"

C:\OpenXCOM WH40K\User\mods\ROSIGMA-main\Ruleset\
and your installed path in front of "Replace With", then click on the "Replace All" button.

Close the "shortcuts.xml" and save the changes

Now load notepad++ again.
on the top menu click on "Macro"
You will notice there are 2 more macro :
---IF YOU have installed the 40K ONLY version of the macros----
"40K ONLY disable AI Maphack" and "40K ONLY view distance max 30"

----IF YOU HAVE BOTH 40K MOD AND THE ROSIGMA EXPANSION---
"40K AND ROSIGMA disable AI Maphack" and "40K AND ROSIGMA  view distance max 30"

click on the one you want to launch
You will have to click OK when asked (+/- 20 times on the max view distance macro)
Once you're done, you may want or not to click on the other macro to launch it (do NOT relaunch the macro you already used, as it would certainly break the carefully setup balancing completely)

When finished, either get rid of both macros (though you may want to re-use them if 40k or Rosigma are updated or you'll get back to the original mega huge view distance) in the Macro menu -> Modify Shortcut/Delete Macro , or simply quit and enjoy your xcom-ised 40k+Rosigma

Spoilerthe rebalanced values:
max view distance will be 30
visibilityAtDay
120  -> 30
80  -> 30
60  -> 30
55  -> 28
50  -> 25
46  -> 23
45  -> 22
42  -> 21
40  -> 20
35  -> 17
30  -> 15
25  -> 13

visibilityAtDark
120 -> 30
80 -> 30
60 -> 30
45 -> 22
40 -> 20
35 -> 19
32 -> 18
30 -> 17
28 -> 16
25 -> 15
23 -> 14
22 -> 13
20 -> 12
18 -> 11
15 -> 10
12 -> 10
9 -> 9

For a comparison in default UFO and TFTD, maxViewDistance was set to 20
And for units visibilityAtDay it was 20 for everyone and for visibilityAtDark it was 20 for aliens and 9 for the squaddies.
« Last Edit: January 28, 2023, 04:03:54 am by Rangerh »

Offline Simi822

  • Colonel
  • ****
  • Posts: 175
    • View Profile
Re: [how to]Playing 40K with old xcom view and engagement ranges
« Reply #6 on: February 01, 2023, 04:23:47 pm »
didnt you wanted to start a subject in regards of the mini mod pack that you just released?

I think a nice discussion should/could occur for example in regards of commendations 

Offline Rangerh

  • Colonel
  • ****
  • Posts: 126
    • View Profile
Re: [how to]Playing 40K with old xcom view and engagement ranges
« Reply #7 on: February 01, 2023, 06:32:57 pm »
completely forgot about that, will do.

Offline Jokerke12

  • Squaddie
  • *
  • Posts: 8
    • View Profile
Re: [how to]Playing 40K with old xcom view and engagement ranges
« Reply #8 on: March 07, 2023, 01:25:19 am »
If I have applied the macro for base 40k previously, but now I want to try ROSIGMA, should I reinstall the mods or can I just apply the the ROSIGMA macro as is?

Offline Rangerh

  • Colonel
  • ****
  • Posts: 126
    • View Profile
Re: [how to]Playing 40K with old xcom view and engagement ranges
« Reply #9 on: March 19, 2023, 09:40:32 pm »
Unfortunately you can't apply it anymore for a Rosigma added -after- upu already used the 40K only macro or the macro will screw up the already modified 40K settings.

Best way to do is to remove your already modified 40k folder (you can keep Rosigma one), redownload 40K and install the folder again, and then apply the 40k+rosigma macros.