• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.
Showing developer posts only. Show all posts in this thread.
Status
Not open for further replies.

podcat

Studio Manager, Game Director <unannounced>
Paradox Staff
12 Badges
Jul 23, 2007
12.812
38.541
  • Europa Universalis IV
  • Hearts of Iron III
  • Semper Fi
  • 500k Club
  • Europa Universalis III: Collection
  • Europa Universalis IV: Pre-order
  • Hearts of Iron II: Beta
  • Europa Universalis: Rome Collectors Edition
  • Mount & Blade: Warband
  • Paradox Order
  • Hearts of Iron IV Sign-up
  • Hearts of Iron IV: Together for Victory
Hi everyone, this weeks diary is going to get really technical! We will be talking modding and improvements we have made for the modders in HOI4. This is also going to be a very long one :)

When starting out we decided we wanted to make HOI4 our most moddable game yet. That meant not hard coding things (HOI3 had a lot of hard coded logic and references to certain nations). In HOI4 all these things are in soft code, or part of scenario script setups making it a much better platform for cool mods. We have also decided to include the tool we use (more further down), and while it is provided as-is and not really polished compared to the real game its very useful. The game is also much better at letting you know when you have made mistakes and everything that can go wrong will usually let you know with logs etc.

Tools and Getting Started
Getting started with the creation of mods are now easier than ever before!
Using the launchers mod tool will allow you to create an empty mod for the game without any hassle and without even starting the game.
XdASvVf.jpg


Then starting the game with the “-debug” flag will enable the “modder mode” that adds some extra sanity checks and enabling tools useful for modifying the game.
For example the in game Nudger tool that provides a simple interface to modify the properties of the map.
asMGY54.jpg

TVGwM7x.jpg

Here I created the awesome state of Östergötland by redistributing some provinces from Småland and tweaked the positions of the buildings.
The Nudger tool will then validate my changes and save them to the appropriate files for me and my mod, just in a few mouse clicks.

These files are of course human readable and can easily be edited with your favorite text editor for more advanced scripting or making smaller changes, most of the files (like state history setup) also have the option to be opened with a external program from the Nudger so you do not even need to find them in the filesystem.
YKRLmUq.jpg


Another nice tool is the instant feedback system aka “Error Dawg” appearing in the lower right corner that will give you instant feedback about scripting errors and oddities during gameplay. Clicking on it will of course open the error log for you, painfully reminding you about things you have forgotten or otherwise faulty scripted.
tOuBWK3.jpg


When satisfied with your mod and fixed all the errors you are just one click away from sharing it with the rest of the HoI4 community by uploading it to the steam workshop with the Mod tool.
LPI3un5.jpg


Another thing we have put a lot of effort into is reloadability. You can reload interfaces (even automatically as the game will check if files are modified and you will see changes instantly ingame) as well as several game systems. For example focus trees will reload with your changes making it really quick and easy to work with making them and not forcing you to restart the game all the time.

Scripting & Language Improvements
One of the small help functions we’ve put in is the console command “trigger_docs”. This will print a list of all the triggers and effects we have in the game along with a small description of how they are used. We hope this can be a useful tool for new modders to find what they’re looking for and old modders to discover hidden possibilities. We of course still have the beloved debug dog to bark at you when something is wrong.

We’re continuously trying to improve the user-friendliness in our script language itself. Therefore we try to take the good practices that has been introduced in our other games and integrate them to all of our titles. One of the later additions that we’ve ported over is scripted effects and triggers which function is that you can basically macro that can be referenced in the various script files of the game that will execute a whole block of an effect or a trigger respectively.

An example of this could be that you might want to show one event option for Germany's neighbors that they are not in a faction with and a different event option for the rest of the world. This could be a common occurrence for all of your events and this would require all of those event options to have the following trigger:

Code:
any_neighbor_country = {
    tag = GER
}

NOT =  { is_in_faction_with = GER }
This could instead be created as a scripted trigger which we would define in the scripted_triggers folder in the game files as the following:

Code:
is_neighbor_not_in_german_faction = {
    any_neighbor_country = {
        tag = GER
   }

   NOT =  { is_in_faction_with = GER }
}
Which could then be referenced in the different event option triggers as a one-line trigger (is_neighbor_not_in_german_faction = yes) in place of the multiple lines previously required.

As commonly used combinations of triggers and effects grow increasingly complex this script feature has two big functions. Firstly in that it decreases the amount of code duplication that would otherwise have been needed. And secondly it will also make the code easier to maintain since when you find yourself in the position that you have to change something in your common conditions for your events you could just add it inside the scripted trigger and just have to update one place instead of having to find all of the different places that would need to be updated.

Another great addition to the script language is the functionality of defining a particular scope as an event target inside an event or event chain, this feature has seen great usage in the script language of Crusader Kings II which always had an overload of scope changes.

The event targets makes it easier to reference different provinces and nations in the event text and execute effects on the correct targets without the need to have a huge amount of hidden bounce events to get the event scopes to evaluate correctly and keep track of different actors or locations. And if you want to get really creative you can try to combine these two script features and define event targets which you then use inside your scripted trigger or effect to have it act as a sort of sub-routine.

The AI
The AI in HOI3 was run though Lua scripts, but we decided to abandon these for several reasons in HOI4 (lack of lua knowledge at the company and low performance was the big ones). The AI is still however very moddable and has a lot of scripts to modify. I think its best to wait and talk about that in the dedicated dev diary on AI stuff I'll make @SteelVolt write before release though :)

Next week we'll have @Sideburnout talk about all things 2D art and interface for HOI4. See you then!

p.s whoever makes a Battletech mod first will forever live on in my heart.
 
Last edited:
  • 174
  • 162
  • 2
Reactions:
finaly! how it will be with mod support from paradox? helping with understanding mechanics or helping with modded events and AI?

There may be plans to expand the mod support team, but I can't confirm anything.
If it does happen I will most likely be primary support for HOI4 and happy to help with pretty much anything. My hope is obviously that our awesome community will guide new modders and help with understanding the mechanics so I can focus on adding new features.
One thing is certain. We will do what we can to support the mod community, something this DD should speak to =)
 
  • 16
  • 14
Reactions:
  • 27
  • 25
Reactions:
  • 9
  • 3
Reactions:
  • 23
  • 7
Reactions:
-Do the carrier based versions of the planes have different stats/ values/ (profiles), or are they at least moddable? Means have they a different unit file? (Same for tanks)
-Also do the TD/Sp-Arty/ AA variants of tanks have different unit files?
I think this may have been answered, but just to be sure... Yes they have a different profile and you can add, remove or change them as you please.

Podcat, any chance to see the "change_tag" effect in HOI IV?
Do you mean changing to play as a different nation? Yes that's in there. change_tag_from
 
  • 14
  • 2
Reactions:
OS looks like Unity/Ubuntu to me. Is @podcat using Linux on his main workstation?
Code:
$ cat os.log
[1939.10.6] (PDC) "Podcat" was puppeted by (GNU) "GNU's Not Unix!"
[1939.10.6] (PDC) "Podcat" changed name to (PDC) "Podnix"
 
  • 7
  • 2
Reactions:
Does this mean even I, someone with no modding experience, could mess around with stuff and make an actual mod if I wanted???
It means that:
*If you do not have any modding experience: It will be easier to begin.
*For more advanced modding: You still will need to know a lot of hoi4 specific text editing and formats of different textures/pictures etc.

What we want by doing this is to try and lower the threshold for start modding the game, just as in a OS you will have better and more control by editing everything in external editors specific for that fileformat.
But if you do not need the "full" control or just want to get started without the need to know everything at once, we provide this alternative.
 
  • 12
Reactions:
This is probably pushing it but what about portraits and art? Will there be anything to aid us in adding flavour content to the game?
We missed this in this dev diary, but I think @Sideburnout will give a take on that in the next dev diary about 2d or we will get back to it before release.
But overall is that you can mod everything in the GUI (both layout and pictures) as it is, that is: nothing is hidden so you cannot hook in more things (in most cases), but you are free to remove and redesign everything you can see (with some limits).

And we also have something called country specific art/localization that will be hooked in depending on the tag of the country, so if you add tag "RMS" as country the different systems will look for the "RMS_" prefix for files and objects in certain cases, ofcourse backrolling to a default if it cannot find it.
 
Last edited:
  • 10
Reactions:
I thought so! I've often wanted to learn more advanced modding but never really got into it because it was daunting, so hopefully this system provides an incentive and a means to get into it finally. Helps that this releases in the Summer.
Well depending on what you want to do I believe that all the tools and extra logging/sanity checking with the "-debug" flag will do the life easier for all modders despite experience level, remember that you do not have to use the "Nudger tool" if you do not want
 
  • 3
Reactions:
Is it also possible to mod the air regions and sea zones you can choose for your naval and air attacks with this tool?

F.e I want to make them all a Little bit smaller and get more?
Yes :)

@podcat

--- Do you know for certain, or can you estimate if it's possible to add new resource types to the map, trade tab, and production (unit & building cost)? Though it appears there isn't room in the interface to add anything, I'm wondering if it's soft coded and in theory--moddable?

Yes no problem but you will need to mod the trade gui to look nice if you add more (probably just add scroll)

One question, if it wasn't asked before - what are the opportunities with this modding tool for creating so-called "Language packs" or unofficial translations? I know it should be possible but - will it be easier too?
You can do this with simple text files. Its pretty easy as well because you can reload text ingame to see if it fits etc

Is it possible to modify a nation's division template by event? For example, can I cause a nation's infantry divisions to go from square (four regiments) to triangular (three regiments) by event? Can we cause specific divisions (by division name) to change their template by event? And can we change a division's name without losing experience? For example, can I cause the "SS-Division (mot.) Leibstandarte SS Adolf Hitler" to morph into the "1. SS-Panzer-Division Leibstandarte SS Adolf Hitler"?
You can add more templates , like a smaller but not change existing or change what templates some units use. Understand that player might have several different templates for infantry or armor so there wouldnt be a way of targeting the right one.

@podcat

1) how complicated will it be to created new interfaces? (Something like adding espionage into the game?) are there default panels that can be filled in easily? are there some blanks that can be used for this purpose?

2) is it easy to expand the focus tree? let's say I want to add an additional branch beside just encryption and decryption....
rom reading that everything is soft coded would make sense those are links and extra links can be created, but just want to be certain (and that UI improves visually as well)
1. You cant make completely new interfaces but you can modify old. Adding espionage screen is not something a modder could do as it would be new features
2. Yeah very easy

So if you load US tank mod and German tank mod no1 would get hurt.
But if you load 'Japan tank mod' + 'Japan events' + 'Japan tech trees'
...
things may not go as planned 'cos they all try to modify the same file.

You can specify mod and dlc dependencies so stuff is loaded in the correct order

He means something like this:

GER change_tag_to HRE

Where all references to GER now reference HRE, including name, flag, parties, foreign relations, factions, techs and so on. Such a change would also invalidate Germany's special decisions and events (no more Anschluss decision, for example, if the HRE tag does not have one).

Similar to the Dual Monarchy Decision for Austria in Vic2. When you fire it, Austria becomes Austria-Hungary. She keeps relevant cores, changes parties, names, flag, keeps her techs, loses access to Austria's special decisions but gains Austria-Hungary's special decisions.

If actual tag switching is not possible (due to tech tree/NF issues), could we at least have name and flag changes possible through events/NFs/decisions?
We only have limited stuff like that unfortunatly so you need to hack around with events. Its something i would like to improve but its very technically difficult. We spent a week on suppoting dynamic tag changes but atm its much too unstable. I hope we can sort it out in the future. Just flag change is easier i guess.

When using debug mode, will be be able to see an event's ID number? Just like the province ID?
Yes

Are we able to add new diplomatic actions into the game (like Offer Alliance, Improve Relation, etc.). That was something I really wanted in EU4, and it would be great if this could be in HOI4.
No, cant add more as thats hard coded. They would be too difficult to make scriptable with all their special rules
 
  • 17
Reactions:
Oooh, nice. are those country specific hooks mainly for units, or are they potentially for things like tech/UI as well? No need to answer, but interested if you can/feel like it :).
They are used a bit here and there but mostly for graphical appearance and text. That is interface textures and naming, the purpose of it is to have different flavor of things that are the same for each country gameplay wise.
Ex:
* Naming and textures used for techtree interface are using the system for both of them for appearance.
* The construction system do not use it as it is but it has support for it at least when it comes to naming, you could easily rename the generic "Trade Goods" for GER (and germany only) to "Sauerkraut" just by adding something like 'GER_TRADE_GOODS: "Sauerkraut"' (where default 'TRADE_GOODS: "Trade Goods"') in the localization files.
etc...
I'm almost more excited about that -debug flag than I am about all the other modding features combined. Praise be to whoever is/are responsible for it making it out to modders :).
Hahaha It is a team effort, we all agreed that moddability should always be one of the main focuses (if/when possible) when designing the different systems.
 
  • 8
Reactions:
That's pretty cool - thank you very much for the extra info :). So, if I get this right, we could have Aluminum for the USA and Aluminium for the UK? ;) (suggestion partly a joking reference to discussion of which spelling to use for it from a DD a ways back :) ).
In theory yes, trade goods are a pseudo resource (loss of civilian production) so I cannot say if the "material" resources are country specific right now... But that is a <5min fix if they are not O;)
 
  • 2
Reactions:
For the love of all things Holy and Demure, @podcat, let us have this tool for EU4!!!

And even CKII if possible!

I do believe that these things are possible due to updates to Clausewitz. Since those games run an older version of the engine, I don't think it will be possible. Sorry! But maybe (hopefully?) I'm wrong though.

So if that is implemented, that means that if for instance I don't like the 3d model for one of the Fokker airplanes, I can go to the workshop to see if a modder has made a modder Fokker to replace it?

That would be the idea, yes.

I'm sorry I have to ask
I'm no modder but am I to understand correctly that modders will be able to create their own worlds? Their own continents, their own oceans similar to that of City Skylines?

As answered before, that has always been possible in our games (check out the modding sections for CK2 and EU4 :))
 
  • 6
Reactions:
Status
Not open for further replies.