Jump to content

Welcome to Obsidian Forum Community
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. If you already have an account, login here - otherwise create an account for free today!
Photo

[Tutorial] Modding Basic Concepts

tutorial

  • Please log in to reply
31 replies to this topic

#1
BMac

BMac

    Programmer

  • Developers
  • 330 posts
  • Lords of the Eastern Reach Backer
Follow-up tutorials: Adding New Icons, Adding Items to a Store, How to Upload Mods to the Steam Workshop.

This is a text version of the video tutorial available here: 
 

 
In this tutorial, I'm going to show you how to create a simple data mod for Pillars of Eternity II: Deadfire. By creating your own game data bundle files, you can create new items, abilities, classes, and other content; modify existing content; and also modify how some parts of the game work, as I'm about to do.
 
First, you need to create a folder to put your modified files in. Locate the Pillars of Eternity II: Deadfire folder. I've installed the game using Steam, so my game is in the steamapps folder.
 
Inside the folder "PillarsOfEternityII_Data", create a folder called "override", if it doesn't exist already. This is where all your mods and mods you download from the internet will go.
 
post-113185-0-11162000-1530822387.png
 
Inside the "override" folder, create a folder for your mod.
 
post-113185-0-29231600-1530822390.png

Next, you need to provide some information about your mod. Inside your mod folder, create a file called "manifest.json".
 
Open that file in a text editor, and type the following text into it.
{
    "Title" : {
        "en" : "Per-Rest Resources"
    },
    "Description" : {
        "en" : "Changes spells and class resources to reset on rest instead of after each encounter."
    },
    "Author" : "BMac",
    "ModVersion": "1.0",
    "SupportedGameVersion" : {
        "Min" : "1.1.0",
        "Max" : "1.2.0"
    }
}
  • "Title" is the name of the mod. You can provide the text in multiple languages, each identified by its standard two-letter language code. In this example, I only provide English - "en".
  • "Description" is a short, one-sentence description of the mod, and can also be provided in multiple languages.
  • "Author" is the name or handle of the mod's creator.
  • "ModVersion" is the version number of your mod. You should increase this each time you release a new version of your mod.
  • "SupportedGameVersion" specifies the minimum and maximum versions of Pillars of Eternity II: Deadfire that your mod is known to be compatible with. The game will warn your users if they are using your mod with an incompatible version, but your mod will still load if it's enabled.
Change the contents of this file to describe your mod, then save and close the file.
 
You may also create a thumbnail image that will represent your mod in the Mod Manager UI. This image will go in your mod's folder. It needs to be named "thumb.png" and the dimensions should be 149x84.
 
Now you're ready to actually modify the game's data. For this mod, I'm going to change spells and class resources from resetting after each encounter to resetting on rest.
 
Let's take a look at the vanilla game data, the data the unmodified game uses. This data is located at "PillarsOfEternityII_Data/exported/design/gamedata". I happen to know that the data I want is in the "global" gamedata bundle. Open that file in a text editor.
 
post-113185-0-28287700-1530822394.png
 
The file is hard to read because it isn't formatted. There are many tools available for formatting JSON data. I'm using Visual Studio Code, so I just need to press Shift+Alt+F to format this document and make it easier to read (note: you'll need to associate the .gamedatabundle extension with the JSON format. link).
 
Now I'm going find the properties I want to edit.  I'll just use my text editor's search function (Ctrl+F) and search for the text "spell".
 
post-113185-0-73833600-1530822397.png
 
To learn what all of these properties do, refer to the Game Data Documentation.
 
I found the data. It's on the object called "GlobalGameSettings", so that's the object I need to override in my mod. I won't be changing all the values on this object, but I'm going to copy the whole thing for now, starting from the curly brace "{" shown below, all the way to the matching closing curly brace.
 
post-113185-0-22247800-1530822401.png
 
Create a new .gamedatabundle file in your mod directory. Enter the text shown, and paste the object you copied.
{
    "GameDataObjects":[
        (PASTE OBJECT HERE)
    ]
}
Now I'll remove the data I don't want to override. Note that I always need to leave the "$type" and "ID" properties of the object, and the "$type" property of any components I want to alter.  That leaves me with this:
{
    "GameDataObjects":[
        {
            "$type": "Game.GameData.GlobalGameSettingsGameData, Assembly-CSharp",
            "ID": "eddfc852-ccb9-4884-b901-e77e8ca31b48",
            "Components": [
                {
                    "$type": "Game.GameData.CharacterStatsSettingsComponent, Assembly-CSharp",
                    "PowerPoolUsageType": "PerEncounter"
                },
                {
                    "$type": "Game.GameData.SpellSettingsComponent, Assembly-CSharp",
                    "SpellUsageType": "PerEncounter"
                }
            ]
        }
    ]
}
Now I'll change all spells and class power pools to reset on rest instead of after each encounter by changing "PowerPoolUsageType" and "SpellUsageType" from "PerEncounter" to "PerRest".
{
    "GameDataObjects":[
        {
            "$type": "Game.GameData.GlobalGameSettingsGameData, Assembly-CSharp",
            "ID": "eddfc852-ccb9-4884-b901-e77e8ca31b48",
            "Components": [
                {
                    "$type": "Game.GameData.CharacterStatsSettingsComponent, Assembly-CSharp",
                    "PowerPoolUsageType": "PerRest"
                },
                {
                    "$type": "Game.GameData.SpellSettingsComponent, Assembly-CSharp",
                    "SpellUsageType": "PerRest"
                }
            ]
        }
    ]
}
That's it. My mod is now ready to test.
 
post-113185-0-77032000-1530822405.png

Attached Files


  • TT1, AndreaColombo, ydaraishy and 10 others like this

#2
kilay

kilay

    (5) Thaumaturgist

  • Members
  • 524 posts

EDIT : Found it

 

Thnks, great start :)


Edited by kilay, 05 July 2018 - 04:29 PM.


#3
house2fly

house2fly

    (7) Enchanter

  • Members
  • 859 posts
Thanks for this, as a newb it's very helpful

#4
TT1

TT1

    Transcendent Spirit of the Obsidian Order

  • Members
  • 285 posts
  • Pillars of Eternity Backer
  • Kickstarter Backer
  • Lords of the Eastern Reach Backer
  • Deadfire Backer
  • Fig Backer
149x84???? Why, Lord, why???

My OCD is screaming for 150x85! 😭
  • AndreaColombo, tonpix and kilay like this

#5
AndreaColombo

AndreaColombo

    Arch-Mage

  • Members
  • 5185 posts
  • Location:Budapest (HUN)
  • Pillars of Eternity Silver Backer
  • Kickstarter Backer
  • Deadfire Silver Backer
  • Fig Backer

My OCD is screaming for 150x85!

 

My OCD can relate.


  • TT1 likes this

#6
Redicular

Redicular

    (1) Prestidigitator

  • Members
  • 13 posts

149x84???? Why, Lord, why???

My OCD is screaming for 150x85!

 

That has to be intentional, some coder wanted to annoy some artist... no way you pick 149 by accident



#7
kilay

kilay

    (5) Thaumaturgist

  • Members
  • 524 posts

 

149x84???? Why, Lord, why???

My OCD is screaming for 150x85!

 

That has to be intentional, some coder wanted to annoy some artist... no way you pick 149 by accident

 

 

i guess that the other 1 px x 1 px is taken by the border

 

EDIT : Nope i'm wrong, there isn't a border


Edited by kilay, 06 July 2018 - 10:34 PM.


#8
zilbest

zilbest

    (2) Evoker

  • Members
  • 51 posts
I try to add new spells in a progression table and it seems you have to include all of the entries for that class.
  • SiliconMage likes this

#9
SiliconMage

SiliconMage

    (1) Prestidigitator

  • Members
  • 46 posts
  • Deadfire Silver Backer
  • Fig Backer

I try to add new spells in a progression table and it seems you have to include all of the entries for that class.

 

I can attest to this as well; you do have to include all other abilities in the Progression Tables, even if you are just adding new ones.


  • zilbest likes this

#10
peardox

peardox

    (5) Thaumaturgist

  • Members
  • 536 posts
  • Location:Manchester, UK
  • Deadfire Backer

Apologies to anyone who's native language ain't English. Only my Italian contact is around ATM - we're both positive a load of the text not in English or Italian is garbage

So - the point of this one is that BMac missed off localisation

Here's one I'm playing with (sorry rest of world for Google Translate)

 

{
    "Title" : {
		"de" : "Einfaches Segeln",
        "en" : "Plain Sailing",
		"es" : "Vela llana",
		"fr" : "Voile simple",
		"it" : "Navigazione Semplice",
		"pl" : "Całkiem proste",
		"pt" : "Navegação simples",
		"ru" : "Гладко",
		"zh" : "一帆风顺"
    },
    "Description" : {
		"de" : "Viel weniger Unterbrechungen durch die Crew",
        "en" : "Far less interruptions by the crew",
		"es" : "Mucho menos interrupciones por parte de la tripulación",
		"fr" : "Beaucoup moins d'interruptions par l'équipage",
		"it" : "Molte meno interruzioni da parte dell'equipaggio",
		"pl" : "Znacznie mniej przerw w pracy załogi",
		"pt" : "Muito menos interrupções pela tripulação",
		"ru" : "Менее меньше перерывов экипажа",
		"zh" : "船员不会中断"
    },
    "Author" : "Peardox",
    "ModVersion": "1.2",
    "SupportedGameVersion" : {
        "Min" : "1.1.0",
        "Max" : "1.3.0"
    }
}

This is properly formatted JSON with additional languages

The effect of the extra languages is that if you switch language (this is dangerous - you may get stuck in something you can't read) - practice switching languages if you wanna verify everything - buttons are always in the same places - I'm about t try Russian + Chinese but not before a few rounds of languages I can at least guess what means what.

 

I just tested this (with my Italian friend on standby) and switched to Italian. The manifest got picked up and displayed correctly. Cool - time for some Chinese (I may get stuck here :))



#11
peardox

peardox

    (5) Thaumaturgist

  • Members
  • 536 posts
  • Location:Manchester, UK
  • Deadfire Backer

I can now confirm that only thumb.png works - I did a JPG first time around



#12
peardox

peardox

    (5) Thaumaturgist

  • Members
  • 536 posts
  • Location:Manchester, UK
  • Deadfire Backer

OK - Been thru every language, it all checks out (got confused about which buttons to press @ the end)

 

This is not a racialist comment, I'm sure that a Chinese developer would get as confused as I did by a few of the nine supported languages - our hard to read ones would differ, of course



#13
kilay

kilay

    (5) Thaumaturgist

  • Members
  • 524 posts

Is there a way to comment out a string inside gamedatabundle?


Edited by kilay, 18 July 2018 - 06:06 AM.


#14
peardox

peardox

    (5) Thaumaturgist

  • Members
  • 536 posts
  • Location:Manchester, UK
  • Deadfire Backer

// Commented out

 

Depends on how good their JSON is

 

In a Mod - I'll go hack first_mod



#15
peardox

peardox

    (5) Thaumaturgist

  • Members
  • 536 posts
  • Location:Manchester, UK
  • Deadfire Backer

Tried it with first_mod

 

Breaks the mod

 

Dev PM time

 

you're quite correct, @kilay, we should be able to comment out mods


  • kilay likes this

#16
peardox

peardox

    (5) Thaumaturgist

  • Members
  • 536 posts
  • Location:Manchester, UK
  • Deadfire Backer

Done Devs with specific reqs

 

Single line, embedded and multi-part should be parsed out of any Mod

 

So..

 

// Some stuff is ignored

      "ID":"abcdef.....", // Something awesome becomes without this comment

 

/*

  Just ignore me

*/

 

Standard C-Style syntax


  • kilay likes this

#17
Xaratas

Xaratas

    (7) Enchanter

  • Members
  • 901 posts
  • Pillars of Eternity Backer
  • Kickstarter Backer
  • Deadfire Silver Backer
  • Fig Backer

Done Devs with specific reqs

 

Single line, embedded and multi-part should be parsed out of any Mod

 

So..

 

// Some stuff is ignored

      "ID":"abcdef.....", // Something awesome becomes without this comment

 

/*

  Just ignore me

*/

 

Standard C-Style syntax

It's json, where is the place you would see a comment handler in a json parser?

Show me a C# json library with such crazy feature, and then it has a tiny chance obsidian like it and include it.


  • TT1 likes this

#18
kilay

kilay

    (5) Thaumaturgist

  • Members
  • 524 posts

I only found that about ability (and the same note there is also in progression table).

I wonder if we can add that structure format also to others components

 

note.png

 

 

EDIT:

I can confirm that It works also in other components


Edited by kilay, 01 August 2018 - 09:57 AM.

  • TT1 likes this

#19
Wodehouse_44

Wodehouse_44

    (2) Evoker

  • Members
  • 55 posts

How would I create a new version of the Gipon Prudensco, with the same effects/enchantments of the Sharpshooter's Garb, and place it in a shop in Port Maje?



#20
peardox

peardox

    (5) Thaumaturgist

  • Members
  • 536 posts
  • Location:Manchester, UK
  • Deadfire Backer

See First Mod sticky

 

I explain exactly how to do this there

 

You just need to replace the Great Word with a modded your thing with some new GUID

This was the simplest mod I could think of to get ppl started


  • Wodehouse_44 likes this





Also tagged with one or more of these keywords: tutorial

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users