Kenshi Wiki
Advertisement


Unfinished

Basics[]

Making a tower in Kenshi is like building a tall cake. Each level exactly the same thickness. Each slice of cake gets its own interior, exterior mesh, floor and ceiling meshes. But the compilation needs to account to exactly same height (or the very least the floor mesh&collision at correct level). Otherwise the floor toggle does not work correctly.

Exteriors and Blacks are listed as parts and interiors, stairs and floors and ceilings as interiors.


TIP only the ground floor exterior walls need collision. Floors above need only collision on the interior walls (so characters won't walk through walls and fall out.


About ceilings and floors[]

In real life the bottom of the floor above is my ceiling. But in Kenshi ceiling and floor are two different meshes. This is because for ease of playing the top part of the ceiling needs to be invisible, so the player can see in. This is achieved by making the ceiling an one-sided plane. The ceiling has no collision.


Making a custom collision[]

Try to make your collision as cube-like as possible. Collision should have only the minimal amount of vertices. Use collision shape 'box' as often as you can. That is the easiest shape for the engine.

To make a collision with an walk-through opening, use collision shape 'mesh'. Windows do not need to be walk-through.

For floors you need a cube that is almost as flat as a plane. You need to position it so its bottom part almost touches the floor surface. The origo of the floor collision being slightly on the floor surface. If the origo resides any lower, the character sinks into the floor.

DO NOTE: the floor mesh's origo needs to be in the foundation level, at the XYZ crosshair. If not, the alignment and placing of the mesh will be in the wrong place.

Do not rename a collision file. The name of the mesh is part of the coll file data and if you change that Kenshi's engine cannot read it. The result is character sinking though the floor. (Luckily no crashes this time). If you need to rename it just re-export it with the correct name.The Blacks

Kenshi uses interesting tactics to reduce engine load: it renders the furniture inside only if a player character is inside the building. However if the door is open, the player could see in and see no furniture. This is solved by a room sized black mesh AKA 'darkness' preventing the player looking in a building. I think this is also part why there are such small windows on the buildings. The blacks go to parts and are called from the previous floor.

See my tutorial video Kenshi Furniture Tutorial: Custom Collision for step by step how to make collisions https://www.youtube.com/watch?v=ng0qJcjKbco

The Mask Trigger[]

The Mask is a special collision script, it triggers the interior to show and the exterior to vanish upon contact with a player character.

Just create a cube that encompasses the interior of your building. especially covering the entrance and add collision to it. Export it as xml.

Edit the xml file after moving it to your mod's buildings folder. Replace the contents with instructions on page Mask Trigger Collision Script.

The mask is called from level 0


What part on which level[]

For me as a Finn it always causes confusion with the floor numbering, as here in Finland first floor is the one you step into, but it's ground floor in Kenshi.

Rule: everything player sees when char is in that floor is called from that level. Everything that blocks player view is called from either lower or above level.

Level 4 = fourth floor (four stairs up)

  • the floor, including mesh (origo at foundation level) & floor collision (origo at walking level)
  • ceiling between floors 4-5
  • interior walls for floor 4
  • exterior walls for floor 3
  • black for floor 5 (if any)

Level 3 = third floor (three stairs up)

  • the floor, including mesh (origo at foundation level) & floor collision (origo at walking level)
  • ceiling between floors 3-4
  • interior walls for floor 3
  • exterior walls for floor 2
  • black for floor 4

Level 2 = second floor (two stairs up)

  • the floor, including mesh (origo at foundation level) & floor collision (origo at walking level)
  • ceiling between floors 2-3
  • interior walls for floor 2
  • exterior walls for floor 1
  • black for floor 3
ExteriorToLVLAbove.png

Level 1 = first floor (one stairs up)

  • the floor including mesh & floor collision (origo at walking level!)
  • ceiling between floors 1-2
  • interior walls for floor 1
  • exterior walls for ground floor
  • black for floor 2

Level 0 = base, ground level

  • the foundation mesh & collision
  • interior walls for ground floor
  • no exterior walls! This floor's outerior walls are put on the next lvl
  • front door - a collision with special script to open door
  • the floor including mesh & floor collision (origo at walking level!)
  • black for floor 1
  • MASK - a collision with special script to trigger when characters walk in


Troubleshooting[]

Why doesn't my game load?[]

Make sure you have all the collisions (xml) in the same exact case sensitive form you have on your file. Sometimes when I do some re-edits and save the collision again I accidentally save it with slightly wrong name. That will result your game trying to pull the collision but cannot, bc the collision does not exist. That will result to an endless loading upon the game start.

FIX: you need to find what collision link is misspelled. And/or make sure the actual xml file is in the correct folder.

Why does my walls look like they exploded ( a graphics malfunction)[]

You have one or more mesh faces occupying the same graphical space. Usually the interior and exterior being exactly identical, only the other its normals flipped. Where in more modern graphic engines this causes only texture flickering, in Kenshi it causes havoc.

FIX: To avoid this make the interior mesh smaller by x and y axis. Z needs to be the same unless you want gaps between your stories.

Why does the game crash?[]

Many things can cause this, one being: You have two or more collisions overlapping. Usually your wall collision overlapping with the floor collision.

FIX: Make sure when you create your building, that you keep all pieces separate.

Crashes are notoriously hard to figure out, as same issue may work today, but won't load properly the next. Good luck.

Why does my character sink through the floor?[]

  • No collision link on the floor mesh file in FCS FIX: add the link
  • The collision's origo is not high enough. FIX: when making the collision, move and resize it in object mode and make sure yellow dot is on floor mesh surface level. Floor mesh origo at xyz crosshairs, floor coll origo at walking surface.
  • The collision is wrongly shaped, too small, misaligned or you exported it as collision shape 'mesh' and it has a hole (missing normals) on its surface FIX: make sure the collision size, shape and position matches the floor and it does not have any unwanted holes.
  • Collision xml filename has been changed via windows file explorer (double-right-clicked and rename chosen). FIX: re-export with correct name.


Why my character cannot enter the building I made?[]

  • There is a collision in the way TIP: it can be also the ground/foliage!
    • 1) Make sure you made the wall collision as collision shape 'mesh' with an opening for a door
    • 2) Is there a correct collision link in the correct story level?
    • 3) Is the doorway too high for the character? FIX: lower the building or add a ramp or stairs.
  • The pathfinding cannot find the doorway
    • 1) Is a door closed? Is there something blocking the way? FIX: remove obstacle and/or rebuild navmesh (shift+F11)
    • 2) Is there a properly navigable path? If you used a ramp, does the ramp have collision and is it set to 'walkable'? Is the collision of the ramp aligned correctly (origo on surface)?

Why my building has gaps between levels?[]

  • Your story walls are too short. Maybe you resized them and forgot the edges need to align with lower and above floors.
  • Is an entire floor wall missing? Make sure you have a correct mesh called from correct level and that it has the normals correct way out.
Advertisement