Go down
roman.oxymoron
roman.oxymoron
developer
Posts : 81
Reputation : 74
Join date : 2018-03-22
http://oxymoron.games/projecthospital/

Modding tutorial: objects Empty Modding tutorial: objects

on Tue Nov 20, 2018 6:18 pm
Message reputation : 100% (1 vote)

Modding tutorial: objects


Hi, this is modding tutorial, focused on creating new objects, walls, doors and tiles for Project Hospital. Examples and texture grids you will find below in attached files. Software used by devs is mainly adobe illustrator and photoshop.
.png files you'll create, has to be saved in your mode folder \\Assets\StreamingAssets\Addons\ModName\
.xml files in \\Assets\StreamingAssets\Addons\ModName\Database\


Attachements:

TestMod contain:
.png textures with example objects
.xml files (scripts for all example objects)

Helpful files contain:
.ai files (layers with isometric grid used in game, texture grid, example of objects used in xml and id numbers)
.png files (grids for those who prefer raster editors)


Objects


step 1)

Use the isometric grid to create your object for all possible direction (north-west NW, north-east NE, south-east SE, south-west SW), . Remeber that no indoor object can be higher than 3 tiles and objects wider than 1 tile (table, sofa, etc...) are called composite objects ... explained below.

Modding tutorial: objects Cap110


step 2)

Place your object into proper texture grid on grayed tiles, all four directions in order (NW, NE, SE, SW) ... follow examples. Gray tiles represetns 1 tiles in game, so consider suitable postion. Object higer than 1 tile needs to be placed in "tall_objects" texture, wider or taller outdoor object (like tree) belongs to "objects_big_demo" texture, etc.

Modding tutorial: objects Captur11


step 3)

Export your texture as .png file, with proper name and resolution into your mode location: \\Assets\StreamingAssets\Addons\ModName\

mod_objects_small_atlas.png - 2048x8192
mod_objects_tall_atlas.png - 2048x8192
mod_objects_big_demo_atlas.png - 2048x2048
mod_decals_2048_atlas.png - 2048x2048
mod_doors_4096_atlas.png - 4096x4096
mod_tiles_4096_atlas.png - 4096x4096
mod_walls_patterns_atlas.png - 4096x2048


step 4)

Create new xml, according to your object type and texture into mode location database: \\Assets\StreamingAssets\Addons\ModName\Database\

ModObjects.xml - objects_small_atlas
ModObjectsAttachments.xml - objects_small_atlas
ModObjectsCompositeParts.xml - multi-tile objects
ModObjectsOutdoorBig - objects_big_demo_atlas
ModObjectsTall.xml - objects_tall_atlas
ModDecals.xml - decals_2048_atlas
ModDoorsAndWindows.xml - doors_4096_atlas
ModDoorPrefabs.xml - double doors
ModWalls.xml - walls_patterns_atlas
ModFloorTypes.xml - tiles_4096_atlas

Best way to create new object is copy paste similar one, from the game xml and edit. Here is oxygen tank for instance ... important parametrs for editing are:

id - must be unique
texture - path to the texture ... don't forget write your mode name ( <Texture>Addons/ModName/mod_objects_small_atlas.png</Texture> )
texture id - id of object directions (in ai files is a layer with id for all usable tiles)
IconIndex - doesn't work for mods
script parameters - will be explained in separate tutorial (not available yet)
tags - used by UI and scripts (tags for building filters: ui_furniture, ui_decorations, ui_equipment, ui_outside, ui_decals)

Code:

<GameDBObject ID="OBJECT_OXYGEN_TANK">
        <AbbreviationLocID>OBJECT_OXYGEN_TANK_DESCRIPTION</AbbreviationLocID>
        <TextureRef>ASSET_TEX_MOD_NAME_OBJECTS_TALL</TextureRef>
        <TextureAtlasLayout>LAYOUT_16_X_64</TextureAtlasLayout>
        <SpriteShape>SHAPE_1_X_1</SpriteShape>

        <TextureIDNW>356</TextureIDNW>
        <TextureIDNE>357</TextureIDNE>
        <TextureIDSE>358</TextureIDSE>
        <TextureIDSW>359</TextureIDSW>
        <CustomIconAssetRef>ASSET_TEX_MOD_NAME_CUSTOM_ICON</CustomIconAssetRef>

        <AccessPositions>
            <AccessPosition>
                <m_x>-1</m_x>
                <m_y>0</m_y>
            </AccessPosition>
        </AccessPositions>

        <PlacedToEdge>false</PlacedToEdge>
        <AttachedToWall>false</AttachedToWall>
        <AttachedToObject>false</AttachedToObject>
        <Placement>INDOORS</Placement>
        <AllowsObjectsOnWallsAbove>true</AllowsObjectsOnWallsAbove>

         <Tags>
            <Tag>ui_equipment</Tag>
            <Tag>ui_oxygen_tank</Tag>
        </Tags>

        <Cost>69</Cost>
        <ColorSetRef>COLOR_SET_BUILDING_OBJECT_OXYGEN_TANK</ColorSetRef>
    </GameDBObject>

Modding tutorial: objects Icons210


step 5)

Object icon can be used from icons.png by using parameter and its id (id_icons.psd):
<IconIndex>716</IconIndex>

Or you can create Custom icons that are currently supported for objects and composite objects.
The icons themselves need to be a 64x64 px png, while the game creates a sprite from the inner 60x60 px area - make sure you leave some space around the icon graphics.
Asset type in the asset lists xml is TEXTURE_CUSTOM_SPRITE.

Add icon parameter to object xml:
<CustomIconFile>Addons/ModName/icon_object_oxygen.png</CustomIconFile>


step 6)

For changing object color in game set "hue" of selected faces on your object to 300°.

Modding tutorial: objects Icons310

Create ModColorSets.xml and create new color list you want to use (5 colors max).

Code:

<GameDBColorSet ID="COLOR_SET_BUILDING_OBJECT_OXYGEN_TANK">
        <Colors>
            <GameDBColor> <R>70</R>  <G>128</G>  <B>106</B>  </GameDBColor>
            <GameDBColor> <R>128</R>  <G>70</G>  <B>70</B>  </GameDBColor>
            <GameDBColor> <R>70</R>  <G>95</G>  <B>128</B>  </GameDBColor>
            <GameDBColor> <R>209</R>  <G>209</G>  <B>73</B>  </GameDBColor>
            <GameDBColor> <R>38</R>  <G>38</G>  <B>38</B>  </GameDBColor>
        </Colors>
 </GameDBColorSet>

Then paste this parametr with id of you color list to the xml of your object:
<ColorSetRef>COLOR_SET_BUILDING_OBJECT_OXYGEN_TANK</ColorSetRef>


step7)


Create ModStringTableEn.xml ... to set a name and description for you new object visible in game.

Code:

<Database>
    <GameDBStringTable ID="LOC_EN_MOD_NAME">
        <LanguageCode>en</LanguageCode>
        <LanguageNameLocalized>English</LanguageNameLocalized>
        <Contributors>
            <Name>Oxymoron Games</Name>
        </Contributors>
        <LocalizedStrings>
            <GameDBLocalizedString>      <LocID>OBJECT_OXYGEN_TANK</LocID>                   <Text>Oxygen tank</Text>  </GameDBLocalizedString>
            <GameDBLocalizedString>      <LocID>OBJECT_OXYGEN_TANK_DESCRIPTION</LocID>       <Text>A decoration.</Text>  </GameDBLocalizedString>
        </LocalizedStrings>
    </GameDBStringTable>
</Database>


step8)

Last step is set loading of all your assets, explained in separate tutorial here.


Others


States


If you want to implement object with more states (open/closed, turned on/off), create new state for each direction and place it right behind (see below).

Modding tutorial: objects Cap211

Then add to object xml parameters of animation frames that determines number of states ... you can see that NE, NW has one more frame but SE, SW doesn't, because in those directions it wouldn't be visible.

Code:

        <AnimationFramesNW>2</AnimationFramesNW>
        <AnimationFramesNE>2</AnimationFramesNE>
        <AnimationFramesSE>1</AnimationFramesSE>
        <AnimationFramesSW>1</AnimationFramesSW>


Seats


Seats are little bit complicated, because for SW and SE directions is object partially in front and partially behind the character.

Modding tutorial: objects Cap310

For this case there is a parameter "TextureIDBack" which moves part of chair behind the character ... you need to set direction and proper id (-1 means none).
example:

Modding tutorial: objects Cap4a10


Code:

        <TextureIDNW>-1</TextureIDNW>
        <TextureIDNE>-1</TextureIDNE>
        <TextureIDSE>2</TextureIDSE>
        <TextureIDSW>5</TextureIDSW>

        <TextureIDBackNW>0</TextureIDBackNW>
        <TextureIDBackNE>1</TextureIDBackNE>
        <TextureIDBackSE>3</TextureIDBackSE>
        <TextureIDBackSW>4</TextureIDBackSW>


Composite objects


When indoor object is wider than one tile, it needs to be splitted out into tile parts and scripted separately.

Modding tutorial: objects Cap510

Example of office desk:

Modding tutorial: objects Cap610

Open/create ModObjectsCompositeParts.xml and both sides of the desk create separately with unigue id:

Code:

<GameDBObject ID="OBJECT_OFFICE_DESK_A">
        <AbbreviationLocID>OBJECT_OFFICE_DESK2_A</AbbreviationLocID>
        <TextureRef>ASSET_TEX_MOD_NAME_OBJECTS_SMALL</TextureRef>
        <TextureAtlasLayout>LAYOUT_16_X_64</TextureAtlasLayout>
        <SpriteShape>SHAPE_1_X_1</SpriteShape>
        <TextureIDNW>360</TextureIDNW>
        <TextureIDNE>362</TextureIDNE>
        <TextureIDSE>365</TextureIDSE>
        <TextureIDSW>367</TextureIDSW>
        <CustomIconAssetRef>ASSET_TEX_MOD_NAME_CUSTOM_ICON</CustomIconAssetRef>

        <PlacedToEdge>false</PlacedToEdge>
        <AttachedToWall>false</AttachedToWall>
        <AllowsObjectsOnWallsAbove>true</AllowsObjectsOnWallsAbove>

        <AttachmentSlot>
            <HeightOffset>0.9</HeightOffset>
            <AllowedTags>
                <Tag>decoration</Tag>
                <Tag>pc</Tag>
                <Tag>tv</Tag>
                <Tag>radio</Tag>
                <Tag>printer</Tag>
                <Tag>lab_eq</Tag>
                <Tag>lab_eq_small</Tag>
                <Tag>microscope</Tag>
                <Tag>hematoanalyzer</Tag>
                <Tag>defibrillator</Tag>
                <Tag>surgery_instruments</Tag>
                <Tag>electrocautery_machine</Tag>
                <Tag>fast_usg</Tag>
                <Tag>RIA</Tag>
                <Tag>audiometer</Tag>
                <Tag>crp_scan</Tag>
                <Tag>spirometer</Tag>
                <Tag>shockwave</Tag>
                <Tag>electromyograph</Tag>
                <Tag>lab_analyzer</Tag>
                <Tag>stool_analyzer</Tag>
                <Tag>thermal_cycler</Tag>
                <Tag>electrocardiograph</Tag>
                <Tag>ui_coffee_machine</Tag>
            </AllowedTags>
            <ForcesAttachmentOrientation>true</ForcesAttachmentOrientation>
        </AttachmentSlot>

        <ConnectedSlots>
            <ConnectedSlot>
                <PositionX>-1</PositionX>
                <PositionY>0</PositionY>
                <AllowedTags>
                    <Tag>office_chair</Tag>
                </AllowedTags>
                <ForcedDirection>SE</ForcedDirection>
            </ConnectedSlot>
        </ConnectedSlots>

        <AttachedToObject>false</AttachedToObject>
        <PartOfCompositeObject>true</PartOfCompositeObject>
        <ForcesAttachmentOrientation>true</ForcesAttachmentOrientation>
        <Placement>INDOORS</Placement>

        <Tags>
            <Tag>desk</Tag>
        </Tags>
        <ColorSetRef>COLOR_SET_BUILDING_OBJECT_OFFICE_DESK2</ColorSetRef>
</GameDBObject>

 <GameDBObject ID="OBJECT_OFFICE_DESK2_B">
        <AbbreviationLocID>OBJECT_OFFICE_DESK2_B</AbbreviationLocID>
        <TextureRef>ASSET_TEX_MOD_NAME_OBJECTS_SMALL</TextureRef>
        <TextureAtlasLayout>LAYOUT_16_X_64</TextureAtlasLayout>
        <SpriteShape>SHAPE_1_X_1</SpriteShape>
        <TextureIDNW>361</TextureIDNW>
        <TextureIDNE>363</TextureIDNE>
        <TextureIDSE>364</TextureIDSE>
        <TextureIDSW>366</TextureIDSW>
        <CustomIconAssetRef>ASSET_TEX_MOD_NAME_CUSTOM_ICON</CustomIconAssetRef>

        <PlacedToEdge>false</PlacedToEdge>
        <AttachedToWall>false</AttachedToWall>
        <AllowsObjectsOnWallsAbove>true</AllowsObjectsOnWallsAbove>

        <AttachmentSlot>
            <HeightOffset>0.9</HeightOffset>
            <AllowedTags>
                <Tag>decoration</Tag>
                <Tag>pc</Tag>
                <Tag>tv</Tag>
                <Tag>radio</Tag>
                <Tag>printer</Tag>
                <Tag>lab_eq</Tag>
                <Tag>lab_eq_small</Tag>
                <Tag>microscope</Tag>
                <Tag>hematoanalyzer</Tag>
                <Tag>defibrillator</Tag>
                <Tag>surgery_instruments</Tag>
                <Tag>electrocautery_machine</Tag>
                <Tag>fast_usg</Tag>
                <Tag>RIA</Tag>
                <Tag>audiometer</Tag>
                <Tag>crp_scan</Tag>
                <Tag>spirometer</Tag>
                <Tag>shockwave</Tag>
                <Tag>electromyograph</Tag>
                <Tag>lab_analyzer</Tag>
                <Tag>stool_analyzer</Tag>
                <Tag>thermal_cycler</Tag>
                <Tag>electrocardiograph</Tag>
                <Tag>ui_coffee_machine</Tag>
            </AllowedTags>
            <ForcesAttachmentOrientation>true</ForcesAttachmentOrientation>
        </AttachmentSlot>

        <AttachedToObject>false</AttachedToObject>
        <PartOfCompositeObject>true</PartOfCompositeObject>
        <Placement>INDOORS</Placement>
        <ColorSetRef>COLOR_SET_BUILDING_OBJECT_OFFICE_DESK2</ColorSetRef>
</GameDBObject>

Next step is to create ModCompositeObjects.xml and unite those objects as one by setting their id and position towards themselfs.

Code:

<GameDBCompositeObject ID="COMPOSITE_OBJECT_OFFICE_DESK">      
 <AbbreviationLocID>COMPOSITE_OBJECT_OFFICE_DESK_DESCRIPTION</AbbreviationLocID>
        <Parts>
            <GameDBCompositeObjectPart>      
                <TileOffset>
                    <m_x>0</m_x>
                    <m_y>0</m_y>
                </TileOffset>
                <ZOffset>0</ZOffset>
                <ObjectRef>OBJECT_OFFICE_DESK_A</ObjectRef>
            </GameDBCompositeObjectPart>
             <GameDBCompositeObjectPart>      
                <TileOffset>
                    <m_x>0</m_x>
                    <m_y>1</m_y>
                </TileOffset>
                <ZOffset>0</ZOffset>
                <ObjectRef>OBJECT_OFFICE_DESK_B</ObjectRef>
            </GameDBCompositeObjectPart>
        </Parts>

        <Tags>
            <Tag>ui_furniture</Tag>
            <Tag>ui_office_desk</Tag>
            <Tag>desk</Tag>
        </Tags>

        <Cost>99</Cost>
        <CustomIconAssetRef>ASSET_TEX_MOD_NAME_CUSTOM_ICON</CustomIconAssetRef>
    </GameDBCompositeObject>

If you see white or black glitches on the connection edge, it can be solved by moving object's cut slightly over the edge of texture grid, or mostly it's caused by alpa channels where solution is to create new layer (in photoshop), expand the object color (photoshop plugin, dilate many) and set transparency to 1%.

Modding tutorial: objects Cap711

Doors and windows


Copy the door texture from game (Assets/StreamingAssets/Textures/doors_4096_atlas.png) to your mod folder as mod_doors_4094.png.
Create a window and put it into the texture.

The tutorial for creating mods has more info how to switch to the new texture.

Modding tutorial: objects Cap910

Create ModDoorsAndWindows.xml and add a new GameDBDoor ... script uses mostly the same parameters like all the other objects.

TextureIDSW / TextureIDBackSW - here you set only one direction ... the rest of it is automatic.
FrameTextureID / FrameCrossSectionTextureID - set id of wall frame from mod_walls_4096_atlas.png ... id's here are counted as groups start at 0, not tile by tile.

Code:

<GameDBDoor ID="WINDOW_TALL">      
     <AbbreviationLocID>WINDOW_TALL</AbbreviationLocID>
        <TextureIDSW>68</TextureIDSW>
        <TextureIDBackSW>70</TextureIDBackSW>
        <FrameTextureID>8</FrameTextureID>
        <FrameCrossSectionTextureID>0</FrameCrossSectionTextureID>
        <Passable>false</Passable>
        <AnimationFrames>1</AnimationFrames>
        <Cost>50</Cost>
        <CustomIconAssetRef>ASSET_TEX_MOD_NAME_CUSTOM_ICON</CustomIconAssetRef>
        <ColorSetRef>COLOR_SET_BUILDING_OBJECTS_DEFAULT</ColorSetRef>
    </GameDBDoor>

Doors is mostly the same, except you need to create animation states for opening and closing:

Modding tutorial: objects Cap1010

For common doors add a parameter <AnimationFrames>4</AnimationFrames> and set number of your states. For sliding doors add parameter <SlideDirection>1</SlideDirection> (-1 for opposite direction) and AnimationFrames keep at 1.

Code:

<GameDBDoor ID="DOOR_RESTRICTED">  
       <AbbreviationLocID>DOOR_RESTRICTED</AbbreviationLocID>
        <TextureIDSW>48</TextureIDSW>
        <TextureIDBackSW>48</TextureIDBackSW>
        <TextureIDSE>60</TextureIDSE>
        <TextureIDBackSE>60</TextureIDBackSE>
        <FrameTextureID>2</FrameTextureID>
        <FrameCrossSectionTextureID>2</FrameCrossSectionTextureID>
        <Passable>true</Passable>
        <AnimationFrames>4</AnimationFrames>
        <OpeningZOffsetSW>1.0</OpeningZOffsetSW>
        <OpeningZOffsetSE>1.0</OpeningZOffsetSE>
        <Cost>100</Cost>
        <SoundEventOpen>SFX_ENV_DOOR_B_OPEN</SoundEventOpen>
        <SoundEventClose>SFX_ENV_DOOR_B_CLOSE</SoundEventClose>
        <IconIndex>743</IconIndex>
        <ColorSetRef>COLOR_SET_BUILDING_OBJECTS_DEFAULT</ColorSetRef>
    </GameDBDoor>


Walls


Copy the wall pattern texture from game (Assets/StreamingAssets/Textures/walls_patterns_atlas.png) to your mod folder as mod_walls_patterns_atlas.png, similar to the process with doors & windows.
Create new assets for wall patterns and paste it to mod_walls_patters_atlas.png (don't forget to make one side a little bit darker):

Modding tutorial: objects Cap1110

Create ModWalls.xml and add new object. Coloring works for faces with hue 300° (explained above), but color list is fixed for all wall patterns.

TextureID - id of wall frame (walls_4096_atlas.png) ... counted by groups
TextureIDPattern - id of pattern from walls_patterns_atlas.png

Code:

<GameDBWall ID="WALL_TYPE_CONCRETE_COLOR">    
     <AbbreviationLocID>WALL_TYPE_CONCRETE_COLOR</AbbreviationLocID>
        <TextureID>0</TextureID>
        <TextureIDPattern>5</TextureIDPattern>
        <AlwaysVisible>false</AlwaysVisible>
        <Cost>10</Cost>
        <CustomIconAssetRef>ASSET_TEX_MOD_NAME_CUSTOM_ICON</CustomIconAssetRef>
</GameDBWall>


Tiles

Copy the tile texture from game (Assets/StreamingAssets/Textures/tiles_4096_atlas.png)  to your mod folder as mod_tiles_4096_atlas.png, similar to the process with doors & windows.
Create new tile patterns and paste them to the new texture. Coloring works for tile with hue 300°, but the list of colors is fixed.

Modding tutorial: objects Cap1210

Create ModFloorTypes.xml and add new object:

PathCost - prioritizes path finding of the AI

Code:

<GameDBFloorType ID="FLOOR_TYPE_WOOD_RIGHT">
        <AbbreviationLocID>FLOOR_TYPE_WOOD_RIGHT</AbbreviationLocID>
        <TextureID>48</TextureID>
        <CustomIconAssetRef>ASSET_TEX_MOD_NAME_CUSTOM_ICON</CustomIconAssetRef>
        <ConnectedTiles>false</ConnectedTiles>
        <PathCost>1.0</PathCost>
        <Cost>10</Cost>
        <MaxDirtLevel>4</MaxDirtLevel>
        <TextureVariations>1</TextureVariations>
        <Specular>0.75</Specular>
</GameDBFloorType>

For random variation tiles (like grass), create all variations and paste to the texture one after another:

Modding tutorial: objects Cap1310

Create object for each variation in the .xml and for the first one add parameter TextureVariations with number of variations:

Code:

<GameDBFloorType ID="FLOOR_TYPE_GRASS_DARK">
        <AbbreviationLocID>FLOOR_TYPE_GRASS_DARK</AbbreviationLocID>
        <TextureID>27</TextureID>
        <CustomIconAssetRef>ASSET_TEX_MOD_NAME_CUSTOM_ICON</CustomIconAssetRef>
        <ConnectedTiles>false</ConnectedTiles>
        <HighPriority>true</HighPriority>
        <PathCost>3.0</PathCost>
        <Cost>10</Cost>
        <MaxDirtLevel>0</MaxDirtLevel>
        <TextureVariations>4</TextureVariations>
        <Outdoors>true</Outdoors>
        <Specular>0.0</Specular>
    </GameDBFloorType>

    <GameDBFloorType ID="FLOOR_TYPE_GRASS_DARK_01">
        <AbbreviationLocID>FLOOR_TYPE_GRASS_DARK</AbbreviationLocID>
        <TextureID>28</TextureID>
        <CustomIconAssetRef>ASSET_TEX_MOD_NAME_CUSTOM_ICON</CustomIconAssetRef>
        <ConnectedTiles>false</ConnectedTiles>
        <HighPriority>true</HighPriority>
        <PathCost>3.0</PathCost>
        <Cost>10</Cost>
        <MaxDirtLevel>0</MaxDirtLevel>
        <Outdoors>true</Outdoors>
        <HiddenInUI>true</HiddenInUI>
        <Specular>0.0</Specular>
    </GameDBFloorType>

    <GameDBFloorType ID="FLOOR_TYPE_GRASS_DARK_02">
        <AbbreviationLocID>FLOOR_TYPE_GRASS_DARK</AbbreviationLocID>
        <TextureID>29</TextureID>
        <CustomIconAssetRef>ASSET_TEX_MOD_NAME_CUSTOM_ICON</CustomIconAssetRef>
        <ConnectedTiles>false</ConnectedTiles>
        <HighPriority>true</HighPriority>
        <PathCost>3.0</PathCost>
        <Cost>10</Cost>
        <MaxDirtLevel>0</MaxDirtLevel>
        <Outdoors>true</Outdoors>
        <HiddenInUI>true</HiddenInUI>
        <Specular>0.0</Specular>
    </GameDBFloorType>

    <GameDBFloorType ID="FLOOR_TYPE_GRASS_DARK_03">
        <AbbreviationLocID>FLOOR_TYPE_GRASS_DARK</AbbreviationLocID>
        <TextureID>30</TextureID>
        <CustomIconAssetRef>ASSET_TEX_MOD_NAME_CUSTOM_ICON</CustomIconAssetRef>
        <ConnectedTiles>false</ConnectedTiles>
        <HighPriority>true</HighPriority>
        <PathCost>3.0</PathCost>
        <Cost>10</Cost>
        <MaxDirtLevel>0</MaxDirtLevel>
        <HiddenInUI>true</HiddenInUI>
        <Specular>0.0</Specular>
</GameDBFloorType>

For connected tiles (floor lines), create all 16 possible directions in way you want to have it connected:

Modding tutorial: objects Cap1510

Modding tutorial: objects Cap1410

Create new object in .xml, set first tile ID and parameter ConnectedTiles to "true" ... it takes all tiles in the same row as above.

ConnectedTilesByColor - you can use to disconnect lines with different colors

Code:

<GameDBFloorType ID="FLOOR_TYPE_COLORED_DARK_LINE">
        <AbbreviationLocID>FLOOR_TYPE_COLORED_DARK_LINE</AbbreviationLocID>
        <TextureID>112</TextureID>
        <CustomIconAssetRef>ASSET_TEX_MOD_NAME_CUSTOM_ICON</CustomIconAssetRef>
        <ConnectedTiles>true</ConnectedTiles>
        <ConnectedTilesByColor>true</ConnectedTilesByColor>
        <PathCost>1.0</PathCost>
        <Cost>10</Cost>
        <MaxDirtLevel>4</MaxDirtLevel>
        <TextureVariations>1</TextureVariations>
        <Specular>0.5</Specular>
</GameDBFloorType>


Decals


Create asset for all directions and paste to the mod_decals_2048.png.

Modding tutorial: objects Cap1610

Open ModDecals.xml ... script is mostly the same like for the small objects, so is the coloring.

Code:

<GameDBObject ID="OBJECT_DECAL_DPT_ICU">
        <AbbreviationLocID>OBJECT_DECALS_DESCRIPTION</AbbreviationLocID>
        <TextureRef>ASSET_TEX_MOD_NAME_DECALS</TextureRef>
        <TextureAtlasLayout>LAYOUT_16_X_16</TextureAtlasLayout>
        <SpriteShape>SHAPE_1_X_1</SpriteShape>
        <TextureIDNW>64</TextureIDNW>
        <TextureIDNE>65</TextureIDNE>
        <TextureIDSE>66</TextureIDSE>
        <TextureIDSW>67</TextureIDSW>
        <CustomIconAssetRef>ASSET_TEX_MOD_NAME_CUSTOM_ICON</CustomIconAssetRef>

        <Placement>UNLIMITED</Placement>

        <AccessPositions></AccessPositions><!-- No limit -->
        <PlacedToEdge>true</PlacedToEdge>
        <AttachedToWall>true</AttachedToWall>
        <NonBlocking>true</NonBlocking>
        <NotInteractable>true</NotInteractable>
        <HeightOffset>1.5</HeightOffset>

        <Tags>
            <Tag>ui_decals</Tag>
        </Tags>

        <CustomIconFile>Addons/ModTrees/icon_decal_rad.png</CustomIconFile>
        <ColorSetRef>COLOR_SET_BUILDING_DECALS</ColorSetRef>
        <Cost>20</Cost>
 </GameDBObject>
avatar
Dalairen
medic
Posts : 2
Reputation : 0
Join date : 2019-06-15

Modding tutorial: objects Empty Re: Modding tutorial: objects

on Sat Jun 15, 2019 3:39 am
Walls do have twice as much colors and I wanted to add missing colors to decals.
With the 5 color limit the only way to do this is to double those in the list with different colors.
Is the limit mandatory?
jan.oxymoron
jan.oxymoron
developer
Posts : 1288
Reputation : 217
Join date : 2018-03-23

Modding tutorial: objects Empty Re: Modding tutorial: objects

on Mon Jun 17, 2019 4:22 pm
Dalairen wrote:Walls do have twice as much colors and I wanted to add missing colors to decals.
With the 5 color limit the only way to do this is to double those in the list with different colors.
Is the limit mandatory?

Hi, the number of color slots for objects (decals are technically objects) is currently limited to 5, that's correct - the code would have to support resizing the palette panel etc., which we originally decided not to implement, as the UI would overflow in lower resolutions (especially 1366 x 768), even with the automatic UI scale. The panel barely fits after adding palette slots for floors and walls and the respective panels are slightly smaller. A possible solution on our side would be to increase the palette size and decrease the number of rows in the object catalogue at the same time, we can quickly discuss this in the next design meeting. Probably not the highest priority though. Smile
avatar
Dalairen
medic
Posts : 2
Reputation : 0
Join date : 2019-06-15

Modding tutorial: objects Empty Re: Modding tutorial: objects

on Mon Jun 17, 2019 10:18 pm
jan.oxymoron wrote:Hi, the number of color slots for objects (decals are technically objects) is currently limited to 5, that's correct - the code would have to support resizing the palette panel etc., which we originally decided not to implement, as the UI would overflow in lower resolutions (especially 1366 x 768), even with the automatic UI scale. The panel barely fits after adding palette slots for floors and walls and the respective panels are slightly smaller. A possible solution on our side would be to increase the palette size and decrease the number of rows in the object catalogue at the same time, we can quickly discuss this in the next design meeting. Probably not the highest priority though. Smile
Thank you. So, I guess, it's the decal duplicates with different palette for now.
avatar
Floracelia
intern
Posts : 4
Reputation : 0
Join date : 2019-06-22

Modding tutorial: objects Empty Re: Modding tutorial: objects

on Sat Jun 22, 2019 4:02 pm
Is there any way to replace the colors of walls, floors and objects already in the game? While I don't mind the color selection I would enjoy a more muted palette more and would like to match all the wood items with each other as literally every item that has wood in it has a different wood color.
jan.oxymoron
jan.oxymoron
developer
Posts : 1288
Reputation : 217
Join date : 2018-03-23

Modding tutorial: objects Empty Re: Modding tutorial: objects

on Mon Jun 24, 2019 8:57 am
Floracelia wrote:Is there any way to replace the colors of walls, floors and objects already in the game? While I don't mind the color selection I would enjoy a more muted palette more and would like to match all the wood items with each other as literally every item that has wood in it has a different wood color.

Hi, yes, you can edit the colors in ColorSets.xml.
avatar
Floracelia
intern
Posts : 4
Reputation : 0
Join date : 2019-06-22

Modding tutorial: objects Empty Re: Modding tutorial: objects

on Mon Jun 24, 2019 12:14 pm
Thank you! I thought I was gonna have to go through all the textures and actually replace them in a graphics program but this is so much easier Very Happy
Sponsored content

Modding tutorial: objects Empty Re: Modding tutorial: objects

Back to top
Permissions in this forum:
You cannot reply to topics in this forum