Environments

Environments are a special set of properties that affect the gameplay in several ways. The most common way they are used is to show background behind characters during dialogue. For instance, in Taodal, every area (map overview, the market, the tavern, etc.) is a separate environment.
However, there is another, no less important function of environments. Every blob you step on on the world map as you traverse it has a defined environment that controls what happens when you step on it. For instance, the Sejan lake blob will always offer you to start the connected encounter dialogue. On the other hand, most of Sejan blobs are used for random animal encounters where most of the time nothing happens, but sometimes the player finds themselves face to face with a creature.
Currently, implementing environments is somewhat limited to improving dialogues. You can create new ones, use them in dialogues and edit the game's map files to add new blobs or edit existing ones, but map editing is slightly clunky and unsupportive of modding (mods colliding with each other).
==File structure==
Environments are stored in, you guessed it, the environments folder under database in the game's installation folder. Each environment has its own folder and it contains only a handful of files.
File 	Description
stats.txt 	Text file with properties of the environment including its encounters, messages and whether it's interior or exterior.
env.png 	One of two pictures of the environment, placed as a bottom layer that's affected by time of day lighting changes. If transparent, sky appropriate to the time of day and random clouds are rendered behind it. Use 2560x1440 PNG files.
env_mask.png 	The other picture used for showing the environment. If it exists, it is rendered over env.png and is not affected by time of day lighting. Useful for interiors and exterior lighting sources to keep their colour no matter the in-game time. Use 2560x1440 PNG files.
env_night.png, env_night_mask.png	The same as the two above, but automatically switched to at night. They're used in the exact same way as the daytime images, but they're completely optional. If nighttime images are not present in the environment folder, the daytime images are used instead.
==Stats file==
The stats file contains the following attributes that, unless stated otherwise, don't have to be specified:
Property: value 	Description 	
interior: (yes/no) 	Specifies how characters are tinted. If set to no, the daytime lighting is applied, if set to yes, the ambient_color and ambient values are used for the colour and intensity respectively. Always specified. 	
ambient_color: (hex RGB) 	Colour of interior ambient tinting on character sprites. 	
ambient: (float 0.0 to 1.0) 	Intensity of interior ambient tinting on character sprites from 0.0 to 1.0 using the multiply blend mode. 	
discoverable: (yes/no) 	If yes, the environment is marked on your map upon discovery and the player is asked whether or not they want to enter the area via a message box. (Example: Taodal, Sejan lake, Sejan cave)
If no, the environment is not labeled and any encounters happen automatically. Used for most map blobs to create random monster encounters. (Example: Sejan forest, Sejan beach) 	
discovery_message: (string) 	Text displayed upon discovery if discoverable is set to yes. No quotes or parentheses are needed around the string, type the text directly after the colon. 	
default_message: (string) 	Text displayed upon repeated visit if discoverable is set to yes. 	
(dialogue functions)} 	Since v2.10, defining a list of encounters has been changed to use the same format character dialogues do. This allows creators to use various functions independent of an actual encounter.
For simple encounters (like Sejan gate or Sulie), only a start_encounter (environment) (character) function is needed in the index that's always named encounters.
For picking from multiple encounters, curated_list (type) is needed. Curated list makes use of player choices and can be modified with //showif and //hideif conditions. To not trigger an encounter in a list, use [0] (akin to the simple 0 in the old format).
Don't forget to use block dividers	to prevent possible errors!
<SOUNDS (file.int 0 to 100) SOUNDS> 	List of ambient sounds played over each other (like separate wind and chippering birds loop) followed by a period and a number specifying the sound's volume, ranging from 0 to 100. 	
<ENCOUNTERS (character / 0) ENCOUNTERS>	DEPRECATED IN V2.10! Use the dialogue format above instead.This item is here only for reference purposes for v2.4 and older.List of encounters (character files or 0 for nothing) that can happen on the map blob. Place each one on a new line, the game chooses randomly from the list. For 100% discoverable locations, use only a single encounter. Some, like the hidden boat, use a mix of their respective encounter and 0s to create a random chance to discover the location.	
==Examples==
This is the Sejan pond stats file, serving as a simple example:
 interior:		no
 
 discoverable:		yes
 dicovery_message:	You have found a pond with a waterfall.
 default_message:	Do you want to stop by the pond?
 
 ||>>ENCOUNTERS
 {encounters | start_encounter sejan_pond sulie} Sulie encounter
 ||
This is the Sejan forest (with Braq stalagmites) stats file that shows how random encounters are specified in the game. [0] signifies no action.
 interior:	no
 
 <SOUNDS
 sejan/forest_birds.45
 sejan/forest_wind.30
 SOUNDS>
 
 ||>>ENCOUNTERS
 {encounters | curated_list random}
 [ | start_encounter sejan_forest_stalagmites braq_m] 
 [ | start_encounter sejan_forest_stalagmites braq_f] 
 [0] 0
 [0] 0
 [0] 0
 [0] 0
 [0] 0
 [0] 0
 [0] 0
 ||
This example of the Sejan forest tiles uses the old encounters list feature. Don't use this in your submissions, it has been removed in v2.10!
 interior:	no
 
 <ENCOUNTERS
 0
 0
 0
 0
 0
 sejan_rusty_spearheads
 sejan_rusty_spearheads
 sejan_rusty_spearheads
 sejan_rusty_spearheads
 sejan_rusty_spearheads
 0
 0
 0
 0
 0
 0
 0
 0
 cuoxur_f
 cuoxur_m
 0
 0
 0
 0
 0
 poh-ack_f
 poh-ack_m
 0
 0
 0
 0
 ENCOUNTERS>
Category:Modding and development