Preview only show first 10 pages with watermark. For full document please download

King`s Bounty: Armored Princess

   EMBED


Share

Transcript

King’s Bounty: Armored Princess Game editor manual Contents: 1. Editor basics. Introduction...........................................................................................................3 1.1. Definition and properties of a game session.........................................................................3 1.2. Editor interface .....................................................................................................................4 1.3. Main menu............................................................................................................................5 1.4. Toolbar panel........................................................................................................................7 2. Location design ...........................................................................................................................9 2.1 Landscape editing ..................................................................................................................9 2.1.1. Terrain ...........................................................................................................................9 2.1.2. Levels ............................................................................................................................9 2.2 Landscape texture editing....................................................................................................11 2.2.1. Texture overlapping. Brush types................................................................................11 2.2.2. Materials and layers.....................................................................................................12 2.2.3. Filling the regions........................................................................................................12 2.2.4. Decals ..........................................................................................................................12 2.2.5. Textures as means of expression .................................................................................13 2.3. Locating objects..................................................................................................................27 2.3.1. Basic operations with objects ......................................................................................27 2.3.2. Changing object properties..........................................................................................27 2.4 Water settings ......................................................................................................................37 2.4.1. Basic properties of water .............................................................................................37 2.4.2. Deep water...................................................................................................................37 2.4.3. Water templates, several types of water on a location ................................................39 2.5. Location light......................................................................................................................41 2.5.1. Types of light in the game ...........................................................................................41 2.5.2. Setting of the global light of the location depending on the day time.........................41 2.5.3. Fog settings..................................................................................................................42 2.5.4. Local light sources. Omni Lights. ...............................................................................43 2.5.5. Zones of local change of the luminosity......................................................................43 2.5.6. Imitation of light/shadows with the help of the texture painting. Lumi layer .............44 2.6 Logical maps of the landscape.............................................................................................46 2.6.1. Map of passability .......................................................................................................46 2.6.2. Types of landscape, arenas and illumination...............................................................47 2.7 General properties of a location...........................................................................................48 3. Location logic ............................................................................................................................50 3.1. Atoms .................................................................................................................................50 3.1.1. Atom classes................................................................................................................50 3.1.2. Basic parameters of atoms...........................................................................................51 3.1.3. Interaction of atoms, embryos and logic units.............................................................53 3.2. Logic Units .........................................................................................................................54 3.2.1. Properties of a logic unit..............................................................................................54 3.2.2. Game logic. Messages and traps .................................................................................55 3.2.3. Game logic. Condition editor ......................................................................................57 3.2.4. Game logic. Action editor ...........................................................................................59 3.2.5. Game logic. Scenario and events.................................................................................61 3.2.6. Game logic. Internal script language of the game .......................................................63 3.2.7. Review of the selected logic units ...............................................................................64 1 3.3 Embryos...............................................................................................................................69 3.3.1. General properties and the meaning of embryo...........................................................69 3.3.2. Embryo of a shop/castle ..............................................................................................69 3.3.3. Army embryo...............................................................................................................71 3.3.4. Embryo of the box/treasure .........................................................................................72 4. Session logic ..............................................................................................................................80 4.1. Actors and enemy heroes....................................................................................................80 4.2 Dialogues .............................................................................................................................83 4.2.1. Creating a dialogue for an actor ..................................................................................83 4.2.2. Editing a dialogue, 2D representation .........................................................................84 4.2.3. Main logic of dialogue.................................................................................................85 4.3 Quests ..................................................................................................................................90 4.3.1. Editing a quest, 2D-representation. .............................................................................90 4.3.2. Quest stages and reward ..............................................................................................93 4.4 Item editor ...........................................................................................................................95 5. Additional aspects of location editing .......................................................................................97 5.1. Monorail system, platforms................................................................................................98 5.2. Army patrol paths ...............................................................................................................99 5.3. Surface for flight.................................................................................................................99 6. Editing arenas ..........................................................................................................................102 6.1. Additional properties of the arena as location ..................................................................103 6.2. Customization of the hex mesh ........................................................................................103 6.3. Camera settings ................................................................................................................105 6.4. Groups of atoms specific for the arenas ...........................................................................105 7. Interaction with the game ........................................................................................................105 7.1. Structure of session folders. Methods of distribution.......................................................105 7.2. Editing session.txt, properties.txt and other text files important for the session..............106 7.3 Loading a session in the game...........................................................................................106 8. Appendixes ..............................................................................................................................107 8.1. Attachments editor............................................................................................................107 8.2. Configuration files of the game and editor.......................................................................108 8.3. Lua-scripts ........................................................................................................................108 8.4. Review of the resource structure of the game ..................................................................109 8.5. Editor hot keys..................................................................................................................110 2 1. Editor basics. Introduction This document represents both a manual for creating user mods and a guide for the features of the game editor in the King’s Bounty: Armored Princess. It is built up in the similar sequence as well as the working process on a full-scale expansion of a game. The location created on the pages of this manual is used for training. The last sections explain the editor’s fine tuning and are recommended for experienced users of the editor tools. This guide assumes that the reader has some basic knowledge on the items. The foremost knowledge concerns the games King’s Bounty: The Legend and the King’s Bounty: Armored Princess. In the second place the experience of work with some game editors or 3D editors is quite desirable. This chapter will shed light upon the basics of editor work: what is to be edited, how and why, which tools are used and how they are applied. The central idea of this chapter is the game session. 1.1. Definition and properties of a game session During the first launch the editor will offer you to fulfill a couple of operations. First of all you should choose the folder sourcemedia for storing the landscape textures. These textures will be installed separately from a self-extracting archive sourcemedia.exe. Secondly, the editor will offer you to create a new session. What is a game session? In fact, it is a game itself, and it includes almost all except graphics and sound. The locations with all their logics, texts, LUA scripts, config files – all these relates directly to a game session. Any new game session created in the editor will be an additional one. It will use everything from the main game session (addon) together with additional data of your own session. Any changed files from the original session are saved in your own session. The session itself is just a folder, which stores all created and edited data files. Let’s create a test session “tutor”. At the same time this name will be the name of the folder storing all the modified and additional game files, including those whose original versions are stored in the folder data. The game stores only the files of the session, which is enabled in the game at the moment. 3 Fig. 1.1 Session selection The session is an expansion, which can be loaded in the game, it can contain new locations, buildings, items and dialogues for the game King's Bounty: Armored Princess. At the same time the editor can work only with one session. Editing the original addon session is not allowed, however you can open and edit any of its locations, the modified files will be saved into your session. While creating a new session you can give it a name and provide with a description, they will be used in the game. If you tick on the item Stand alone in this window, you will disable all the locations and all the data of the addon session (including heroes, game characters, their dialogues, items, etc.). In this way you can create a unique and independent adventure in your own world. Let’s call our session Sunset Isle and provide with a description Tutorial. Further the editor will offer us to choose a location for editing. There are two types of the locations – standard and combat arenas. We’ll create a new location pressing New Map and providing it with the technical name - sunset_isle. 1.2. Editor interface Fig. 1.2 Editor interface The interface consists of several parts. The upper part of the working window houses the main menu (1 on the fig. 1.2), the bottom part has the panel of locations (2). It shows all the locations loaded at the moment. A right click on an empty space of this panel allows to choose a desired location, a click on the head of the opened location shows the menu. Unload – removes the location without saving any changes, Discard – cancels all unsaved changes, Save – saves all the changes on the location. A click on the location heading with Ctrl pressed makes it active for editing. The toolbox is on the right (3), it is described in the item 1.4. It includes tools for drawing the locations, placing objects and logic on it. The information panel (4) shows the current FPS, buffer occupancy Undo (Ctrl-Z) and the characteristics of the selected object – tag or atom class, embryo name and its unique identifier. And finally, the center shows the location to be edited (5). 4 1.3. Main menu This section describes the basic functions of the main menu in brief. For details check corresponding sections: Tab General: Settings: Global editor settings. Section General: Render Buffer is responsible for the size of the area, where the rendering of location takes place. Count Atoms indicates the amount of atoms on the location in the list of atoms. Shadow Resolution – indicates the resolution of the shadows map. A low resolution decreases the quality of the shadows, but increases the performance speed of the editor. Section Show: It shows/hides particular groups of objects on the location. Show Grid – a grid mesh of the location (Ctrl-G). Show Helpers – shows special auxiliary and invisible objects (Ctrl-R). Show Hidden Objects – shows hidden objects. Any object in the game can be hidden till the special command of the game logic. Show Chess Cells – only for arenas. It shows the mesh of hexes. Show Collision Meshes – it shows the geometrical figures responsible for the physical volumes of objects. They are actually the waypoints for the cursor to hover over the game objects. Show Selection Highlight – highlight effects for an object located under a cursor. Show Water – shows the water surface for better view of the sea bottom. (Ctrl-W). Section Camera: Camera settings within the game editor. There are several types of cameras, the difference in operation of particular cameras lies only in the more or less comfort. Section Misc: You select an atom here, which sizes help you to analyze the passability map for a particular unit. The waypoints can be displayed on the map with the help of keys Ctrl-H. If Moving Atom is enabled, the yellow area of ‘relative passability’ will be rendered for a selected atom. It is required that the yellow areas are not aligned. Switch to Game: It switches to the game, the location opened in the editor will be active. Lua IDE: It launches the LUA-script editor. It is completely identical to the script launched in process of game debugging. To provide a stable operation of the game editor, make sure that all the script files of the game are unpacked from the resources. Exit: Leave the editor. It will request you to save the current session. Tab View: It fully duplicates the section Show from Settings. Tab Session: It allows manipulating the status of the whole game session, editing the list of locations, creating and editing dialogues, items, actors and quests. Save Session: Save the session, all changes on the locations and inside the session. Save Session Advanced: 5 The same as above, but you should choose from the list, what is to be saved. Save Current: Save the changes of the current location. Clone Current Location: Create an exact copy of the current location including its logic. You should give a name to a new location. Insert New Map: Create and add a new location with the specified name (ID) into the session. Insert New Arena: Create a new arena within the session with the indicated name. It is recommended to add a prefix ‘a-‘ to the name of the location, where the arena belongs to, i.e. a_arena. For example, abolo_arena_1 is the 1st arena on the Bolo island. Delete Location: Delete the remains of a location in the session. No physical deletion takes place, just the links to the location are deleted within the session. Locations List: A list of location in a session. Items: Editor of items in a session (items.txt is edited in a more comfortable form). Check items for details. Dialogs: Dialogues editor of the session. For details see item 4.2. Quests: Quest editor of the session. For details see item 4.3. Actors: Actor editor of the session. For details see item 4.1. Heros: Enemy heroes editor in the session. For details see item 4.1. Texts: Global string variables of the session. Create texts unbound to any dialogue or quest. You will be able to load them in any place selecting from a list or using the system tag of the string. Tab Location: Here you determine the settings of the current location. They include: the light, arena properties and atom monitoring. Light: Location light properties. Check item light for details. Board: Arena configuration settings. For details see item 6. Minimap: Mini-map export. It provides an automatic snapshot of the location from the bird’s eye view to use is as radar or a minimap. You can indicate the resolution, type of objects present in the radar, borderline (it is not recommended to change the existing borders for not to destroy the radar attachment to the location) and the light amplification ratios, check item 2.5.1. In order to provide a correct operation of the radar, save its picture either in the folder \data or inside the current session (recommended). Paths: Interface for viewing and editing the routes of enemy troops and NPCs on the map. It is duplicated with the help of Paths tool, check item 5.2. Embryos: 6 A list of all embryos on the location. You can edit them here and create new embryos, which will be used in the game logic later. For example you can dynamically load the settings of troops and awards from here, item 3.3. Atoms List: A list of all atoms on the location for a quick search. A selected atom will be highlighted with a red halo, double-click an atom from the list to focus on it. Red color marks the ‘lost’ atoms placed beyond the location or too far from the landscape surface. At the top you can select the atom class to be displayed, item 3.1. Properties: Here you can specify the general properties of a location, item 2.7. Switch to Map: It helps to open and enter the edit mode of next location. Switch to Arena: It helps to open and enter the edit mode of the next arena. Tab Misc: View storage file: Option for viewing the contents of *.strg-files, storing various settings and parameters. Scan for: Scanner allowing to search for key words and variables in the game logic. Mego-Chekker: It checks the data of a session, discovering all possible errors, e.g. empty buildings, characters without pictures and dialogues, army paths, etc. 1.4. Toolbar panel There are several tabs available on this panel, each of them is responsible for a particular group of tools. Their descriptions are given below. Monorail system – customization of the logic of flying/floating platforms like in Demonis) and their paths on a location. Omni lights – setting up local light sources. Paths – setting up the patrol paths of enemy armies or NPCs. Atoms – arrangement of various objects on a map. Landscape – landscape drawing: setting up the terrain and texturing. This is where the setting up of the logic maps of a location takes place. Flight surface – drawing a surface for a flight. Water – setting up water, global and local. Arena – setting up an arena. Available only on arena locations. Logic units on a location. – list of global logical objects used in a session and local objects The following chapter will describe the creation of a location and its unique view with the help of the tools of the Landscape tab. Practice Here we go with our own location. We should decide what we’d like to create: – location Sunset Isle. This is small island with the minimum of characters and decoration with the size 4x4 of a tile (e.g. Pink Wind takes 8x8 of tiles); 7 – a Debir portal, which leads the protagonist through an underwater cave to a certain location. Accordingly, our island should also house a portal bringing her back; – an NPC (non player character), sitting in a house. You can talk to it and receive a quest; – a mission to kill a monster, given by the mentioned NPC; – an enemy hero – the monster from the above quest; – a couple of occasional objects; – two hostile armies, which simply patrolling the island; – lighthouse, a building which houses a simple store. Before you start making a location, you can prepare its plan, a scheme. Our plan will look as follows: Fig. 1.3 Plan of Sunset Isle First of all you should draw the approximate tile mesh, just to have an idea of the scale, and only after that to start with the location outline. This picture shows with the help of pepper images various locations you require. Such a plan gives a general understanding of what we’d like to create. The primeval task of the session is to add new game contents. During a session the editor will offer to create a new location, which we'll process. In any moment you will be able to add an arena or a location into the existing session through a menu item Session/Insert new map (arena). It is desirable first of all to create the basics of a location: terrain, preliminary coating, and outline all paths and glades, set up main decoration objects providing the appearance and passability areas: mountains, trees, etc. After that you will be able to adjust such global things like light and water. Afterwards you can start with the final shape of the landscape – set up unique and interactive objects (NPCs, stores, enemy troops, treasures), local light sources, carefully paint the territory. Having done all this you can set up the contents of the embryos (armies, stores, treasures) and start with the fine tuning of the logic – quests, dialogues, unique interactive objects, items. The final stroke is to saturate the location with details and create the atmosphere with the help of fine tuning of fog, light sources sounds, music, etc. 8 2. Location design All related to the landscape editing is available through the tool Landscape on the toolbar. Press Shift-L to quickly enter this mode. First thing to be done is to change the size up to the planned one. There is a button on the landscape panel with an indication of the current location size (4x4). Press it to change the amount of tiles constituting the terrain. Take into account that the big size of a location and a large amount of various objects on it will result in high system requirements of your mod. The optimal size is 12x12 tiles. Use the button move to transfer the landscape to another place. The option Deep Water disables the deep water, and Deep Water Settings duplicates its settings in the tool Water. At the very bottom there is Global Blend Factor, which helps to set up the transparency for all the objects to have a better view of the landscape beneath them. Four main tools are available on the tab Landscape: terrain (Height tool), levels (Levels tool), texturing (Texturing tool) and landscape logic (Landscape logic). Now we’ll discuss the first two items, the description of the last two will follow later. 2.1 Landscape editing 2.1.1. Terrain The terrain is edited with the help of a tool set Height tool. Each tile (square) of the landscape is separated into 256 smaller tiles (i.e. each big tile has a side of 16 smaller ones). The editing allows to process the heights of apexes of small squares – the terrain mesh. Thus the terrain in the game is a big surface, determined by the constellation of heights of these apexes (height map). In the course of terrain procession you have only one brush with two radiuses available – inner and outer. Press the LMB on the landscape to elevate the terrain, if you hold down Shift, the height will decrease. The level of landscape modification with the help of a mouse click is adjusted via a parameter Raise Strength: the stronger the click, the higher is the terrain modification (keys 0…9). The brush radius can be increased/decreased with the help of the keys [ and ] or it is set up in fields Outer size/Inner Size. The brush has a square form, but if you tick the Circular shape you can change it to a circular one. Hold down Ctrl and click the LMB to make the height in the whole internal radius of the brush equal with the apex height where the cursor is pointing. Hold down Alt and click the LMB to make the height equal to the value set in Fixed Height, by default 0. There is a tick Smooth outside for an outer radius, it is disabled by default. It means that the terrain will be smoothened on the brush edge. Tick this option off and the outer radius will have no influence on the terrain. The optimal way to edit the terrain is to move the brush holding down the LMB. If you enable the option Position Lock, the terrain will change not with the mouse move, but simply after pressing the LMB. We don’t recommend making sudden drops of heights, this will prevent the landscape mesh (together with a texture) from strong deformation. If it is impossible to escape, such places should be concealed under objects. Press Ctrl+G to view the landscape mesh. 2.1.2. Levels The tool Levels tool helps to create figurate levels of the landscape: sudden drops of heights with high detalization of textures and the relief ‘walls’. The walls of the level are the sets of various objects, prepared in advance, which disguise the sudden drops of heights. The levels help to create dungeons and catacombs with their own set of ‘walls’. 9 First of all choose the set, which would determine the level appearance and its height (depth). Then choose the order of your level in the option Level. The initial location level is – 0. All wall types are divided into two classes – ordinary and inverted (for catacombs). For ordinary walls Level should be set to ‘+1’, for inverted to ‘-1’. Levels help to create steps, the parameter Level of the each next step will with be +1 or -1. As agreed the brush level is adjusted with the help of keys [ and ]. The mode Ramp creates a slope on the drawn fragment of the level, the protagonist can ascend the level or descend from it using this slope. You can delete the levels either with the help of a brush, tick Erase in advance, or hold down Shift. Take into account that only the type of walls can be deleted, which is selected at the moment in the palette. The mode Customize allows to manually select one of the elements of the set from the list. This is convenient for the creation of special objects, e.g. doors, in particular places. If you click on a wall for a second time, it will be replaced by an occasional object. Some level sets differ only in textures, when you select such a set, a list of available texture sets appears under the buttons Ramp and Customize, you need to indicate the required one. It is recommended to use the levels, when there is a necessity in it; in other cases you can solve the problem of heights with a simple changing of the terrain and texture or with the help of mountains on the map. Practice We are creating a location with the size 4x4 tiles. To create the location outlines according to our scheme we are using a standard brush of the radiuses 5-9 and the default pressure strength. The key combination Ctrl-G will enable the mesh. Fig. 2.1 Landscape mesh of the location 10 Try to achieve a similar result; this will be sufficient for now. Each big tile of the surface corresponds with a texture of the maximal resolution 1024x1024 pixels (you can reduce the resolution of textures in the editor to save the RAM). Hundreds of various textures are available in the editor for the use in unique and manifold landscapes, they are grouped in categories. Besides there are several methods of overlapping and brush types, which would help to create the landscape meeting the author’s idea. Fig. 2.2 Texturing tool The texturing mode is available via the Texture Tool on the tab Landscape of the toolbar. There are three methods of surface drawing: brush (button brush), region filling with a texture (button region) and decals overlapping (button decal). An additional window of materials selection appears in process of work with the texture. To add the texture palettes here, install the pack sourcemedia, which includes all the textures used in the game. 2.2 Landscape texture editing 2.2.1. Texture overlapping. Brush types We’ll paint the island with the help of a brush. There are three types of brushes (group of icons Mode) and brushes they have four types (group of icons Type). The simplest brush type is a circle brush, it is enabled by default. There is a square brush, a star brush and a texture brush (with a complicated type). The brush type is adjusted with the help of keys [ and ] or manually via the field Size. Brush types: regular, eraser and mixing. First two are obvious, the third brush mixes new material with the previous layer instead of applying it over the available one. Another important setting – texture transparency. The higher is the value in the field Alpha, the higher is the brush strength, however when you apply a texture to the same place repeatedly the values of transparency are summed up. Therefore for an equal application of transparent materials use a mixing brush, another method is to draw with constantly LMB pressed. The value of the field Angle determines the brush rotation, not the texture rotation. Angle changes the orientation of decals, we’ll dwell upon it later. 11 Lumi Layer is a special one, this layer doesn’t work with a texture, but it highlights the landscape in a particular way. This option will help you creating illuminated and shaded areas (shades) without light sources as well as help painting textures into colors you need. 2.2.2. Materials and layers At the very bottom of the edit panel there is a layer field. The parameter Scale is responsible for the texture scaling on a tile and helps to save the RAM. Further you see the material layers, which are applied to the current tile. Only three upper layers are displayed, the current layer, which is being edited, is located in the bottom field. Press button Layers to view all of them on the tile and swap them. Each layer corresponds with the particular material and is created at the moment, when we touch the tile surface with the brush. The eraser deletes only the upper layer, if an error is in the bottom layer, you can swap them and delete unneeded parts with the eraser and then swap the layers again. It is recommended to periodically use the button merge map, which will merge all layers into one and delete the information about them unloading the video memory. You can edit the location textures in any graphic editors, which work with the format *.dds. 2.2.3. Filling the regions You can enable this mode with the help of the button region. It is convenient for filling some area with a particular texture. The outline of this area can be extremely complicated, e.g. built-up with the help of short elements. First of all you need to create a region with the help of consecutive mouse clicks: each new click creates a new dot of the polygon. If you hover the cursor to an existing apex, the line will grow green and you can close this region with the help of the mouse click. A Shift-click on a closed region will fill it with the texture of the selected material. A Ctrl-click will remove a region (but not the texture it is filled with!). The same rules are applicable here as for the regular brush: material layers and texture attachment to the tiles. If you try to draw with a texture, but nothing happens, it means that this material was already applied to the tile and it is available in some bottom layer. To solve the situation you should either raise the layer, or use merge map. 2.2.4. Decals Decals are one of the possibilities to fill a location with unique details. This mode allows to lay arbitrary pictures in arbitrary places. For example stumps under the trees or light from windows. A number of decals are available in the editor, which you can use in your locations, but you can also import your own. After you have selected a decal a left mouse click will move it to the place selected on the map. Click on the picture centre to select it. A number of operations with decals is available: – movement (hot key M); – transformation (it is performed via the movement of decal apexes); – rotation (R), you can rotate a decal both around the centre and around one of its apexes; – scale changing (key S) along all or one of the axes. 12 Fig. 2.3 Applying decals You should always apply decals over the landscape following its curves and not mixing them with each other. 2.2.5. Textures as means of expression Texturing is the most handy and at the same time very expressive means for the creation of a location. The working options of textures are almost unlimited and everything depends on the designer’s imagination and talent. The palette of this editor includes hundreds of textures and their variations to any taste, including transparent ones – fallen leaves, stones, shells, flowers, etc. With the help of textures you can create illusive volumes: small stones, roots, slabs protruding from the ground, ravines or puddles. Practice We need sunset, orange notes, therefore we’ll use the texture packs humenlands and autumn. For a start we’ll apply the basic texture Ground_A_02 on the location – it will be our base (1 on the Fig. 2.2). 13 Fig. 2.4 Basic texture Now you need to apply other textures and make qualitative transitions between them, and interim ones on the joints. For the mountains we are taking the rock texture humen_stone_10 (see. Fig. 2.4, marked with 1 on the figure). For its transition into the sand texture we can take the textures humen_stone_2 (2) and humen_stone_4 (3). For that smooth transition the alpha of the brush should be about 30. 14 Fig. 2.5 Mountains Final stroke – we’ll select the mountain tops with a bright texture – humen_stone_10a. 15 Fig. 2.6 The mountain tops are highlighted with a brighter texture. The same method goes with the southern headland 16 Fig. 2.7 Southern headland Now we are starting to work with the island neighboring to the main location. 17 Fig. 2.8 Island coast We’ll make its dark and frightening using a group of textures of the dark forest. First of all we are taking the texture humen_darkstone_1 and make a rocky coast in the south-east. The mesh is enabled for a convenient display of the terrain unevenness. 18 Fig. 2.9 Basic island texture Two materials are used here – basic humen_darkgrass_6 (2), and the material humen_darkstone_2 (1). Let’s add a path. 19 Fig. 2.10 A path on the island A couple of final strokes and the island is ready! 20 Fig. 2.11 A completely textured island As we used the rocks texture, it was the first time we worked with the decorative texture. Such textures have transparent areas, therefore they can be applied only above other textures and serve to improve the appearance of the surface and make an illusion that there are objects on it. To merge the layers, press merge map. 21 Fig. 2.12 Areas with vegetation Figure 2.12 shows the application of a texture to the location areas with the vegetation. We’ll use the material Ground_D_01, mixing it with similar materials Grass_00, Grass_01 and Grass_Big_00-04. Don’t forget to put small rocks onto the path. 22 Fig. 2.13 Coast line In this way we'll make the coast line and in other location areas and leave a couple of descents to the sea. Now we are starting to paint the paths. To create a dark stone road use a texture Ground_A_03 (1 on the Fig. 2.14) and humen_dirt_7b (3) for the bright one or its equivalent humen_dirt_6a (3). We are applying them with a very small alpha channel. Finally we’ll apply a decorative texture of large road stones Ground_A_04 (2) over them. 23 Fig. 2.14 Roads Now let us start with a detailed decoration of the areas of grass glued with sand and decoration of other areas. 24 Fig. 2.15 Decoration work At this stage you can consider the preliminary texturing as finished. In this section we’ll speak about the static objects of the terrain. In general any object of the game consists of two parts: an atom and a logic unit. An atom determines the basic properties of an object in the game world: its appearance, size, the influence on the passability of a location. A logic unit determines the nature of its interaction with the player, its reaction on the mouse clicks, etc. Each atom belongs to a particular class. Here we’ll have a closer look at the atom classes static, dynamic, hollow and bridge. Static – atoms, which have no animation, no logic. These are rocks, trees, fences and other stationary objects, which don’t interact with the player in any way. Dynamic – these are animated objects, which have no logic too. For example a rabbit running around or a sign with a streetlight shaking in the wind, these are dynamical objects. Hollow – atom, which has no model. As a rule these are special effects created on the basis of particles. A cloud of fog, smoke, fire, a column of light. All these items are of the class hollow. Bridge – a static or dynamical atom, which has additional properties, it serves as a ground for player’s runabout. With this the map of landscape heights is adjusted to these objects: you can not pass under a bridge and if you try to do it, your protagonist will try to hop onto the bridge. 25 Fig. 2.16 Atom tool For the decoration work the static atoms from the tab Atoms (Shift-A) in the toolbar are used first of all. When we open this tab a tree of all atoms pops up. A bit higher you can toggle the displaying method of the tree folders either via the atom icons (thumbnails) or via the list using a tag (a name of the prototype file). Instances will show the list of all atoms, which are already located on the map, for a quick search. Choose an atom, press Insert and the left mouse button, and put the atom on the map after that. 26 In Decorations there are atoms stored responsible for the decoration. These are fir-trees, stumps, grass, stones and other objects required for the location design. The folder Decorations/land/bridge, where the majority of bridges is stored, deserves particular mention. In Resources there are various altars, gold/crystals, trunks and other interactive objects, which a player can pick up and receive various bonuses and resources. In the category Units there are armies (monsters on the map), enemy heroes (unique models marked by a special effect) and NPCs. In Environment there are atoms of the hollow-class – special effects, waterfalls and others as well as atoms responsible for the sounds on the map such as purl of water. In Buildings there are active (not decorative) buildings on the map including castles. In Logic there are objects with logic, for example the protagonist herself (it is required on the very first location for generation) or elevators/platforms. In Arena there are atoms specific for the arenas, Old (atoms from the King’s Bounty: The Legend) and Uncategorized, which were not categorized. 2.3. Locating objects 2.3.1. Basic operations with objects All atoms on the map support the following operations: movement, rotation and scaling. It is highly recommended to memorize the following hot keys: M – toggles the mode of atom movement. Press Alt to shift the object movement from the horizontal into the vertical plane; R – toggles the rotation mode of atoms around the vertical axis Z. Press Alt to shift the object rotation around other axes, but in the range of 180 degrees; S – toggles the scaling mode of atoms along all three axes. Take into account that many atoms set up a random value of the rotation angle and the scale, however in specified limits. Try to choose a tree and place it on the map ten times, and you will comprehend how it works. The key N + a selected object (a selected object is an object under a cursor) forwards us to the next atom with the same name, V creates another variation of an atom with the same tag (atoms with a similar tag can vary in the orientation/size), F finds an atom in the palette. For more complicated atoms E edits the embryo, and L – the logic unit, we’ll dwell upon it later. Press Space bar to open the window with the properties of an object. 2.3.2. Changing object properties Each object receives default parameters from the atom-file of this object. Press Space bar to open the window with the properties of an object. Tab Origin – is the object position on the location. Here you can manually, but in the meantime highly accurately adjust the object position along all three axes, its rotation along these axes and its scale. Tab Overrides allows to reload some pseudological properties of a map object. Parameters Main: Is hidden – if an object is hidden or visible on the map. It is required for quest objects, which appear or hide with the help of special logical commands; Mapicon – icon image on the location map. Only for buildings/NPC/portals. Parameters Collision Shapes: Ground collision – view and size of object collision, it determines the physical properties of an object and influences its passability parameters. If you set up a figure, the area of passability will be a circle with this radius, if you set up a colshape-file, the passability will be difficult according to the parameters 27 customized in the file, if you set up nothing (not ‘0’, but exactly an empty field) – an object will be fully passable; Layer #0 (buildings or boxes) – area of interactive relations for buildings and containers. Radius or colshape; Layer #1 (Army/NPC impact) – area of close-by relations for armies and NPCs. Radius or colshape; Layer #2 (radius smell) – army radius, where the enemy notices the protagonist even in the case, when it appears from the back side; Layer #3 (radius vision) – radius of army visibility, at which a troop notices the protagonist, if it is in the visibility range. Only for armies; Layer #4 (radius lost) – radius required for the protagonist to be beyond, for an enemy army to stop the pursuit; Layer #5,6 – reserved, you can use them at your disposal; Layer #7 (boat with hero) – interaction radius of the protagonist with the boat. A number of objects have an additional tab Text, which allows adding a description on the map. Hint – message, which pops-up, when you mouse over the object. Message – displayed in a window after a RMB click on an object. If you don’t use Message, the program will display Hint instead. Another general tab for many objects – Variables. You can view and edit the variables stored in the object. Practice It is high time to fill our location with objects and life, i.e. static and active objects. First of all you should erect a lighthouse on the map, it is located in the category Buildings/Human/lighthouse_02. If required, use Alt-Move to slightly sink it in the landscape. Note that there are several very useful functions at the panel top: Objects follows landscape – if this function is enabled, an object will stick to the landscape and you will not be able to raise or lower it; Addition – this button provides additional possibilities. You need a search line Find. If you enter names or name parts in it, the filter will be enabled. A button on the right will show the amount of objects corresponding with the specified condition. If you press it, a list of found object will pop up. Having selected a required object, you’ll move to it in the palette of atoms; Pay attention to the shadow of the objects: it doesn’t look nicely, therefore open the main menu in Location/Light and reduce the shadow transparency from 1 up to 0.5 in the tabs for each day time. Having erected the lighthouse, fill in the areas next to it with trees. Take the trees from the folders Decorations/land/human/trees and Decorations/land/human/trees/highpoly. In the result you’ll receive something similar to the figure 2.17: 28 Fig. 2.17 Original object location Now you need to do the same with the northeast of the main island, additionally we'll set up a house for an NPC there. We’ll take the house from Buildings/Pirate_robber/building_pirate_house03. 29 Fig. 2.18 Objects in the north of the island. Let’s work with a cave. Set up a cave entrance from the folder Decorations/cave/cave_cyclop into the mountain, which we have already made. You can disguise the joint with a texture of small greenish rocks. Fig. 2.19 Cave entrance 30 Now perform the same procedure with the mountain next to the lighthouse adding there mountains-objects. If required, we’ll paint the landscape there. Fig. 2.20 Rocks on the southern headland Now when all big and eye-catching is located on the map, you can position small decorative objects. 31 Fig. 2.21 Slight decoration in the south of the island Here everything can be determined only by the stretch of designer’s imagination. In the same way we’ll decorate the cave entrance using trees, bushes and roots. 32 Fig. 2.22 Slight decoration of the cave entrance The location will win a lot, if it will have not only ‘just forest’ or ‘just rocks’, but also some remarkable objects looking good to the eye and making this place stand out. We’ll have a giant stump in a forest. Here is where it’s located: Decorations/land/human/tress/stub/stub02, in Decorations/land/human/plants we’ll take the mushrooms, which will grow next to it. Fig. 2.23 Places of interest 33 Finally it we can paint the space under with some other texture with roots (the texture is located next to the grass texture, which we used). Now as we locate this object on the map, we’ll create a forest path to it from the house of our NPC. Fig. 2.24 Forest path Now decorate the path and the place around it. Fig. 2.25 A refined path 34 Now it is time to start working with the decorative textures, combine them with the objects. For example you can make a glade with flowers: Fig. 2.26 A glade with flowers Locate butterflies over the glade, it’s an atom of the class hollow located in Environment/visual_fx/hll_butterfly. This is an above mentioned atom without a model, to display its centre in the editor, it is required to enable the display of the hidden objects (View/Hidden in the main menu). Locate the atoms of fireflies in the forest deep hll_firefly, and a couple of atoms hll_leaves_summer_c near the stump and will paint the landscape next to it with the fallen leaves. 35 Fig. 2.27 Fallen leaves around the magic stump Let us put a portal next to the cave entrance. Take the portal effect and a special invisible atom containing the portal logic here Logic/portal/portal_test_ground and will carefully sink it inside the cave arch. Fig. 2.28 Effect of portal Finally we’ll locate the objects on a small island. 36 Fig. 2.29 A neighboring island How to connect a small island with the main location? Act simply: we’ll construct a raft. In detail this process is described below, and now you should customize the water. 2.4 Water settings The water settings are available in the game in three places: tool Water in the toolbar, template default is responsible for the main water on the location, button Deep Water Settings in Landscape (it edits the same template default) and additional water settings in Location/Light in the main menu. Water has two types – main and additional. Main water is determined by the template default and it fills the whole location by default, additional water is determined by other templates and it can exist on the location separately from the main one. 2.4.1. Basic properties of water As you customize the water, you customize its thickness and its surface. The water thickness is a color gradient from the surface to the bottom, and you can set up the gradient strength and its color. Additionally water thickness is responsible for the blurring of objects and the landscape, which are located under the surface. The water surface is a bit more complicated. It can have a texture of the reflected sky, which is additionally colored with the water color. Later this texture is modified with a dynamic effect responsible for the waves washing on the surface. All these receive an animated texture of waves at the coast. An additional complexity in work with water is that the main template of water and the additional one have great differences in the settings, one and the same parameters can have different meaning. It is recommended first to toggle the settings of the existing water, simulating it from another location. Import/Export of water settings is provided with the buttons Load from file/Save to file. 2.4.2. Deep water In 99% of cases if you need to use the basic water template, the button Deep Water should be disabled. The main template is situated beyond the location, but if Deep Water is absent, the water will not be rendered till the crack of doom, creating endless water surface and the horizon line. The best way to set it up is through Deep Water Settings on the tab Landscape. 37 Fig. 2.30 Water settings Water level – water level in regards to the null point of the axis Z. Water color – four sliders in the format RGBA. They influence the coating of the water surface. Texture scale – size of the reflective texture. Diffuse texture rotation – texture rotation. Fresnel bias – determines the transparency of the water surface. The higher is the value of this parameter, the lower is the transparency of the surface. Fresnel depth alpha – determines the intensity of water ripples. The higher is the value of this parameter, the smaller are the ripples on the water. Bump scale – duplicates the previous setting and their effect is summed up. Depth scale – determines the intensity of the color gradient. The smaller is the value of this parameter, the more transparent is the water thickness. Environment cubemap – selection of a texture reflecting in the water. It is usually the sky. Refraction – when this option is ticked, the water will reflect the nearby objects/elements of the landscape. This option heavily loads the graphics card and sometimes shows incorrect procession of the object edges. Refraction scale – intensity of object reflection in water. Water speed – determines the speed of waves, the intensity of ripples. Water direction – direction of waves move. Tab Swash allows to preset the water splashes, when water collides with the coast. It is not used in the game. Tab Foam allows to preset the waves, which will leap the coast. Three layers of waves are accessible, what allows to create an interesting coast line. The waves are created only around the landscape ignoring any other objects. Here are the settings of each of the layers of the coast waves: 38 Foam width – determines the width of the wave texture from the coast; Foam jitter – synchronization of waves with each other; Foam speed – the speed of wave texture animation. General settings for all three layers: Foam opacity – transparency of the wave texture; Foam opacity bias – level of transparency at the coast; Foam margin – scaling of the wave texture. The higher is the value of this parameter, the more elongated is each wave along the coast; Foam scale – normal scaling of the wave texture. Each separate wave will grow smaller, but the amount of waves themselves will grow. It influences the speed of wave generation; Foam thresh – determines the amount of waves, which are created around the coast areas. If the value of the parameter is big, the amount of waves grows smaller. You can adjust the deep water quite flexibly, but first of all you should take your bearings at the appearance: The more attractive and natural it looks, the better. One of the most important parameters - color of the water thickness is unavailable through the water settings themselves, it should be customized through the light properties (Location/Light/Water Settings/Deep Color). It should be noted that there can be a creative approach to the deep water: You can remove its surface and make the thickness color to ‘black’, then you can use it as an abysmal gulf. 2.4.3. Water templates, several types of water on a location All above mentioned relates to the template default. However from time to time we need several types of water on the location. Let’s consider the limitations, which appear in these cases. The template default is present always, you can not delete it or replace. In the list of templates you can create a new template by a right mouse-click, however in order to paint with it, you need to lower the level of the main water under the landscape in this tile. Shallow water has no color gradient and you should create the sense of bottom through the coloring of the bottom texture. For such water there are settings, which modify its optical properties depending on the depth, but the depth is calculated basing exactly on the landscape. If you require to apply default for creation of seas and oceans, other templates suit best of all the static isolated water ponds: mountain lakes with crystal-clear water, muddy swamps or deeps, small colorful pools. You can also create rivers and use the special effects of moving water from the group of atoms hollow (Environment/visual_fx/waterfall). Besides the adjustable template of water differs from default in the following parameters: Water level – the same as for default; Water color – the same as for default, however this setting has more influence on the water color; Texture scale – determines the scale of the wave texture. It will be distinguishable at the parameters extremely close to ‘0’; Diffuse texture rotation – rotation of the ripples texture in degrees; Fresnel bias – determines the level of dependence of the water surface texture on the sky texture and the water color, which was preset above; Fresnel scale – determines the general transparency of the water surface; 39 Fresnel depth alpha – dependence of the transparency of the surface texture on the depth texture. It is important to understand that for the shallow water the depth is always considered as the difference of the landscape level and water in a particular point; Bump scale – determines the scale of the ripples texture as well; Depth alpha – determines the level of transparency of water with the depth; Depth scale – determines the scale of water depth. At high values of the parameter all other settings with influence on the depth will act stronger and on the contrary; Environment cubemap – selection of the sky texture for the water surface; Refraction – here this parameter determines the dynamic blurring of objects under water. Enabling recommended: Objects under water look more realistic; Refraction scale – the intensity of influence of the previous setting; This combination of settings allows to make the water nice enough. Take into account that the sky texture doesn’t move along with the camera movement, so some textures assume the application in specific conditions for example humen_underwater. Practice Let us try to adjust the water on the location. First of all open the tool Landscape and press Deep Water, enabling the deep water. Later you’ll be able to edit water also from here through Deep Water Settings. Fig. 2.31 Water by default Let us choose a sky texture - water_cube_sky_2.dds. Additionally we’ll make the surface color smoother, if we set all sliders approximately to 0.15, and slightly protrude the red one. Let us set Fresnel bias approximately at 0.25, as on the figure 2.30. We’ll increase the amount of waves on the water with the sliders Fresnel depth alpha and Bump scale. We need to launch the ripples with the parameter Water speed. The setting of water is finished with this so far. Further we’ll need to set up the color gradient of water depth, we’ll dwell upon it in the next section. 40 2.5. Location light The light helps to make an interesting or a boring location. In this section we’ll discuss, which parameters of light settings are responsible for the creation of a particular visual effect. At your disposal there are sample files created by developers, you can study them. 2.5.1. Types of light in the game There are five types of light in the engine of King’s Bounty: Ambient Light – ambient light, which amendment would similarly influence the color of all objects including those in the shadow. This light is always present on the location; Diffuse Light – global light, which has a direction and builds up shadows thrown by objects. Same as previous one it is present on each location; Omni Light – spot light. Its brightness is maximal in the centre and descends to the null at the border of the light radius. We can use multiple light sources on a map; Specular Light – reflected light, which is responsible for the realistic metallic luster and for the light-reflecting properties of some materials; Bloom Light – additional light effect responsible for bright twinkles or light-striking of some materials. Bloom is a post effect, applied to the final picture. 2.5.2. Setting of the global light of the location depending on the day time Go to the mode of global light and select item Light on the tab Location in the editor main menu. Let us study the tabs one by one. Fig. 2.32 Window of day time setting on the location 41 At the bottom of the window there is a field Time line; if you press the button Test, you will see, how the light on the location change with the day time. Buttons Load Defaults and Load and Save allow exporting the light settings into a .strg-file and a consequent importing back. Common – settings of the sun and fog types. Sun settings are responsible for the location of the source of Diffuse Light and for its change with the time. Pitch – angle above the surface. With the help of Min Pitch and Max Pitch you can make longer or on the contrary shorter shadows. The parameter Time Speed is set in the configuration files of the game by default. Scenetime – setting of the day time on a location. If you tick Don’t use default times, you can set the length of the day time. The same tick can unblock the setting Time Speed in Common, which allows to decrease/increase the time flow on a location. Night/Morning/Day/Evening – light settings on a location in a particular time of the day. In all four panels the settings are absolutely the same. Ambient Color – color of the ambient light. All the objects on the location will be colored with it. Diffuse Color – color of the objects when they are lit with direct sun rays. The intensity and the color of the diffused light will allow to create the general atmosphere on a location. Diffuse light has more influence on the landscape, Ambient – on the objects. Landscape Shadow – color of shadows of the landscape. Object Shadow – color of shadows on the objects. Specular Power – modifier of the reflected light. Shadow Transparency – transparency of the shadows. Bloom Cutoff Threshhold, Bloom Factor, Bloom Factor (for indoors), Clouds Intensity – settings of the Bloom-light. Fog Settings – fog settings. Water Settings – settings of water light. Deep Color – color of the deep water. Horizon Line Color – color of the horizon line. Tint – color of the adjustable water texture. Env Map – adjustable water texture for the time of the day. Save/Load Panel Settings – export/import of the light settings for a particular time of the day into .strg-files. 2.5.3. Fog settings The fog in the game both creates the atmosphere on a location and helps to hide the borders of the rendering, beyond which the objects don’t display any longer. The fog is to be set up in two places: on the tab Common and in the light settings for a particular time of the day. On the tab Common you can choose the fog type. First of all we are interested in Depth Fog, Height Fog and Depth Fog (angle dependent). The first and the second ones differ only in their intensity (Height Fog is more thick). The properties of the fog of the third type depend on the camera direction. In the settings for a particular time of the day there is a field Fog Properties. In the tab Normal in this field you can set up the fog color, its transparency, front and rear plane. Near plane – distance at which the fog condensation starts (there is no fog before this distance), Far Plane – 42 distance at which the fog strength becomes equal to its Transparency. If the latter one is set to 1, it will be exactly at the distance Far Plane from the camera, as the fog would completely ‘devour’ the objects and the landscape and will assimilate with the horizon. Other four tabs in Fog Properties (South, East, West, North) will work only with the enabled angle dependent fog. Then you will have to set up the fog properties not for all the direction at once, but separately for each direction. 2.5.4. Local light sources. Omni Lights. This type of light is responsible for spot light sources. It is important to note here that this light doesn’t make objects throw shadows. You can enter the mode for editing the omni-light, if you choose the tab Omni Lights on the toolbar. You can perform the following operations with the omni-light sources: Insert create a new light source, Del – delete an existing light source, left mouse button – move an object in one plane, Alt+LMB – move an object in another plane, scale an object (Ctrl-LMB), simultaneously changing the radius and the light strength. Space – allows to edit the settings of the omni-source. Color – color of the omni-source, basic setting. Amplification – luminosity of the omni-light. Range – distance, at which the effect of the source reduces to ‘0’. Max Radius Delta – determines the range at which the illumination radius changes with the time. 0.2 means that the radius will change from the nominal value to 0.8. The radius itself changes chaotically in the specified interval. Radius Delta Frequency – determines the frequency with which the illumination will change at the nonzero delta. Light Landscape – when ticked off, the omni-source will illuminate only the objects, no landscape. Four States – if this option is disabled, you can indicate other properties of the omni-source dependant on the time of the day, for example color and intensity. You can enable or disable them, when at the day time shift. A correct use of the omni-sources on the location can make it nicer and more interesting. You can complement the objects, which have visual luminosity (flame) with omni-sources of light for the sake of atmosphere creation. For example, lanterns, which light up with the night outbreak. 2.5.5. Zones of local change of the luminosity You can set up in the editor that the light on a particular location differs from the global light. To do this you need to choose the tab Landscape on the toolbar and Landscape Logic -> Light Zones. At the bottom you will see a list of different zones, for the start we need to create a new zone. Its setting is completely identical to the setting of the global light – exactly these parameters will smoothly change when the protagonist enters a zone with special light. You can change absolutely all parameters. You can use the created zone as a brush and paint some areas of the location with it. Shift-Click deletes the zone of the amended illumination. A tick at Override Mode is required, if you need to paint one zone with another. As opposed to the omni-light, the illumination of the objects here depends not on their coordinates, but on the coordinates of the player, i.e. when you enter such a zone objects located beyond it will also change the luminosity. 43 2.5.6. Imitation of light/shadows with the help of the texture painting. Lumi layer Does omni-light make additional load on your graphics card? In this case you can achieve the same effect just painting a texture. The main instrument for it is the luminosity-layer in the texturing toolbar. In this layer you apply not a texture, but a particular color through surface highlighting. Lumi-layer is always above and it doesn’t unite with them via the Merge Map. You can achieve the same result, if you use lighter variants of textures available in the game kit. Finally you can simulate dropping shadows (for example from a group of trees), it will be possible, if you select a texture brush in form of a tree shadow, black texture and a small alpha – painting under the trees will create a required shading effect. Practice Let us assume that there is always the sunset at our location and the time of the day doesn’t change. Enter Location/Light in the main menu. Set the parameter Sun dir scale to ‘0’, the sun will stop its run. We’ll set the sun direction in the parameter Sun time – to 3.30. Finally, we need soft light and long shadows therefore we’ll set the parameters Min pitch and Max pitch to ‘1’. Fig. 2.33 General settings of the location light We’ll indicate Position dependent in the settings of fog selection. Let us set up all the light for the evening and copy-paste it into other times of the day – now we have an everlasting evening. 44 Fig. 2.34 Light settings in the evening Let us add a bit of grey to slightly smoothen the color of the shadows. We’ll add orange to the color of the diffuse and ambient light; make the color of the horizon line and fog color also orange; draw near the close and distant planes of the fog to make it slightly appear on the location; finally, set up the a darker color of the deep water than the default one; export all these settings into a file (Save panel settings) and load for all other times of the day. Now let us place several omni-sources on the location. We should make the island look interesting and highlight the places and objects, which appeared to be in the shadow with their front sides due to their position. We are using light-yellow colors, and red and blue on the neighboring small island. 45 Fig 2.35 Omni-sources on an island 2.6 Logical maps of the landscape Besides texture and height each tile of the landscape has a number of logical properties. There are four logical landscape maps, which you will have to work with and they are available via the tool Landscape Logic on the tab Landscape. These are maps of area passability, surface types, arena types and triggers. You can set up the size and the brush type everywhere, with a tick at Override mode you can re-paint the already painted landscape with another brush. In general the same rules as with the textures are working here. 2.6.1. Map of passability This map is available in the mode passability. There are two types of passability: for the protagonist and for a ship. You will find below two buttons for each of the type. Let us consider water first of all. We should paint the tiles in this mode, we are making them impassable for the protagonist and passable for a ship. In order to save the manual work we can select the fixed water level (Depth), press Apply and turn all the tiles located below this level to the water ones. In the mode Land painting of a tile turns it into an impassable one. The passability can also be created with the help of objects – the so-called colshapes * , which were mentioned above. With the help of tile painting we are making the landscape additionally impassible in the areas, where there are no objects and the impassability is required there. However take into account the sizes of creatures and characters: a walking princess can pass through a rather narrow opening, than a riding princess. Use the key combination Ctrl-H, to see the passability map. Yellow squares on the surface are the area of ‘relative passability’, the hero will hardly get inside. To escape problems don’t make yellow squares adjacent in the area, which is supposed to be passable. The green border belongs to the physical cObjects, they also create areas of full and relative impassabilities around * Collision shape – a contour of physical or logical interaction with an object. This contour can be determined by a figure (circle radius) or a primitive contour (shape) loaded from a file. 46 themselves. Yellow border – logical colshapes (we spoke about them in regards to the object settings on the map). You should also avoid ribbed edges of the passable areas, an excess of sharp edges will result in hero jamming-in and in the complication of path-finding. 2.6.2. Types of landscape, arenas and illumination Other types of the logical maps are very similar in their performance: you should create or choose a type of filling and paint the surface with it. Let us consider them one after another: Triggers – creates zones, where you can trace the absence or the presence of the protagonist or other objects using the game logic. Surface Type – surface type. This option determines the type of particles, which appear in the process of movement (a horse riding on sand kicks up dust, on water – splashes) and the corresponding sound of hooves. Arena Type – type of arena for a particular section of the area. It is recommended to choose arenas, suitable for the specified area. If you don’t specify the arena type, the editor will use the arena from Location/Properties/Map. Practice Here you need to build a map of passabilities, map of arenas and map of surface types. You should paint the whole sea (we'll have no ship), rocks, hills and the forest, impassable according to our conditions. Fig 2.36 Map of location passability Set up the map of surface types in the similar way, use the types Grass, Sand and Ground for the corresponding textures. Finally, place a dark forest arena on the small island – Uncategorized/adarion_1_forest_5. 47 2.7 General properties of a location In this mode you can set up the general properties of the location such as music, shadows, complexity and arena types. There are several tabs, which show the groups of settings. Fig. 2.37 Location settings System: No shadow – object classes, which will not throw shadows. Music playlist – list of music themes for a location. A playlist is chosen from the songs in the file playlists.txt. You can edit this file and introduce in the session. Sky mesh properties – settings of the sky on the location. The list is empty by default, you can create time key points of the sky in it. The sky will have the look specified by the figure defined in the point up to the next point. You need to choose the sky texture for each sky point – Mesh file. Sky scale – customization of the sky altitude and fog over the horizon; Zero height sets the height of the sky texture over the horizon; Fog level – fog level over the horizon, Fog height – height of the color gradient of the fog. Location Bias – setting of the variety of texture detalization for distant objects. Common Logic: The only setting here is the level of location complexity from 1 to 100. It determines the generation of gold/scrolls available at the location. Start with 5, the recommended pitch of values 10, i.e. 5, 15, 25. Map: Special Hero Atom – determines, if the model of walking Amelie will be used on the location and if the flight is prohibited; required for caves and buildings. Force Flymode – the protagonist appears on the location in the flight mode. Default Arena – arena will be available on the location by default. It is highly recommended to customize a universal arena for the location here. Enable Custom Game Camera – enables a special camera for the game. Required for a number of caves with too narrow passages. Practice Customize the sky, arena type and location complexity. Starting with the sky. With the help of a RMB click generate a new point on the tab System in the field Time key point. Then edit it and 48 select the sky skyarena_day. Now you should adjust three important settings: Zero height to 3.5 to see the nicest clouds above the surface, Fog level –4 (minus four), and Fog height – 2 (two). Additionally, for the best effect, choose the fog color and the horizon line in the light settings. As a playlist for the location you can customize – debir. Fig 2.38 Sky over the location Now set up the difficulty level at the location on the tab Common Logic. On the level of Pink Wind it will be – 15. On the tab Map we’ll set up a default arena – aisland_2_coast_1. Now it’s time to settle our island with characters and monsters, lay around trunks and shrines, create quests and dialogues. In this section we’ll speak about that part of logic, which is specific for a particular location. Everything placed on the location belongs to it. For example a house; its logic will be built up as a part of the location and it will be saved on the location. However if you decide to settle a hero in the house, you’ll need to turn to the general logic of the session. A character is living in a session with its quests and dialogues, you can easily move it from one house to another and even in process of the game! If you modify the house, you’ll only save a location, if you modify a character, you save only the session. Logical data specific for the session is called session internals; NOTE! Undo doesn’t work for their modification, so be careful! 49 3. Location logic 3.1. Atoms Practice Acting in this way, you’ll have an NPC on an island, it will sit in a house with a shop; the shop will open only after a quest completion. There will be a monster on a small island and a raft, which can bring the protagonist to the small island; several scattered trunks and shrines, a lighthouse with a shop and finally two armies patrolling the island; additionally a portal bringing you back to Debir. First the buildings will be inhabited by actors – the lighthouse and NPC (we’ll call it Mushroom Joe). There is also a monster, a hero heading an enemy troop (an actor is required for it too). Mushroom Joe needs a dialogue, this is also session logic, and a task for the monster killing. Here is a task list: – lighthouse logic. If you click it, a shop appears, you should set it up too; – Joe’s house logic. If you click it, a dialogue with Joe appears. You can go to a shop from the dialogue; – a couple of bonuses lying on the map. A treasure under a big stump; – a raft to ford to the small island. Make it active only after Joe has given you the quest. It is required for not to kill the beast before receiving the task; – enemy army - monsters; – two armies, patrolling the way to the lighthouse and the forest path; – two-way portal to Debir. Adjust the raft logic later, now position only the required objects on the map and adjust their logic and contents. Atom is an object with the following properties: 1) the game engine makes it visual as a whole element; 2) it has physical parameters: size, 3-D model, sound or FX; 3) it can contain a logic unit. There are several types of atoms and as we mentioned above the atom-file determines its atomprototype. The class of the atom and a number of parameters of its atom file define the possibilities available for it in the game and in the editor. Let us have an overview of the atom classes available in the game. 3.1.1. Atom classes First of all they determine the availability of settings for the atom and the logic of the atom by default, as you place it on a map. Here is the list of classes: static – static atoms. They have only the model and the physical size. Examples: grass, stones, trees. dynamic – the same as static, but these atoms have animations. Examples: a squirrel, a sign with a swinging lantern, a windmill. hollow – atom of this class doesn’t have any model, but it can have an attached special effect. It is used both on the map and in the battle. Example: a sunlight beam, fireflies, waterfall and its splashes. 50 bridge – it is a dynamic atom, which has one unique feature, in the area of its location the height is calculated not on the basis of terrain height, but basing on its model itself. Example: all bridges, wooden pier, Demonis islands. platform – the same as bridge, only it has logical settings and can move together with the protagonist. Example: raft, flying demonic platforms. multistate – dynamic atom, which has a status. There are several states, which the user can toggle via the script, and it will have influence on the model and/or animation of an object. It can use its own logic. Example: opening gates, train, crashing statue. hero – special type of the moving atom, which a user can control. The installation of this atom on the location means that the player’s hero appears in this place. It is required for the first location only, further we are moving to the location through a portal. It stores a logic unit with a number of variables specific for the protagonist. boat – hero’s boat. army – enemy’s army on the map. You should not mix it up with a unit on the battlefield, these are different atoms. There are special armies available for the armies. This atom has logical shapes. box – treasure on the map or in the battle. It has a special type of the embryo for a box. It has logical shapes. Examples: trunk, a pile of gold, magical crystal, Mana fountain, altar of Battle. castle – building. This category includes both castles and standard houses with shops. By default it has the adjustable building embryo. npc – the most widespread and universal of the atoms with customizable logic. It has only the logical shape, however it can fail to have an embryo. It is to customize manually. It can walk, fight, die, fulfill the functions of a portal and a shop, this is what to be called universality. Examples: warrior on a map, portal. throwable – special type of the atom for various shells and special effects in a battle. You must not apply them in the editor, they are used in animations and in scripts. Example: archer’s arrow in a battle, effects of spells and blows. chesspiece – battle unit on an arena, they are spawned in a battle themselves. pawn – a battle unit, but on the contrary to the chesspiece, it doesn’t have any pre-set functions in a battle. Pawn doesn’t know how to walk, shoot or even die. All its logic and behavior on the arena are customized through the Lua-scripts. Universal class like NPCs. Example: beehive, totem, powder keg, ball lighting, egg of the Hayterant, all bosses and even the Pet Dragon! spirit – in Princess this type of atom is not used. embryo – embryo as an independent function. More details about embryos below. land – a very rare class. It is an element of decoration. Its usage can result in distortion of the surface terrain, additionally this element can use the landscape texture as its own. Example: Pit-Trasher on Bolo, dwarven elevators. 3.1.2. Basic parameters of atoms In the atom selection menu you can click any of them with the right mouse button. After that in the pop-up menu you can check/change the atom settings. Edit thumbnail, Explore thumbnail, Reread thumbnail and Replace thumbnail with are responsible for the atom icon in the list, Move to helps to move the atom into another place in the folders, Clone creates an atom duplicate, Attachments launches the editor of the attachments (see below). In any moment you can see the 51 atom in the text form through Edit atom file or Explore atom file, but to make it you need to have the game resources unpacked. We are interested in Atom properties and the relationship of the settings represented there with the contents of the atom-file. There is a section main inside of each atom. Let us consider its parameters: class – atom class; model – model with a texture and animation. Format *.bms (static) or *.bma (animated); nodimming – if this parameter is equal to ‘1’, this atom doesn’t become transparent, if it gets into a camera damming significant objects; cullcat – the category of atom importance, when you zoom out the camera. Atoms with small values of this parameter are visible at large distances; instanced – technical parameter for rendering. It unites groups of similar objects into one in process of rendering; spawnscale – atom scale during its generation directly in the game; offline – if equal to ‘1’, the atom will be invisible and disabled, it should be enabled through game logic; camcol through it; – an obstacle for the camera, when equal to ‘0’ the camera freely moves blend – starting value of the transparency when generating an atom in the game; decal – if the decal number is chosen here, when you position the atom on the map, it automatically appears on the landscape. This is the method for making stumps under trees; colmesh – determines the collision-mesh, a primitive 3D model, which helps to trace the pointing of the mouse cursor and damming the camera view areas with the object; ttl – for the atoms of the hollow class it determines the time of existence. It happens in the following order: such atoms appear, the effect works and they disappear at once; apass located; – on the arena it specifies the passability of the hex, in which the atom is cursor – cursor image when you point it at the atom; walk_speed – atom movement speed. It is relevant only for the moving objects such as hero, army or npc; turn_speed – atom turning speed; lutemplate – template of the logic unit in the atom. It is taken from the library of the templates. Such template is a component of the embryo; mapicon – icon on the map; only for castle or npc. There are other modules in the atoms. The module arena_params is characteristic only for those atoms, which appear on the arena (for example chesspiece or pawn). The module attachments is responsible for the graphic objects or sounds attached to the atoms, scripts – for the specific Luascripts of atom behavior, collision – for physical and logical shapes of an atom. Let us study one more module, which is important for the editor, which is called editor. 52 align – is responsible for the attachment of an atom to a particular type of mesh. If the grid is defined, the atom will be attached to the coordinates mesh. If the chessboard is defined, the atom will be strictly attached to the arena cells. angle – is defined by three figures, for example, 0:1:360. The first and the last figures are the initial and final rotation angles, the middle figure is the minimal rotation. scale – defines the range of object scaling. 0.5:2 means that an object can be scaled from the half-size up to the double-size. spawnscale – actually it is the same parameter, but it influences the scale value, which an object receives during its random positioning on the map. spawnangle – same as previous. spawnalign – same as previous. These settings will help, if it is unclear how to make a ‘very big tree’ or a ‘very small mountain’. 3.1.3. Interaction of atoms, embryos and logic units Embryo is a template of an object, which contains the logic of its behavior, appearance, the set of variables and the rules of object generation and its variables. Moreover, this embryo can contain several templates and if you start a new game, one of the templates will be generated from them. For example, in one of the games you will find a shop with creatures on the island and in the other – some gold. The embryo exists only in the editor. If you place an embryo on the map, you will be able to customize the future object, which will grow from the embryo. And if you generate a game, an embryo will turn into an atom with a logic unit and a set of variables. There are several standard types of embryos, which have their parameters, the logic of the future object and the logic of its generation: embryo of a castle, embryo of an army and an embryo of a container. When you customize the logic of such an object on the map, actually you are customizing its embryo, hence all objects created on its basis. You can customize the embryo of the selected object by pressing key E, for the logic unit use key L. If you press the tab Logic in the atom settings, a location will produce three big buttons. None of them is pressed by default, what means that the default settings of an embryo will be used. Only the containers and altars are completely customized, their filling depends on the location, where they are. Shops have a customized logic, but an actor and the assortment in them should be specified manually. If you press the button Independently, it will mean that for the taken object you are using a local copy of an embryo and can customize it individually without modifying other objects. Advanced Mode – a mode, when we specify not only the parameters in the embryo, but also the atom itself, this is the way you create shops, which have different appearances, assortments and even the logic of player interaction in various generations. The third mode, Custom Logic, means that additionally to the embryo setting, you are using your own unique logic unit. Take into account that if you press L on the atom with the embryo, you will edit the template of the logic unit utilized by an embryo, we strictly insist on not doing it, since all objects in the game, where this template is used, will change. There is another mechanism of object varying. In the palette you can create a meta-atom (choose the item Meta atom with a right click) and add regular ones into it. When you position such an atom on the map, a real random atom contained in it will be chosen. For example, in this way you can create a brush, which paints occasional trees from a list. The choice is done here exactly at the stage of object positioning on the map in the editor, and not at the start of a new game. 53 A logic unit represents a set of variables and rules of interaction with the world. There are several types of logic units: templates of logic units or virtual logic unit (further – LO), which are stored in the library of templates; global logic units, which are not assigned to any real atom at all and exist within a session storing the global variables of a session; local, which exist on a location and can have no personal position; and objective – they have an attachment to their objects, when zoomed out they are customized basing on the object properties; the prototypes of LO, which are used in the embryos and can become objective. Logic units are available in all interactive objects on the map. The interactivity of the game world is related not only to the protagonist, but to the game objects in general, you can customize the enemies in the way that they run around the map and collect trunks, ride the moving platforms, enter the teleports, purchase goods in shops. 3.2. Logic Units 3.2.1. Properties of a logic unit You can find the logic units on the tab Logic Units (Shift-U) of the toolbar. The following logic units of the current session are available - Source:Session and the library of templates Source:Library. The reason is that various logic units can have varying area of existence. You can see the global objects everywhere and from everywhere, local objects are visible only when you are editing a location, where they are placed. Let us consider one of the templates of logic units, situated in Library - map (template of the navigation map), click it two times with the right mouse button. Fig. 3.1 Customization of LO You should set the name of a logic unit on the tab Properties, specify if it is a template or not, specify its visibility field and location. Usually the visibility field is determined automatically. The tab Traps contains the logic of interaction with the game world. The tab Castle contains the actors (those in the castle) and the background of the picture. On the NPC you can customize the same things for the NPC inside LO. The tab portal is responsible for the point of exit from the portal. The next tab is Shop. Here you can customize units, items and scrolls available for purchase. Tab Skills (relevant only for the hero) and finally Variables a set of variable LO. There are three types of variables: user, game and scripted. First one – user variables, you can modify them. The second group – game variables, they are created automatically. The third group – script variables, which calculate the value of the variable at the moment of its call. 54 3.2.2. Game logic. Messages and traps Let us create a new LO in the list and open a tab Traps in it. Trap – is a trap for a message. The game constantly generates messages and events, which LO receives. Having received such a message, LO can process it and react, i.e. to check a set of some conditions and fulfill a number of actions. The customization of conditions and actions proceeds via the form Action/Condition editor and the internal logical game constructor, it is used also in the editors of dialogues, quests and items. A right click opens a pop-up menu. Add msg trap sets a trap. Add trap ref create a reference to the trap in another LO. Import from and Replace all from create copies of traps customized in another LO, the latter with the removal of available traps. Finally, Save preset saves the current settings in .strg-file, Load preset – loads them from a file, and Append preset – adds the ones loaded from a file to the current ones. Press Add msg trap. A menu appears over them, you can add comments to the trap in the upper part of it and select the event traced by the trap. For example, let us choose the Capture Click. Now the trap reacts at a left mouse click on the current game object. A field below determines additional conditions, which are checked when the trap is triggered, leave it empty so far. Below there is an option to preset the delay between the trap trigger and action start in milliseconds, at the bottom there is a tick, which can prohibit triggering any other trap until the conditions of the current trap are fulfilled. Press OK, the trap appears in the list. Now you need to click it with the right mouse button and press Add Action, to add a new action, which will be launched by a trigger-trap. A list of available actions will pop-up. Choose for example Begin Dialog. By default there is by current active actor, i.e. the dialogue will start with the actor, which is active now as a rule, it is the one, who is sitting in the LO. A trap with the action is ready, now the left mouse button click will launch the dialogue with the actor. Let us check, if we did everything correctly and open some LO with the customized logic. We are choosing Source:Library, folder npc and LO NPC_example. It turns out that it is incorrect. A correct trap in this case consists of two. Let us consider the available ones in detail. As the first trap the same CLICK_CAPTURE is selected (LMB click), however there is another action – Send for Hero. It means that the protagonist will run for the building. The second trap INTERACTION_PASSIVE_ON, which determines that another LO arrived into some area around LO. There is another condition – logical consisting of two components applied to the trap. The first one – Send for hero in progress, it means that the protagonist is running to the building at this moment. The second condition, logical OR from two variants – either hero, or the boat are inside of the logical shape of the atom, this is the area of trap action. In this way the action will be performed only when the hero sent to a building with a mouse click will reach the zone of the logical shape. This is exactly the way all objects act in the game. This example should show how the logic in the game is constructed, further we’ll need to consider various logic units one after another in order to understand the principles of their work, and all of them are made exactly of these simple pieces – traps and Condition/Action. Let us dwell upon the available types of traps. Additionally let us consider that some of the traps in Condition editor have an extra condition – Trap specific. Usually a trap will not function without it. Start game (START_GAME) – object receives at the game start. Arena end: hero wins (ARENA_WIN) – object receives, when the protagonist has won a battle at the arena. The battle should be initiated exactly by this object. Arena end: hero loose (ARENA_LOOSE) – object receives, when the protagonist lost the battle at the arena. 55 Arena end: cancel (ARENA_CANCEL) – not used. Client spawned (SPAWNED) – object receives, when it was spawned in the game. It is required for those atoms, which dynamically appear on the map during the game basing on some events, but they don’t exist at the moment of game generation. Logic unit activated (ACTIVATED) – object receives when a location is being loaded, where it is situated. On dead (ONDEAD) – LO destroyed (not hidden, but exactly destroyed). Information click (CLICK_INFO) – RMB click on an object. Capture click (CLICK_CAPTURE) – LMB click on an object. Active interaction on (INTERACTION_ACTIVE_ON) – LO entered the action zone of another atom. It is required to indicate the exact atoms, as well as the type of the logical shape. A tick at Path must be present is responsible for the possibility to place the path from one LO to another. Active interaction off (INTERACTION_ACTIVE_OFF) – LO left the action zone of another atom. It is required to indicate, which atoms are traced and the type of the logical shape, which specifies the zone. Passive interaction on (INTERACTION_PASSIVE_ON) – another atom arrived into the action zone of the current one. Passive interaction off (INTERACTION_PASSIVE_OFF) – another atom left the action zone of another atom. In chase radius (IN_CHASE) – traces the availability of hero inside the radius of LO follow-up. Out of chase radius (OUT_CHASE) – traces the hero location beyond the radius of LO chasing. End client scenario (SCENARIO_END) – object completed the execution of a condition specified in the scenario. New day part (NEW_DAY) – object receives at the shift of the day time. A condition specifies the time of the day, which should be shifted. On timer event (TIMER) – object catches the timer activation. You should indicate in the condition, which timer is to be caught. Those timers are monitored, which have been launched within the object. Custom event (CUSTOM_EVENT) – object catches an order directed to it. Condition is the order type. Logic event (LOGIC_EVENT) – object can catch a number of logical events in the game. Condition is the type of the traced object. Quest node changed (QCHANGE) – object monitors the status of the quest knots. You choose the quest, quest knot and the type of the monitored status as an additional condition. Box taken (arena event) (TAKEN) – object of the box class receives this message, when it is picked up on the arena. Teleportation complete (ON_TELEPORT) – object receives, when anyone (hero, monster, NPC) used it as a point for exit out of the portal. Unload boat (UNBOAT) – current object receives this message, when the protagonist leaves the boat. (hz) – works simply when some Condition-condition is stipulated. There is no particular condition, but it will not work without any additional condition. Hint: to comprehend the above stated material study the performance of as many as possible customized LOs, there are plenty of them and many of the traps are implemented in them in many different ways. 56 3.2.3. Game logic. Condition editor In this section we’ll review the editor of conditions, which is supposed to execute the game logic. Any condition returns the logical true or false, and it can consist of several conditions. Let us create another trap. In the field ORC we’ll create a new condition with a RMB click, and a list of available conditions will pop-up. Let us consider them in details: Fig. 3.2 Editor of conditions Use – group of conditional operations. Complex – a logical combination of several conditions. There are six operations available, which support an optional number of arguments. You can receive the same, if you click a condition and choose Complicate. Expression – validation of some expression in the format [a]*2==[b]. Where a – is some parameter of the hero, and b – constant. The square brackets contain the names of the variables, and their value should be chosen later in from the list below. Expression – is a universal and very powerful tool for the work with mathematical and logical operators, which can manipulate a large number of game variables. Quest – group of quest conditions. Is quest online – defines the particular status of some quest. We are choosing a quest from the list and the check of its status from the available variants. Quest chip place – status check of the logical section of a quest. We are choosing a quest, its logical section and the status. Special – group of special conditions. 57 Check item – check, if LO has an item. We are defining an LO and checking it for the presence of an item and the item itself. You can check the presence of the item both in the backpack and on the body. Army death – check, whose army has died - actor’s or embryo’s. Logic interaction – check for a logical interaction of the current LO with some object. We are choosing a logical shape and the object type. Other – other conditions. Random – generates a random number and checks the condition, if the generated number gets into the specified interval from 0 till N<=1. Script – checks the value returned by the Lua-script. To have an opportunity to use the Lua-script in this condition, it is required that it has the comment “--ftag:if” next to the function name. Trap – group of special conditions for the current trap. trap – specific condition for this type of trap, available not for all. hidden – hidden conditions, you can show them, if you tick Show rare conditions. * key pressed – one of the following keys are pressed Ctrl, Shift or Alt. * is custom event canceled – some user-defined event was cancelled. Choose the event type. * skill – check of the presence of particular skill level of the protagonist. Choose the skill. * variable – comparison of two variables or constants with a variable. Syntax var=@this?blabla means that the variable blabla is taken from the logic unit this. You can choose the values of the counters with the syntax itm=@this?itmname.itmvalue. For example, itm=@hero?rage.count – you take from the protagonist hero the counter of rage rage and its current value count. In comparison to the expressions it can compare the text values! * platform – checks the status of the platforms. test logic bits – check of some logical flags of the game. In particular you check here the send for hero in progress, availability of hero’s wife and a number of other statuses. 58 3.2.4. Game logic. Action editor Action editor is equivalent to the editor of actions. It has the same universality as the Condition editor. The available actions: Fig. 3.3 Action editor Use – group of conditional operations. Multiaction – creates some condition for the execution of a group of actions. There will be a field of conditions created in the right part, where you can use all the possibilities of the Condition editor. Further the actions themselves pile on the condition, a right click on the condition and we add add subaction in the menu. Expression – analogous to the similar option in Condition editor, however it doesn’t evaluate the expression for trueness, but execute it. The syntax of assignment “:=”, all other rules of work with the variables are analogues. For example [b]:=10*([a] –[c]*2) Quest – group of work with quests. Begin quest – launches a quest and adds it into the log (if a quest is visible). Quest – allows to manipulate the statuses of the logical sections of one or several quests. 59 End quest – emergency ending of a quest with one of the statuses: failed, completed declined. Best of all it is to use the properties of the quest stages. Dialogs – group of work with the dialogues and interface forms. Begin dialog – starts a dialogue with an actor. It either begins with a starting phrase with the current actor or allows to choose an actor, its dialogue and the starting phrase in it. Show form – shows some interface form. Often used – buy_from, buy_from_s – forms of sale, and building – castle window. Show message box – shows the dialogue window. It allows to choose one of the global strings for using in form of the displayed text. Freeze logic will freeze the game world, until the player reacts to the dialogue window, Question opens a window with a question and two buttons: Ok and Cancel. You can assign some user action to each button hit (custom event), and it will be monitored by the current logic unit. Fight – a group of work with the combat system. Self-destruct – atom with LO either will die with the animation of death or will disappear constantly. Enter fight mode – transfers you to the combat mode. There is some fineness here: It is required to simultaneously launch Change location without parameters. The required arena is known to the game, but you need to transfer the hero there. Change aggressive – changes the embryo attitude to the player. You can fight only with aggressive embryos. Embryos – a group of work with embryos. Embryo/Atom switch – enables/disables an embryo on the map. A disabled embryo is completely invisible, its logic is passive and it doesn’t influence the scheme of map passability. In the result of enabling the object will be immediately exposed, it will activate all its logic and includes it into the calculation of the pathfinding. You can perform this operation not only with embryos, but with any object. You can customize the status Enabled/Disabled for each object manually on the map from the object menu. Flush embryo – it produces an item-embryo, which was a priori customized, from the actor or from the current location to the protagonist. Remove item – removes the specified item from the selected object. Special – special operations. Switch location – teleports the hero to the selected portal (button Add). In the list of the selected portals-exits only the portals of the locations opened in the editor will be shown. Custom notification event – launches or stops the user-defined event, which can be monitored with the help of the trap CUSTOM_EVENT. Change shop assortment – changes the assortment of the specified shop/NPC for the one determined a priori. hidden – additional operations. You will be able to see this group, if you tick Show rare conditions. Run scenario – launches one of the preliminarily scripted complicated scenarios. The list of available scenarios is given in the Appendix. Timer – assigns the LO to the timer from the list. Each time, when the timer engages, you can check its engagement with the trap TIMER. Subscribe(once) cancels the timer after its first response, Unsubscribe cancels the active timer. 60 Platform management – manipulates the platforms. We’ll dwell upon it later. Teleport unit – moves the LO to the portal selected from the list. Execute script – executes the Lua-sript, transferring a line to it in form of a parameter. For the editor to make a choice the functions are used, which have the following comment next to their name “--ftag:action”. Modify variable – modification of the internal variables of the LO selected in the list. Spawn client – spawns an atom with the selected template of the LO in the place of the current LO. Spirit manipulator – functions of work with the spirits of rage. For the Armored Princess only pet is essential, you can enable it here, give experience and level to it, enable one of its functions. Send for hero – makes the hero run (swim) into the position of the current LO, ‘summons’ it. Assign dialog to actor – allows to glue the dialogues together. If the protagonist has the main dialogue with the priority 10 and you glue another dialogue with the priority 15 to it, you will have a situation, when the end of the second dialogue will loop to the start of the first dialogue, but the talk will start from the second dialogue. Change army – builds up an army for some external LO, which is interacting with the current LO. There are a lot of variants and operations with troops. A tick at Store army is controls that the previous LO would be memorized and restored after the battle. Actor switch – Changes the current actor of LO. 3.2.5. Game logic. Scenario and events In this way the user can simulate the events with the help of timers or custom event. Besides there are events, which can be generated by the game itself: Spirit Click – player clicked one of the Rage Spirits in the hero interface. It is not used in the Armored Princess. Reach boat – it is generated, when an object approaches a boat. Begin chat – it is generated, when someone starts a talk with an object. End chat – it is generated, when someone finishes a talk with an object. Box taken msg box ok – the player clicked the dialogue window of this container. Box digged out – object has been dug out. -broadcast- (game messages) Building form closed – the interface window of the castle is closed. Chat form closed – the interface form of the dialogue is closed. Loaded game – game is loaded. End cutscene – the script move finished or has been interrupted. Now let us have a look at the scenarios. The is some complicated action, which an atom performs on the map, this action was preset earlier and is available for the selection from a list. In most cases it is some animation, however there some options. Let us have a look at them: Scripted 61 Execute scripted scenario – execute some script scenario. In reality the Lua-script is performed or an encrypted scenario. A tick at Freeze hero will freeze the control over the hero and the camera. You can create and add such scenarios, e.g. a succession of animations and preset camera angles. Terminate scripted scenario – interrupt the scenario execution. Movement and interaction Terminate current path processing – terminate the path completion at this moment. Proceed path – attach an object to the one selected from the path list. Run to current hero position – an object will run to the current point of the protagonist location. Re-test logic intersections – check the interception of object shapes with others. Go away – go from the protagonist. Run away – run from the protagonist. Specials Box taken – move the contents of a container into player’s inventory displaying the item designation or a window with a button. To the window with the button you can apply a custom event. Load source to boat – load this object into a boat. Unload boat – unload a boat. Set logic state – change the logical status of an atom (controls the icon-signs over the troops). Play sound – play some sound, which is described in sounds.csv as voice. Hero Drop slots – dressed items drop into the inventory. Replace wife – exchange wife / companion for the one indicated. Spawn child – bring a child to the world in the wife’s slot. It is not used in the Armored Princess. Rename pet – open the dialogue for pet renaming. Global Open location – open a location on the global map and for travelling. Location switch – allows for some time or for ever to prohibit/allow the shifting of locations. Morning mania – restores mana and discards rage up to null. End game – finishes the game with a victory or with a defeat. At the end let us have a look at most useful and frequently utilized scenarios: Hero – section run animation. Launches the hero animation. Transport – launches the animations and the preset camera angles attached to them for transport. Armies Lost contact – a troop loses the sight of the protagonist for a second. Stop – this is where the scenarios of troop stops are always stored; for the preset intervals of time and for ever. Custom – you can launch any preset animation, indicating its name, and play it the indicated amount of seconds. --run animation – launches one of the troop animations for one time. 62 Platform – control scenarios for platforms and elevators. Quest object – control scenarios for NPCs, multistate and quest objects. Destroy – launches the animation of dead and stores the variable death = 1 into the object. Assigns the animation death. --run animation - launches one of the object animations for one time. The object must have the selected animation otherwise it will no be played. Recharge object – reloads the current altar or fountain. 3.2.6. Game logic. Internal script language of the game This language is available via a condition or an action Expression. If you give an optional name of a variable, which we would like to utilize, we use this name in expressions in square brackets - “[a]”. At the moment we applied the variable, it appeared in the list below. This is where you should prescribe, which parameter it addresses to. Hero – variable of the hero. Logic unit variable – a variable of some logic unit from the list. Logic unit counter – counter of a logic unit. Logic unit chesspieces – amount of combat units of a particular type with some LO. Logic unit scrolls – amount of scrolls of particular type with some LO. Item custom param – internal variable of the current item. Quest variable – internal variable of the selected quest. Global variable – global variable. Internal – internal variable of the expression. A number of operators are available, brackets are supported. The symbol “Ù” marks equivalent signs: !x Ù not x a/b a%b a*b a+b a–b x << n x >> n xy x <= y x >= y x==y x != y Ù x <> y a && b Ù a and b a || b Ù a or b a ? x, y a := b – logical NOT. Returns the Boolean value; – division; – excess from the integral division of a by b; – multiplication; – sum; – subtraction; – a bit shift to the left; – a bit shift to the right; – comparison operator. Returns the Boolean value; – equivalent; – equivalent; – equivalent; – comparison operator. Returns the Boolean value; – operator NOT EQUAL. Returns the Boolean value; – logical AND, returns the Boolean value; – logical OR, returns the Boolean value; – complex operator. If a is true, returns x, if false – returns y; – assignment, the value b is stored into the variable a. True are all the figures not unequal to null or nonempty strings. In Expression it is allowed to use a number of integrated functions: day() daytime() rnd(x) rnd(x, y) – returns the game day; – returns the time of the day (0..3); – pseudorandom number [0..x) from the timer; – pseudorandom number [x..y] from the timer; 63 rnd(x, y, n) hdist() abs(x) – pseudorandom number [x..y] from n; – distance from the current LO up to the hero in meters, rounded; – module x. 3.2.7. Review of the selected logic units In this section you’ll study two logic units for the sake of practicing our theoretical skills – hero LO and LO of a castle. Let us start with the hero. You should open the panel of logic units (Shift + U) and the folder in it [global] (Source:Session). It stores the same LO template of the hero for the current session, it is called hero. As you can see this is also a template LO (a tick at template). There are only five traps in hero’s LO. Fig. 3.4 Hero traps INTERACTION_ACTIVE_ON Hero entered some logical shape of another object. Two conditions are checked here. One of them is Send for hero in progress, it means that the hero is running to the LO at this moment. In the second the class of the object-client is defined, in this case it is the container and the shape image, Layer #0 (buildings or boxes). When these conditions are met, the following action is executed, the event Taken is sent to the container for further procession. START_GAME 64 The game started. There are only three actions. The first one – Execute script. A Lua-function generation_hero with the parameter ‘test’ is launched. This function generates all initial parameters of the hero depending on its class, constructs the item slots, gives an army, etc. The second action is the expression [a]:=0, where a – is an internal variable of the hero canfly, which prohibits hero’s flights. If you set the variable to ‘1’, the hero will obtain an opportunity to fly from the very beginning of the game. The third action is a start of a dialogue window with one button. This is exactly the message, which you see at the game start. ACTIVATED A trap engages in the moment of hero activation. In this case a subscription to a 10-second timer Decrease rage and the execution of the script change_manarage take place. The mechanism of mana restoration and Rage decrease launched. TIMER In this trap the timer Decrease rage is to be caught, which had been launched earlier. And the script change_manarage launches, which changes the level of Mana and Rage of the hero each 10 seconds. CUSTOM_EVENT In this case the game monitors the event NPC wait for hero, which some characters starting a dialogue with the protagonist can trigger. The scenario Stop is being executed, which stops the protagonist. All other tabs of protagonist’s LO are empty except the last one. The second LO, which we’ll study is building_castle, a template for embryos of all castles. As it was said before, it makes no use to edit it, since it will bring to life changes in all the castles, where Custom Logic is not customized. Additionally we can enter it (Source:Library) and study its structure. 65 Fig. 3.5 Traps of the castle template. CLICK_CAPTURE As usual, an object is summoning the protagonist. INTERACTION_PASSIVE_ON Here is where the condition is set: in ORC we are checking Send for hero, and the type of the object, which entered the zone. The delay for trap launch is set up to 300 milliseconds, after that a PDC is checked for Send for hero again. Further next two actions are executed, they are processed one after another. A tick at Terminate processing if true is responsible for the completion of the first action before the start of the next ones. The condition is that: There is an army at the castle, a variable nofight inside the current LO is not equal to 1 and the LO is aggressive towards the player. In this case a dialogue window pops up with an offer to start a fight. If the player answers 'yes', an event Go to arena inside the castle LO is generated. If these conditions are not fulfilled, the interface form of the castle will be displayed. ARENA_WIN This trap will work only, if the protagonist with the LO got into the fight and won. In this case the LO army is set to zero and the interface form of the castle is displayed. CUSTOM_EVENT 66 In this case we are monitoring the event Go to arena (it is generated in INTERACTION_PASSIVE_ON, if the protagonist is willing to enter a fight). First of all the Enter fight mode is executed basing on this and then the Switch location, which transfers us to the arena of the current building. Practice Let us customize the portal, which we have just created. We need to create a cave on Debir, a portal, which leads to the island and the return portal. We are using the dead end on Debir for this, which is located next to the deserted house. Fig. 3.6 A dead end and the entrance into the cave Let us locate an entrance to the cave in it from Decorations/cave. We’ll have to remove a couple of trees and slightly move the embryos of containers aside. It is important not to forget to edit the map of passabilities located under the entrance. Now to create the connection of two points between each other we require four portals, two of them will work for the entrance, they will have the logic and a nice FX, and two for the exit, just points with the tag of the portal. Please take into account that the shapes of the portals should not intersect! We’ll install portal_twirl_red at the entrance, and an invisible atom trigger_zone at the exit. Please take into account that trigger_zone has an arrow. The protagonist after the exit from the portal will be looking into the side opposite to the direction of that arrow. 67 Fig. 3.7 Portals In the similar way we’ll add a couple of portals on our island. Now we are choosing trigger_zone on the map and press L. The settings of LO appear. On the tab Portal we set up the portal tags (on Debir – exit_sunset_to_debir, on the Sunset Island – exit_debir_to_sunset) and the camera. The button Test allows to have the exact camera view at the portal exit. Now we need to customize the exits. The logic of the portal is simple: the trap CLICK_CAPTURE calls the Send for hero, and INTERACTION_PASSIVE_ON enables the transfer to another location. The action Switch location is missing the portal tag now (in the list you can choose only portals opened in the editor of locations). Press Add and you will add corresponding points of exit. That’s it, the portal is done! You just need to enter the points of entry (now only via the spacebar), open the tab Text and edit the popping up hint for the map: ‘Entrance to the underwater cave’. We already know, an embryo is a prototype of some object on the map, which specifies its properties. During the game generation the embryo turns into a real object on the map. The customization of an embryo is a choice of what can be generated of it. 68 3.3 Embryos 3.3.1. General properties and the meaning of embryo There are two varying visibility areas for an embryo: a template of an embryo for some object exists inside the object type, it is a separate atom. You can review such an embryo in the table of atoms, if you click its icon with the right mouse button and choose Embryo. Fig. 3.8 Atom properties If you choose Independently, the object will use a local copy of this embryo available for editing. You should always do it for armies and buildings. Meanwhile the embryos of containers are already customized. All embryos have the property Chance – this parameter determines their chance for appearing on the map. If you set it to ‘0’, the object will not appear on the map. The option Generate on demand enables the generation of the embryo contents not at the game start, but at the moment, when the player interacts with the object for the first time. Option Advanced mode is an advanced mode of the embryos. In this mode there will be not one embryo, but several ones, and only one of them will appear in the game – a default one. When there is an object with embryo on the map, if you choose Variations in the pop-up menu and press V, you will have a full copy of an object with the embryo, which you can place on the map in any other place. Only one of the variations will appear on the map during the generation. If you choose Show hidden, you will see signs in form of wrenches over the embryos. If there is a plus over a wrench, this object has variations. Finally we can edit embryos template. Having edited the embryo in the object, press Store, - all the current settings will be saved in the embryo template. 3.3.2. Embryo of a shop/castle Let us open the properties of an object embryo of the class castle. This embryo is similar for castles and standard shops and the type of the interface screen, which would be used during the entry into such an object depends on the logic settings. Let us consider all the parameters separately. 69 Fig. 3.9 Castle embryo Background – background picture for castle, you can select it from the list. Rulers – actors living in the castle. You can indicate several of them for a castle. By default an actor is enabled, but you can disable it and later enable with the help of logic. You can toggle various variants of the shop assortment (both troops, and spells, and items at the same time) via the logic, by default base is used. On the right you can see three fields: setting of troops, scrolls and items for sale. In the assortment each line is responsible for the filling of one of merchant’s slots. Choose Add with a right click and add a new set, a double click on a set opens it for editing. In its turn each line in the set is responsible for some variant of generation with particular volume. The field of unit selection is located lower. In each line we are choosing, which units you can generate in this slot, the variants are given in the line separated by commas, they are generated with equal probability. If you double-click a race, you will add to the list a chance to generate not a particular unit of this race, but an occasional one. You can also add a level to it, and choose particular units and their amount on the right. Here is the way you can add the amount: With a number, with a range (5:10) and with a pitched range (10:5:50). The amount of units equal to 9999 or higher means that there will be plenty of them, and the empty line (empty) – will leave the slot vacant. You can customize the assortment of the spells in the same way. Each line in the assortment is responsible for the generation in one and separate slot and represents a set of variants, which will be used with a particular volume. In the same line the variants are equiprobable. In the field script you can customize the special calculation method of the variant volume. This should be a Lua-function, which doesn’t accept the parameters and returns the volume in form of a figure. For example you can specify different weight of variants depending on hero’s class or other parameters, but a tick at Generate on demand should be obligatory. The customization of items assortment has a lot in common with the previous ones. We are customizing here each slot separately. The difference is that you choose an item from the list in a separate window, and we can customize the amount only for the container-items (like torn seeds), additionally there is a tick at consider max count, which prohibits the generation of an 70 item, if its generated amount in the game world is equal to the figure indicated in its settings in the field maxcount. There are fields in the embryo settings below, which are responsible for the army and the arena. By default t he army will fight the protagonist, if there is a tick at Aggressive available. If you don’t choose the arena, a default arena for this landscape will be used. A click on the army will transfer us to the settings of the army embryo (check below), a tick at All for free is needed to have everything for free in a castle. 3.3.3. Army embryo Similar as in the castle embryo there is a field on the left, which determines various variants of generation. Each of the variants is a separately customized army, when the game is generated only one of them is selected. Each variant has its own volume, it determines the probability of its generation. These templates of an army you can upload for the future use into strg-files. There are settings for an embryo as a whole above: Army name (for convenience) and its fate after a defeat. Rebirth – respawn at a special portal, and Total defeat – total defeat. You can define the place of respawn by the indication of the portal name and location in the file config.txt – parameter homeportal=portal_name.location_name. Fig. 3.10 Army embryo Now let us speak about the customization of a particular army template. You can define the volume and name on the window top, the range of leadership or the range of enemy level you can define lower. These figures are later automatically multiplied by the ratio, which depends on the game difficulty level. Further we are customizing each slot separately. First of all we are choosing the unit type, which will be generated in the slot; you can select a unit of particular type, you can select a unit by its race and level. In one of the slots there can be several types of units, only one of them will be generated. The next issue is the quantity, we are indicating percent (figure or the range «N:Q» in per cent from the total amount on the specified Leadership). Through Amount you can define a strict number of units in the army, the leadership is not taken into account here. Filling type defines the type of filling during the generation, the volume is a relative opportunity for the 71 generation. Excl tag specifies the volume of the generation, if two units have equal ones, only one of them will appear. The program generates the army in the following succession, first of all it takes all units with the type if filling Required. When they all have been applied, the rest of the units is added (Undefined and Addition). If the cycle is over, but the place for filling is still available, the rest of units is taken from the type Addition. It is most reliable to make generations using only the types Required and Addition. Other parameters of the army: Display - unit type, which will be used for the army display on the map. Strongest – the strongest in leadership, First – first in the list. Arrangement - arrangement of units on the arena. Automatic – units are automatically placed on hexes. By groups – units from the slot with a number N will take a hex with the number N on the arena. If you customize slots 1, 3 and 5 for the generation, these slots will be taken by the units on the arena. Behavior you. – behavior of a troop on the map: either joins you, or neglects you, or attacks Hero – you can choose the protagonist, which will be helping your enemy. If this protagonist have a model, it will be displayed on the map. Bonus – calls the container embryo for the customization of the battle award. When combined, all these parameters allow to make a flexible customization of the army. There is one subtlety, if you double-click an item in the list of armies on the left, it will be highlighted in green and this army will become the main one for the united army, and two armies will attack the protagonist simultaneously. If it is the army of the protagonist, it she should be located in the main army. 3.3.4. Embryo of the box/treasure The customization of such an embryo resembles the customization of the shop assortment. It is important to comprehend that each box always contains one item, either 1474 of gold, or 3 similar runes, or 5 similar scrolls. There are several common parameters: Buried treasure makes a trunk to a buried treasure, Can be digged – means that a treasure can be dug out. If in rucksack – if you choose an item here, you will be able to dig only when this item is in the inventory. 72 Fig. 3.11 Container embryo There are sets with different volume in the list. In each of the sets you can customize the volume manually or determine with the help of the script. The resources mentioned in the line have an equal opportunity for the generation and we’ll receive one item at the end. There are specifically customized parameters on the tab Parameters1, which have varying value dependant in the game type: leadership, money and experience. You can set them up manually, but it is better to apply ticks, which make available a variant with a preset amount. For example for the leadership Huge is equal to 34:2:40 of leadership in form of bonus. Further this figure is multiplied by the index of the location difficulty. If you set up two ticks at once, both of the indicated ranges will be taken into account. On the tab Parameters2 there are bonuses with the equal value related to the game stage – hero parameters, runes and crystals. Items allow to give an item to the hero, Scrolls – a scroll, Units – troops (here you will need to put down a message, which will appear on the screen, if the player suddenly refuses). Army – a trunk will be customized for aggressive behavior in relation to the hero and will try to attack her, but the player will be informed about it at the beginning (a message in the field below), on the tab Text you can store the texts of messages, which the player will see as questions about the trunk and reactions to the positive or negative answers of the player from the list of the global strings of the session. You will spare your time customizing the container embryo, as it is already customized for the specified types of objects. In the list of atoms there are special objects, which are universal embryos, they have a large amount of generations in stock, they are displayed in form of yellow or pink balls and are located in the folder Resources in the tree of atoms. Practice Customize the shops on our island. Start with the lighthouse. Enter the properties of the atom and pressing Independently – now you can customize the embryo manually. We are shifting to the embryo settings, which are now accessible to us and place the actor into the lighthouse. Go to Session/Actors, choosing in the filter at the bottom All, finding the location sunset_isle and create three actors with a click of the right mouse button: Lighthouse, Mushroom Joe and MonsterMushroom. Skip editing them, you need them just to locate them inside the buildings. Return to the settings of the lighthouse embryo and place the actor Lighthouse there. 73 Let us customize the assortment. There are two slots of units with low chances to generate the third one. Into the first slot settle down with the equal probability 200-300 robbers, 100-180 looters or 80-150 archers. Let it be 100-200 goblins or 80-120 wild goblins in the second one. The third one will represent 20-30 Evil Eye Beholders with the probability 30%. Since you remember, each slot should be customized separately. Fig. 3.12 Customization of the first slot We’ll customize the second slot similarly, we’ll have more difficulties with the third one. We need to create several variants with different volumes, including an empty one, with the balance of volumes 3:7 (in this way we’ll receive 30% of probability). Fig. 3.13 Settings of the floating slot 74 Now we have to customize scrolls/items. Let us set up one slot with 3-5 random scrolls of the 12 level and a slot with an occasional item of the 1st level. The shop you have constructed you can see on the picture 3.15. In the atom properties don’t forget to add a popping up map hint to the lighthouse. Fig. 3.14 A customized lighthouse embryo Now start with the house of Joe. Enable the Custom Logic here and edit the house logic itself. You should have not the bargain at the start of the communication, but a dialogue with Joe. Hence we are deleting two last branches of the logic, which are connected with the arena. We are deleting all actions from the INTERACTION_PASSIVE_ON. However we are leaving the trap itself. Now instead of the actions you have deleted, create a new action Begin dialog by current active actor. Call the bargain form in course of a certain order from the dialogue. 75 Fig. 3.15 Special logic for the house of Joe Now customize the house of Mushroom Joe. The shop is a prize one, therefore we’ll populate it with strong plants. From 7 up to 10 royal thorns will live there together with an Ancient Ent. There will be no scrolls there, but there will be several sprouts of ent and Mana potions. Don’t forget to attach a map hint to Joe’s house. Now get started with the bonuses. Let’s have up to six random bonuses on the main island and two on the small one. You can define their location with the help of variations. Additionally place a random altar here. You can find in the palette (Resources/Altar) an altar of attack increasing target. Place it on the map, choose Independently and press Advanced Mode. In this way we can create various atom variants for generation. You have one of them in the list, it is the target. Click it in the list and choose Add embryo, in the tree we are choosing in turn the atoms training_dummy and absorbent_magic. In the end you’ll have the image from the Fig 3.17. 76 Fig. 3.16 A complex embryo for the altar All your variants have the same volume, therefore with equal probability the game would generate an altar, which increases intellect, attack, or defense. Now place the bonuses on the location. We’ll use both separate atoms of the class box, and a ‘pure’ embryo – a special atom in the folder Resources in form of yellow or red ball. This is a preset embryo with a wide variety of variants and generations. Additionally put a treasure under a trunk, as you tick Buried treasure and Can be digged. Fig. 3.17 Bonuses placed on the location 77 The only thing left to do is to locate armies. There are three of them. One of them you can customize with tight parameters of generation, and make other two similar, but with higher freedom of generation. There are no protagonist now, but you can make it later. Place any army on the map. Open an atom, pressing Independently and entering the setup mode. Create several variants of generation. Make a squad of mages, which summoned demons, robbers, a flock of forest monsters and an army of beholders/dragon. You should create three additional templates and give them appropriate names. Fig. 3.18 Army embryo Now create an animal template. First of all you need to setup the full leadership. Your location is a little bit weaker than the Scarlet Wind, so indicate the range of hero levels as 4-6. Define the types of units. In the forest you can have wolves, brown and ancient bears, as well as ThornHunters. The obligatory units will be wolves and bears, both 20-40% of the general leadership in the army. Two other units will have the type of filling Addition and the per cent of filling 1030%. 78 Fig. 3.19 Forest template Analogously customize other templates. Now before you close the setting of this embryo, make the following, export all the templates into .strg-files. Place the second army on the map and import them one after another there. Finally locate the hero’s army on the island. Make a double army. One of its parts will consist of beholders and all types of snakes, the other one of beholders and all types of spiders. Add the protagonist later here. Don’t forget to merge the army, you need to select one of the template variants with a double click. Fig. 3.21 Double army At this stage you are completing the customization of the embryos on the location. 79 4. Session logic In this chapter you’ll study the aspects of the logic, which exist globally, i.e. in the session itself. We call such data session internals in the editor and store them separately from the locations. One of these elements is the actor. This is a game character, a container for other logic like dialogues and quest relations. The sense of such a container is that you can easily move an actor with all its dialogues and items from one location to another and have nothing to re-customize. We can do such relocation not only in the editor, but also dynamically in the game itself. You’ll study actors, enemy heroes, dialogues, quests and the item editor in the next sections of this chapter. Here we’ll speak about the storage of global string variables. You can find the storage in the main menu under Session/Texts. There are texts, which you can use in dialogue windows. On the contrary to the pop-up hints on the map and dialogue texts, the dialogue windows (those you can call up with the help if the action MessageBox) don’t support the direct text input. You can insert the text in them using a link. The link is leading you directly to the storage of the string variables. When we are customizing a container embryo for example, we have an opportunity to write down a text to be displayed in the dialogue window, which appears when the protagonist picks an item up. To do it in the correct way, first of all you should create a new string variable in the storage and then select it from the list in the embryo settings. 4.1. Actors and enemy heroes Practice In the same way you worked with the location logic, make a list of what you need to do for our island: – three actors – Mushroom Joe, Mushroom Monster and the Lighthouse; – enemy hero – Mushroom Monster; – dialogue with Mushroom Joe. The dialogue should produce a quest task, it should check the quest completion, the shop should be accessible after the quest completion; – quest to murder Mushroom Monster. It should consist of two stages: when the quest is received and when the Monster is dead. All this will be done within this chapter, but we’ll elaborate the quest by supplying it with a moving platform. Actor is a description of the game character, a container, which stores the character name, character portrait, its dialogues and items. All that is connected to a particular actor and belongs to it, even despite its movement between various buildings and locations. One and the same actor can not exist in two different places, if you try to use one actor two times, first of all the game will produce a warning, secondly only one of them will be generated. This all looks like some kind of variations, but within the limits of the whole game and not one location. Anyway, go to the main menu item Session/Actors. 80 Fig. 4.1 Actors You will see a list of locations, the actors are assigned to. In the reality this assignment is conditional and is needed for convenience only. The mode All will show you all the location in the session. The mode Actors will show you only those, which have the assigned actors. Finally the mode Dialogs will show the locations, which have actors with dialogues. Let us study the existing actor, open the actor Rake Yavik in the location bolo. 81 Fig. 4.2 Editing an actor First of all give a name to the actor. The description is not used anywhere and executes an auxiliary function. A tick at Multi instance actor allows an actor to simultaneously appear in several places of the game world. Below you will find actor’s inventory. Below you will find a list of items you can hand over to the actor with the help of the action flush embryo. Below you will find a list of dialogues and a condition, which execution will turn on an icon ‘start quest’ over it. You can customize a portrait with a click on the field: you either need to enter the portrait name yourself, or choose it from the list. The list consist of files located under the following path \data\interface\textures\CFaces (for dialogues), and the path \data\interface\textures\Faces (for castles). Enemy heroes are made on the basis of actors and use their portraits and names. You can find them, if you choose the menu item Session/Heros. Open Rake Yavik. The first field is responsible for the base-actor, it is compulsory. If you have no actor, who you are talking to or making a bargain, you’ll have to create it. Hero actors are placed in the location bolo_dungeon_1, and all of them have minimal settings and no dialogues. The field Hint determines the hero description, which pops up, if you hover over it with the mouse cursor during a battle. The field Atom is responsible for the hero atom on the map, which determines its appearance, animation and the speed of movement. Those heroes should have this atom, which move around the map on their own. The next hero parameters are: Attack, Defense, Mana, Intellect, Level and a list of accessible spells. The setup field of additional bonuses is located below, these are the bonuses, which the protagonist share to her troops. The setup of their settings is absolutely identical to the setup of standard items, thus we are leaving it out in this section and we’ll dwell upon it at the end of the chapter. Practice Start with the lighthouse. This is the simplest actor. Find the Big Lighthouse among the existing actors. Here is the name of its portrait: face_house_lighthouse_02.png, we are copying it and pasting into our lighthouse. That’s it, our actor has a face. Act in the same way with Joe and the 82 Monster taking the portraits for them from Grog Reaper from Umkas, and from the Abyss Monster from Debir correspondingly. In the actor Joe create a dialogue later and now turng the Monster into an enemy hero; open the hero panel and choose Add in the pop-up menu and enter the setup window of a new hero. First of all you need to choose a prototype actor, it will be a Mushroom Monster. Now create a description and choose an atom on the map (it will be ah_beholder_vulgaris, it is the same as with the Abyss Monster). Customize its parameters: 6 level (influences the level of spells), 3 attacks and 3 defenses, 8 intellect and 70 mana. We'll store in its book Lightning, Ghost-Sword and Haste (spell_lightning, spell_ghost_sword and spell_haste). Now you should assign unique modifiers for troops. Adding to all hero troops +15% of magic damage. To do it you should click on the field Fight mods and choose Add. A window with bonuses will appear. On the right you can setup a filter: only allied troops will receive bonus, if we choose Check Belligerent, in a field below– Ally, after that we are hitting Add, to add a filter. In the field of bonuses we are hitting Damage, damage type magical, and the bonus itself– 15 in the field % of base. Now all units of the hero, who inflicting magical damage, will receive +15% to their damage. Fig. 4.3 Setting up the enemy hero animation The only thing left is to place the monster on the map. Open the army, which we have customized for it, enter the basic template, and click Hero, choose Mushroom Monster; that’s all. 4.2 Dialogues 4.2.1. Creating a dialogue for an actor You can find dialogues in the main menu in Sessions/Dialogs. 83 Fig. 4.4 Session dialogues However it is not recommended to create dialogues using this window, since they are created there without assignment to any actor. It is more useful to create dialogues through the list of actors, select an actor, click it with the right mouse button and press Add. You can also customize the default dialogue of this actor. The main dialogue (be default) is the dialogue, which you call directly for example through Action – begin dialog by current active actor. You should indicate other dialogues either in action, or preliminary assign them to an actor. 4.2.2. Editing a dialogue, 2D representation A dialogue structure in the editing window have a form of a block diagram. There can be three elements on this diagram: snap, switch and connections. A right click on the diagram allows to create an element or move the whole diagram while holding down a mouse button. The key Home will return the window into the initial stage or will centre the diagram basing on the starting element. 84 Fig. 4.5 2D representation of a dialogue Snap – is the main component of the dialogue, each snap – is one dialogue ‘screen’ with the text spoken by the actor and the variants of your answers. Each variant of the default answer finishes the dialogue, if you press it and connect it with an arrow to another element, in this way you are creating a relation. The very first element (it can be either snap or switch), which we add to the dialogue becomes a starting one, the dialogue starts with it by default, if we don’t define other conditions. Switch – is a technical element. Its feature is that first you can assign some action to it, second, switch can have several outlets and the logic will choose only one of them. You can edit the general properties of the dialogue from above: Description allows to set up the technical description of the dialogue for the sake of transparency in the list, Priority determines the dialogue priority when you use the method Assign dialog to actor, a tick at Important enables a ‘cross’ in the dialogue window, which allows to close it. You can also close it with its help. You can also choose the actor-owner of the dialogue. The buttons Store and Restore are responsible as usual for the import and export of the dialogue into a.strg-file. 4.2.3. Main logic of dialogue In this way the starting switch/snap is marked with green. For the start consider what you can customize in the switch. To do it, open some simple dialogue and try to study its structure. For this use a pilgrim on Debir, which provides the hero with runes. Choose Pilgrim from the list of actors, it should have the dialogue main. Double-click to enter the mode of dialogue editing. The dialogue starts with the switch BEGIN. After a double-click you can check, what is to be customized here. Above you can see a field Techname, this is a technical name of the element. This is a convenient option for marking elements. Below you will see a field of the condition switch/snap. This setting duplicates the options of switch, when it is located before it and out of use. Define the condition either through Condition editor, or with the help of ticks Ones per game or Ones per talk. The first condition means that the phrase will disappear for ever after you click it for the first time, the second means that the phrase will disappear for the period of the 85 current dialogue. The option Autosave saves the game into the slot Autosave after the dialogue completion. If you use it before the battle start or before the location shift, it will lead to errors! The fields of variants are located below. Each variant of switch is responsible for the transfer to some other element (you can enter it manually or merge with some other element dragging and dropping it with a mouse), additionally it has the conditions of existence and action during the transfer. The pilgrim in the starting switch has two variants: either it goes to the dialogue branch snap_5, or if the condition is fulfilled (variable piligrim_done inside the LO all unequal to null), or if the transfer to another line is inevitable – snap_3. The variants are toggled one after another, initially the ‘null’ switch is checked, if the condition is true, the transfer to another line is done, if not – the condition of the next variant is checked and further. The field Header override allows to specify the dialogue text, which would appear in the target element during the transfer from the current one. For example, we have a snap, when someone says to you ‘Hi’, and you have the variants for the answer ‘How are you?’ and ‘I am leaving’. ‘I am leaving’ makes us leave the dialogue, ‘How are you?’ transfers us to the same snap. However if we customize Header override ‘Fine!’ to the variant ‘How are you?’, then if you choose this variant, in this snap the text will be ‘Fine!’ and the variants of the answer will remain the same. Header override overloads the speaker text in that snap, which we are going to transfer to. The field Conditions allows to launch Condition editor and choose the condition of existence of the answer variant snap/exit switch. Below there are Options, which give an additional condition: Exist one time during the game or one time during a dialogue. In the field Actions you can add any actions, accessible in the Action editor, and the transfer point additionally: either dialogue start/end, or any of the local for the dialogue snap/switch, or the starting element of any other dialogue in the game. The settings of snap duplicate the settings of switch in many ways, the difference is that we input the text here, which is displayed, and we can choose the variants of answers, while in the case of switch the answer chosen is the one meeting the condition. An additional field on the left allows to input the headline text, its variants are created similarly. However Condition here determines, if the answer variant will be highlighted as accessible for the selection (if the condition is not fulfilled, it will not be highlighted). In the same way you can assign some action to the answer variant and reload the headline of the next snap. Above there is the field Voice, which will help to play a sound file, when a dialogue will transfer into this snap, i.e. voiceover the dialogue. 86 Fig. 4.6 snap settings Here is a small guide on the color codes of the dialogues. The starting element is marked with green. A bold arrow indicates that there is Header override (which apropos goes through all switch till the first snap). The variants of answers to snap/switch are marked as follows: • dark-blue – end of dialogue. • green – standard variant of an answer. • yellow – an additional condition or action is assigned to the variant of the answer. • orange (it can be mixed with other colors) – once per a dialogue. • red – once per game. Practice Now it’s high time to make a dialogue for Joe. Go to Session/Actors, choose Joe and click it with the right mouse button and choose Add. The dialogue will be connected to the quest, we should set a tick there Important, it will save us from any unpleasant situation with the ‘cross’. Now prepare an exemplary scheme of the dialogue. First of all set up switch, which will either lead us to the greeting (one time per game) or immediately to the central snap. We’ll create a couple of themes for a chat starting from the central snap in the switch-collector, and will assign a quest there. On the Fig. 4.7 the role of the starting switch belongs to START, snap of the greeting – greetings, central snap – maintalk, a switch-collector – transparent (it is transparent in the sense that there is no logic, it is needed only for the convenience and legibility). 87 Fig. 4.7 Initial structure of the dialogue Now we’ll study the structure in detail. We’ll have four original situations, which can have influence on the variants of the headline of the main snap. We’ll save the greeting and the standard situation, but we’ll add a variant, when we have a quest received, but not completed, and a variant after quest completion. As the conditions are checked in stages, it is required that an unconditional variant (a standard situation) was on the last place in the list. Now in the central snap we are making a number of variants of the answer with the flag Once per talk. The hero will be asking Joe about the island, mushrooms and the mushroom potion. As the last answer you should add an exit from the dialogue. You can realize the variants of answers via Header override. Add another variant of answer – about a successful quest completion and a variant of answer, which transfers us to the bargain form (Action Show form: buy_from_s), and finally a variant of answer, which transfers us to the branch of quest receiving. The structure of the texts will look like on the Fig 4.8 below. 88 Fig. 4.8 Full structure of a dialogue You shouldn’t forget using the tag [reward] in the branches connected the quest, it will display a reward. The only thing left is to insert an additional condition for some dialogue branches, but we can do it only, when we have the quest structure created. You can find the quests in the main menu in Session/Quests. In the window you will see the list of all locations, which have quests (or, if you choose All, all the locations). 89 Fig. 4.9 List of session quests Similar as actors the quests are assigned to a certain location. You can transfer a quest to another location with a RMB click or add a dialogue into it. The last option is not recommended, as the dialogue will be created without an actor and you will have to attach it to an actor later. The more correct way to attach a dialogue together with the actor to a quest looks as follows: create a new dialogue in the actor, enter Session/Dialogs, choose a dialogue and in the pop-up menu choose Assign Quest. Due to this the following options are available: – use the tag [reward] at the end of the dialogue, which would display the reward for the quest; – you can work with a dialogue from the quest, what is more convenient: all its dialogues are collected in one place, you can open them with one click. 4.3 Quests 4.3.1. Editing a quest, 2D-representation. You should choose a quest for editing, for example a quest with a runaway Erica on Bolo. It has rather complicated structure, which is good enough to show you the main possibilities available during the quest creation. In the same time it is easy to comprehend it. Anyway we are starting 90 with the quest logic. On a 2D field, like with dialogues, there is a number of elements: chip places, chips, transitions. A right click on them opens a menu of the current element. A quest has a number of common properties, here are they. A tick at Primary Quest means a storyline quest. Dialogs allows to see a list of dialogues enabled in the quest and create a new, an assigned one. Rewards allows to customize an award for the quest. You can create several awards. The field Difficulty means the complexity of the quest, it is defined with values from 1 up to 100. If there is Auto ticks preset in milliseconds, the check of conditions fulfillment of the quest logical stages proceeds besides the real changes in the quest itself also automatically at the beginning of each specified period. Logic unit launches the customization of the logic unit of quest, you can not set up traps there, but you can create and store variables. You can use such variables in the quest text in the simple form [varname] in the manner of [reward]. Finally a tick at Journal is responsible for the availability of a quest entry in the log. If a tick is available, you can press the button Journal and get into the text part of the quest. Fig. 4.10 2D-representation of a quest In the upper fields we store the name and the general description of the quest. They don’t change in process of quest completion, in the description field we recommend to use the tag [reward], which would display the reward for the quest completion. Below there is a field To kill, for the contracts. If we choose an enemy hero for it, an additional field Done will appear, where you should store the text, which appears after the quest completion. A field with the intermediate stages of quest completion is located lower. In each line you can input the text of the quest stage and the actor, by default you will receive a list of actors connected to the quest, but you can select any. The selected actor (or its house) will be marked with a quest sign on the map. 91 Fig. 4.11 Log properties We are returning to the general structure of quests. The rule is simple, you can initiate a quest from the logic through the action Begin quest. A quest is completed, when a chip appears in the chip place marked by a halo. The halo can be green (quest completed), red (quest failed) or blue (player cancels the quest, and it gets deleted from the quest log), this option should be customized in the field Chip event in the settings of the chip place. How a chip can appear in the chip place. When you activate a quest, any changes in its logic (it is usually a deletion or location of a chip in the chip place) or when auto-ticked (if the timer is active) result in all chips moving from their places further via passages in direction of arrows. You can connect the quest elements with the help of passages with Shift pressed. A chip is trying to move from its place to another through the passage and runs against a valve. If it can pass it by, it moves further into the next chip place and further to the next one. However we have valves, which can hinder the movement of chips. It happens, if there is a special condition (it is customized in the field additional conditions via condition editor) or if there are several passages leading into it, and a condition ‘logical AND’ is established for the valve passability. The latter means that a valve will become passable, when all chips try simultaneously pass it by via the passages. When a chip (or several chips) pass a valve by, some action can happen, which we have predetermined on the tab actions (via the familiar interface). 92 4.3.2. Quest stages and reward Now we'll consider the chip places. In reality a chip place is a logical stage of a quest, which is invisible for the player, it can have the following two states: active (a chip is in the chip place) and inactive (a chip place is empty). When a chip gets into a chip place it activates it, and fulfills the following actions (it is irrelevant, if a chip got stuck or moved further): 1) quest completion. Via Chip event; 2) rewarding for this logical stage of quest. Either it is added to the global award for the quest, or, if Give immediately is set, it is immediately given to the player; 3) updating of log entries. We’ll elaborate this item. Originally all quest stages are in the status Invisible and they are not shown in the log. They have three states Completed (colored in the log with grey, with a note ‘completed’), Enabled (added into the log with standard color) and Failed (colored in the log with grey, with a note ‘failed’). These stages are required exclusively for the log marks to help the player; in the game itself they effect only the quest icons over the heads of game characters: if a quest stage is in the status Enabled, an icon will appear above a character. In the starting chip place it is logical to transfer into the status Enabled at least one of the quest stages, otherwise there will be no entries for this quest in the quest log. You can work with quest stages in dialogues and in any other logic, for example customizing the logic of buildings and troops. The operations, which are used for it, we have considered above. We have a chance to optionally track the status of the quest and its stages, change these statuses. Practice Create a quest for killing a monster. We should go to Session/Quests, choose our location and add a new quest into it. You need two quest stages: between quest receiving and monster killing and quest completion. Use the simplest scheme: three chip places, a starting one, intermediate (monster killing) and final. Having created the chip places, name the quest the ‘Fungal Affair’ in the Journal, to have an easy access to it in the list. Then go to Dialogs and find a dialogue of Joe there, which you have created earlier. Click it and choose Assign quest, where you find your quest. Now the dialogue is attached to the quest. 93 Fig. 4.12 Quest structure Add rewards – Experience (average) and Money (average). Store in the quest a description and two text stages. Finally customize the quest stages upon completion. The first chip place will include only the first stage, in the second chip place the first stage will be completed, and the second one disabled, in the third one both will be completed, as well as the quest itself. How should you provide the completion of the first stage of monster killing? There are several means. You an modify the logic of the army embryo, where the Monster is seated, by adding there a trap ARENA_WIN and supplying it with an action for quest stage completion. You can move a simpler way, add a so-called ‘valve’ on the quest diagram and bind the completion of the quest first stage to it (connect the first and the second chip places to it). In the valve you should enter the tab Additional condition and choose the condition Army death there, and the army source – actor Mushroom Monster. Now this stage will be completed automatically when we kill the monster. The only thing left is to add the logic into the dialogue. For the answer variant bound to the quest completion set up the condition Is quest online, where you should choose the status succeeded and our quest. For the variant of the answer bound to the started, but uncompleted quest set up the same condition, but the condition will be online. If the conditions will be checked exactly in this order, everything will be okay. Now the first variant of the answer is mostly snap, in which you inform Joe about the success. You need to add a condition Quest chip place (full) for the chip place, which is responsible for 94 the monster killing, and in the same time it is required that this variant of the answer won’t appear, when the quest is already completed, i.e. the condition Quest chip place (empty) is for the final chip place. Bind this variant of the answer to the action Quest, where you’ll choose your quest, its final chip place and set. In this way this variant of the answer finishes the quest. Attach the condition of the quest completion to the answer, which leads us to the shop. Now start working with the dialogue branch, which leads to the quest completion. Add there the condition Is quest online with the status offline, now this branch will be available only, when the quest is not received. Further this branch will become separated into two: quest acceptance and quest refusal. We are attaching the action Quest:Begin quest to the quest completion. Now the interaction of the quest and dialogue is completely customized. 4.4 Item editor You can enter the item editor via Session/Items in the main menu. You will view a list of all items in the session and a big number of its filter parameters. In this list you can choose some item, edit it and create a new one. Open a new or an existing item (the class Equipment is most suitable for it: most of the settings are accessible for it), several tabs will appear in the new window. Fig 4.13 Item editor 95 The first tab – General. Here you can set up an item icon (you can simply click it with the mouse cursor), the technical name of the item or a tag (an important characteristic, the item doesn’t exist without it) and a number of other parameters: race, level, hero’s slot and the identity of the set. You can customize the price and the maximal quantity, which will not ban hero from having more items than required, - in a random generation the amount of items exceeding the specified figure will not be created. A null means that the amount of such items in the game can be unlimited. This is where the flags of items are customized: Quest prohibits to throw it away or destroy, Usable and Dialog include the pop-up menu items Use and Talk, Moral enables a morale counter, and Rare prohibits a random generation in shops, Upgrade to – a new stage of item improvement, Army and Arena – army and arena for upgrades or suppression. Fig 4.14 Editing an item Tab 3D includes the settings of a 3D representation of an item, which you can pick up on the map. Tab Labels is responsible for the string data. Name – item name, Hint – a pop-up hint (this is where you should store the information about the bonuses, it is not generated automatically), Information – text, which displayed, if you click Info and item name in the pop-up menu. Three other fields are needed for atoms with 3D representation on the game map. Tab Use Condition appears only at those items, which have a tick at Usable. It gives an opportunity to use Condition editor to make a condition for the item use. Tab Pacify Condition appears only at those items, which have a tick at Moral. It gives an additional condition for item suppression. Here is a detailed description of the tab Mods. This tab is responsible for the modifiers, which an item gives to the protagonist or troops. There are two fields: hero modifiers and troops modifiers. Hero modifiers are his main parameters or counters; they are to be customized in the upper field. A right click will open a form with two strings: a parameter name and a value modifier. Counters are leadership, attack, defense, mana and other main parameters of the hero, which have the current value and level. You can choose the modification parameter below (count and limit). In the modifier field you can choose the value either in absolute units or in per cents (and the 96 bonuses of the clad items will not be calculated!). Besides the counters there are special parameters (Specials) available, they are customized in the configuration files. As a rule you can carry on the modification of the creature leadership or spell parameters with their help. In the bottom field you can set up the simplest filters, the execution of their conditions will provide troops with bonuses. This is the field, which is available, when you customize special items of the enemy heroes. A right click can create a new bonus: On the top we set up one or several filters for bonuses. Don’t forget to set up belligerent=ally for your units, otherwise the bonus will be available for all the troops on the arena. Filter types: Check param – unit parameters are higher, smaller or equal to the one specified. Available parameters: race, leadership, count, level; Check unit – unit tag, we choose one or several from the list; Check belligerent – determines the side a units will play for. Player – the player independent of the side; Ally – ally; Enemy – enemy; Check daytime – Check of the day time. You can customize for up to three bonuses basing on their types. First type – unit parameters. Second type – damage modification, here you choose the resistance type. Third type – resistance modification. Modifier parameters: Mod tag – unique modifier tag; Absolute – absolute bonus (or penalty, if the value is negative); % of base – per cent of the basic value; % of cur – per cent of the current value; Duration – longevity of the modifier validity in rounds. It is usually ‘0’ (limitless), but you can set up a limited value; DoD – if the program should disable the modifier, when a unit receives damage; Priority – modifier priority, which determines the order in the value calculations. It is valid only for the modifiers, which have a bonus to the current value. The higher it is, the later should the modifier be calculated. Tab Events is responsible for the events, which happen to an item. You can associate one or several actions with an event through the Action editor. You can perform actions during upgrades, if you press a menu item ‘Chat’ and during other events. Custom params – a tab of internal variables of an item. You can use them in expressions and in scripts, you can store various properties of an item, which change with the time in this or other way. In the text format you can save them in form =, with the separator – a new line. 5. Additional aspects of location editing In this section we’ll discuss not all the properties of items, but only some part of them. For example the navigation maps have a parameter Open map, it is responsible for a particular location, which a map opens, for medals the tab Medal condition determines the conditions for receiving an award, for companions – tab Wife determines a set of additional slots. In this section we return to the process of location editing. There are three other tools, which we haven’t studied. All of them are simple in use. The time for their application starts at the very end of the process, when all other things are completed. We are speaking about the customization of the flying platforms, patrol paths for armies and the surface for flight. 97 5.1. Monorail system, platforms The tool for working with the monorail system is located in the tab Monorail System in the toolbar. The monorail system allows to create stiff so-called ‘rail’ routes in the space. Actually the monorail system includes three parts: a station, monorail, and a platform. The station is a point in the space, which has a number of free rotation levels. It has three coordinates and three rotation angles. The monorail is created by joining of two or several stations into a route. The route has the start and the end, though one and the same station can be used in it many times. The monorail curve is constructed automatically, it will be a maximally smooth curve, which will go through all the stations. And finally the platform is what will move along the route. The platform has two shapes: a physical shape is analogous to the shape of the bridge, and the logical shape or the radius, which works with the platform logic and inside which the protagonist gets glued to the platform during its movement. A typical scenario of the platform operation: when the protagonist enters the logical shape, a user event is generated, which launches the movement of the platform from the current station to the opposite one, - the end station. For the time of the trip the protagonist is firmly glued to the platform, when it arrives to the end station, she becomes finally free. You can add new station with the help if the key Insert. You can move them and rotate like atoms, you can open the properties window with the help of the Space bar. It will help to manually set up the position/rotation of the platform. To create a new route, click the panel Routes with the right mouse button and choose Add. A list of all routes on this location will be displayed in this panel, below you can choose the platform type on this route. In a field below you will find the field of stations displayed, which are located along this route. You can add a station there, if you click it with the right mouse button, the curve will be drawn automatically. One and the same station can be a part of several different routes, and moreover it can be used in the same route two times. You can change the sequence of stations in a route through the station panel or delete the unneeded ones. With the help of keys Home and End you can display a platform on the start or end stations of the route correspondingly. A repeated pressing of these keys will trigger a platform trip along the route, what would allow to create understanding about its behavior in the game. Now when you have created one or several routes, you need to attach the logic to them. For this create a new object in the LO panel (don’t forget to indicate Scope = Location, platforms have poor interaction with the global LO). For the work with the stations the action Platform management should be used: There are six different variants available inside this action: Spawn platform – creates a platform with a unique name on the chosen station. At the game start there are no platforms, you must create them; Kill platform – remove a platform with a particular name or on the specified station or, if both conditions are chosen, a platform with a particular name for the case, if a platform is located on the specified station in the moment of engagement; Kick platform to station – launches a platform with the specified name to the specified station. If you don’t specify a station, the platform will move to the opposite end station; Speed is responsible for the speed of platform movement; Change state – changes the platform status; Subscribe for event – a user-defined message will appear in the selected LO, which you will be able to catch with the help of a trap CUSTOM_EVENT. A tick at Automatic unsubscribe is responsible for the option that during a one-time generation of an event it will never appear again; 98 Unsubscribe – all subscriptions of the selected LO to the events connected to a chosen platform will be cancelled. Besides this the platform is a special bridge, it has the properties of a multistate-atom, it means it has statuses. Statuses are responsible only for the animation, additionally you can set up the default status on the end stations of the routes. 5.2. Army patrol paths The paths are customized through the tool Paths in the toolbar. The logic here is simple: We create a path despite of the fact, who will use it. After that we attach it to one or several active objects, as a rule armies or NPCs. A button Show all paths will show all paths on the map, otherwise only the chosen path will be displayed. The list of paths is located in the upper field, you can create a new one also there, if you click a right mouse button and choose New path, in the field below the points of the current path are displayed. We’ll create a new path. We can add new points on the map with the help of Insert. Press Insert again to create a new point connected with the previous one via an arrow and so on. A repeated pressing of J on the point, which is already connected with the selected one, will change the arrow type into the one-sided one, you can delete the arrow with the help of button U. In this way we’ll create a network of routes of one patrol path. When you get to some point, a character will randomly select the next direction of the available ones, if different is not specified (for example, with the help of one-sided arrows we can make it move in circles). When a unit arrives to some point, there is a certain probability it can receive an indication to execute a particular scenario. You can customize a particular point and the execution of scenarios at it, if you select it and press the space bar. The frequently applicable scenario is the expectation. When a unit arrives to some point, it won’t proceed further, but it makes a halt and start looking around, the animation idle launches. You can customize the probability of scenario execution and the rotation of a unit. You can use other scenarios for example launch animations. Now about the control. You can move a point, if you hold down the left mouse button, if you hold down Shift, the radius of chase for an army will change (it works only if a tick at Custom chase radius is set). Click some point holding down Ctrl, the probability of execution of some scenario will change, Alt will change the scenario type (only the expectation scenarios with different times are used). Finally the movement of a mouse with pressed Shift, Ctrl and the LMB will rotate the violet arrow, which is responsible for the army rotation at the point. Now when the path is created and completely constructed, we should attach it to some object. All objects, which can move, there is a variable path in the LO. You can input it manually or choose from a list a path to use. You can use one and the same path for several armies. 5.3. Surface for flight You can enter the edit mode of the flight surface, if you choose the tool Flight surface in the toolbar. The button Enable initiates the mode, the field Factor helps to choose the amount of surface apexes at an area unit, Grid – mode of mesh displaying for convenience. You can raise or lower each of apexes with the help of the mouse. It is obligatory to watch for the smoothness of the surface without drastic changes of the apexes. The buttons located a little bit lower are responsible for the process of shifting/deforming the surface as a whole. Practice Start with the platform-raft. Create two or three stations exactly above the water in the area of the strait and two of them will be located at the shores. Create a new route Route_0 and in succession add these stations to it. Choose the platform type raft_platform (raft). Now you need 99 to set up the heights for the points and the orientation so the raft is partially appeared from the water. At the end of route construction you need once again check the passability map. Fig. 5.1 Customization of the monorail You have created a monorail, but you haven’t supplied it with any logic. You can and should fix it. To do it go to the tool Logic Units and create a new LO there. Name it lu_raft and set up the Scope = Location. In this LO you’ll store the logic of the platform behavior and the variable, which will be responsible for the logic engagement. Create the variable in the list, name it power, and initiate it with the value ‘0’. Now you need to customize the traps in the created LO. For a start create a platform on the monorail, you can do it at the game start via the trap START_GAME. As the action choose Platform management and choose Spawn platform inside it. In your case you should create one platform (we'll name it raft) at the end station, which is located at the shore of the main island. Spawn uniq doesn’t have a value, but you don’t plan to create other platforms. Now you need to assign the platform LO to the event. You should choose again Platform management, but this time Subscribe for event. As the platform name you should input raft, as the condition – Anyone in adhesion radius, as LO you should input self, as an event – Special Command #1. Now when someone is getting into the adhesion radius, the platform will generate inside of LO the event Special Command #1, which you’ll catch with a trap. You should create a trap CUSTOM_EVENT, in ORC of which you’ll choose the event type – Special Command #1. Choosing again Platform management, platform name – raft, and the action itself – Kick platform to station. No need to input anything else, the platform will head for the opposite station. Now the logic of the raft is almost completed, however we have one hitch, we need this platform stay out of work until the protagonist receives a quest. Add an additional condition into ORC CUSTOM_EVENT (first we click the main condition ORC and choose Complicate) – Expression. Put down the expression [a]==1, and below decipher that a is lu.self.var.power (i.e. a variable power of the LO itself). Now the movement of the platform will 100 start only if the variable power is equal to ‘1’. Where shall we change it? We’ll open the dialogue of Joe again and find the variant of the answer, where we are receiving the quest task. We are creating the second action also there – Expression. Put down there [a]:=1, as a choose Logic unit variable -> Specific -> lu_raft (this is the name of the LO, which we have created for the platform). The variable power should appear in the list, and you can choose it. Now when you are receiving a quest, it becomes equal to ‘1’, exactly what we need, it creates a sufficient condition to keep it out of order until the protagonist receives a quest. Fig. 5.2 Full logic of the platform You have to make the paths for armies. You need only two paths, each of them will suffice with two points. You should create paths, within which you should create two paths for each and set up a 100% execution of the scenario Stop 5 with the army rotation. The rotation angle will be set in the island center. It means that in each final point a monster will have a look at the protagonist and stay 5 seconds before moving further. 101 Fig. 5.3 Customizing a path Now you have to assign these paths to our armies. Enter the atom settings – Variables. There is a variable path (for all armies). double-click it and receive a chance to choose the path from a list. That’s it. Now you only have to remove the mini-map, remove the text atom of the hero and not to forget to put down in session.txt a parameter start=darion_1, which will return the normal flow to the game. Your location is fully completed, you can play here! 6. Editing arenas Arena is an ordinary location in the terms of the game. It is ordinary because the same rules of creation are valid for it as for the regular one. You should create relief, paint it with a texture, arrange objects, make light, water (if required), customize the sky and set up the list of tracks (playlist). However such a location has different logic, for example there is no LO and no logical maps of the landscape, no map of flight. Moreover it has a number of additional features, which we’ll study. The arena has no map of heights for the logic units and soldiers. There is the mesh level, absolutely all the military units are located on this surface, the combat surface of the arena will always be flat. Only beyond the mesh you can manipulate the relief, arrange static and dynamical objects the way you like. There is another remark: As a rule common static objects are not used directly on the battlefield. The atoms of another group are used instead of them, i.e. those which have chessboard in the properties align. They are especially defined for the allocation in the specified amount of hexes and orientated for the rotation on the arena on the hex sides. The passability of the landscape or objects on the arena is disabled, there is only the passability of cells. 102 6.1. Additional properties of the arena as location First we’ll study the properties of the arena, which are available in Location/Properties in the main menu. On the very top there are fields responsible for the Lua-scripts, which calculate the damages on the arena and the after-combat bonus of the protagonist. Originally these fields have apply_damage and calc_bonus correspondingly, you can find both these scripts in arena.lua. The following fields execute the spells on the arena. Start spell – spell, which will be executed at the very start of the battle (after the script on_round_start), and Each turn spell will be executed after each move of each creature. It is worth emphasizing that these are just spells, they should be mentioned in items.txt or in the files assigned to it through include, the real script for execution will be defined in the field script_attack of these spells. Random objects – settings of the active objects, which appear on the arena. Depending on the random factor one or several altars, trunks or simply impassable hexes with some stone or stump can emerge on the arena. We can customize a group of objects, which can appear on the arena, the maximal amount of objects of this type and the probability of their appearance on the battlefield. It is worth mentioning that such objects are born only in specially marked cells. In the field Logic bits we can choose the arena characteristics. It depends on such characteristics, if the units consider this arena an underground one for example and receive bonuses from it. The field Cell highlight preset determines the color of hex border, the field Arena type – is a default main camera. In the field Sickness camera you can customize the ship motions for arenas. In the field Return location we can customize the teleport, which will produce the hero after the battle end. By default the hero appears in the same place, where the battle commenced, but you can compulsory move it to some other place. Finally a tick at Disable rage spirits disables the Pet Dragon/Rage Spirits in battles, and Total defeat prohibits the hero respawn after the battle, a defeat will result in game over. 6.2. Customization of the hex mesh During the editing, an item Arena appears in the toolbar, it is unavailable for other locations. You can enable a non-standard camera there, move or rotate the mesh (mode Move arena) around the location and launch the editor of the hex mesh. You can launch it also from Location/Board in the main menu. 103 Fig. 6.1 Customization of the hexagonal mesh On the left there is a list of templates prepared by developers. On the right there is a field of arena editing, below you can set up the mode. In all the modes a left click adds or deletes a cell, a right click opens a pop-up menu. You can move the field with the pressed middle mouse button, the scaling proceeds automatically. Entity – the most important mode. Here you can show the passability of each hex (there is a grey hexagon inside it), which you can change with the key U. There are four types of passabilities: full, only for flight, for flight/soar, and completely impassable. There are spirits of rage and the Pet Dragon on the impassable hexes. Additionally we can change it in process of battle. Further we can arrange a place on a hex for the respawn of hero’s or enemy’s troop. The hero can have up to five of such places, the enemy up to ten. The direction of the hex (the unit will look into this side) is given by the keys [ and ]. Additionally if you press B you can make a cell to a candidate for trunk respawn, P – hive or altar, and O – hindrance. Finally there are two other items in the pop-up menu: Empty clears up a cell from any logic, and Spirit makes to the point of birth of Spirits of Rage/Dragon. It is worth mentioning that a Dragon has some marking standard, as shown on the figure above. Camera – settings of the motion pictures camera (it doesn’t work, if the accelerated animation is enabled). You should mark, which of four cameras will work in this hex. It is usually the side of the player, which uses the first camera, the enemy side uses the second one. Spirits of Rage and the upper part of the battlefield use the third part and all others the zero one. Boss – helps to provide a cell with an additional property, which you will be able to select from it with the help of Lua-function Attack.bosscellid(cellunit). A right click on the hex helps to set up the boss identifier. A figure will be stored in the cell and the function will return exactly it. You can use these identifiers not in boss-battles. Naturally you can mark several cells. 104 Uids – mode of changing the unique identifiers of cells. Each cell on the arena has its unique number, from zero to the amount of cells minus one. The button Z can set up the zero cell. 6.3. Camera settings We can set up a special camera for the arena, if we choose Custom Camera in the mode Arena in the toolbar. Store saves the current camera position, and Restore camera loads the previously saved position. With the help of the button Edit camera you can set up the position and camera parameters manually. You can edit the camera, as if looking at it from a side, and also you can look from it, as if you are in the game, you should press the button Define camera. Look at bounds determines the maximally possible shift of the camera along the horizontal axes. Movement speed is responsible for the speed of camera movement along the axes. You can control the camera position (x, y, z) and its rotation angles (pitch – camera inclination in relation to the arena surface, yaw – camera inclination left-right in relation to its virtual axis). In the group of parameters Initials you can set up the initial parameters of the camera: FOV (Field of view) determines the camera vision angle. Pitch and Yaw – angles, at which the camera will be rotated at the battle start. Dist to center – starting distance of the camera from the arena surface. In the group of parameters Limits you customize the limits of change of the above mentioned parameters during the game. Distances are determined in conditional meters. The growth of a knight on arena is approximately two game meters, a small tile of the landscape – one meter. 6.4. Groups of atoms specific for the arenas There is a number of atoms on arenas, which are made especially for them. In the folder Arena/Decorations you can find static atoms for arenas, which have sizes convenient for the allocation on hexes and the assignment align=chessboard, which automatically sets an atom into the hex center on the arena and provides it with the rotation angle divisible by 60 degrees. Such atoms are included into the groups of decorations, which can automatically appear on the arena in hexes marked as Obstacle. It is admissible to use dynamic atoms on arenas, which don't have any logic. The following class of objects – chesspiece. These are troops. You shouldn‘t set up the troops manually on the arena, they will appear in the battle on their own. The general properties chesspiece for warriors and available properties of attacks you can find in the appendixes. Finally the last type of atoms, which we should study – pawn. Different as chesspiece, they can have no properties at all, but you always put them in the singular onto the arena, not like troops. The behavior of such objects is completely customized through the scripts, and you can put such atoms on the arena directly in the editor, in particular the bosses have been put in this way. Now when we have discussed the possibilities of the editor itself, we should find out, how we can use the created content in the game. 7. Interaction with the game 7.1. Structure of session folders. Methods of distribution As it was said in the beginning, a session is actually a storage folder. There is an important file session.txt, it contains all new and modified data required for the work. The data is distributed in folders and files: Actors – actors with unique numbers; Chats – files of dialogues specific for a session; 105 Config – configuration files storing various parameters, objects settings, etc; Heros – enemy heroes; Images – pictures of the interface elements: icons, backgrounds and portraits; Localization – files with the game texts; Locations – all locations including textures and all logic in separate files; Lus – all analogous session objects, which were not created automatically during the allocation of objects on the map; Quests – all session quests; Lutree.strg – data of the tree of logic units of the session; Properties.txt – data of the external properties of the session, its name, etc; Session.txt – data of the internal structure of the session. In principle any of these files you can move within the folder borders up to your liking, and it will be used anyway, in the same way you can create your own subfolders, the program will read data as usual. You can pack the files into the format .kfs for the session. (You should make a .zip or .rar archive and change the extension manually. 7.2. Editing session.txt, properties.txt and other text files important for the session We are starting with properties.txt. This file contains the name and the description of the session, as well as the list of exceptions (it marks the data related to the session). This name and the description are highlighted in the main menu when you select an additional campaign for the game. In the same way the picture of the session named .png will be displayed as well. You can use any picture for it. The second important file for the session is actually – session.txt. In this file you will find the list of locations categories inside a session (cats). You can easily add new categories, the main idea – not to modify the old ones. The next list in the file is – maps, which determines the set of locations in the session. Start – is the start location of the session. There can be other files in our session, which the editor doesn’t create automatically. Their format has resemblance features: playlists.txt (transfer from data.kfs) – file responsible for the music plalists, file format is described inside; sound_tables.txt (sounds.kfs) – this is a table of sounds, which have links to the .csv-files with tables of all sound files in the game. To use the sounds/music in the game, they should be listed there; config.txt (ses.kfs) – a set of various constants, which the program reads both from the code and scripts; items.txt (and its insertions via include) – all items of the session, including spells and creature abilities. 7.3 Loading a session in the game If you have at least one user-defined session in the folder sessions, an additional menu will appear in the main menu, it will help to attach any of the available sessions, which are called in the game ‘campaigns’. In one moment of time only one of them can be active, and the save files are individual for each of the sessions, you will not see them from other campaigns. You can use the same campaign menu to return into the Armored Princess. 106 8. Appendixes 8.1. Attachments editor Each atom in the game can have objects attached to it: other atoms, special effects, light sources or sounds. For example, flame burning in imp’s eyes or its giggling on the battlefield. There is a means to add and customize these attachments. Right click an atom in the list and choose item Attachments in the pop-up menu (you need to have the function atoms_editable in editor.ini enabled). Fig. 8.1 Editor of the attachments On the left you can see the model, below – the options of its displaying. We can play a particular animation, if we choose it from the list. To launch the animation and effects, you should press the button Play. Since a number of attachments is displayed only in certain conditions: on particular surface or in the logical state of the atom, you can customize certain conditions with the help of buttons Logic State and Surface Type and check, how your attachments would behave. The basis of these elements is Attach Point, the points of attachment. Click the field Attach Points to create a new point. Almost all character models in the King’s Bounty uses the skeletal animation. Correspondingly we can attach the objects not only in the coordinate system of an atom, but to the skeleton itself. Skeleton points (not all models have it) have no settings, regular points have the settings of the position and the orientation in the atom coordinates. As soon as we have chosen the point of attachment, we can customize the attachment itself. When you select it, several other tabs appear together with the tab Main. Tab Common – display conditions. You can select the time of the day, specific animation, state of logic or surface type, on which the attachment can be displayed. Button Spec allows to additionally customize the position of the particular attachment in relation to the point of attachment. The next tab – settings appropriate to various types of the objects to be attached. List of frequently used objects: 107 particle – particles. Typical example – portal animation between the locations or regular flame; omni – omni-source of lighting. The settings are absolutely identical to the settings of the general omni-source; mesh – any model in the format .bms or.bma, however it will not be animated; sound – sound saved in the table of the sound files sounds.csv; camera shaker – calls in camera shaking. The giant has such an attachment at the animation of earthquake; light_alterator – change of the global scattered and diffuse light; dummy – empty attachment for the exchange for something else with the help of scripts. 8.2. Configuration files of the game and editor A lot of game and editor settings are stored in ini-files. The file editor.ini in the folder editor is responsible for the properties of the editor on a certain PC. We’ll study the parameters defined in it: atomseditable – 1 or 0 determines, if it is possible to change the atom-files of objects inside the editor. The game resources should be unpacked for the process of editing. This will trigger the editor of attachments; undosize – size of the buffer Undo. The bigger, the better, however it can cause some delay in PC performance. Values lower than 10000 are not taken into consideration; sourcemediafolder – folder for storing the textures of locations and source materials; font – font used in the editor. You can choose any; editor_use_adapter – option specifies, if to use the second monitor; execcount – amount of launches of the editor in the system. If there is no such a key in the file or its value is equal to zero, the editor will be initialized, the program will offer to choose the folder sourcemedia, etc. Game parameters are stored in the files app.ini, game.ini and default.ini in the folder data. Below we are dwelling upon the values significant for the editor. app.ini: sets ~language – language code of the current game version. The game will work only with the localization files (.lng), which start with this code; sets ~session – basic game session. It is always ‘addon’, since it is the whole game. You can install your own, but it should have all necessary for a full-scale game from A to Z; sets ~sessionadd – additional session. We create them in the editor and enable in the game. 8.3. Lua-scripts The game uses the script language Lua. All scripts are stored in the file ses.kfs in the folder sessions, in files with extension .lua. Lua – is a simple language for studying and usage, you can find the official text-book for it here http://www.lua.org/pil/ (in English). The game represents rather wide library of functions, free for use, the list of them you can find in the Internet here: http://kingsbounty.ru/docs/scripting/. 108 To use the Lua-scripts directly in the editor you will need to have the comment at the function --ftag: where - function type. An incomplete list of function types: --ftag:frame --ftag:idle --ftag:vv --ftag:watch --ftag:itmw --ftag:if --ftag:damage --ftag:bonus --ftag:action --ftag:mascn --ftag:escn --ftag:posthit --ftag:objuse --ftag:armygen – frame-script (on animation frame); – for chesspiec function idle; – Var's value; – script-trap for changing the variable value; – script-trap for changing the item meaning; – checking the conditions; – function for calculation of the damage done; – function for calculation of the after-battle bonus; – is called from action; – map actor scenario; – editor's scenario; – script of the post-production of the damage after an impact; – function for the item use; – function-generator of the army. 8.4. Review of the resource structure of the game A short list of the main types of the game files: .txt – such files can have very different formats, they usually set up the configuration of the game or objects; .atom – atom-file. Special text file, which has the description of the game world object and all its properties; .ui – interface configuration file; .dds – object textures; .png – interface pictures; .ani – animated cursor; .bma – 3D model with animation; .bms – 3D static model; .bsa – file of animation for a skeleton model; .csh – file collision shape, which defines the flat contour of object interception; .cms – file collision mesh. A simplified model, which specifies the object interception with the cursor or the camera beam; .track – route of the director’s camera; .stream – compressed texture of the location; .lu – logic unit in the binary shape; .strg – some storage of data, universal format; .kfs – renamed .rar or .zip-archive; .ptb – file of particles. The generation and the character of these particles are customized in it; .loc – location file; 109 .csv – simplest data table; .act – internal format of the actor file; .chat – internal format of the dialogue file; .hero – internal format of the hero file; .qst – internal format of the quest file; .lua – Lua-script. Text file; .ogg – sound format, used for music. 8.5. Editor hot keys General: Home Ctrl + R Ctrl + "Gray+/Gray-" Ctrl + Gray1 Ctrl + Gray1 Ctrl + F1 Ctrl + F2 Ctrl + F3 Ctrl + F4 Ctrl + F5 Ctrl + H Ctrl + G Shift + F2 Shift + F3 Shift + F8 (Ctrl + Gray1) Ctrl + Shift + Alt + H Ctrl + Shift + Alt + O Ctrl + Shift + Alt + B Ctrl + Shift + Alt + S Ctrl + W – sets the camera into the default position; – disable displaying of auxiliary objects; – increase/reduce the time flow; – show/hide all except landscape; – show/hide landscape; – show/hide FPS; – show/hide the distribution of CPU resources; – show/hide the memory load; – show/hide video memory load; – show/hide the statistics of primitive element rendering; – show/hide the passability and logical/physical shapes; – show/hide the mesh of texture tiles of the landscape; – show/hide bound boxes; – show/hide collision meshes; – show/hide non-landscape models; – show/hide shadows; – enable/disable omni-lighting; – enable/disable bloom; – enable/disable sounds; – enable/disable water in the editor. Camera control: LMB – left mouse button, RMB – right mouse button, MMB – middle mouse button; Default engine camera: RMB A, D W, S Up, Down Left, Right Pgup, Pgdn E, Q + Shift + Ctrl + Alt 3DMAX-like camera: MMB MMB + Alt MMB + Alt + Ctrl – rotation; – moving left/right; – left/right along the camera axis; – forward/backward without altering the height; – turn left/right; – turn up/down; – movement up/down; – quick movement; – slow movement; – slow rotation; – panoramic movement; – orbital movement; – smooth movement forward/backward; 110 MMB + Ctrl MMB + Shift Mouse wheel Left, Right, Up, Down Pgup, Pgdn + MMB – rotation; – movement up/down; – zoom in/out; – movement in the plane (+Shift – quick, +Ctrl – slow); – movement up/down (+Shift – quick, +Ctrl – slow). Toolbar: Shift + L Shift + A Shift + U – landscape tool; – atom tool; – tool of the logic units. Terrain tool: LMB LMB + Shift LMB + Ctrl LMB + Alt [ ] [ + Shift ] + Shift 1...0 ' " – raise the terrain; – lower the terrain; – make the terrain flat; – sea level; – reduce the brush; – increase the brush; – reduce the internal radius of the brush; – increase the internal radius of the brush; – brush strength; – square/round brush. Level tool: [ ] ' " Pgup Pgdn +Shift – reduce the brush; – increase the brush; – square/round brush; – level up; – level down; – erase. Map objects: P L A N Space (on atom) Shift + mouse M M + Alt S R R + Alt V – view atom properties; – view logic unit/template of the logic unit; – choose this atom in the palette; – next atom of this type; – object properties on the map; – frame selection of a group of obejcts; – move an object; – move vertically; – scale an object; – rotate an object along the vertical axis; – rotate an object along the horizontal axes; – create an object variation under the cursor. Logic: Ctrl + Q Ctrl + A Ctrl + D – quests; – actors; – dialogues. Paths: Insert J – new point; – add/change the connection type; 111 U Space Ctrl + Shift + Alt + Click Ctrl + Shift + LMB + mouse move around an object Ctrl + Click Alt + Click – delete the connection; – properties of a point; – set up/delete a turning; – rotate the arrow responsible for the direction of the character look; – probability of execution of the scenario/stop; – stop time. Monorail: Insert RMB Space Home End – new station; – add a station into the selected route; – station properties; – create/launch the platform from the start station of the route; – create/launch the platform from the end station of the route. 112