Import custom books (experimental)

Discuss modding questions and implementation details.
Post Reply
User avatar
TheLacus
Posts: 883
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"
    }]
    
    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.
  3. Books are assigned an id at runtine, used for game saves. The result for all installed mods is stored at StreamingAssets/Books/Mapping/IDs.json. This file must not be deleted.
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"));
    
Possible future improvements
After initial feedback, i'd like to work on the following features:
  • Unique books: not found inside loots, must be made available by mod (specific location, quest reward, etc.).
  • Dynamic books: can be edited by mod to make book-like logs, etc....
  • Human readable format for books (json) ?
Attachments
CustomBookInGame.png
CustomBookInGame.png (142.48 KiB) Viewed 376 times
CustomBookEditor.png
CustomBookEditor.png (36.38 KiB) Viewed 376 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: 472
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.

Post Reply