Next tasks?

Discuss coding questions, pull requests, and implementation details.
User avatar
InconsolableCellist
Posts: 28
Joined: Mon Mar 23, 2015 6:00 am

Next tasks?

Postby InconsolableCellist » Tue Nov 08, 2016 2:52 am

I've been looking to work on DFTFU/Daggerfall Unity, and I was wondering if there are any upcoming tasks you'd want a third party dev to work on. Last time I messed around Daggerfall Unity didn't exist, and I'm looking for something to get my feet wet. It's also fantastic progress by the way! I love seeing this project come together, and I think I have some time to start giving back again.

I read the roadmap (http://www.dfworkshop.net/projects/dagg ... y/roadmap/) and started looking into the book reader. I actually discovered that there's actually a UI stubbed out. Would this be good to work on?
User avatar
Nystul
Posts: 873
Joined: Mon Mar 23, 2015 8:31 am

Re: Next tasks?

Postby Nystul » Tue Nov 08, 2016 7:47 am

Great that you will join in in the development!
User avatar
Interkarma
Posts: 1981
Joined: Sun Mar 22, 2015 1:51 am

Re: Next tasks?

Postby Interkarma » Tue Nov 08, 2016 9:15 am

Welcome back InconsolableCellist, great to see you around again. :)

Book reader UI is basically complete, but still need to wire up book drops to loot table and to inventory UI (i.e. open book reader on use in inventory). Also going to need a note reader very soon.

I haven't looked at the book reader in a while, it was one of the first UIs to be developed for DagUI and may need a little refactoring to bring online. So if it's something you'd like to sink your teeth into, go for it.
User avatar
InconsolableCellist
Posts: 28
Joined: Mon Mar 23, 2015 6:00 am

Re: Next tasks?

Postby InconsolableCellist » Tue Nov 08, 2016 10:35 pm

Sweet! I took a stab at it and converted the BookReaderWindow to use the new UI approach that the other windows seem to be taking. I also hooked it up to the inventory window, and you can open and close books, as well as page through them. All the hard stuff was already done though, with the text layout working well. The font and margins will need a bit of tweaking, but at least it's functional.

You can see the commit in my forked repo here:

https://github.com/InconsolableCellist/ ... 8fa0228904

Image

I haven't sent a pull request yet though, and I have two questions for finishing this up:

* It appears that the books are uniquely identified by UID. Is it correct to think that there needs to be a mapping between UID and the filenames that are in ARENA2/BOOKS? If I create this mapping should I make it a JSON file in Resources or hardcode it somewhere? I'm assuming that it's hardcoded in Daggerfall, as I can't find any information about what file might map the filenames to the item UIDs. A Daggerfall file format expert might know this immediately.

* What's the key that goes into the LootChanceMatrix that tells the game to create a random book? Or even a glossary of all the abbreviations there would be helpful

I also sometimes get a NullObjectReferenceException in the DaggerfallSongPlayer on line 82. If it matters, my system is muted. Is this a known bug?
User avatar
Interkarma
Posts: 1981
Joined: Sun Mar 22, 2015 1:51 am

Re: Next tasks?

Postby Interkarma » Tue Nov 08, 2016 11:50 pm

InconsolableCellist wrote:Sweet! I took a stab at it and converted the BookReaderWindow to use the new UI approach that the other windows seem to be taking. I also hooked it up to the inventory window, and you can open and close books, as well as page through them. All the hard stuff was already done though, with the text layout working well. The font and margins will need a bit of tweaking, but at least it's functional.


Speedy work! :) Font is the classic Daggerfall font and there's no margins as such. The wrapping is determined by the text layout in the book file. If you see a row of text overflowing margins, it should be almost identical in that same book in-game. That's why it's important to keep the same font for now, as formatting is hard-coded around font pixel dimensions relative to the book UI. Blech.

At some point, I'd like to update font and implement a better line-wrapping setup. But overall, I'm not unhappy with the 1:1 reader having the same problems as Daggerfall for now.

InconsolableCellist wrote:* It appears that the books are uniquely identified by UID. Is it correct to think that there needs to be a mapping between UID and the filenames that are in ARENA2/BOOKS? If I create this mapping should I make it a JSON file in Resources or hardcode it somewhere? I'm assuming that it's hardcoded in Daggerfall, as I can't find any information about what file might map the filenames to the item UIDs. A Daggerfall file format expert might know this immediately.


I was looking at mapping imported books to their correct book index a while back, but memory failing me and don't have my old notes handy (I'm at work). Imported books may be missing required data. The UID you're seeing is probably the internal UID Daggerfall Unity generates for serialization, which isn't related to the game files at all. Will answer this further when I can.

InconsolableCellist wrote:* What's the key that goes into the LootChanceMatrix that tells the game to create a random book? Or even a glossary of all the abbreviations there would be helpful


Now that you mention it, I'm not sure I've added books to the loot generation yet (as in the loot generator will not be able to spawn a book). The abbreviations in loot change matrix are based on loot tables in Chronicles. Legend for abbreviations are on comments in DaggerfallUnityStructs.cs (starting from line 333). BK is for book, but books won't drop at all at this stage as loot generator can't spawn them yet.

I'm more than happy to handle setting up import and dropping of books. Was on my hit-list for this version anyway. :)

InconsolableCellist wrote:I also sometimes get a NullObjectReferenceException in the DaggerfallSongPlayer on line 82. If it matters, my system is muted. Is this a known bug?


I've not seen an exception on that line, but there does appear to be a problem with song player in relation to OnAudioFilterRead. Seems to be a threading issue of some kind with Unity Editor. I've only had problems in the Editor, not in builds at this time.
User avatar
InconsolableCellist
Posts: 28
Joined: Mon Mar 23, 2015 6:00 am

Re: Next tasks?

Postby InconsolableCellist » Wed Nov 09, 2016 5:13 am

Ah, you're right about the font. I agree that making the behavior as close as possible to the original should be the goal (barring support for mods and such).

I was looking at mapping imported books to their correct book index a while back, but memory failing me and don't have my old notes handy (I'm at work). Imported books may be missing required data. The UID you're seeing is probably the internal UID Daggerfall Unity generates for serialization, which isn't related to the game files at all. Will answer this further when I can.


I think this is where my problems lay at the moment. I took a real Daggerfall save where I bought books and parchment and loaded it using DFU. DFU parses the save tree and then assigns the wrong ItemTemplate to the books in this save's inventory. It's setting books to be parchment (enum value 279 instead of 277), and parchment it's trying to grab groupIndex 3, which is an error handled by line 59 of ItemHelper.cs.

It seems to me there's a mismatch between the save's ItemRecord.ParsedData.category2 and the enum ordering in ItemEnums.cs:280. Additionally there's at least one category missing from that same Books enum (possibly a null type?). I haven't tried Potion_recipe yet.

I'm bringing this up instead of fixing what I think is a bug because there's a comment of "//checked" indicating that the Books enum values are correct.

Do you happen to know what could account for this mismatch? Should I trust my save file and fix the enum so it works for me?


I've not seen an exception on that line, but there does appear to be a problem with song player in relation to OnAudioFilterRead. Seems to be a threading issue of some kind with Unity Editor. I've only had problems in the Editor, not in builds at this time.


It started printing out a bunch of errors so I added a quick fix. I'm not sure if it's only my system or not, but here's the change I had to make:

https://github.com/InconsolableCellist/ ... 1c64fd4c13

Dunno if you want this one upstream, but I'll keep it in my fork at least. It might be something to do with my audio configuration (running Windows in a VM). Weirdly I *do* hear MIDI music, but not always.
User avatar
Interkarma
Posts: 1981
Joined: Sun Mar 22, 2015 1:51 am

Re: Next tasks?

Postby Interkarma » Wed Nov 09, 2016 5:19 am

Thanks for the info. Besides the book reader UI, I haven't done much with book items themselves. It's really not surprising they don't work as expected yet.

Since this crosses over a few systems, it might be easier for me to field getting books importing and operating correctly when I can.
User avatar
InconsolableCellist
Posts: 28
Joined: Mon Mar 23, 2015 6:00 am

Re: Next tasks?

Postby InconsolableCellist » Wed Nov 09, 2016 5:23 am

True, it might be easier, but I'm learning a lot about the save system at least! I'm pretty close to having it working though. You could review my changes once I have everything ironed out (which would give me peace of mind too).

I'm not sure I'll tackle the ID mapping yet...there has to be some piece of identifying information in the ItemRecord that comes with the save, but I don't know what it is. And yeah, the UID I was referring to turned out to be assigned by DFU.
User avatar
Interkarma
Posts: 1981
Joined: Sun Mar 22, 2015 1:51 am

Re: Next tasks?

Postby Interkarma » Wed Nov 09, 2016 5:38 am

Sure thing, just let me know when happy and I'll review. I've setup a new branch called 'book-updates'. Please send your updates at that branch when you're happy. I'm sure with a bit of back forth we'll get it sorted.

I'm trying to be a lot more active with DFU at the moment, but work is kicking my ass on the lead-up to Christmas. Everything should even out again in a few weeks. For now, I'll just keep ticking away in maintenance mode.
User avatar
InconsolableCellist
Posts: 28
Joined: Mon Mar 23, 2015 6:00 am

Re: Next tasks?

Postby InconsolableCellist » Wed Nov 09, 2016 5:04 pm

Quick question if I do proceed with trying to mess with the import logic...Do the "index" values in ItemTemplates.txt specify more than their order in the ItemEnums? In other words, if I reorder three of them in the middle and then increment the second half of the list, will it break things? (Existing saves, perhaps?)

My investigation has led me to think the book and potion_recipe enums have the wrong offsets in their data structures, such that I think I have to change the template ordering so that an offset of 3 goes to book, 4 to potion recipe, and things like that.

Return to “Developer Discussion”

Who is online

Users browsing this forum: No registered users and 1 guest