UPDATEThis is a fully configurable version for B.A.T., just like whistler's original mod for 4.12. It
fully replaces my first version, which was limited in that it offered four sets of fixed distance limit values. Delete my previous version. Now you will have full control! Get it here:
https://www.mediafire.com/file/lpah0bublye282l/%2521%2521%2521_Long_Visual_Distance_for_BAT_custom.7z/file From the included readme file:
Increasing the visibility distance for objects and effects, for B.A.T. (and perhaps 4.12).
Whistler (of NG-MAP, NG-HUD, NG-CAM and NG-PAL fame) introduced this increased visibility limits mod for 4.12 a few years ago. Since the creation of B.A.T., it was suggested that this approach would not be appropriate or viable due to some new way certain objects' visibility was handled. Very soon after jumping straight from 4.12.2 to B.A.T. 4.0, and noting the similar, limited visibility limits, I adapted this mod for my own B.A.T. 4.0 game. Instead of using the capacity of adjustability via four editable parameters in the [Mods] section of conf.ini, I made fixed values in World.class, based on having settled upon a set that worked well for me. And thus far it's worked as expected.
################################################################################################
Due to the introduction of triggers in B.A.T. 4.1.2, it's necessary to offer this mod in two versions:
- One for B.A.T. 4.1.1 and earlier. This should be OK for non-B.A.T. 4.12 as well, I think.
- One for B.A.T. 4.1.2 and later.
The three classfiles in the root folder (same place as this readme file) are for the LATER B.A.T. versions. If you're still running B.A.T 4.1.1 or earlier (including non-BAT 4.12?), copy and paste the three classfiles from its folder.
These are the three classfiles which comprise World.class:
8A318408BB7C513E (this is the main class)
64F83BC6574C11DE
949499C0F4E85D88
As a user of mods, you should already have a section in conf.ini (located in your game's root folder) called:
[Mods]
===== In the [Mods] section in conf.ini, paste the following 8 lines of text: =====
;MaxVisualDistance=5000 //- effects?
;MaxStaticVisualDistance=4000 //- objects?
;MaxLongVisualDistance=10000 //- big ships?
;MaxPlateVisualDistance=16000 //- runways?
MaxVisualDistance=20000
MaxStaticVisualDistance=8000
MaxLongVisualDistance=20000
MaxPlateVisualDistance=20000
===== Paste into conf.ini the 8 lines of text above this line =====================
I include 'remarks', preceded by ";" characters ("//" are also used for the same purpose), as reminders of what the stock values are and what the parameters control. The game will not remove or overwrite such lines of text as it executes overwrites to conf.ini, which is handy as you forget things over time. Now, if you like things to be nice and clean, you can certainly dispense with the first four remarks lines, pasting only the last four lines.
The four values supplied above are of course editable to suit your preferences; suggestions are provided below. Note that any change to conf.ini requires to restart the game in order to take effect.
The distance variables, what I think they control, and the stock values (in meters):
MaxVisualDistance = 5000 - effects?
MaxStaticVisualDistance = 4000 - objects?
MaxLongVisualDistance = 10000 - big ships?
MaxPlateVisualDistance = 16000 - runways?
I first offered a mod that contained four sets of values, which is superseded by this version which now offers you complete control of setting the individual values. Here are those four sets of values (plus stock) I previously supplied and which you might consider as starting points from which to further refine:
STOCK: 5000, 4000, 10000, 16000
Shortest: 10000, 8000, 15000, 20000
2nd Shortest: 15000, 10000, 20000, 20000
2nd Longest: 20000, 12000, 20000, 30000
Longest: 30000, 15000, 30000, 30000
I find the "2nd Longest" to work well enough for me. In good part because the longest view distance for certain of my own effects is 20km. You can of course mix things up as you see fit. For instance, if you want only to see smokes at long distance, and keep to the stock limits otherwise, you could set the limits as, say, 20000, 4000, 10000, 16000.
################################################################################################
Note that for effects the max distance as set in a texture's .mat file is the ultimate limiter on visibility distance. For objects such as buildings, both the .mat file and the farthest LOD value in the mesh *might?* need to be altered. If one wanted to boost the visibility distance, the relevant .mat file would have to be extracted from SFS, if not already available in a mod. Then the line
VisibleDistanceFar 5000
would have the numeric value altered as desired (here being 5000m, or 5km).
If a .mat file adjustment turns out to be insufficient, then in the mesh for the object we would increase the value given to the farthest LOD, which is the last one listed. For example, from one of the Body.msh files for the highway bridge, we have:
[LOD]
200
350
700
900
1500
3500
These numbers are not necessarily directly tied to a specific visibility threshold. That's because the screen pixel pitch and FoV (field of view) play roles as well. (Recall that an object not visible at a wide FoV can pop into visibility when zooming in.) The last, largest number, corresponding to the switching on/off of the lowest detail, farthest LOD, could be increased in increments until the desired result obtains.
I include the Java for this class, in both the early and later B.A.T. versions. The relevant changes made are very near the bottom of the code listings.
################################################################################################
In the Java for B.A.T. 4.1.2 (actually 4.13, which I'm given to understand is applicable for the latest B.A.T.), I had to make a small change in order to get the code to compile. It might have been necessary to do this due to a decompiler error. I hope a more capable Java meister will chime in. Here's the original line (line #501, in method checkViewOnPlayerDied(Actor actor) ) and its altered version...
// Main3D.cur3D().hookView.set(actorviewpoint, 3F * Main3D.cur3D().getClass().defaultLen(), 10F, -10F);
Main3D.cur3D().hookView.set(actorviewpoint, 3F * Main3D.cur3D().hookView.defaultLen(), 10F, -10F);
################################################################################################
A last note. Classfiles are strange beasts, in that they can still be read by the game even though residing in lower, child folders. For this reason, to be safe against any strange results it might be wise to keep all unused copies/variations of classfiles outside of the game entirely. That means keeping this full mod stored in some 'external repository', and picking ONLY the three classfiles you need and putting them in this mod's root folder.
################################################################################################
As always, this work is offered for use by any and all, for any purpose, without restriction.
WxTech
Nov 5, 2021