Wilderness Overhaul

Show off your mod creations or just a work in progress.
Post Reply
User avatar
Hazelnut
Posts: 3016
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Believable Wilderness

Post by Hazelnut »

King of Worms wrote: Fri Jan 22, 2021 7:41 pm Im looking forward to it since the day u started to investigate the systems 😊

Current distribution of nature sprites is very simplistic so anything more advanced and less arteficial will be really welcomed.

The issue with basic roads in not a serious problem, a plant/tree here and there on the road is ok for me.
Sorry to be a bit late, but I'd like to point out that as long as the new TerrainNature implementation (which I added the mod interface for coming in next release) follows the rule of not placing nature on road tiles then roads will not be affected. (default does this by only placing on grass, dirt or stone tiles) Tracks will have nature though.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
Daniel87
Posts: 391
Joined: Thu Nov 28, 2019 6:25 pm

Re: Believable Wilderness

Post by Daniel87 »

So far I only added certain water tiles to the list for placement. So roads should not be affected. If not I will exclude them manually to make sure it gets not spawned on them. Problem is I used randomization. (x and y are int which caused the old nature billboards to be placed like pawns on a chess board. Here I turn them into floats and randomize them slightly within a certain range. This means, that when I round them back to ints to roughly check what tile they are on, they might have a 50% chance of still being on the road partially. I might have to check for the neighbouring tiles as well, to completely avoid them being on the road, but in that case, they might create an awkward industrial cut through forests. If there was a different way of sampling the tile texture rather than using integers, it might be easier.

As i understood it so far, when the vertex [x,y] is defined a street tile, then the street tile will be placed between the vertices [x,y] [x+1,y] [x,y+1 and [x+1,y+1], is this correct? In that case I could Mathf.Round my floated x and y values to check if the billboard is closer to [x,y] as it is to [-x, y] and in that case remove it.
Last edited by Daniel87 on Mon Feb 01, 2021 6:46 am, edited 1 time in total.
In Julianos we Trust.

User avatar
Daniel87
Posts: 391
Joined: Thu Nov 28, 2019 6:25 pm

Re: Believable Wilderness

Post by Daniel87 »

Okay, so I got it to work.
Raycasts will check if a Billboard can be placed inside a location or if a collider is in it's way. Next will be to check for the ground tile (street or not?)
But this feature comes at a price: I had to do two small changes inside the StreamingWorld.cs, which I never wanted to touch. Since I am no expert, I have no idea if my changes are performance killers or if they will cause trouble down the line. I think tomorrow I will do a PR and will see what Interkarma thinks about them, but I will also leave my changes here, so maybe someone else more experienced can tell me if those are absolute no-gos.

So, concerning the changes to StreamingWorld.cs:
All I have done is to cut the loading of locations after loading of nature billboards and paste it before, as well as paste it into the method below. The reason is that I cannot check for collisions with StaticGeometry, if the locations aren't loaded first. Without loading them first, the option of having overgrown ruins in the forest and similar things will be off the table.
Spoiler!
Image
And as always, some pictures of the work done. This is the reason why I would love to implement this feature of populating places with nature billboards as well. I will leave the rect in place, so Travel Options keeps working, but it will not be used as criteria anymore for placing billboards in Jungle Locations.
Spoiler!
Image

Image

Image

Image

Image

Image
As always, stay safe!
Last edited by Daniel87 on Sun Feb 07, 2021 8:24 am, edited 2 times in total.
In Julianos we Trust.

User avatar
King of Worms
Posts: 4752
Joined: Mon Oct 17, 2016 11:18 pm
Location: Scourg Barrow (CZ)
Contact:

Re: Believable Wilderness

Post by King of Worms »

I really like the trees in the city/ruins there 😊

User avatar
Daniel87
Posts: 391
Joined: Thu Nov 28, 2019 6:25 pm

Re: Believable Wilderness

Post by Daniel87 »

Yeah at least for the jungle biome, I also totally dig it!
Maybe I will do the same within other climates but just let flowers and smaller bushes grow there. I will experiment around with it.
In Julianos we Trust.

User avatar
Hazelnut
Posts: 3016
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Believable Wilderness

Post by Hazelnut »

I hope that this will be an optional part of the mod, as I'm not keen on it.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
Daniel87
Posts: 391
Joined: Thu Nov 28, 2019 6:25 pm

Re: Believable Wilderness

Post by Daniel87 »

Sure, I mean once I get to the part where I learn how to create mod settings, I will try to do as much as possible optional, so people can create their own experience, using it. It should be just the tweaking of a couple of booleans to enable or disable it, so I think that's definitely an optional feature in the future. Right now I am just testing the capabilities, if it works with other mods and if it is feasible performance-wise. Having the collision check function is definitely useful I think.
Last edited by Daniel87 on Mon Feb 01, 2021 2:45 pm, edited 2 times in total.
In Julianos we Trust.

User avatar
Hazelnut
Posts: 3016
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Believable Wilderness

Post by Hazelnut »

collision detection wont work because locations are constructed after the terrain. You'd need to use the location data to work out where the buildings are in each block. That will be computationally expensive but would work. As you may be able to tell I don't think it's worth it, but if you want to try there's many examples of going through the block data in DFU code.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
Daniel87
Posts: 391
Joined: Thu Nov 28, 2019 6:25 pm

Re: Believable Wilderness

Post by Daniel87 »

Hazelnut wrote: Mon Feb 01, 2021 2:44 pm collision detection wont work because locations are constructed after the terrain. You'd need to use the location data to work out where the buildings are in each block. That will be computationally expensive but would work. As you may be able to tell I don't think it's worth it, but if you want to try there's many examples of going through the block data in DFU code.
As you can see in the code screenshot, I have exchanged the positions of nature billbaord creation and location creation inside StreamingWorld.cs and on my machine it works well. I am not sure if this small change will create a huge after-effect but when I tested it, I couldn't find any changes beside of my collision detection finally working.

After now the locations were loaded in on the terrain before the billboards were placed, I was able to call a quick raycast for each billboard placement and refuse the placement when the raycast hits a StaticGeometry tagged collider. On my machine I couldn't really tell if there was a big difference in loading time. Everything seems to run the same way as before. But I am not sure about weaker PCs.
The whole feature will be optional anyway, so if Interkarma accepts this little change in order, I can offer the vegetation inside of locations as mod setting to those who like it.
Last edited by Daniel87 on Mon Feb 01, 2021 2:50 pm, edited 1 time in total.
In Julianos we Trust.

User avatar
Hazelnut
Posts: 3016
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Believable Wilderness

Post by Hazelnut »

Ah, okay. Not sure what side effects that might have as locations are done in a co-routine. Also not sure how you'd do that in a mod. Is your code in github, I might take a look see what you did.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

Post Reply