Not getting "DaggerfallBillboardBatch: Maximum batch size reached" message when generating nature layout.

Discuss modding questions and implementation details.
Post Reply
User avatar
Daniel87
Posts: 391
Joined: Thu Nov 28, 2019 6:25 pm

Not getting "DaggerfallBillboardBatch: Maximum batch size reached" message when generating nature layout.

Post by Daniel87 »

Hi dear modder community,

After a long period of procrastination, I finally got back to continue my Nature Overhaul mod.

There is a problem that bothers me for a long time now and I never found a proper fix for it:

Image

Image

As you can see, the Map Pixel did not finish the Nature Layout and leaves a blank stripe without vegetation.

Usually when this happens, I reach the maximum billboard count, but then I should receive a Debug.Log().
In the cases shown above I don't get this Debug.Log() and I have no idea why.

I tried increasing the number of billboards generated to make sure I exceed the limit and actually still get the error then.
Why I don't receive the Debug.Log() in these cases seen above, I can't figure out and it drives me nuts as debugging this particular bug becomes impossible. The bug is immersion breaking af, but I can't find a way to find its root cause.

I double-checked my own code and couldn't find anything that would explain the bug.
I am using a simple perlin noise to generate the Nature Layout pattern (Forest, empty grass or bushes/flowers) and it's impossible for the algorithm to produce such a pattern, even when the output is or is not clamped.

If I'm exceeding the batch limit, why am I not getting the log?
If I don't exceed it (as it seems to be, since I dont get the log but will get it eventually when I increase the amount of billboards) why do I get this pattern?
In Julianos we Trust.

User avatar
BadLuckBurt
Posts: 948
Joined: Sun Nov 05, 2017 8:30 pm

Re: Not getting "DaggerfallBillboardBatch: Maximum batch size reached" message when generating nature layout.

Post by BadLuckBurt »

Hi, been a while since I posted but I'm going to ease myself back into DFU so might as well start here :)

First off, I have three questions:

1. Does this always happen with the same map pixels? If it does, it makes it a bit easier to investigate.
2. Is there a location nearby when this happens?
3. Is it possible that your code exceeds a time limit, as in the terrain is promoted before your script finishes populating billboards?

I know the terrain is a pain to debug but maybe you could find the cause by adding some extra debugging that shows how long your script runs per map pixel and what it's doing. Unless someone else already knows what's going on, I think we may need more info.
DFU on UESP: https://en.uesp.net/w/index.php?title=T ... fall_Unity
DFU Nexus Mods: https://www.nexusmods.com/daggerfallunity
My github repositories with mostly DFU related stuff: https://github.com/BadLuckBurt

.

l3lessed
Posts: 1400
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: Not getting "DaggerfallBillboardBatch: Maximum batch size reached" message when generating nature layout.

Post by l3lessed »

3. Is it possible that your code exceeds a time limit, as in the terrain is promoted before your script finishes populating billboards?

I know the terrain is a pain to debug but maybe you could find the cause by adding some extra debugging that shows how long your script runs per map pixel and what it's doing. Unless someone else already knows what's going on, I think we may need more info.
Timing my minimap mods code to run in sync with the base engine code execution and generation of its numerous objects and properties was a constant issue and caused numerous bugs I had to track down. However, my mod does do allot of code setup and work during runtime of the engine, and it is continually destroying and recreating things on the fly. My resolution was exactly what bad said, I began putting debug logs every where, including in base engine scripts that I was calling, to see exactly when and where the code was executing in relationship to the base code execution timing.

As an example, many times my markers were being created before the terrain block itself was fully finishing being creating and initialized, which then led to either null errors for npcs needing markers or the much more annoying one, which was no errors and the building markers generating at the completely wrong places/heights. I slammed my head against this issue for weeks, and ended up having to put in a number of checks to ensure the markers code is executed only after everything in the base code is fully executed, including for fast travel and game loads as these have differing execution times for code I found.
My Daggerfall Mod Github: l3lessed DFU Mod Github

My Beth Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

User avatar
BadLuckBurt
Posts: 948
Joined: Sun Nov 05, 2017 8:30 pm

Re: Not getting "DaggerfallBillboardBatch: Maximum batch size reached" message when generating nature layout.

Post by BadLuckBurt »

l3lessed wrote: Mon Nov 29, 2021 5:52 pm As an example, many times my markers were being created before the terrain block itself was fully finishing being creating and initialized, which then led to either null errors for npcs needing markers or the much more annoying one, which was no errors and the building markers generating at the completely wrong places/heights. I slammed my head against this issue for weeks, and ended up having to put in a number of checks to ensure the markers code is executed only after everything in the base code is fully executed, including for fast travel and game loads as these have differing execution times for code I found.
There is an event called OnPromoteTerrainData that is raised from the PromoteTerrainData method in the DaggerfallTerrain class that signals that a terrain is completely finished.

There's also another event called OnCreateLocationGameObject that is raised from the CreateLocationGameObject method in the StreamingWorld class which signals that the location has finished it's layout.

I don't know if you already use these events but if you don't, they might be worth looking into as they might save doing a few checks.

@Daniel, they might be useful for you if your script hooks into those events and reports it's status for the map pixel the event is raised for.
DFU on UESP: https://en.uesp.net/w/index.php?title=T ... fall_Unity
DFU Nexus Mods: https://www.nexusmods.com/daggerfallunity
My github repositories with mostly DFU related stuff: https://github.com/BadLuckBurt

.

l3lessed
Posts: 1400
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Re: Not getting "DaggerfallBillboardBatch: Maximum batch size reached" message when generating nature layout.

Post by l3lessed »

Thanks bad. I'll look into this. It might be a more effective approach then my current one.

I ended up using the streaming world object, checking its init state for being finished and streaming, and combined it with a city navigation check, and that seemed to stop most of the execution issues I was having.
My Daggerfall Mod Github: l3lessed DFU Mod Github

My Beth Mods: l3lessed Nexus Page

Daggerfall Unity mods: Combat Overhaul Mod

Enjoy the free work I'm doing? Consider lending your support.

Post Reply