Adding coastal locations using world data system (difficult)

Discuss modding questions and implementation details.
User avatar
Yagiza
Posts: 120
Joined: Wed Jul 31, 2019 5:16 pm

Re: Modding Tutorials: World Data Overrides

Post by Yagiza »

Hazelnut wrote: Sat Nov 09, 2019 3:50 pm What version of the DFU codebase are you using, the worldDataDev test branch?
BTW, if new feature announced in v.0.10.19 build, why it do not work in it? When a version with working World Data System will be released?

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

Re: Modding Tutorials: World Data Overrides

Post by Hazelnut »

Yagiza wrote: Sat Nov 16, 2019 8:39 am BTW, if new feature announced in v.0.10.19 build, why it do not work in it? When a version with working World Data System will be released?
I assume you meant to type v0.10.9 build. That build (and up to the .11 latest release) contains many of these changes, but not the ability to replace RMB blocks. That work I did later is now being checked and tested on a branch. As such this is all marked as WIP (work in progress) until the system is all finished and basic documentation done. I can't answer when a release with the full system will be done, that's down to others and the time they have available. I would say that I believe the current release does have a working system, just not complete. I changed the docs which originally stated that RMB changes were not yet possible before it's released because I wanted to get info down while it was in my head.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
Yagiza
Posts: 120
Joined: Wed Jul 31, 2019 5:16 pm

Re: Modding Tutorials: World Data Overrides

Post by Yagiza »

Hazelnut wrote: Sat Nov 16, 2019 12:18 pm I assume you meant to type v0.10.9 build. That build (and up to the .11 latest release) contains many of these changes, but not the ability to replace RMB blocks. That work I did later is now being checked and tested on a branch. As such this is all marked as WIP (work in progress) until the system is all finished and basic documentation done. I can't answer when a release with the full system will be done, that's down to others and the time they have available. I would say that I believe the current release does have a working system, just not complete. I changed the docs which originally stated that RMB changes were not yet possible before it's released because I wanted to get info down while it was in my head.
IC. Anyway, do you want me to add an ability to override map pixel data? It seems really simple, so, if you have no time for that, I can do it myself and send you a PR.

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

Re: Modding Tutorials: World Data Overrides

Post by Hazelnut »

Yagiza wrote: Fri Nov 22, 2019 6:12 am IC. Anyway, do you want me to add an ability to override map pixel data? It seems really simple, so, if you have no time for that, I can do it myself and send you a PR.
Yeah it should be pretty simple, main work is testing. I was waiting until my work on RMB blocks was accepted and merged, but I suppose there's no reason to wait as I'm fairly confident it will go in at some point. I'll see what I can do tonight.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

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

Re: Adding coastal locations using world data system (difficult)

Post by Hazelnut »

Okay submitted a PR #1621. You will now be able to programatically set the politic index (region) and climate index (climate) for each map pixel, overriding the data from the pak files. This should be done in your mod initialisation.

For example:

Code: Select all

MapsFiles mapsFile = DaggerfallUnity.Instance.ContentReader.MapFileReader;
mapsFile.SetPoliticIndex(208, 215, 145);
mapsFile.SetPoliticIndex(207, 217, 148);
mapsFile.SetClimateIndex(207, 217, Climates.Desert);
mapsFile.SetClimateIndex(198, 154, Climates.Rainforest);
They do return a bool if you're interested in whether they worked for the pixel values, they will fail for invalid coords and return false. Obviously they will only work once the PR has been merged.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
Yagiza
Posts: 120
Joined: Wed Jul 31, 2019 5:16 pm

Re: Adding coastal locations using world data system (difficult)

Post by Yagiza »

Hazelnut wrote: Fri Nov 22, 2019 9:20 pm Okay submitted a PR #1621. You will now be able to programatically set the politic index (region) and climate index (climate) for each map pixel, overriding the data from the pak files. This should be done in your mod initialisation.

For example:

Code: Select all

MapsFiles mapsFile = DaggerfallUnity.Instance.ContentReader.MapFileReader;
mapsFile.SetPoliticIndex(208, 215, 145);
mapsFile.SetPoliticIndex(207, 217, 148);
mapsFile.SetClimateIndex(207, 217, Climates.Desert);
mapsFile.SetClimateIndex(198, 154, Climates.Rainforest);
They do return a bool if you're interested in whether they worked for the pixel values, they will fail for invalid coords and return false. Obviously they will only work once the PR has been merged.
That's nice, thanx. But I think it would be better to do it in json files in WorldData subdir, just like other world data overrides.

Also, what do you think about improving terrain generation code, to extend land part of beaches, to land parts of neigbour sea pixels (just as I described above)?

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

Re: Adding coastal locations using world data system (difficult)

Post by Hazelnut »

Yagiza wrote: Sat Nov 23, 2019 7:43 am That's nice, thanx. But I think it would be better to do it in json files in WorldData subdir, just like other world data overrides.
No, I don't think that would be appropriate for core DFU. If your mod has a lot of these to set, by all means create an intermediate data structure and read a json file into it, then set the byte's you need to. Most mods will not need this at all, and if they do will be setting values for a single pixel so there's really not worth adding a new data structure and code to read in/out for this into core.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
Yagiza
Posts: 120
Joined: Wed Jul 31, 2019 5:16 pm

Re: Adding coastal locations using world data system (difficult)

Post by Yagiza »

Hazelnut wrote: Sat Nov 23, 2019 12:18 pm No, I don't think that would be appropriate for core DFU. If your mod has a lot of these to set, by all means create an intermediate data structure and read a json file into it, then set the byte's you need to. Most mods will not need this at all, and if they do will be setting values for a single pixel so there's really not worth adding a new data structure and code to read in/out for this into core.
IC. And what about second question?

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

Re: Adding coastal locations using world data system (difficult)

Post by Hazelnut »

So, how are you getting on with this? The climate override (per map pixel) went in the release 0.10.14 just in case you missed that, so you should be good to stop hacking it now and set the climate properly.

Regarding extending terrain by altering terrain generation, that does seem to be possible. BadLuckBurt has been playing with this so he may be able to help if you feel you need this. I did have an idea for solving this based on the fact that you can place models of a block outside the area of that block. So you could bridge the channel of water with models of bridges or quays or something appropriate.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

Post Reply