- You are creating a tileobject object, which stores the tile type and the tiles four corner types into byte data.
- You then are using the lookup table to create each individual tile object and store it into the table (The tiles are flipped and rotated when the tile object is created using MakeLookUp); here you're hand keying in each byte array for each tile type so the table has a byte array for every tile in the texture sets for proper marching algo operation.
- The last step is the AssignTilesJob which grabs the tile byte data for each corner and then tries to find a proper neighboring tile by using a byte array formula to scan the byte array for the tile that fits the proper corner transition.
Wilderness Overhaul
-
- Posts: 1409
- Joined: Mon Aug 12, 2019 4:32 pm
- Contact:
Re: Wilderness Overhaul
How's it going. I'm getting my head around this and how you're setting it up.
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.
My Beth Mods: l3lessed Nexus Page
Daggerfall Unity mods: Combat Overhaul Mod
Enjoy the free work I'm doing? Consider lending your support.
-
- Posts: 1409
- Joined: Mon Aug 12, 2019 4:32 pm
- Contact:
Re: Wilderness Overhaul
Can you explain how you're handling the shapes and ring computation? It isn't in your code, and it is shown in marching squares documentation for sorting out what tile transition is correct. Is this because you're hand coding in each tile set yourself?
Same with the ring computation, which is critical to telling the algo where the tile transitions are happening in the array. I don't see this in your code.
I may be misunderstanding this because we have more tile types than the documentation I am generally seeing. But, if you look on page 6 of this document, you can see they are using both a shape and ring computation to get a clean transition between water,dirt, and grass.
https://www.omiod.com/docs/pdf/Squares- ... rching.pdf
Same with the ring computation, which is critical to telling the algo where the tile transitions are happening in the array. I don't see this in your code.
I may be misunderstanding this because we have more tile types than the documentation I am generally seeing. But, if you look on page 6 of this document, you can see they are using both a shape and ring computation to get a clean transition between water,dirt, and grass.
https://www.omiod.com/docs/pdf/Squares- ... rching.pdf
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.
My Beth Mods: l3lessed Nexus Page
Daggerfall Unity mods: Combat Overhaul Mod
Enjoy the free work I'm doing? Consider lending your support.
- Daniel87
- Posts: 391
- Joined: Thu Nov 28, 2019 6:25 pm
Re: Wilderness Overhaul
Thank you for the help!
So, I spent the whole day trying to understand the bit-operations of the marchin square algo and came to realize that the algorithm can only work with linear gradients like water > dirt > grass > stone.
After considering this approach a dead-end, I wrote my own Lookup Table for all transitions (still in progress but got more now than there were in the base game) and created a new Class TileObject, which stores the tile itself (byte) and the 4 neighbours tile type (int).
Now marching square instead of performing bit operations, is just calling Array.Find(bottomLeft, bottomRight, topRight, topLeft).
It works like a charm. Performance hit is 100-150ms loading time per MapPixel, which is quite okay. The fireflies and shooting stars consume way more (200ms avg.) as they are gameObjects instantiated and destroyed at runtime (hundreds of em), but they can be disabled in the Mod Settings. My basic stochastic algo distributing the nature billboards still has to be optimized for more performance.
Performance:
W/o mod - 500-600ms/MapPixel
W/ mod 1000-1200ms/MapPixel
Tile transitions via Marching Squares only contributes to about 100-150ms of that difference and is now quite performant.
So basically we can now consider the Tile Transitions done and working. Now I have to be creative about how to tile the landscapes, as there are no limitations to transitions anymore.
So, I spent the whole day trying to understand the bit-operations of the marchin square algo and came to realize that the algorithm can only work with linear gradients like water > dirt > grass > stone.
After considering this approach a dead-end, I wrote my own Lookup Table for all transitions (still in progress but got more now than there were in the base game) and created a new Class TileObject, which stores the tile itself (byte) and the 4 neighbours tile type (int).
Now marching square instead of performing bit operations, is just calling Array.Find(bottomLeft, bottomRight, topRight, topLeft).
It works like a charm. Performance hit is 100-150ms loading time per MapPixel, which is quite okay. The fireflies and shooting stars consume way more (200ms avg.) as they are gameObjects instantiated and destroyed at runtime (hundreds of em), but they can be disabled in the Mod Settings. My basic stochastic algo distributing the nature billboards still has to be optimized for more performance.
Performance:
W/o mod - 500-600ms/MapPixel
W/ mod 1000-1200ms/MapPixel
Tile transitions via Marching Squares only contributes to about 100-150ms of that difference and is now quite performant.
So basically we can now consider the Tile Transitions done and working. Now I have to be creative about how to tile the landscapes, as there are no limitations to transitions anymore.
Spoiler!
In Julianos we Trust.
-
- Posts: 1409
- Joined: Mon Aug 12, 2019 4:32 pm
- Contact:
Re: Wilderness Overhaul
Great work man. Yeah, looking at your code, I was like, this seems like it should work, but I'm a math scrub, so I wasn't sure.
Was interesting learning how byte arrays work and how they can be used, so thanks.
Yeah, my particle sparks cause a bit of a cpu drag on older, basic systems. Those dang particles are not cheap cpu wise.
Was interesting learning how byte arrays work and how they can be used, so thanks.
Yeah, my particle sparks cause a bit of a cpu drag on older, basic systems. Those dang particles are not cheap cpu wise.
Last edited by l3lessed on Thu Apr 22, 2021 8:54 pm, edited 1 time in total.
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.
My Beth Mods: l3lessed Nexus Page
Daggerfall Unity mods: Combat Overhaul Mod
Enjoy the free work I'm doing? Consider lending your support.
- Daniel87
- Posts: 391
- Joined: Thu Nov 28, 2019 6:25 pm
Re: Wilderness Overhaul
Yeah I just deleted the shape and ring computation a couple of minutes before, as it is not needed anymore. I will hard code in all transitions, since the performance hit this way is not significantly bigger and wasting too much time thinking about how to change the ring and shape algo, will just kill motivationl3lessed wrote: ↑Thu Apr 22, 2021 8:41 pm Can you explain how you're handling the shapes and ring computation? It isn't in your code, and it is shown in marching squares documentation for sorting out what tile transition is correct. Is this because you're hand coding in each tile set yourself?
Same with the ring computation, which is critical to telling the algo where the tile transitions are happening in the array. I don't see this in your code.
I may be misunderstanding this because we have more tile types than the documentation I am generally seeing. But, if you look on page 6 of this document, you can see they are using both a shape and ring computation to get a clean transition between water,dirt, and grass.
https://www.omiod.com/docs/pdf/Squares- ... rching.pdf
Absolutely! I always shied away, when I saw bit-operations. Finally I overcame my anxiety and learned how this ancient technology works hehe.
Sorry for making you learn that hell xD and thank you for your support! Knowing you are also looking into this, gave my motivation a huge boost.
In Julianos we Trust.
-
- Posts: 1409
- Joined: Mon Aug 12, 2019 4:32 pm
- Contact:
Re: Wilderness Overhaul
Yeah, that makes sense for sure. That was my thought too, but wanted to verify if I was correct or you needed the assistance still. The documentation actually mentions hand coding in the tile transitions like you did for larger tile sets because of the very thing you mention. Anyways, great work as always. You're a madman with the terrain/environment modding you're doing.
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.
My Beth Mods: l3lessed Nexus Page
Daggerfall Unity mods: Combat Overhaul Mod
Enjoy the free work I'm doing? Consider lending your support.
- Daniel87
- Posts: 391
- Joined: Thu Nov 28, 2019 6:25 pm
Re: Wilderness Overhaul
Haha, damn. I could have saved myself 6h of trying by just reading the documentation.l3lessed wrote: ↑Thu Apr 22, 2021 8:56 pm Yeah, that makes sense for sure. That was my thought too, but wanted to verify if I was correct or you needed the assistance still. The documentation actually mentions hand coding in the tile transitions like you did for larger tile sets because of the very thing you mention. Anyways, great work as always. You're a madman with the terrain/environment modding you're doing.
As we say in Germany "What one doesn't have in the brain, one got in the legs" meaning, if one doesn't use the brain, one has to walk the way double
Definitely a good description for me.
Alright, time to lay flat. Hit my 5 am threshold again and gotta go to dentist in a couple of hours >_<
In Julianos we Trust.
-
- Posts: 1409
- Joined: Mon Aug 12, 2019 4:32 pm
- Contact:
Re: Wilderness Overhaul
Do it all the time myself. I can't tell you how many hours I wasted coding stuff or working on stuff for my mods just to scrap everything because I found a better approach.
Understanding how tiles are assigned will be helpful anyways once I get back to the interactive terrain mod. The code is setup for it and I submitted the speedchanger script updates to the pull request. However, until now, tile assignments and ids were a mystery to me. Getting the documentation from interkarma and you is helpful. This verified that I need to be excluding transition tiles in that mod and having movement only affected when the user moves from one filled tile type(all snow tile) to another filled tile type(all sand tile) and some weird movement changes are a result of odd tile transitions. Interactive terrain with this mod would make the landscape feel much more immersive, alive, and realistic. Combine it with the climates mod, and we will have some real brutal immersion. Won't it be fun trying to make it through a desert without dehydrating, when you are slowed down by the soft sand. Or have fun trying to track through thick snow in the middle of a snow storm and not freeze to death.
Understanding how tiles are assigned will be helpful anyways once I get back to the interactive terrain mod. The code is setup for it and I submitted the speedchanger script updates to the pull request. However, until now, tile assignments and ids were a mystery to me. Getting the documentation from interkarma and you is helpful. This verified that I need to be excluding transition tiles in that mod and having movement only affected when the user moves from one filled tile type(all snow tile) to another filled tile type(all sand tile) and some weird movement changes are a result of odd tile transitions. Interactive terrain with this mod would make the landscape feel much more immersive, alive, and realistic. Combine it with the climates mod, and we will have some real brutal immersion. Won't it be fun trying to make it through a desert without dehydrating, when you are slowed down by the soft sand. Or have fun trying to track through thick snow in the middle of a snow storm and not freeze to death.
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.
My Beth Mods: l3lessed Nexus Page
Daggerfall Unity mods: Combat Overhaul Mod
Enjoy the free work I'm doing? Consider lending your support.
- carademono
- Posts: 210
- Joined: Sat Jul 11, 2020 3:20 pm
Re: Wilderness Overhaul
This mod is looking more and more amazing every day. Would it be possible to scatter small rock models (a la Kamer's World of Daggerfall) on the rock textures? Because that would be *chef's kiss*
Vanilla Enhanced: https://www.nexusmods.com/daggerfallunity/mods/273
World of Daggerfall Project: https://www.nexusmods.com/daggerfallunity/mods/249
GIS Construction Set: https://github.com/drcarademono/GIS-construction-set
World of Daggerfall Project: https://www.nexusmods.com/daggerfallunity/mods/249
GIS Construction Set: https://github.com/drcarademono/GIS-construction-set
- Daniel87
- Posts: 391
- Joined: Thu Nov 28, 2019 6:25 pm
Re: Wilderness Overhaul
I would love to add 3D objects, but I am no modeller, just simply a coder.carademono wrote: ↑Fri Apr 23, 2021 2:13 am This mod is looking more and more amazing every day. Would it be possible to scatter small rock models (a la Kamer's World of Daggerfall) on the rock textures? Because that would be *chef's kiss*
In Julianos we Trust.