Problem adding world data override in Cybiades

Discuss modding questions and implementation details.
Post Reply
User avatar
haloterm
Posts: 391
Joined: Sat Feb 16, 2019 5:21 am

Problem adding world data override in Cybiades

Post by haloterm »

I want to give the Cybiades a bit of content, so I added a small tavern-type village to these islands.

I know how to add new locations and did this already successfully in my Black Horse Courier mod, they work fine.

My new location also works at the surface - the village is at the intendend place (mapX = 438, mapY = 342).

However, when I enter a building and then return, the screen is black. I can still move and when I press ESC and the menu appears, suddenly the scene becomes visible.

Now the problem according to player.log is this:

Code: Select all

Restoring scene: DaggerfallWorld [mapX=438, mapY=342] 
(Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 39)

Exception: GetPeopleOfCurrentRegion() did not find exactly 1 match.
  at DaggerfallWorkshop.PlayerGPS.GetPeopleOfCurrentRegion () [0x00028] in <8966aa1dc271433faadcf946afed92a0>:0 
  at DaggerfallWorkshop.Game.TalkManager.GetStaticNPCFactionData (System.Int32 factionId, DaggerfallConnect.DFLocation+BuildingTypes buildingType, DaggerfallConnect.Arena2.FactionFile+FactionData& factionData) [0x00025] in <8966aa1dc271433faadcf946afed92a0>:0 
  at DaggerfallWorkshop.Game.TalkManager.GetBuildingList () [0x00277] in <8966aa1dc271433faadcf946afed92a0>:0 
  at DaggerfallWorkshop.Game.TalkManager.OnMapPixelChanged (DaggerfallConnect.Utility.DFPosition mapPixel) [0x00007] in <8966aa1dc271433faadcf946afed92a0>:0 
  at (wrapper delegate-invoke) <Module>.invoke_void_DFPosition(DaggerfallConnect.Utility.DFPosition)
  at DaggerfallWorkshop.PlayerGPS.RaiseOnMapPixelChangedEvent (DaggerfallConnect.Utility.DFPosition mapPixel) [0x00007] in <8966aa1dc271433faadcf946afed92a0>:0 
  at DaggerfallWorkshop.PlayerGPS.Update () [0x0003e] in <8966aa1dc271433faadcf946afed92a0>:0 
Here is my location json file for reference:

Code: Select all

{
    "Loaded": true,
    "Name": "Voughtwent",
    "RegionName": "Cybiades",
    "HasDungeon": false,
    "MapTableData": {
		"MapId": 342438,
		"Latitude": 20096,
		"Longitude": 56064,
        "LocationType": "Tavern",
        "DungeonType": "NoDungeon",
        "Discovered": true,
        "Key": 256
    },
    "Exterior": {
        "RecordElement": {
            "Header": {
				"X": 14352384,
				"Y": 5144576,
                "IsExterior": 32768,
                "Unknown2": 135,
                "LocationId": 50503,
                "IsInterior": 0,
                "ExteriorLocationId": 0,
                "LocationName": "Voughtwent"
            }
        },
        "BuildingCount": 4,
        "Buildings": [
            {
                "NameSeed": 1800,
                "FactionId": 0,
                "Sector": 4,
                "LocationId": 50503,
                "BuildingType": "House4",
                "Quality": 6
            },
            {
                "NameSeed": 470,
                "FactionId": 0,
                "Sector": 12,
                "LocationId": 50503,
                "BuildingType": "House4",
                "Quality": 9
            },
            {
                "NameSeed": 26113,
                "FactionId": 0,
                "Sector": 25,
                "LocationId": 50503,
                "BuildingType": "House2",
                "Quality": 3
            },
            {
                "NameSeed": 6040,
                "FactionId": 0,
                "Sector": 31,
                "LocationId": 50503,
                "BuildingType": "Tavern",
                "Quality": 5
            }
        ],
        "ExteriorData": {
            "AnotherName": "Voughtwent",
            "MapId": 342438,
            "LocationId": 50503,
            "Width": 1,
            "Height": 1,
            "PortTownAndUnknown": 0,
            "BlockNames": [
                "TVRNBS00.RMB"
            ]
        }
    },
    "Climate": {
        "WorldClimate": 229,
        "ClimateType": "Desert",
        "NatureSet": "Nature_SubTropical",
        "GroundArchive": 2,
        "NatureArchive": 501,
        "SkyBase": 24,
        "People": "Breton",
        "Names": "Nord"
    },
	"Politic": 189,
	"RegionIndex": 61,
    "LocationIndex": 0
}
The location itself is just a copy of an existing tavern, where I just edited name, map ID, latitude, longitude, world X, world Y, region index and climate data. All these are correct. Of course I also set a new location ID (from the range I reserved in the resource register thread).

I have no idea why it does not work.

Is the problem that there are no towns at the island? Or did I oversee something in my json file?

User avatar
haloterm
Posts: 391
Joined: Sat Feb 16, 2019 5:21 am

Re: Problem adding world data override in Cybiades

Post by haloterm »

Maybe I found a first hint.

When I started, I exported the one default Dungeon that exists on the Cybiades. Not because I want to make a dungeon, but just to get some region data.

It had the region ID 61, so of course I use that one in my mod.

However, I now checked the faction.txt and there the Cybiades have in fact region ID 62. The 61 is actually Illessan Hills!

So maybe this led to a mismatch somewhere... when I go back to my PC, I will check what happens when I correct the region ID to 62...

User avatar
haloterm
Posts: 391
Joined: Sat Feb 16, 2019 5:21 am

Re: Problem adding world data override in Cybiades

Post by haloterm »

According to the UESP wiki, the Cybiades are indeed 61.

https://en.uesp.net/wiki/Daggerfall_Mod:Region_Numbers

Whereas 62 is the Vraseth Clan and Ilessan Hills is 60.

So why is in DFU's faction.txt 62 used for Cybiades and 61 for Ilessan Hills? And 60 for Glenumbra Moors? And Vraseth have 63...

Wow, I am confused now.

User avatar
haloterm
Posts: 391
Joined: Sat Feb 16, 2019 5:21 am

Re: Problem adding world data override in Cybiades

Post by haloterm »

Well, of course changing 61 to 62 did not solve the problem. That only led to the problem that the new location was not found at all.

So going back to square 1.

Anybody any ideas?

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Problem adding world data override in Cybiades

Post by Interkarma »

Region indices in Daggerfall Unity are in DaggerfallUnityEnums.cs inside DaggerfallRegions enum. For example, you'll note that Daggerfall is region index 17, Wayrest is index 23, and Cybiades is index 61.

But FACTION.TXT has it's own way of doing things. The "region: N" field is always +1 of the region index field in MAPS.BSA (it's one-based rather than zero-based). So it looks like below:

Code: Select all

#201
type: 7
name: Daggerfall
rep: 0
summon: -1
region: 18 (+1 of 17)

Code: Select all

#207
type: 7
name: Wayrest
rep: 0
summon: -1
region: 24 (+1 of 23)

Code: Select all

#236
type: 7
name: Cybiades
rep: 0
summon: -1
region: 62 (+1 of 61)
Based on your exception trace above, the problem appears to be that game cannot find "people of" data in FACTION.TXT for Cybiades. I can see the "people of" data exists (it's ID #584) so most likely there's some other issue with either the replacement data or how faction data is formatted in FACTION.TXT being incompatible. It wouldn't be the first time we've found issues in FACTION.TXT in classic. In fact, the whole reason this file is now included with DFU is it's so full of problems that including it means we can at least fix it for everyone when problems are found.

I don't know what's causing your issue here however. I'll try to take a look when I can.

Edit: Thinking about this one some more. If you added a tavern with NPCs, game will attempt to generate random quests for those commoners (as you'd see with other taverns in the main world). It's likely something is failing there as Cybiades really isn't setup for questing and has no other service locations and only one dungeon. It's probably not a good candidate for population to start with, unless a lot of other infrastructure is also added. I'll try to dig into this exception at least.

Edit2: Based on a quick look, the Cybiades FACTION.TXT data should return a positive search. The GetPeopleOfCurrentRegion() method searches for type=15 (people), sgroup=0 (commoners), ggroup=4 (general populace). ID #584 has the following data, which is a match.

Code: Select all

#584
	type: 15
	name: People of Cybiades
	sgroup: 0
	ggroup: 4
So there must be some reason the search fails, such as the replacement data not technically being in the correct region. When you're standing at the tavern and enter "tdbg" into console, does it show that you're currently in Cybiades or some other region?

If you could please attach a zip with both your save standing at the tavern and the full world override data file for me to drop into WorldData, I'm happy to step through code in action and look at this more closely.

User avatar
haloterm
Posts: 391
Joined: Sat Feb 16, 2019 5:21 am

Re: Problem adding world data override in Cybiades

Post by haloterm »

Interkarma wrote: Mon Sep 20, 2021 10:03 pm So there must be some reason the search fails, such as the replacement data not technically being in the correct region. When you're standing at the tavern and enter "tdbg" into console, does it show that you're currently in Cybiades or some other region?
Thank you, Interkarma, for taking a look at this.

I feel very stupid now. The "tdbg" command (which I did not try until now) showed me that my tavern was placed in the ocean, despite the actual landscape being land. (So it is not just that well-known default mismatch between the travel map and the actual region borders, but also between the visual landscape and the region borders. Funny island. But that's not DFU's fault and maybe can even be explained by some magic-head-canon-logic).

I moved my tavern one map pixel south and now everything works (so far). The innkeeper even gave me a quest to retrieve some scroll guarded by a Daedra from the only default dungeon on that island.

Of course that does not guarantee that it may not fail for some other reason, for example if some installed questpack tries to generate a random quest which would send me to a town or temple (which don't exist and I not really want to add, if I can avoid it), but I will see how it works out.

For now many thanks again!

P.S.: Different topic, regarding tdbg: It's cool that it shows which music track is playing, but it does it only for exteriors. It would be cool if it could also show which music is playing for interiors and dungeons. I downloaded a music dfmod and want to replace one particular of its songs with another one placed in "Sound", but I can't identify which one it is.

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Problem adding world data override in Cybiades

Post by Interkarma »

Ah cool! Happy you made some progress. :)

Post Reply