Post feature RSS Darkest Hour - Dev Diary #14 - Modding with Darkest Hour Part 4

Darkest Hour is very moddable. Part four of this dev diary shows you in what ways.

Posted by on

Darkest Hour - Dev Diary #14 - Modding with Darkest Hour Part 4

Follow us on:

First of all, today we're going to talk a bit more about syntax and rules for decisions, as many fans expressed their interest in this subject.

As we've already discussed in Dev Diary 12, on the left side of the screen we introduced a new list which contains the available decisions that the player can evaluate and eventually take. From the point of view of the code, a decision is a normal event with two new sections:
- decision = { ... insert normal triggers here ... } : if these triggers are fulfilled the decision appears in the decision list for the human player;
- decision_trigger = { ... insert normal triggers here ... } : if these triggers are fulfilled the decision can be taken by the human player;
When the decision is taken, it fires as a normal event and can always be canceled. In the latter case the event isn't registered as fired and the decision remains active in the decision list and can be taken again at a later date (if the conditions in the decision_trigger section remain fulfilled). Please beware that for AI nations decisions are treated as events, this means that only the usual trigger = { ... } section is checked! This means that all three sections (decision = {...}, decision_trigger = {...} and trigger = {...} ) must be correctly compiled to make the decision work. Moreover, the decisions appear and can be taken only during the chosen date-deathdate interval, so that part of the code must always be compiled too!

Here are more technical informations on decisions:
- there is a new modifier in misc.txt (“mod” section) to enable or disable decisions: #Enable decisions for players. 0 - Disabled, 1 – Enabled ;
- decisions are hidden until all triggers in decision = { } section are fulfilled;
- decisions become available for selection when all triggers in decision_trigger = { } section are fulfilled;
- once selected, the decision fires as regular events via standard event window with all the usual information and actions on it plus the possibility to cancel the decision;
- decisions are logged in event history as regular events;
- the decisions list is populated on game start and updated daily;
- usually the tooltip on the decision displays the description of the event, but optionally it is possible to insert a specific text: decision_desc = "....";
- a new kind of pictures is introduced, to be used in the decision list: decision_picture = "picture_name.bmp" (if none if chosen, a generic picture is loaded by default - gfx\event_pics\decisions_empty.bmp);

Another important change introduced by Darkest Hour is the export of the effects of policy slider to a new file, db\policy_effects.csv.
This file allows complete control over the effect of policy sliders and is a very powerful tool. Here's a list of the possible effects that are associated to slider position:

MODIFIER_COUNTER_INTEL - used for units detection
MODIFIER_REL_NORMALIZATION: applied each 6th day
MODIFIER_INTELLIGENCE - used as extra spy level in distance calcs

This allows the modders to customize the policy slider. We might talk about what we've done to one on these slider in another Diary.

To close this DD, let's review other changes related to modding that we introduced:
- Enabled unlimited unit models (was fixed to 10). To use just add a new model = {….} entry in the respective txt file in “units” folder. As a bonus this change will decrease loading time and memory usage for unit types that use less then 10 models.
– Added new (optional) parameter for units: max allowed brigades. This overrides default hard-coded values. Add to division files in “\db\units\divisions”. Format: max_allowed_brigades = X. Currently it is allowed to have up to 5 brigades for naval units and up to 1 brigade for land and air units.
- new country IC modifier - wartime_ic_mod. Works like peacetime_ic_mod, but when at war;
- new adjustable reaction of puppets when not-allied master is at war: puppets with neutrality 150+ (set in misc.txt ) that are not allied to their master will not join automatically master’s wars anymore

* Puppets should join Master's war if AI Neutrality is equal or greater then THIS. Note: this works only if puppet is not part of
Master's alliance! 0 = always join Master's wars 150 #0

- new modifiers in misc.txt (“mod” section) to handle the spawning of rebel units:

* Rebels army composition - chance for infantry over militia. 0 - only militia, 100 - only infantry, 50 - 50%/50% and so on.
* Rebels army tech level (based on the available model in the country that controls the province). -1 - Only model 1, 0 - Only
the Latest model, else random model in the range from (latest model - THIS) to (latest model).

– Allowed (optional) unique province capital/city icons. Gfx\map\city_PROVID.bmp (city_55.bmp for Paris and so on).
– Added optional fonts support for each language. Fonts are expected to be found in \gfx\fonts\X folder where X is the language set in settings.cfg (0 – ENG … 5- Polish). If not found in numbered folder fonts are read from fonts default location (\gfx\fonts\).
- All minister modifiers are moved to a moddable file (db\ministers\minister_personalities.txt). Moddable effects:

* Leader skill
* Research time – per tech or for all
* Research cost – per tech or for all
* Resource production bonuses – oil, energy, metal, rare materials, money
* Production bonuses – foreign IC, national IC, reinforce, upgrade, consumer goods, supplies
* Units – build time, build cost, attack bonus, defense bonus, morale (org. regain), organization
* Brigades - build time, build cost, attack bonus, defense bonus, morale (org. regain), organization
* Land unit speed
* Belligerence – required for DoW, wartime and peacetime
* Transport capacity modifier
* Provincial buildings (IC, coastal and land forts, flak, infrastructure, air and naval bases, radar stations, nuclear
reactors and rocket test sites) time and cost
* Detection – naval, land and convoy
* Dissent
* Manpower growth – total and non-national
* Supply consumption
* Spying networks bonus – intelligence (home) and counterintelligence (foreign). Limited up to 5% each!
* Intelligence reports accuracy – land/air units, navy/convoys and production/research. Values from -10 to 10
* Diplomatic action chances – trade (used also for trade agreements), alliance (offer, join and bring), non-aggression pact, demand territory, ask for military access, sue for peace (insist on demands, white and beg for peace), assume military
control and influence
* Diplomatic action chances extra modifiers – weak target (Total IC is less then ½), same alignment, opposite alignment,
democracies, dictatorships, close government type (difference +/- 2)
* Diplomatic action cost for each action. The final value can be no less then 0.0
* Diplomatic action cost extra modifiers – weak target (Total IC is less then ½), same alignment, opposite alignment, democracies, dictatorships, close government type (difference +/- 2), national (actions against us: cost modifier = 1 +  Sender’s modifier + Target’s modifier).
* Convoy transports and escorts build time and cost (using transport ships and destroyers modifiers)
* Intelligence mission cost for each mission – 2 modifiers: for sender and for target (Final cost modifier for a mission = 1 +
Sender’s cost modifier + Target’s defense cost modifier). The final value can be no less then 0.0
* Intelligence funding and maintenance cost modifiers
* Intelligence mission chances for each mission – 2 modifiers: for sender and for target (Summary chance for a mission = Sender’s modifier + Target’s defense modifier)
* Stockpile - modifiers on stockpiles limit: which = industry / supplies (used for oil too) / all (default); when = war / peace / all (default); value = x.xxxx

See you next week!

Darkest Hour Screenshot

Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.