Changing terrain after generation

Discuss modding questions and implementation details.
l3lessed
Posts: 1068
Joined: Mon Aug 12, 2019 4:32 pm
Contact:

Changing terrain after generation

Post by l3lessed »

Quick question for possible future mod. Can we change terrain after generation, then save the rmb block some way, so players can change terrain after generation? Some mods I might want to make would require this.
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
Hazelnut
Posts: 2862
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Changing terrain after generation

Post by Hazelnut »

The terrain has nothing to do with RMB blocks which are used to put locations onto the generated terrain which is pre-flattened for this.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

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

Re: Changing terrain after generation

Post by l3lessed »

So no? Is terrain only changeable at generation time? Guess need to do some of my own research and mess with some code to see what can be done.
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.

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

Re: Changing terrain after generation

Post by l3lessed »

Found some answers I can try. Seems possible, but I'll have to backup the original heightmap to be restored on new games, so any changes don't get propagated into new games after loading
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
Hazelnut
Posts: 2862
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Changing terrain after generation

Post by Hazelnut »

If you say what you're trying to achieve I might be able to suggest something. At the moment I really have no idea what you want to do.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

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

Re: Changing terrain after generation

Post by l3lessed »

I had an idea of allowing players to maybe build their own home, and if that worked, and was possible, see if that could be expanded to some form of town claim/building. Give players more non-combat play role/diplomat options. Could even tie it into all the really under-used language/diplomat skills and quest/gold as ways to claim land for building on.

In order to do this though, the terrain would have to be changed during run-time so the player could change the terrain to their building need and then saved for later loads.
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
carademono
Posts: 117
Joined: Sat Jul 11, 2020 3:20 pm

Re: Changing terrain after generation

Post by carademono »

Hazelnut wrote: Sun Jul 25, 2021 10:57 am The terrain has nothing to do with RMB blocks which are used to put locations onto the generated terrain which is pre-flattened for this.
Seconding this question about terrain flattening in locations... Is this something that can be altered by the modding system? I've been thinking that it might be interesting to have Q*bert style terrain elevation in cities:

Image

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

Re: Changing terrain after generation

Post by l3lessed »

It appears it can be done through the Terrain object, but it does not look simple. I was going to mess with this code when I had some time to see if it could be applied to the DFU terrain that has been generated by the image maps.

And yes, I would love for someone to apply the same concept to existing cities and their rmb blocks to get cities that look realistic and not perfectly flat.

https://answers.unity.com/questions/110 ... t-run.html
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
Hazelnut
Posts: 2862
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Changing terrain after generation

Post by Hazelnut »

l3lessed wrote: Sun Jul 25, 2021 10:55 pm I had an idea of allowing players to maybe build their own home, and if that worked, and was possible, see if that could be expanded to some form of town claim/building. Give players more non-combat play role/diplomat options. Could even tie it into all the really under-used language/diplomat skills and quest/gold as ways to claim land for building on.

In order to do this though, the terrain would have to be changed during run-time so the player could change the terrain to their building need and then saved for later loads.
Nice ideas, and it's actually something that could be implemented using World Data variants if you accept some constraints. The amount of different stages / branches would depend on the number of override files developed, but everything is there to allow adding stages of a building or set of buildings on an existing location or even a new one. New locations would need to be a limited selection, depending on how many location override files someone wanted to create and support. This would not require any terrain changes, as DFU automatically flattens terrain for locations before the blocks are laid out.

I'm not sure I really understand why you think terrain would need to be changed during run-time to do this? I see that as a choice, rather than an essential element, and will certainly be a lot more complex to do because currently all locations are flat to have Daggerfall blocks laid out on them. Ignoring player built aspect, variable height locations would need quite a major overhaul of the terrain and block layout code. Daggerfall locations were only ever designed for flat ground and when the flattening algorithm doesn't do it's job you end up with floating and buried buildings. It would be a big project for sure, though maybe it could be limited to just player created settlements, but that might seem a bit weird to players with all others being flat.

Just my thoughts, hope they're helpful. :)
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

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

Re: Changing terrain after generation

Post by l3lessed »

That is helpful. I feel for it to be a full building/city creator, you need to be able to raise and lower terrain. I want players to be able to build anywhere they can access. If they can't modify terrain, how will they build a house on a mountain side?

For preexisting cities, that would be quite a job for sure. I was swimming in the RMB and city creation code for weeks when I was making the minimap MOD. It would require some real work. If anyone wants to get into it, I recommend starting by looking into the RMB block creation routines and code that creates the city blocks that are placed on the flat land.

Maybe, if you could stop it from flattening the whole city terrain before rmb block creation, then had it instead flatten a certain area around the building placement location itself using the built in building location properties. From my work on the minimap mod, I know you can get the world location of the buildings, which would allow you to find the terrain below that building and then flatten it. If you found the right flattening parameters for the buildings, you may be able to get a non-flat city that looks good.
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