Import custom books (experimental)

Discuss modding questions and implementation details.
Post Reply
User avatar
TheLacus
Posts: 933
Joined: Wed Sep 14, 2016 6:22 pm
Contact:

Import custom books (experimental)

Post by TheLacus » Tue Jul 30, 2019 8:09 am

Recently relased alpha build introduces support for custom books, in addition to replacement for classic books which was already available. This feature is still considered experimental but is provided as opt-in to receive early feedback from interested mod creators. For general informations on books modding see modding/books.

How to enable
Open ini setting file, search [Experimental] section and set

Code: Select all

CustomBooksImport=True
How to import from loose files
  1. Place a new book file with .TXT extension inside StreamingAssets/Books. Example: StreamingAssets/Books/ExampleBook.TXT.
  2. Create a json file inside StreamingAssets/Books/Mapping. Example: StreamingAssets/Books/Mapping/ExampleBooksPack.json.
    This file must contain an array of objects, one for each book that is to be announced to the game.

    Code: Select all

    [{
       "Name": "ExampleBook",
       "Title": "An Example Book"
       "ID": 1531909675
    }]
    
    Name is the filename without extension.
    Title is a readable name for the book, shown in game. The reason to have it here is to access it without loading the entire book resource.
    ID An unique ID for the book between 1 and 2147483647 (generate with google).
    IsUnique If true this book is not found inside random loots or bookshelves and must be made available directly by mods.
    WhenVarSet Book is available only when this global variable is set.
How to import from mods
Custom books can be provided from mods (.dfmod) simulating loose files structure. Specifically, place mapping json files inside a directory that ends with Books/Mapping.
For example, you should have something like this:

Code: Select all

<root>/ReadMe.txt
<root>/ExampleMod.dfmod.json
<root>/modsettings.json
<root>/Books/ExampleBook.TXT
<root>/Books/Mapping/ExampleBooksPack.json
What to expect
  • Custom books can be read from booshelves.
  • Custom books can be found inside random loots and added to inventory as items. If mod provider is removed, books inside inventory become unreadable claiming to be ruined.
  • Custom books can be made available by mods

    Code: Select all

    GameManager.Instance.PlayerEntity.Items.AddItem(ItemBuilder.CreateBook("ExampleBook"));
    
Attachments
CustomBookInGame.png
CustomBookInGame.png (142.48 KiB) Viewed 1021 times
CustomBookEditor.png
CustomBookEditor.png (36.38 KiB) Viewed 1021 times
If you are interested in creating mods for Daggerfall Unity you can find the documentation here.

azmanian
Posts: 12
Joined: Tue Aug 13, 2019 12:59 am

Re: Import custom books (experimental)

Post by azmanian » Tue Aug 13, 2019 11:44 am

*chronicling the histories of the Illiac's noble families intensifies* :D

BansheeXYZ
Posts: 500
Joined: Fri Oct 23, 2015 8:19 pm

Re: Import custom books (experimental)

Post by BansheeXYZ » Tue Aug 13, 2019 12:49 pm

I'm interested, except... if you play near 1080p (and most people do), it's kinda hard to read a whole book in what is essentially a size 36 yellow font. 5x scaling only looks good in a twitter thumbnail. So it'd be great to have scaling options for the old ui for enhanced readability. Doom is a 320x200 game as well. Play gzdoom you'll see that not only can choose your own scalings, the default is "adaptive" which makes sure the old HUD/messages doesn't get scaled to 5x just because you bumped the resolution 5x.

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

Re: Import custom books (experimental)

Post by Hazelnut » Sun Sep 08, 2019 6:02 pm

I'd like to add a book for the Archaeologists guild with some details and locations of guild halls. When is this feature likely to move from experimental?

User avatar
TheLacus
Posts: 933
Joined: Wed Sep 14, 2016 6:22 pm
Contact:

Re: Import custom books (experimental)

Post by TheLacus » Sun Sep 08, 2019 7:06 pm

Hazelnut wrote:
Sun Sep 08, 2019 6:02 pm
I'd like to add a book for the Archaeologists guild with some details and locations of guild halls. When is this feature likely to move from experimental?
I want to be cautious and avoid changes to core game before confirmation that there are no regressions. It works fine in my tests so i'm happy to enable this feature for all after someone actually release a book and no bugs are found.
If you are interested in creating mods for Daggerfall Unity you can find the documentation here.

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

Re: Import custom books (experimental)

Post by Hazelnut » Sun Sep 08, 2019 7:27 pm

If I put a book into the mod and the books setting is not enabled, will that possibly cause issues? That's my concern I suppose.

User avatar
TheLacus
Posts: 933
Joined: Wed Sep 14, 2016 6:22 pm
Contact:

Re: Import custom books (experimental)

Post by TheLacus » Mon Sep 09, 2019 12:16 pm

Hazelnut wrote:
Sun Sep 08, 2019 7:27 pm
If I put a book into the mod and the books setting is not enabled, will that possibly cause issues? That's my concern I suppose.
No, it should be fine ;)
If you are interested in creating mods for Daggerfall Unity you can find the documentation here.

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

Re: Import custom books (experimental)

Post by Hazelnut » Mon Sep 09, 2019 12:26 pm

Great. Will do this in a couple of weeks when I get back. Should hopefully be a good test case.

Post Reply