From ba41861325d8657cdb333bf112afda762cefc7db Mon Sep 17 00:00:00 2001 From: Evgeniy Moiseenko Date: Sun, 10 Oct 2021 21:28:38 +0300 Subject: [PATCH 01/52] Added structure for translation into Russian --- docs/config.toml | 3 + .../Asset Browser/FilterQueries.md | 20 ++ .../Asset Management/Asset Browser/_index.md | 8 + .../Asset Management/Asset Types/_index.md | 7 + .../Asset Types/animations.md | 187 ++++++++++ .../Asset Types/asset_naming_conventions.md | 89 +++++ .../Asset Management/Asset Types/bodies.md | 35 ++ .../Asset Management/Asset Types/materials.md | 8 + .../Asset Management/Asset Types/meshes.md | 14 + .../Asset Types/overriding_assets.md | 88 +++++ .../Asset Types/overriding_scenes_prefabs.md | 18 + .../Asset Management/Asset Types/path.md | 7 + .../Asset Management/Asset Types/prefabs.md | 18 + .../Asset Management/Asset Types/scripts.md | 19 + .../Asset Management/Asset Types/skeletons.md | 5 + .../Asset Management/Asset Types/textures.md | 11 + .../russian/Asset Management/_index.md | 7 + docs/content/russian/Asset Management/faq.md | 42 +++ ...generating_and_loading_ui_sprite_sheets.md | 220 ++++++++++++ .../horse_reins_simulation_creation.md | 61 ++++ .../how_to_add_custom_fonts.md | 153 ++++++++ .../quickguide_create_a_mod.md | 30 ++ .../bannerlord_destructible_component.md | 103 ++++++ .../Script Components/callbacks.md | 45 +++ .../scene_barrier_builder.md | 30 ++ .../scene_spawn_points_guide.md | 142 ++++++++ .../spawn_point_debug_tool.md | 49 +++ .../Authoring Mission Scenes/_index.md | 7 + .../Authoring Mission Scenes/sieges.md | 334 ++++++++++++++++++ .../tactical_positions.md | 107 ++++++ .../Authoring Mission Scenes/villages.md | 205 +++++++++++ docs/content/russian/BestPractices/_index.md | 7 + .../BestPractices/scene_performance_guide.md | 46 +++ .../BestPractices/sealed_class_extension.md | 67 ++++ .../BestPractices/xslt_usage_tutorial.md | 32 ++ .../russian/Editor/Resource Editors/_index.md | 7 + .../Resource Editors/cloth_simulation.md | 125 +++++++ .../Resource Editors/material_editor.md | 148 ++++++++ .../Resource Editors/meta_mesh_editor.md | 25 ++ .../Editor/Resource Editors/mipmap_editor.md | 19 + .../Editor/Resource Editors/model_viewer.md | 47 +++ .../Resource Editors/skeleton_editor.md | 57 +++ .../russian/Editor/Scene Editor/_index.md | 7 + .../Scene Editor/alignment_and_snapping.md | 78 ++++ .../Editor/Scene Editor/creating_entity.md | 62 ++++ .../Editor/Scene Editor/distance_tool.md | 22 ++ .../Editor/Scene Editor/editor_shortcuts.md | 69 ++++ .../Editor/Scene Editor/entity_inspector.md | 61 ++++ .../Editor/Scene Editor/level_system.md | 61 ++++ .../Editor/Scene Editor/mass_selection.md | 16 + .../russian/Editor/Scene Editor/nav_mesh.md | 221 ++++++++++++ .../Editor/Scene Editor/nav_mesh_inspector.md | 81 +++++ .../Editor/Scene Editor/path_editing.md | 16 + .../russian/Editor/Scene Editor/prt.md | 85 +++++ .../Editor/Scene Editor/terrain_creation.md | 33 ++ .../Editor/Scene Editor/terrain_mesh_blend.md | 39 ++ .../Editor/Scene Editor/terrain_resize.md | 22 ++ docs/content/russian/Editor/_index.md | 7 + .../Playing Sounds/Adding Custom Sounds.md | 82 +++++ docs/content/russian/Playing Sounds/_index.md | 7 + docs/content/russian/_footer.md | 0 docs/content/russian/_header.md | 3 + docs/content/russian/_index.md | 17 + 63 files changed, 3641 insertions(+) create mode 100644 docs/content/russian/Asset Management/Asset Browser/FilterQueries.md create mode 100644 docs/content/russian/Asset Management/Asset Browser/_index.md create mode 100644 docs/content/russian/Asset Management/Asset Types/_index.md create mode 100644 docs/content/russian/Asset Management/Asset Types/animations.md create mode 100644 docs/content/russian/Asset Management/Asset Types/asset_naming_conventions.md create mode 100644 docs/content/russian/Asset Management/Asset Types/bodies.md create mode 100644 docs/content/russian/Asset Management/Asset Types/materials.md create mode 100644 docs/content/russian/Asset Management/Asset Types/meshes.md create mode 100644 docs/content/russian/Asset Management/Asset Types/overriding_assets.md create mode 100644 docs/content/russian/Asset Management/Asset Types/overriding_scenes_prefabs.md create mode 100644 docs/content/russian/Asset Management/Asset Types/path.md create mode 100644 docs/content/russian/Asset Management/Asset Types/prefabs.md create mode 100644 docs/content/russian/Asset Management/Asset Types/scripts.md create mode 100644 docs/content/russian/Asset Management/Asset Types/skeletons.md create mode 100644 docs/content/russian/Asset Management/Asset Types/textures.md create mode 100644 docs/content/russian/Asset Management/_index.md create mode 100644 docs/content/russian/Asset Management/faq.md create mode 100644 docs/content/russian/Asset Management/generating_and_loading_ui_sprite_sheets.md create mode 100644 docs/content/russian/Asset Management/horse_reins_simulation_creation.md create mode 100644 docs/content/russian/Asset Management/how_to_add_custom_fonts.md create mode 100644 docs/content/russian/Asset Management/quickguide_create_a_mod.md create mode 100644 docs/content/russian/Authoring Mission Scenes/Script Components/bannerlord_destructible_component.md create mode 100644 docs/content/russian/Authoring Mission Scenes/Script Components/callbacks.md create mode 100644 docs/content/russian/Authoring Mission Scenes/Script Components/scene_barrier_builder.md create mode 100644 docs/content/russian/Authoring Mission Scenes/Script Components/scene_spawn_points_guide.md create mode 100644 docs/content/russian/Authoring Mission Scenes/Script Components/spawn_point_debug_tool.md create mode 100644 docs/content/russian/Authoring Mission Scenes/_index.md create mode 100644 docs/content/russian/Authoring Mission Scenes/sieges.md create mode 100644 docs/content/russian/Authoring Mission Scenes/tactical_positions.md create mode 100644 docs/content/russian/Authoring Mission Scenes/villages.md create mode 100644 docs/content/russian/BestPractices/_index.md create mode 100644 docs/content/russian/BestPractices/scene_performance_guide.md create mode 100644 docs/content/russian/BestPractices/sealed_class_extension.md create mode 100644 docs/content/russian/BestPractices/xslt_usage_tutorial.md create mode 100644 docs/content/russian/Editor/Resource Editors/_index.md create mode 100644 docs/content/russian/Editor/Resource Editors/cloth_simulation.md create mode 100644 docs/content/russian/Editor/Resource Editors/material_editor.md create mode 100644 docs/content/russian/Editor/Resource Editors/meta_mesh_editor.md create mode 100644 docs/content/russian/Editor/Resource Editors/mipmap_editor.md create mode 100644 docs/content/russian/Editor/Resource Editors/model_viewer.md create mode 100644 docs/content/russian/Editor/Resource Editors/skeleton_editor.md create mode 100644 docs/content/russian/Editor/Scene Editor/_index.md create mode 100644 docs/content/russian/Editor/Scene Editor/alignment_and_snapping.md create mode 100644 docs/content/russian/Editor/Scene Editor/creating_entity.md create mode 100644 docs/content/russian/Editor/Scene Editor/distance_tool.md create mode 100644 docs/content/russian/Editor/Scene Editor/editor_shortcuts.md create mode 100644 docs/content/russian/Editor/Scene Editor/entity_inspector.md create mode 100644 docs/content/russian/Editor/Scene Editor/level_system.md create mode 100644 docs/content/russian/Editor/Scene Editor/mass_selection.md create mode 100644 docs/content/russian/Editor/Scene Editor/nav_mesh.md create mode 100644 docs/content/russian/Editor/Scene Editor/nav_mesh_inspector.md create mode 100644 docs/content/russian/Editor/Scene Editor/path_editing.md create mode 100644 docs/content/russian/Editor/Scene Editor/prt.md create mode 100644 docs/content/russian/Editor/Scene Editor/terrain_creation.md create mode 100644 docs/content/russian/Editor/Scene Editor/terrain_mesh_blend.md create mode 100644 docs/content/russian/Editor/Scene Editor/terrain_resize.md create mode 100644 docs/content/russian/Editor/_index.md create mode 100644 docs/content/russian/Playing Sounds/Adding Custom Sounds.md create mode 100644 docs/content/russian/Playing Sounds/_index.md create mode 100644 docs/content/russian/_footer.md create mode 100644 docs/content/russian/_header.md create mode 100644 docs/content/russian/_index.md diff --git a/docs/config.toml b/docs/config.toml index 75493e0..497a96d 100644 --- a/docs/config.toml +++ b/docs/config.toml @@ -17,6 +17,9 @@ enableMissingTranslationPlaceholders = false [languages.zh_cn] contentDir = "content/schinese" languageName = "简体中文" + [languages.ru] + contentDir = "content/russian" + languageName = "Русский" # Add more languages here diff --git a/docs/content/russian/Asset Management/Asset Browser/FilterQueries.md b/docs/content/russian/Asset Management/Asset Browser/FilterQueries.md new file mode 100644 index 0000000..30ad53a --- /dev/null +++ b/docs/content/russian/Asset Management/Asset Browser/FilterQueries.md @@ -0,0 +1,20 @@ ++++ +title = "Filter Queries" ++++ + + +------------------ + +You can use sql syntax to search for assets with specific properties like textures whose resolutions are greater than 1024. +To do this you need to enable query mode from extras menu : +![](/img/asset_browser/extras_icon.png) + +From the Texture Inspector (Right Panel), you can enable/disable MipMap blending by toggling Use Mipmap Blending checkbox. +When you enable MipMap Blending, you will see all mip levels of the selected texture next to each other in Preview Window. +![](/img/mipmap_editor/tex_editor_post_mip.PNG) + +Clicking on MipMap Blend Amounts will open a new window where you can adjust blend amounts for every mip level. +![](/img/mipmap_editor/mipmap_blend_window.PNG) + +Then you can select MipMap Blend Color (1) and click Recompile (2) button to apply blending. The result will be immediately visible in Preview Window and also in Game. +![](/img/mipmap_editor/tex_editor_compiled.PNG) diff --git a/docs/content/russian/Asset Management/Asset Browser/_index.md b/docs/content/russian/Asset Management/Asset Browser/_index.md new file mode 100644 index 0000000..683362d --- /dev/null +++ b/docs/content/russian/Asset Management/Asset Browser/_index.md @@ -0,0 +1,8 @@ ++++ +title = "Asset Browser" +description = "" +weight = 1 ++++ + +Asset browser shows assets +5256+2+56 \ No newline at end of file diff --git a/docs/content/russian/Asset Management/Asset Types/_index.md b/docs/content/russian/Asset Management/Asset Types/_index.md new file mode 100644 index 0000000..417c1e1 --- /dev/null +++ b/docs/content/russian/Asset Management/Asset Types/_index.md @@ -0,0 +1,7 @@ ++++ +title = "Asset Types" +description = "" +weight = 1 ++++ + +{{%children style="h5" description="true"%}} \ No newline at end of file diff --git a/docs/content/russian/Asset Management/Asset Types/animations.md b/docs/content/russian/Asset Management/Asset Types/animations.md new file mode 100644 index 0000000..fbfa06f --- /dev/null +++ b/docs/content/russian/Asset Management/Asset Types/animations.md @@ -0,0 +1,187 @@ ++++ +title = "Animations" +description = "" +weight = 1 ++++ + +### Modding the Animation System + +#### Exporting Animation for Bannerlord + +##### Default Animation Settings + +* Frame rate: 30 FPS(Optimal) or 60 FPS +* Humanoid or Creature Skeleton(Rig) Settings +* Max supported bone count: 64 +* Bones that are not used should contain “_notused” at the end of the string. Also root bone (highest bone in the hierarchy) should contain this only for the animations. +![](/img/animation_system/image2.jpg) + +##### FBX export settings (Autodesk Maya) +These settings are applied to Maya. Similar kind of software might contain the same settings. When we export the new rig for the first time, the exported FBX file should contain the skeleton and the mesh. + +##### First time setup (Skeleton + Mesh) +![](/img/animation_system/image4.jpg) +![](/img/animation_system/image3.jpg) + +##### Exporting Animation Only Settings +We make sure to disable mesh and skin related options before we export the animations. ”Use scene name” is very important to check when exporting for both animations and rigs. Also make sure that the root bone contains “_notused” at the end of the string. +![](/img/animation_system/image6.jpg) + +We make sure that we don’t send any kind of “Constraints and Skeleton Definitions”. Constraints, Connections and Unit settings should be set as the image below. Our engine also uses the “Z” as the up axis. +![](/img/animation_system/image5.jpg) + +##### Defining New Animations +After exporting your animation, to reference it in the game, you need to add new animation clips from the resources browser which references that animation. To do so, you should use the "Animation Clip" button inside the " Create" parent build. Most important properties of these clips are: + +* id: ID(unique name) of the anim clip to be used in other systems +* source1: Start keyframe of the animation clip +* source2: End keyframe of the animation clip +* anim_data_name: The source animation resource that was imported to the engine for this clip +* duration: Duration of this animation clip in seconds + +A typical animation contains some optional attributes as well. Most common one is blend_in_period, which sets the duration for blending to the existing animation and reaching 100% weight. blend_out_period is the opposite of this blending, but it has an important difference. Blending out actually means that the animation ends earlier than the given duration, and the rest of the animation will only be used for blending out to another animation. But blend duration is only set by blend_in_period. Having a longer blend_out_period than the next animation’s blend_in_period doesn’t extend this blend duration. It just helps the blend to look smoother, since during that blend, if both animations play at the same time, it looks visually more appealing. An animation with 0 blend_out_period simply pauses during the blending to the next animation, and it causes a sudden stop/velocity change in bone rotations. + +An animation has several more optional attributes: + +* priority: Priority simply allows/disallows animations to be played as an interrupt while another animation is in progress. Higher priority animations are played over lower or equal priorities as interrupts. +* param1, param2, param3: Params are used in cases when the engine requires additional data. They may have quite different meanings. +* sound_code: Plays a sound when the animation is played. +* step_points: These are step points for sound. +* voice_code: Plays a voice when the animation is played. +* facial_anim_id: Morphs the face to this when the animation is played. +* left_hand_pose, right_hand_pose: These morph the hands to their values when the animation is played. +* combat_parameter_id: This gives an additional set of information to the engine (see combat_parameters.xml) +* blends_with_action: This attribute references another action (warning: action, not animation) to blend the animation with. This is valid only when the engine requires two animations to be blended with (i.e. shield blocking up/down, weapon swings requiring balanced and unbalanced versions etc.). +* continue_to_action: This attribute calls another action (warning: action, not animation) to be played soon after this animation is finished. Animation is considered to be finished always when the duration (blend_out_period) is reached. + +Animations usually contain two other nodes: flags and clip_usage_data. clip_usage_data is a common data pointer that may refer to blend_data, displacement_data, bipedal_movement_and_ik_data, and quadrupedal_movement_data. Their usage is mostly for specific cases and their details are out of this explanation’s scope. Flags are used for nearly all animations though and require some explanation. Possible flags that can be used for an animation are: + +* disable_agent_agent_collisions: Disables collisions between agents. +* ignore_all_collisions: Disables all collisions. +* Ignore_static_body_collisions: Disables collisions with static bodies. +* use_last_step_point_as_data: 4th step point is considered as data instead of a sound point. +* make_bodyfall_sound: Creates a fall sound when the body touches the ground. +* client_prediction: Prevents animations from being sent through the network. +* keep: Doesn’t end the animation when it is finished and keeps it as paused instead. +* restart: Forces the animation to start from the beginning if the same animation is already being played by that skeleton. +* client_owner_prediction: Prevents animations from being sent through the network only for the agents that are controlled by that client. +* make_walk_sound: Plays hardcoded walk sounds. +* disable_hand_ik: Prevents hand inverse kinematics to be applied during the animation. +* blends_according_to_look_slope: Allows animation to be blended with another animation according to the look slope, with this one being downward. +* synch_with_horse: Plays the animation without using its original duration, it instead matches the progress with the mount’s animation. +* use_left_hand_during_attack: Allows the combat system to check the left hand as the collider during an attack. +* lock_camera: Prevents players from controlling the camera during this animation. +* lock_movement: Prevents agents to move during this animation. +* synch_with_movement: Plays the animation without using its original duration, it instead matches the progress with the agent’s movement animations. +* enable_hand_spring_ik: Allows a spring-like inverse kinematics to be applied to hands for applying lower body movement’s forces on them. +* enable_hand_blend_ik: Allows inverse kinematics to try to keep the hands a bit at the starting location when this animation starts by blending the original position and the animation position. +* synch_with_ladder_movement: Plays the animation without using its original duration, it instead matches the progress with the agent’s movement on the ladder. +* do_not_keep_track_of_sound: Prevents engine from holding a reference to a sound when it is played. +* reset_camera_height: Reduces the additional camera height for this animation. +* disable_auto_increment_progress: Prevents the animation from being played and keeps it paused at the current progress instead. Progress might have to be set manually from the code. +* enforce_lowerbody: Prevents previous channel and movement animations to be played during this animation. +* enforce_all: Valid for channel 0 only. Prevents channel 1 and movement animations to be played during this animation. +* cyclic: Animation loops and never ends. +* enforce_root_rotation: Abdomen (root) rotation is taken from this animation instead of the previous channel or movement animation for internal calculations. +* allow_head_movement: Allows agent’s head to move according to look direction. +* disable_foot_ik: Disables foot inverse kinematics for this animation. +* affected_by_movement: Allows movement adder animations to be added on top of this animation to give a better shaky feeling. +* update_bounding_volume: Disables bounding box optimization, should be used when the agent moves outside its regular boundaries with this animation. +* align_with_ground: Aligns agent's frame with the ground during this animation. +* ignore_slope: Prevents quadruped agents to align with the ground during this animation. +* displace_position: Updates world position of the agent during the animation using the displacement data. +* enable_left_hand_ik: Forces the left hand to stay on this animation’s target frame even during blending with other animations using inverse kinematics. +* ignore_scale_on_root_position: Allows abdomen (root) position to stay at the same position with the original scale, allowing the agents to interact with objects better. +* randomization_weight: Randomizes the animation inside its alternative group with this value. Higher value allows the animation to be selected more frequently. + +##### Modifying/Adding New Actions +Agent animations are mapped to action sets as actions. In order to set a new animation to an existing action, first you need to define a new animation clip through the resource browser. Animation clips define the animation start and end seconds, FPS and various properties. Then you need to map it under action_sets.xml for the specific action set. If a new action is needed to be created, first you need to add it as a new line under action_types.xml, and then do the same steps above. + +Non-agent animations are not mapped as actions. For those, you just need to add the animation clips through the resource browser and then start using it in the code. + +Each action has several attributes. These attributes are hardcoded so that the engine can understand certain properties of the action. The attributes are: + +type (default: actt_other): + +* actt_other, +* actt_defend_fist, +* actt_defend_shield, +* actt_defend_forward_2h, +* actt_defend_up_2h, +* actt_defend_right_2h, +* actt_defend_left_2h, +* actt_defend_forward_1h, +* actt_defend_up_1h, +* actt_defend_right_1h, +* actt_defend_left_1h, +* actt_defend_forward_staff, +* actt_defend_up_staff, +* actt_defend_right_staff, +* actt_defend_left_staff, +* actt_ready_ranged, +* actt_release_ranged, +* actt_release_throwing, +* actt_reload, +* actt_ready_melee, +* actt_release_melee, +* actt_parried_melee, +* actt_blocked_melee, +* actt_fall, +* actt_jump_start, +* actt_jump, +* actt_jump_end, +* actt_jump_end_hard, +* actt_kick, +* actt_weapon_bash, +* actt_passive_usage, +* actt_equip_unequip, +* actt_idle, +* actt_guard, +* actt_mount, +* actt_dismount, +* actt_dash, +* actt_mount_quick_stop, +* actt_hit_object, +* actt_sit, +* actt_sit_on_the_floor, +* actt_ladder_raise, +* actt_ladder_raise_end, +* actt_rear, +* actt_strike_light, +* actt_strike_medium, +* actt_strike_heavy, +* actt_strike_knock_back, +* actt_mount_strike + +usage_direction (optional): + +* ud_attack_up, +* ud_attack_down, +* ud_attack_left, +* ud_attack_right, +* ud_defend_up, +* ud_defend_down, +* ud_defend_left, +* ud_defend_right, +* ud_defend_any, +* ud_attack_any + + +action_stage (optional): + +* as_attack_ready, +* as_attack_quick_ready, +* as_attack_release, +* as_reload_phase_1, +* as_reload_phase_2, +* as_defend, +* as_defend_parry + + +Using the modified actions is pretty straightforward, you just need to change the action to animation mapping under action_sets.xml and that will probably be enough. But if you want to create a new action, or create a new behavior for an existing action, possible ways of integrating it within the game would be: + +* Calling the action from the code: Agent class has the necessary functions to do that. For performance reasons, make sure to cache the index of the action using the ActionIndexCache class. +* Using it in movement_sets.xml: This file contains two sets: movement_sets and full_movement_sets. A movement_set contains all the animations required for a character to move in all directions in a single stance and state. A full_movement_set contains a group of movemen_sets in order to satisfy all stances and all states: walking, running, crouch walking and crouch running with left and right stances. Please keep in mind that crouch does not have a left stance, and as such some weapon usages enforce only right stance to be used in all cases (i.e. ranged weapons in Native). full_movement_sets contain their conditions as attributes: left_stance and movement_mode. +* Using it in item_usage_sets.xml: new combat actions should be given from here as long as they don't require a combat system change. Idle, guard, weapon usage, kick usage actions can be set from here for every item with certain conditions. In addition to that the actions defined under movement_sets.xml are also referenced from here. There are too many conditions and attributes for the usage_sets to explain them here, but the existing examples should help you understand how everything works. One important and not so straightforward detail is that, all of the usages defined here are traversed from top to bottom, and the first usage that satisfies the condition is used. So it is important to keep the usages that have more limits at the top of the list, and fallback usages at the bottom. +* Using it in monster_usage_sets.xml: Just like item_usage_sets.xml, this file contains possible actions that agents can do without depending on an item type. Those can be strikes, jumps, falls and mountings. For quadruped agents there are a few more possibilities: upper_body_movements, movements and movement_adders. This file requires a closer explanation, but its structure is similar to item_usage_sets.xml and the examples shown there should be self explanatory. Again for all cases, usages are traversed from the top and first usage that satisfies the conditions is used. Since the conditions vary a lot for different conditions of actions, sometimes a condition can be used outside of its meaning (i.e. meaning of is_heavy becomes a speed condition for quadruped falls and strikes). And some directions may not be applied for certain conditions (some actions check 4 directions, some check front_left and front_right instead of front, and some check only cross directions: front_left, front_right, back_left and back_right), so it is advised that you experiment a bit if you try to go beyond what the Native code gives you. For the full possible body_parts, please check bone_body_types.xml, which mainly holds some attributes for body parts related to combat collision checks. + diff --git a/docs/content/russian/Asset Management/Asset Types/asset_naming_conventions.md b/docs/content/russian/Asset Management/Asset Types/asset_naming_conventions.md new file mode 100644 index 0000000..32aa4b1 --- /dev/null +++ b/docs/content/russian/Asset Management/Asset Types/asset_naming_conventions.md @@ -0,0 +1,89 @@ ++++ +title = "Naming Conventions" +description = "" +weight = 1 ++++ + +To distinguish and organize assets and simplfy asset authoring process there are some predefined rules to consider. + +##### Meshes + +All meshes imported from a single geometry file(e.g. fbx) are grouped by their names. To add a LOD mesh simply append **".lod\"** to the name of your mesh. Here **n** is the number of lod. +Consider an fbx file as below : + +asset.fbx : + +- wall_damaged +- wall_damaged_v2 +- wall_damaged_v2.lod1 +- wall_damaged.lod1 +- wall_damaged.lod2 + +Two meshes will be imported from asset.fbx file : wall_damaged, wall_damaged_v2. These meshes will have one and two lods respectively. If your modelling software does not support dots in names(e.g. Maya) you can also use "\_" insted of "." to specifiy lods(e.g. wall_damaged_v2_lod1). +A mesh can not have more than one material so during import phase meshes wil be divided into submeshes according to material usages of polygons. Consecutive numbers will be appended to the names of these auto generated meshes. Consider a mesh **wall_damaged** using three different materials. Name of the imported mesh will be **wall_damaged** and it will have three submeshes with names **wall_damaged.1**, **wall_damaged.2**, **wall_damaged.3**. + +{{% notice info %}} +During mesh import, materials defined in geometry files are not created. You should create materials manually with the same name they are referenced from geometry files. +{{% /notice %}} + +##### Physics shapes + +You can export physics shapes just like regular meshes. The only difference between a mesh and a physics shape is that name of physics shapes begin with "bo_" prefix. You can also export analytical capsules and spheres as well. + +**Capsules** + +If name of a node begins with **"bo_capsule"** it will be imported as an analytical capsule shape. Sizes of this capsule is determined by following rules : + +- Local XY axes assumed as the radial plane of capsule +- Local Z axis assumed as the direction of capsule(height) +- Scale of object in XY directions should be equal + +Only orientation and extents of capsule nodes are used. Any content attached to them(like mesh) is ignored. + +**Spheres** + +If name of a node begins with **"bo_sphere"** it will be imported as an analytical sphere shape. Sizes of this sphere is determined by the extents of the node. Center of the node will also be the center of the sphere shape. +Only orientation and extents of sphere nodes are used. Any content attached to them(like mesh) is ignored. + +**Composite Shapes** + +You can combine different shape types to create more complex shapes. To export a composite shape you must create a node whose name begins with **"bo_composite"**. You can append child nodes with different shape types to this node. + +- bo_composite_building1 + - bo_capsule1 + - bo_capsule2 + - bo_sphere + - bo_building_walls + + This shape will be imported as a single asset with name **bo_composite_building1**. + +##### Textures + +You can provide basic hints for your texture by following by following these rules: + +- Albedo textures ends with _d +- Normal textures ends with _n +- Specular textures ends with _s +- Heightmap textures ends with _h + +Despite these rules are not obligatory, it will help engine to decide best compilation rules during first import and help some features of editor to work(e.g. auto completing normal texture slot of material). If your textures do not follow them you can change import settings later though. + +##### Skeletons + +Most of in-house assets are organized so that skeletons, meshes and animations using these skeletons are stored in separate files. So we follow some naming rules to correctly establish cross-references between these files. If you are also planning to import skeletons, meshes and animations from different files : + +- Bone hierarchy of skeletons must match +- Every bone node should have its name ending with a hardcoded bone number(e.g. _0, _1) to make sure skeletons originating from different files have their bone numbers match regardless of export process of your modelling software or exporting tool. There are these rules that each bone name must follow : + - Appended bone indices must start from zero + - Appended bone indices must not be greater than or equal to number of bones + - Two bones can not have same bone index + +{{% notice info %}} +If you want to export only skeleton related assets(e.g. skinned mesh or animation) but not the skeleton itself -which is the case if you have a file you imported your skeleton from and you regularly import new meshes for that skeleton from different files- you should append **_notused** to the name of skeleton to make engine automatically ignore it and import only other assets. +{{% /notice %}} + +Skeletons take their names from the root node of bone hierarchy in your geometry file. This is to let you name your skeletons something other than the name of root bone. If your root bone does not have a parent node, you can create a dummy node and make your root bone child of it. By renaming dummy node you will be able to rename your skeleton without affecting bone names. + +{{% notice info %}} +Some softwares automatically export animations with a predefined names(e.g. 3DS Max -> take_001). This will cause multiple skeleton animations to be imported with same name if you have more than one skeleton defined in your geometry file since engine interprets animation data defined for each skeleton as different assets. Because of this you will receive a **duplicate asset** warning. To avoid this it is best to export one skeleton per geometry file. You can also disable **animation import** from import settings of that file. +{{% /notice %}} \ No newline at end of file diff --git a/docs/content/russian/Asset Management/Asset Types/bodies.md b/docs/content/russian/Asset Management/Asset Types/bodies.md new file mode 100644 index 0000000..3b7a1ed --- /dev/null +++ b/docs/content/russian/Asset Management/Asset Types/bodies.md @@ -0,0 +1,35 @@ ++++ +title = "Bodies" +description = "" +weight = 1 ++++ + +Bodies define the physics boundaries of objects. They can be assigned to entities in scenes or prefabs. Users can edit the Body Flags to change their behaviour. + +##### Body Flags + +* Two Sided: Forces the physics engine to use both sides of the polygons for this body. +* AI Limiter: Used to tag bodies which will only used against AI agents, excluding the player. +* Destructible Door: Used by the automatic navigation mesh generator to not put nav mesh under destructable doors. +* Disabled: Disables the physics for this prefab or entity instance. +* Barrier: Enables smooth exit for agents exiting the interior of the body. +* Exclude Path Snap: Path points does not snap to these bodies. +* Don't Collide With Camera: Camera for the player does not collide with these bodies. +* Dynamic: Physics engine simulates the movement of this entity. +* Moveable: This flag indicates that this body and its owner entity can move. +* Ladder: Should be given to the ladder meshes so that they function properly. +* Has Steps: Should be given to the bodies of the staircases so that the agent can climb them correctly. (The body of the stairs should be seperated from the other parts of the entity). + +Agent physics require smooth and low poly physics objects for performance. Missile ones require more precision so that the stuck missiles are simulated better. The below flags can be used to have two different bodies per object which is the best of both worlds. If none of the flags are given, both missiles and agents react to the bodies. + +* Agent Only: Only the agents react into these bodies. +* Missile Only: Only the missiles react into these bodies. + + +##### Occluders + +Occluders are bodies which are placed at mesh surfaces to tell the rendering system to not render the contents on the other side of that surface. They do not contribute to the physics simulation. Big towns and villages benefit largely from carefully placed occluders. User can place occluders directly to the scene or attach them to entities & prefabs. + +{{% notice info %}} +The imported occluder bodies names should start with "occ_" phrase. +{{% /notice %}} \ No newline at end of file diff --git a/docs/content/russian/Asset Management/Asset Types/materials.md b/docs/content/russian/Asset Management/Asset Types/materials.md new file mode 100644 index 0000000..1b58310 --- /dev/null +++ b/docs/content/russian/Asset Management/Asset Types/materials.md @@ -0,0 +1,8 @@ ++++ +title = "Materials" +description = "" +weight = 1 ++++ + +Materials define the rendering characteristics of meshes. They contain the shader and texture information, also the rendering flags (defined from by shader and the global ones). +A mesh can have a single material. The initial value of a mesh's material will be assigned through it's given material name in the 3rd party mesh editing applications. Materials can be created and edited through the Material Browser which can be accessed through the Resource Browser. The material can also be edited at runtime through scripts and behaviours. More information about material editing and default materials of the engine can be found at the [Material Editor]({{< ref "material_editor.md" >}}). \ No newline at end of file diff --git a/docs/content/russian/Asset Management/Asset Types/meshes.md b/docs/content/russian/Asset Management/Asset Types/meshes.md new file mode 100644 index 0000000..52f98b8 --- /dev/null +++ b/docs/content/russian/Asset Management/Asset Types/meshes.md @@ -0,0 +1,14 @@ ++++ +title = "Meshes" +description = "" +weight = 1 ++++ + +Meshes contain the polygon positions and attributes to be used at the rendering pass. Every mesh has one material that defines their rendering behaviour. They are grouped inside MetaMesh's by their LOD level. Also, at the same LOD level, there can be multiple meshes with different materials. More information about importing meshes to the engine can be found at [Material Editor]({{< ref "asset_naming_conventions.md" >}}). + + +##### LOD System + +Modern engines use LOD(level of detail) systems to ensure that the amount of GPU share used by the closer parts of the screen is more than the far ones. This is done by reducing the mesh qualiy with respect to the distance to the camera. This system ensures that the polygon per pixel ratio is similar across the screen as much as possible. The default LOD distances are as follows: 15, 22.5, 30, 50, 70, 130, 210 meters. These distances are for the best graphics quality and they can be reduced via the Environment Quality and Character Quality options. + + \ No newline at end of file diff --git a/docs/content/russian/Asset Management/Asset Types/overriding_assets.md b/docs/content/russian/Asset Management/Asset Types/overriding_assets.md new file mode 100644 index 0000000..b47a090 --- /dev/null +++ b/docs/content/russian/Asset Management/Asset Types/overriding_assets.md @@ -0,0 +1,88 @@ ++++ +title = "Adding & Overriding Assets" +description = "" +weight = 1 ++++ + +In RGL you can easily override existing assets or create new ones within the editor for your custom mode. Override mechanism works by replacing existing assets with the one you supplied in your module's assets directory. It tries to match your custom assets with the ones previously registered by other modules by their names. This happens with respect to loading order of the modules. + +If **Module A** and **Module B** are loaded in addition to the **Native** module respectively, list of final assets and their sources will be as follow : + + + + + + + + + + + + + + +
Native + Module A + Module B + Result +
adobe_wall
tarnished_metal
ground_mud
marble
-
adobe_wall
tarnished_metal
-
-
metal_plate
adobe_wall
-
ground_mud
-
-
Module B::adobe_wall
Module A::tarnished_metal
Module B::ground_mud
Native::marble
Module A::metal_plate
+ +Currently moddable asset types are: + +- [Material](#overriding-materials) +- [Mesh](#overriding-meshes) +- [Texture](#overriding-textures) +- [Physics Shape](#overriding-physics-shapes) + +### Folder Hierarchy + +Asset system treats some folders in module directory specially according to their names. Here is the list of these folders and their uesages : + +- **Assets** : Includes editable *.tpac files which stores meta data of each asset. +- **AssetSources** : Includes source files of imported assets(.psd, .fbx). +- **AssetPackages** : Includes read-only *.tpac files. It is generated when a module is packed for client builds. +- **EmAssetPackages** : Includes read-only *.tpac files. It is generated when a module is packed for editor builds. +- **DsAssetPackages** : Includes read-only *.tpac files. It is generated when a module is packed for server builds. +- **RuntimeDataCache** : Includes auto-generated data required by engine for each asset. Can be deleted but it might take time to generate from scratch during startup. + +### Modding Permissions + +Asset system looks for different folders according to the version of game's running executable. According to presence of these folders it decides whether a module can be modified or it can be used only in read-only mode. If you want to distribute your module you can pack your assets and share packed folders without distributing thousands of files and their sources. You have three options to pack your assets : + +- **Client** : Others can activate your module to play. You must distribute **AssetPackages** folder. +- **Editor** : Others can use your module in editor but can not modify it. Used if you want others to derive modules from your module. You must distribute **EmAssetPackages** folder. +- **Server** : Used for server builds. All data which is not related to server is stripped out. You must distribute **DsAssetPackages** folder. + +You can also share your module just like you are using it to allow others to modify it. In this case you must distribute **Assets**, **AssetSources** and optionally **RuntimeDataCache** folders. + +### Overriding Materials +Overriding materials can be done by creating a new material with the same name of the material you want to override. +Navigate to assets directory of your module and right click on an empty place in the browser pane. Create a new material and rename it to the same name with the material you want to override. + +{{% panel footer="Material of an existing mesh overriden by ModuleA" %}}![](/img/modding/assets/material_override.png){{% /panel %}} +At this point all material references in the system will be redirected to your custom material. +

+### Overriding Meshes +Models can be imported from several file formats(e.g. Trf, Fbx). Resources imported from a single file are grouped by their names according to <>asset naming convetions<>. Imagine an fbx file as follow : + +- Model.fbx + - wall(Mesh) + - wall.lod1(Mesh) + - wall.lod3(Mesh) + - bo_wall(Physics Shape) + +According to asset naming conventions, first three resources will be grouped into a single mesh which has three submeshes belong to different LODs. At the end two asset will be imported from Model.fbx : wall(Mesh) and bo_wall(Physics shape). + +By following these rules you can export a new geometry file(e.g. fbx) which contains a group of meshes with their names begin with **wall**. In this case a new **wall** mesh will be created from these submeshes and existing mesh will be replaced completely with the one you supplied. Name of the geometry file is not taken into account. It is worth to mention that mesh overrides occur on mesh level. It is not possible to override single submesh via module override. + +{{% panel footer="Existing cube mesh with name **testbox** overriden by ModuleA with a teapot" %}}![](/img/modding/assets/metamesh_override.png){{% /panel %}} +

+### Overriding Textures +Overriding textures is very similar to materials. You need to import a new texture with the same name of the texture you want to override. You can also rename any texture already imported to something that matches with the name of the texture to override. + +{{% panel footer="Existing albedo texture with name **roman_ground_d** overriden by ModuleA with a white texture" %}}![](/img/modding/assets/texture_override.png){{% /panel %}} +

+### Overriding Physics Shapes +Overriding physics shapes requires you to import a physics shape with the same name of asset you want to replace. Check <>Asset naming conventions<> to see hot to import physics shapes + +{{% panel footer="Existing torus shape overriden by ModuleA with a custom aquila shape" %}}![](/img/modding/assets/physics_shape_override.png){{% /panel %}} \ No newline at end of file diff --git a/docs/content/russian/Asset Management/Asset Types/overriding_scenes_prefabs.md b/docs/content/russian/Asset Management/Asset Types/overriding_scenes_prefabs.md new file mode 100644 index 0000000..82f1558 --- /dev/null +++ b/docs/content/russian/Asset Management/Asset Types/overriding_scenes_prefabs.md @@ -0,0 +1,18 @@ ++++ +title = "Overriding Scenes and Prefabs" +description = "" +weight = 1 ++++ + +You can override existing scenes and prefabs by creating new one with the same name. + +{{% notice info %}} +You should keep in mind that overriding prefabs may break existing scripts if you change entity hierarchy. Make sure you preserve entity hierarchy to avoid possible breaking errors if your entity is being used by existing scripts. +{{% /notice %}} +### Prefabs + +Prefab definitions are stored in xml files located in **Prefabs** folder in each module's directory. + +### Scenes + +Scenes are stored in two separate folders **SceneObj** and **SceneEditData** in each module's directory. **SceneObj** folder stores necessary files to open scene in client mode while **SceneEditData** stores files necessary for editing operations. \ No newline at end of file diff --git a/docs/content/russian/Asset Management/Asset Types/path.md b/docs/content/russian/Asset Management/Asset Types/path.md new file mode 100644 index 0000000..f47b6af --- /dev/null +++ b/docs/content/russian/Asset Management/Asset Types/path.md @@ -0,0 +1,7 @@ ++++ +title = "Paths" +description = "" +weight = 1 ++++ + +In RGL, 'Paths' are used to define continous points within a scene. They have unique names and can be used by the gameplay logic for different reasons. Paths define how the siege engines move in missions. Also, for field battle missions, initial spawn point candidates are defined via a path. The spawn logic selects two positions for the teams with respect to the size of the battle. Detailed information about path editing can be found at [Path Editing]({{< ref "path_editing.md" >}}). diff --git a/docs/content/russian/Asset Management/Asset Types/prefabs.md b/docs/content/russian/Asset Management/Asset Types/prefabs.md new file mode 100644 index 0000000..8414d6f --- /dev/null +++ b/docs/content/russian/Asset Management/Asset Types/prefabs.md @@ -0,0 +1,18 @@ ++++ +title = "Entities & Prefabs" +description = "" +weight = 1 ++++ + + +In RGL, entities are containers for all of the meshes, particles, script components, occluders and physics objects. They can also contain other entities as children. They have their own transformation that determines their position, scale and rotation in the world. + +##### Prefabs + +Prefabs are template entities which do not sever the connection to the prefab even after it is saved in a scene. Complex entities can be constructed one time and saved as a prefab to be used at any time, in any scene. Later updates to the prefab will affect the already done scenes as well. In Bannerlord, nearly all of the mission objects and scene props are prefabs. + +##### Connection Rules + +Once a prefab is placed into a scene, all of the values under prefab(mesh colors, child entity transforms, script values) are connected to the original prefab and will be updated after every change to the original one. Any change in the scene for those values will sever the connection. Beware that any “Addition” operation to the prefab in the scene, will break the prefab connection all together. Examples: adding a new mesh, particle system, light, child entity or script component. + + diff --git a/docs/content/russian/Asset Management/Asset Types/scripts.md b/docs/content/russian/Asset Management/Asset Types/scripts.md new file mode 100644 index 0000000..d3b1d08 --- /dev/null +++ b/docs/content/russian/Asset Management/Asset Types/scripts.md @@ -0,0 +1,19 @@ ++++ +title = "Scripts" +description = "" +weight = 1 ++++ + +Script components are executable scripts that are attached to entities and can be used to implement various gameplay functionalities. In Bannerlord, many gameplay logic are written via script components. For example chairs, dropped weapon, siege machines. There are many different callbacks that can be inherited and filled in these script components. + +##### Callbacks + +* Constructor: In constructor one needs to assign default values to its public variables(variables which can be changed by the scene maker). In constructor script component is not assigned to an entity or scene. Also, you should not write any logic that has any side effect because , even though it is created, the script component may be deleted once the scene is opened because of the upgrade level system. +* OnPreInit: This is called after the script component is assigned to its owner entity in the scene. Once you are in this callback , you can be sure that the user defined variables from that script instance are set. However, the other script components of the other entities may not be assigned yet. Thus, in pre init there should not be any logic code that relies on other script components. Example, in pre-init ManagedObject registers himself to the managed object array in the current mission instance. +* OnInit: This is called once the mission is loaded and all of the script components of the entities are initialized. You can use any type of logic code inside this callback. Run time instantiated scripts also get this callback called. +* OnEditorInit: Editor version of on init. It is called when the scene is loaded from the editor. Beware that there is no mission or game state in editor. +* OnTick: This is called for every script component every frame on mission from the same thread. +* OnEditorTick: Editor version of the OnTick function. +* IsOnlyVisual: If you have a script component which is only visual and does not have any logic code that should be running in the dedicated server , you should return true in this function. This ensures that this type of scripts does not run on dedicated server. +* OnEditorVariableChanged: This is called in editor whenever a public variable in that script component is changed by the user. This callback can be used for any visual-logic state change if the artist needs instant feedback on the editor scene. +* OnRemoved: Called when the entity or the script component is being removed. If you have any allocated objects which are stored in somewhere else (for example static containers), you can use this callback to ensure that they are not leaked. \ No newline at end of file diff --git a/docs/content/russian/Asset Management/Asset Types/skeletons.md b/docs/content/russian/Asset Management/Asset Types/skeletons.md new file mode 100644 index 0000000..2606205 --- /dev/null +++ b/docs/content/russian/Asset Management/Asset Types/skeletons.md @@ -0,0 +1,5 @@ ++++ +title = "Skeletons" +description = "" +weight = 1 ++++ diff --git a/docs/content/russian/Asset Management/Asset Types/textures.md b/docs/content/russian/Asset Management/Asset Types/textures.md new file mode 100644 index 0000000..3327fea --- /dev/null +++ b/docs/content/russian/Asset Management/Asset Types/textures.md @@ -0,0 +1,11 @@ ++++ +title = "Textures" +description = "" +weight = 1 ++++ + +Textures can be imported through the Asset Browser. They can be assigned to materials via the Material Editor. The texture slots of the PBR materials can be found at [Material Editor]({{< ref "material_editor.md" >}}). + +{{% notice info %}} +The maximum value for the terrain textures' resolution is 2048 by 2048. +{{% /notice %}} \ No newline at end of file diff --git a/docs/content/russian/Asset Management/_index.md b/docs/content/russian/Asset Management/_index.md new file mode 100644 index 0000000..4dcfd6b --- /dev/null +++ b/docs/content/russian/Asset Management/_index.md @@ -0,0 +1,7 @@ ++++ +title = "Asset Management" +description = "" +weight = 1 ++++ + +{{%children style="h5" description="true"%}} \ No newline at end of file diff --git a/docs/content/russian/Asset Management/faq.md b/docs/content/russian/Asset Management/faq.md new file mode 100644 index 0000000..f146aa8 --- /dev/null +++ b/docs/content/russian/Asset Management/faq.md @@ -0,0 +1,42 @@ ++++ +title = "Frequently Asked Questions" +weight = 1 ++++ + +##### How to install the tools? + +You can download the “Mount & Blade Bannerlord Modding Tools” from the Tools section of steam. Note that the tools use some of the files downloaded within the game itself. Thus, the tools and game should be at the same version and installed on the same harddrive. + +##### How to launch the tools? +You can use the SinglePlayer option from the Launcher and once you are in the Initial Menu, you can either press the Editor button or press the Ctrl + E key combination to start up the editor. + +##### How to create your own module? +We have a built-in functionality in the editor which creates a new module and populates it with example xml files registered to the module for ease of adding new content. After opening the editor, you can use the “Create New Module” option in the “File” menu from the top toolbar. Note that you need to restart the game in order to register the module from the Launcher. + +##### How to edit Native resources? +You cannot edit native resources, you can override them on your own module. For details look at http://docs.modding.bannerlord.com/asset-management/asset-types/overriding_assets/ + +##### I can’t add new meshes, textures etc. +You cannot add resources to native modules, you should add them to your own module. First, you need to create a new module: http://docs.modding.bannerlord.com/asset-management/quickguide_create_a_mod/ +For the details of adding new assets: http://docs.modding.bannerlord.com/asset-management/asset-types/overriding_assets/ + +##### Example scenes to look at? + +empire_village_003 +khuzait_castle_002 +sturgia_town_b +battle_terrain_v +empire_castle_keep_a_l3_interior +empire_house_c_tavern_a +empire_dungeon_a +arena_empire_a +Main_map + +##### Where to find example assets? +You can inspect native resources from Resource Browser but there aren't source files for these and you cannot export them. We will be providing some example source files soon. + +##### I have mods with DLL’s and my modding tools does not launch. +If you have any mods with DLL’s enabled, be sure to copy them to the Modules\MOD_NAME\bin\Win64_Shipping_wEditor folder as well. + +##### My modding tool does not launch. +Be sure that Visual Studio 2013 Redist x64 is installed in your machine. Also, check whether the version numbers for the base game and modding tools match. If all of the above checks does not work, you can create a new topic in the “Bug & Crashes” section of the modding forums(https://forums.taleworlds.com/index.php?forums/bug-crash-reports.784/). \ No newline at end of file diff --git a/docs/content/russian/Asset Management/generating_and_loading_ui_sprite_sheets.md b/docs/content/russian/Asset Management/generating_and_loading_ui_sprite_sheets.md new file mode 100644 index 0000000..fb2ff8f --- /dev/null +++ b/docs/content/russian/Asset Management/generating_and_loading_ui_sprite_sheets.md @@ -0,0 +1,220 @@ ++++ +title = "Generating and Loading UI Sprite Sheets" +weight = 2 ++++ + +#### Introduction +Sprites are two-dimensional images that are mostly used in the user interface of a game. Sprite sheets are the collection of such images. In other words, sprites are packed together to form a sprite sheet. This documentation will go through the following steps: + +* Adding new sprites. +* Generating sprite sheets from the sprites that you have added. +* Importing the sprite sheets to your module. +* Using sprites in UI XML files. +* Loading and unloading the sprite categories. + +#### Prerequisites +* A submodule created under INSTALLATION_PATH\Mount & Blade II Bannerlord\Modules\ +* Knowing how to build your project from the Integrated Development Environment (IDE) like Visual Studio. +* Mount & Blade II: Bannerlord - Modding Kit downloaded from Steam. + +#### Adding Sprites +* Create a new folder named GUI under Modules\YOUR_MODULE_NAME\ +* Create a new folder named SpriteParts under the newly created folder GUI. +* Create a new folder named ui_{YOUR_CATEGORY_NAME} under the newly created folder SpriteParts. In this documentation, it will be named **ui_mycategory**. +* Note: Content inside of ui_{YOUR_CATEGORY_NAME} will be put in a single category called YOUR_CATEGORY_NAME. All the sprites in a category are loaded and unloaded together. It is suggested to divide your sprites into categories (instead of having only one category) in order to avoid unnecessary sprites being loaded. For example, you may create a new screen in the game that requires certain sprites to be loaded. Those sprites could be packed into a category and once that screen is opened, you can then load the relevant sprites only, and then when the screen is closed you can then unload them (see Loading & Unloading Sprite Categories section). +* Put your sprites into the ui_{YOUR_CATEGORY_NAME} folder. For example, this sprite is added and named **mysprite.png**: + + + +#### Generating Sprite Sheets +In order to generate sprite sheets, run the TaleWorlds.TwoDimension.SpriteSheetGenerator.exe executable file located at INSTALLATION_PATH\Mount & Blade II Bannerlord\bin\Win64_Shipping_wEditor. If you have followed the steps above, after running SpriteSheetGenerator.exe, you should see the following window: + + + +SpriteSheetGenerator.exe will create two folders named Assets and AssetSources under Modules\YOUR_MODULE_NAME. It will also create a SpriteData.xml file (with a prefix of your module name) under Modules\YOUR_MODULE_NAME\GUI. + +#### Importing Created Sprite Sheets +In order to use the sprites in your sprite sheets, you should also import them from the resource browser. Follow these steps to import a sprite sheet: + +* Make sure you have built your project into Modules\YOUR_MODULE_NAME\bin\Win64_Shipping_wEditor (in addition to Win64_Shipping_Client). If your project is not built properly, you will get a crash while launching. +* Run Mount & Blade II: Bannerlord - Modding Kit from Steam. +* Make sure your mode is selected in the Mods section of the Launcher, then hit “Play”. +* On the main menu, press Alt + ` to open the console. +* Type resource.show_resource_browser, then hit enter. + + + +This should open the resource browser: + + + +Collapse the folder named Native on the left of the resource browser to see your module easily. Then, select your module. + + + +Open the GauntletUI folder in your module. Then, press the “Scan new asset files” button which is pointed with a red arrow below (arrow on the right). + + + +This should open a new window: + + + +Make sure your category is selected (in the example, it is ui_mycategory) then press the Import button. Then, you should see something similar to this: + + + +Close the resource browser and the game. +You should now see a new file named ui_{YOUR_CATEGORY_NAME}_1_tex.tpac under Modules\YOUR_MODULE_NAME\Assets\GauntletUI. + +#### Using Sprites In UI XML Files +You may now use the sprites in the sprite sheets that you have created (you also need to load the corresponding category which is explained below, in the Loading & Unloading Sprite Categories section). Sprites are used in UI XML files. You may refer to your sprites with their names. You can find the names of your sprites in the SpriteData.xml file (with a prefix of your module name) which is located at Modules\YOUR_MODULE_NAME\GUI. +To give an example, we will create a new UI XML file. To do that, go back to the folder named GUI under Modules\YOUR_MODULE_NAME\ and create a new folder named Prefabs. Create a new file named MyXml.xml under the Prefabs folder. You may now refer to your sprites in this file as Sprite="mysprite". For example, the content of the MyXml.xml file could be: + + + + + + + + + + + +#### Loading & Unloading Sprite Categories +In order to use the sprites that you have added, you need to load them. You have two options in this regard:¸ + +1. Loading & Unloading Manually + * The developer has more control. They can choose when the sprite categories are loaded and unloaded. Thus, they can manage memory usage and performance. + * Requires writing code. Thus, more complex than The AlwaysLoad Option. + +2. Using The AlwaysLoad Option + * Sprite categories are loaded on startup automatically. + * Categories are kept in the memory until the game is closed. Thus, no need to manually load them every time they are used. + * Decreased UI loading time at the cost of increased memory usage. + * Easy to use. + +##### 1. Loading & Unloading Manually +Here we show how to load & unload sprite categories manually. In the example below, we override the OnGameStart and OnGameEnd methods of MBSubModuleBase class to add and remove the MyScreen global layer respectively. Notice that the constructor of MyScreen loads the sprite category and the UI XML that we have created in previous sections. We also unload the sprite category inside the OnFinalize method. + +If you are going to copy the below code, do not forget to change the namespace and name of the Main function. They should match with the fields in your SubModule.xml. In other words, you should change SpritesheetDocumentation (namespace) to YOUR_MODULE_NAME and Main (name of the Main function) to YOUR_MAIN_FUNCTION_NAME in this field of the SubModule.xml: + + + +Otherwise, they won’t be recognized and the game will crash while launching. + + using TaleWorlds.Core; + using TaleWorlds.MountAndBlade; + using TaleWorlds.Engine.Screens; + using TaleWorlds.Engine.GauntletUI; + using TaleWorlds.GauntletUI.Data; + using TaleWorlds.TwoDimension; + + namespace SpritesheetDocumentation + { + public class Main : MBSubModuleBase + { + private MyScreen _myScreen; + + protected override void OnSubModuleLoad() + { + + } + + protected override void OnGameStart(Game game, IGameStarter gameStarterObject) + { + base.OnGameStart(game, gameStarterObject); + _myScreen = new MyScreen(); + ScreenManager.AddGlobalLayer(_myScreen, true); // add MyScreen on game start + } + + public override void OnGameEnd(Game game) + { + base.OnGameEnd(game); + _myScreen.OnFinalize(); + ScreenManager.RemoveGlobalLayer(_myScreen); // remove MyScreen on game end + } + } + + public class MyScreen : GlobalLayer + { + private GauntletLayer _gauntletLayer; + private IGauntletMovie _gauntletMovie; + private SpriteCategory _category; + + public MyScreen() + { + var spriteData = UIResourceManager.SpriteData; + var resourceContext = UIResourceManager.ResourceContext; + var resourceDepot = UIResourceManager.UIResourceDepot; + + _category = spriteData.SpriteCategories["ui_mycategory"]; // select which category to load, put your category name here + _category.Load(resourceContext, resourceDepot); // load the selected category + + _gauntletLayer = new GauntletLayer(2); + Layer = (ScreenLayer)_gauntletLayer; + + _gauntletMovie = _gauntletLayer.LoadMovie("MyXml", null); // load the ui xml in Prefabs folder + } + + public void OnFinalize() + { + // unload ui xml, sprite category, layer, etc. + _gauntletMovie = null; + _category.Unload(); + _gauntletLayer = null; + } + } + } + +##### 2. Using The AlwaysLoad Option +Instead of manually loading sprite categories like in the Loading & Unloading Manually section, you can choose which sprite categories should be loaded automatically on startup by enabling the AlwaysLoad option for those categories. Unless they are manually unloaded by the developer, categories that have the AlwaysLoad option enabled will be kept in the memory until the game is closed so that you don’t have to load them manually every time they are used. Enabling the AlwaysLoad option decreases the load time of UI (since these categories are loaded only once on startup) but increases memory usage (since these categories will be kept in the memory even when they are not used). This option is very useful for the categories that are frequently loaded & unloaded (f.e. A category that is used in a screen that is opened and closed frequently). + +Note: This feature has been released with e1.6.2. If you are on an earlier version and still want to use the AlwaysLoad option, please switch both the game and the modding kit to e1.6.2 or a newer version. + +To enable the AlwaysLoad option for a category, follow the steps below: + +Create a new XML file named Config.xml under the folder Modules\YOUR_MODULE_NAME\GUI\SpriteParts. Copy and paste the following into Config.xml: + + + + + + + +Replace ui_{YOUR_CATEGORY_NAME} with your category. Then, generate sprite sheets by following the steps in the Generating Sprite Sheets section above. To check if everything is okay, open the file named {YOUR_MODULE_NAME}SpriteData.xml which is located at Modules\YOUR_MODULE_NAME\GUI. There you should see that the AlwaysLoad option is enabled for the categories that you have selected in the Config.xml: + + + + + ui_{YOUR_CATEGORY_NAME} + + 1 + + + + ... + + +You don’t need to change/add any code to load the new sprite sheet category. + +#### Conclusion +Make sure you have created a screen and loaded the UI XML file that you have created in Using Sprites In UI XML Files section in order to see the result below. + +Note: If you have added your sprite category with the AlwaysLoad option and didn’t use the code shared in the Loading & Unloading Manually section, you can write your own code to create a screen and load the UI XML. If you don’t know how to do it, you can copy the code from the Loading & Unloading Manually section (please also read the details in that section) and delete the following lines since you have used the AlwaysLoad option and don’t need to load the category manually: + + var spriteData = UIResourceManager.SpriteData; + var resourceContext = UIResourceManager.ResourceContext; + var resourceDepot = UIResourceManager.UIResourceDepot; + + _category = spriteData.SpriteCategories["ui_mycategory"]; // select which category to load, put your category name here + _category.Load(resourceContext, resourceDepot); // load the selected category + +You can also delete the _category field and remove its references. + +* Make sure you have built your project into Modules\YOUR_MODULE_NAME\bin\Win64_Shipping_Client. +* Launch the game (not the Modding Kit) from Steam and make sure your module is selected in the Mods section of the Launcher, then hit “Play”. +* Create a new campaign or load a compatible save file to open the campaign map. Both of them will start a game. Notice that the code we have written adds the screen once the game starts (check the OnGameStart method). +* After you start the game by creating a new campaign, you should see this screen: + + \ No newline at end of file diff --git a/docs/content/russian/Asset Management/horse_reins_simulation_creation.md b/docs/content/russian/Asset Management/horse_reins_simulation_creation.md new file mode 100644 index 0000000..3601b59 --- /dev/null +++ b/docs/content/russian/Asset Management/horse_reins_simulation_creation.md @@ -0,0 +1,61 @@ ++++ +title = "Horse Reins Simulation Creation" +weight = 1 ++++ + +### Introduction + +This tutorial explains how to add simulation to the reins of a horse armor set. + +We previously used only one mesh for horse armor, however the reins would hang in the air and not move according to gravity. We then decided to add simulation to the reins which meant applying some changes to the system. Instead of a single mesh, horse armors now contain 3 meshes. We will divide them into 2 groups. + +#### Group 1: + +- **The horse armor/harness**: The armor set that is related to the body of the horse as demonstrated in Image 2b (which has its own simulation but we’ll ignore that for now) Example: horse_harness_x +- **The original rein piece**: The part that is separated from the initial single mesh that we have mentioned above and it is seen in Image 2c. We kept this unsimulated piece for occasions where the simulated piece is not needed; that is when the camera is distant from the horse and the armor set begins to switch to LOD 1 and to the rest of the LODs. Example: horse_harness_x_rein + +#### Group 2: + +- **The simulated rein piece**: When the camera is close to the horse, the rider holds the reins and the reins move according to physics. Example: horse_harness_x_rein_rope + +This tutorial mainly explains how to create the third mesh which is “the simulated rein piece”. But before diving into the steps, we would like to clarify a few things. + +| | | +| ------ | ----------- | +| | | +| **Image 1a**; *Normally each component has a different name but we will refer to the parts of our mesh either as headpiece or rein as shown in Image 1b.* | **Image 1b**; *For simplicity and due to functionality we will only use “head piece” and “reins”.* | + +We named the horse harness as “horse_harness_x” to serve as an example below (marked light grey) while explaining the grouping (those names are only chosen as examples, please mind that there are meshes with names “horse_harness_x, horse_harness_x_rein, horse_harness_x_rein_rope” in the game already). + + | | +------- | ------- | -------- + | | +**Image 2a**; *This is the initial stage where you model the horse harness/armor and rein according to horse anatomy. The rein should be modelled so that it is positioned within the rider’s reach (we have modelled the armor sets in 3ds Max).* | **Image 2b**; *horse_harness_x.* | **Image 2c**; *horse_harness_x_rein (headpiece is part of this mesh which will later be duplicated to become horse_harness_x_rein_rope).* + +In the following chapter, we will talk about how to create the third component; “the simulated rein piece” of the armor set. + +### Rein Simulated Piece: Horse_harness_x_rein_rope + +The simulated piece needs another skeleton for skinning which is part of our Modding Kit, accessible under Mount & Blade II Bannerlord\modding_resources (see image 3). + + + +**Image 3**; *horse_harness_rein_skeleton which contains 22 bones is on the left. On the right we have a demonstration of how the horse_harness_x_rein_rope is supposed to fit on the skeleton.* + +#### Steps to create the simulation mesh: +1. Duplicate the mesh “horse_harness_x_rein”. +2. Rename it to “horse_harness_x_rein_rope”. +3. Tweak the new mesh (“horse_harness_x_rein_rope”) so that it sits perfectly on the “horse_harness_rein_skeleton” (when you are done the mesh should look like it does on Image 5a and 5b). +4. Skin “horse_harness_x_rein_rope” according to “horse_harness_rein_skeleton”. Image 4 shows the bone list of the skeleton in question. +5. Set the alpha of vertices of the simulated region to “100”. Set the other non-simulated vertices to “0” (see Image 6). + + | | | +------- | ------- | -------- | -------- + | | | +**Image 4**; *bones of horse_harness_rein_skeleton.* | **Image 5a**; *side view of horse_harness_x_rein_rope compared to horse_harness_x_rein.* | **Image 5b**; *top view of horse_harness_x_rein_rope (selected mesh) compared to horse_harness_x_rein.* | **Image 6**; *alphas of the selected vertices (red/lighter) are set to “100” since they belong to the simulated region of the rein. The part where the rider holds and the head piece (see Image 1b) are not simulated, hence they are set to “0”.* + +### Exporting the meshes to the game + +Export the meshes in fbx format to the designated folder: + +[Game Folder]\Modules\[Mod Folder]\AssetSources diff --git a/docs/content/russian/Asset Management/how_to_add_custom_fonts.md b/docs/content/russian/Asset Management/how_to_add_custom_fonts.md new file mode 100644 index 0000000..9b4dbfc --- /dev/null +++ b/docs/content/russian/Asset Management/how_to_add_custom_fonts.md @@ -0,0 +1,153 @@ ++++ +title = "How to Add Custom Fonts" +weight = 3 ++++ + + +#### Introduction + +This documentation will go through the following steps: + +* Setting Up The Files and Paths +* Generating Fonts +* Placing Files in the Module Folder +* Generating Sprite Sheets +* How to Use Fonts In Bannerlord + +#### Prerequisites + +* TrueTypeFont file for the font. E.g. (OpenSans-Regular.ttf) +* Mount & Blade II: Bannerlord - Modding Kit downloaded from steam +* Knowledge on generating UI Spritesheets (see: [GENERATING AND LOADING UI SPRITE SHEETS](http://docs.modding.bannerlord.com/asset-management/generating_and_loading_ui_sprite_sheets/)) + +#### Setting Up The Files and Paths + +* Go to Mount & Blade II Bannerlord\GUI\GauntletUI\Fonts\. +* Make sure the two files below exist in the directory. We will use them to generate our font data. + * **GenerateFont.bat** + * **GenerateFontSettings.txt** +* Move your **.ttf** font file to the directory. +* For our example, we will use a font file named **OpenSansRegular.ttf**. +* Open the file: "**GenerateFontSettings.txt**". +* "**GenerateFontSettings.txt**" default values are: + + -fontpath {FONT\_PATH.ttf} + -outputpath {OUTPUT\_PATH.png} + -atlassize 2048 2048 + -size 64 + -angle 8 + -range 16 + -padding 16 + -smooth 0 + -smoothingConstant 0.5-mode 1 + +* Here, we need to change the placeholder variables **{FONT\_PATH.ttf}** and **{OUTPUTPATH.png}** with actual paths. +* The paths here are relative to the directory: **…\bin\Win64_Shipping_wEditor** directory unless you specify a full path. +* Please note that if you want to use paths that contain spaces, you need to put them inside quotes. +* Setting -fontpath: + * In our example, the variable should be: **-fontpath OpenSansRegular.ttf**. +* Setting -outputpath: + * This variable determines where the **.png** file should be placed. We should use a **.png** file path to a non-existent file which will be created in the process of generating atlas. + * In our example we set the -outputpath variable as: **-outputpath OpenSansRegular.png**. +* The contents of **GenerateFontSettings.txt** should now look like this: + + -fontpath OpenSansRegular.ttf + -outputpath OpenSansRegular.png + -atlassize 2048 2048 + -size 64 + -angle 8 + -range 16 + -padding 16 + -smooth 0 + -smoothingConstant 0.5-mode 1 + +_If the generated .png file does not contain all the characters for your font, consider increasing the_ **-atlassize**. + +#### Generating Fonts + +* Now that the files are added and the correct paths for generator set up, start the **GenerateFont.bat**. +* If everything is properly set up, the program will not throw any errors and will generate 3 files in the directory which you defined as your **-outputpath**. + * In our example, the 3 files are: + * **OpenSansRegular.fnt** + * **OpenSansRegular.bfnt** + * **OpenSansRegular.png** +* If you see any errors in the batch script, make sure that the **-fontpath** and **-outputpath** variables are set correctly. +* In our example, the 3 generated files are located in the **…\bin\Win64_Shipping_wEditor\** directory since we put a relative path. + +#### Placing Files in the Module Folder + +* In the step above, we have generated 3 files. Now we need to place those files in our module. + +##### Font Files + +* Go to **{YOURMODULE}\GUI\Fonts** folder. If your module doesn't have a **Fonts** folder, create it. +* Move the generated **.fnt** and **.bfnt** files to the **Fonts** folder, in our example they are named **OpenSansRegular.fnt** and **OpenSansRegular.bfnt**. + +##### Image File + +* Go to **{YOURMODULE}\GUI\SpriteParts** folder. If your module doesn't have any **GUI** or **SpriteParts** folders, create them. +* In the **SpriteParts** folder, create an empty folder named **ui\_custom\_fonts**. +* If you don't have a **Config.xml** in your **SpriteParts** folder, create it too. +* At this stage, **SpriteParts** folder should have a folder named **ui\_custom\_fonts** and a file named **Config.xml**. +* Now we can move our **.png** file to the ui\_custom\_fonts folder. In our example, the file is named **OpenSansRegular.png**. + +##### Configuration + +* In order to be able to use our font in-game, we need to specify in our **Config.xml** file that our font needs to be loaded automatically. +* The contents of the Config.xml should include this Config: + + + + + + + + + + +* Note that **ui\_custom\_fonts** here comes from the name of the folder you created in **{YOURMODULE}\GUI\SpriteParts**. + +#### Generating Sprite Sheets + +* Now the spritesheets of the font need to be generated, using the **.png** file created in the last process. +* We will briefly cover how to add your new font to the spritesheets. For a detailed explanation see: [GENERATING AND LOADING UI SPRITE SHEETS](http://docs.modding.bannerlord.com/asset-management/generating_and_loading_ui_sprite_sheets/). + * Run the spritesheet generator by simply launching the **Mount & Blade II Bannerlord\bin\Win64\_Shipping\_wEditor\TaleWorlds.TwoDimension.SpriteSheetGenerator.exe**. + * If everything was set up correctly, the output of spritesheet generator should look like this: + + * You should import the font via the resource browser in-game. Which was explained in the [document](http://docs.modding.bannerlord.com/asset-management/generating_and_loading_ui_sprite_sheets/) above. + +#### Using the Newly Added Fonts + +* If we did everything correctly, we should be able to use our newly added fonts in-game. +* In order to use a font, we can declare it's name in a brush, for example: + + + +