Before you start
Prefab Size Limits
The maximum height a prefab can be is 255 blocks/metres high. While there is no hard limit as far as I know on width and length (If you don’t plan on using a distant mesh or want to use vanilla RWG* ), there is an issue that occurs with large prefabs with the distant mesh overlaying itself over the prefab while you’re inside it, instead of unloading. While it’s possible to overcome this issue, we’ll just keep things simple. Size obviously depends on what your building but the smaller it is the easier it will be. Try to aim for no larger than 100×100 if you want it to be compatible with the vanilla tiles and no greater than 200×200 for compatibility with vanilla RWG generator.
If you plan to place it manually, 169 is the maximum x & y dimensions while not incurring the distant mesh bug. This bug also depends on the clients view distance video settings, 169 is with it set to low so since that option is the lowest you can go in the options menu, that maximum dimension for x & y has the greatest accessibility for everyone.
If you want to spawn a prefab in a vanilla tile it has to be a specific size or it will not get spawned. The sizes are as follows (nothing larger than Medium will spawn in the downtown tiles):
Extra Small – 25 X 25
Small – 42 X 42
Medium – 60 X 60
Large – 100 X 100
Custom – Prefabs larger than 100 x 100 can only be spawned in the wilderness.
If you want to know more on the issues and gotchas with larger prefabs continue reading, if not you can skip to the “other limitations” section.
If you want to go larger than 169×169 users will have to select the medium view distance option in the video options. (assuming you want your prefab to have a distant mesh, obviously the glitch doesn’t apply if it doesn’t have one 😉 )
With medium you can take your prefab out to 202. Second to last is restricting your prefabs use to the high option, with it set to high you can do 234.
yes if you really really want to, you can max out the games view distance with the console command “sg optionsgfxviewdistance 12” this isn’t a great plan, not only will every user have to enter that command every single time they launch the game (If on a server you can force the setting on them xd) it also means they might have to choose between lowering their view distance and deal with the bug, or leave it enabled and get poor performance. Also it goes without saying if your prefab is large enough to need this, there is no chance it will be compatible with vanilla RWG. Also also any prefab this large will take a ridiculous amount of time to make and make the game run very poorly.
However if you really, really, really want to do it, the absolute maximum you can stretch the x & y dimensions with the command is 364 while still not triggering the distant mesh bug. Anything larger than that will suffer from the distant mesh bug regardless.
Currently there is a ceiling of around 250-256 sleeper volumes before is starts acting buggy, but if you follow the size recommendations above you shouldn’t need to worry about it. Lights also have 2 limiting factors. 1 performance, lights are very taxing and lots of bright lights with a large range can quickly turn things into a slideshow. The 2nd factor is you can only have custom settings on a limit
Tiles that are manually spawned will not spawn their parts or prefabs. Furthermore switches, triggers & distant meshes will not function on a server if the prefab files are not installed on the client also.
There are several things you can do to improve performance in your prefab.
Using the “Show Light Perf” option in the debug tools tab you can see the range of all your lights. Try to ensure you don’t have multiple lights that overpass each other ranges. You can still have lights next to each other but for every 4 lights in a row you should set the other 3’s range to 0 they will still show as on but won’t incur the performance penalty.
2. Paint Textures
Make sure you don’t use the paint textures on blocks if the texture already exists as a default texture for an existing block. For example don’t paint anything with the wood texture if you can just use the wood block without any painting. This will reduce the memory consumption of the prefab.
For the best compatibility never spawn more than 25-30 zombies in a single volume or group of volumes. The default max alive for servers and single player is 65, if you reach that number sleepers will stop spawning in that volume until there is room in the cap. This leads to situations where the player will think a volume is cleared only to go away, kill some zeds that frees up the cap and then returns to find a bunch of zeds materialise in their face not great.
Also make sure you don’t over do the sleeper positions, for every 4 sleeper positions you should spawn 3 zeds. Only have about 25% more positions that will spawn.
4. Structural integrity
This should go without saying but you should always make sure your prefab is stable. If your prefab collapses ingame that has a huge performance impact, so make use of the playtest option and click “show stability” in the debug tools tab to see where your prefab has blocks that will collapse.
5. Trapped Zeds
Try to avoid having zeds enclosed behind solid blocks (trap blocks are fine since they only take 1 hit) for what ever reason damaging blocks has a big impact on performance, so having a bunch of zeds hammering at walls trying to get out will drastically reduce performance.
Create a new prefab
Once your in the prefab editor, first thing to do is press ESC and go to the last tab (Prefab Browser) Then “create new prefab”. You’ll be asked to name your prefab, so any name will do and it can be changed later. When renaming a prefab you can just rename the files of the prefab found in C:\Program Files (x86)\Steam\steamapps\common\7 Days To Die\Data\Prefabs
There will be a handful of different files for each prefab, just watch out for the .NIM file. It has a double extension and it’s easy to overlook. So don’t forget the .blocks or it won’t load.
Now that it’s been saved you can press ESC and click on save at any point. I’d highly recommend that you create backups and keep the last several. So if something goes wrong or you make a design mistake, you have previous versions to revert back to.
The prefab editors bread & butter is the selection tool. You press Z and a blue box appears, press it again on another location and the box will fill the area between the 2 points. Using the selection boxes you can create walls in a couple seconds, limit other tools to a specific area, copy and paste entire sections (or even whole prefabs). You can change it’s size by holding SHIFT + G then drag the 3 arrows in the direction you wish to expand the box in. You can also move it by holding G then using WASD and SPACE for up and C for down.
You’re already in debug mode when you load into the prefab editor. So to open the creative menu just hit U. Here you can get all of the blocks you need. I’d recommend you use the mutiblock variant type blocks if you can, just to save you having to go back and forth to the menu to see all the options.
If your prefab is intended to be player explorable, you can add Sleepers too it with the editor. Adding sleepers is a 2 part process, first you need sleeper blocks. These control individual zombies/sleepers. Then you need to group your sleepers in Volumes to control group behaviour and when they spawn.
You can find the sleeper blocks in the Creative menu. There are 2 main types of sleeper blocks, the 1st is generic zombies and the 2nd is individual animal sleeper blocks. Although the zombie blocks all look the same the actual type of sleeper that zombie becomes is controlled by the Sleeper Volume. The blocks control where in your prefab zombie sleepers spawn and what “sleeping” position they will be in once spawned. They also control individual zombie sleeper behaviours like hearing and sight range, so you can set up monster closets. The animal sleeper blocks are a little different as these will determine what animal the sleeper becomes regardless of the volumes settings.
Once your sleeper blocks are placed you can start grouping them into Sleeper Volumes. If you go to the Level tools tab in the editors tab menu you will find a checkbox called “show Sleeper Volumes”. Once this is enabled you can start editing your volumes, you might not have any volumes in a new prefab and if that’s the case just load up another prefab that does and check the show volumes if it isn’t checked already.
Then you can simply left click on a volume and copy it CTRL + C then go back to your prefab and paste it anywhere CTRL + V. Alternatively there is a “cpy Sleeper Volume” button in the Level Tools tab that can do the same thing. Once you have a volume in your prefab you can just copy it to get more.
To change the volumes settings, left click on a volume and the edges will turn green. You can move the selected volume the same way as the selection box discussed earlier. If you press K you will get the sleeper volumes settings. Here you can select the group of the type of zombie you want to spawn, so if you wanted soldiers select “Group Zom Soldier”. You also need to specify how many zombies will spawn, i’d recommend you only spawn as many sleepers as you have sleeper blocks placed. The 2 boxes for “Spawn Count” are minimum and maximum. If you want a set number to spawn every time just set the same value in each box. If you want them to spawn in the same place every time enter the value of the total sleepers in the volume in spawn count boxes.
Giving Your Prefab A Distant Mesh
I’d recommend you do this part last. For the most part it’s a one click deal, however it might need some tweaking before hand. Before you click on “update Imposter” to create your mesh i’d recommend you make a backup first and make some edits before going ahead. You want the mesh to be essentially an empty shell, so block up any holes that are open into your prefab (Any Marble painted blocks work well). Another thing of note is terrain won’t “convert” and will simply disappear in the mesh. So if your prefab has raised terrain on the exterior, you will need to use conventional blocks and paints to approximate the terrain for the mesh.
Once your prefab is prepped and ready hit “update Imposter”. This will create a basic version of your prefab and if you sealed it up right, it will be hollow inside. Do NOT save while “show Imposter” is checked it will save the imposter over your actual prefab. Make sure the main prefab is loaded before saving. You can then rename the new .Mesh file if you made a new prefab version for the mesh creation.
Doors, Traps, Switches & Triggers
These are new with A20, they allow players to open locked doors after pressing a switch or key activation. They can also be used to trigger traps to break to create ambushes.
For doors place your door, switch or key activator blocks and hold E on either. Assign a trigger group to it, this links the door and switch together so when you press the switch it opens that door. Make sure both your switch and door have the same group number. Doors also have some new options holding E in the “edit” menu. You can change the damage state with the upgrade/downgrade buttons, use a preset state and open or close it from here.
Traps are set up almost identically, place your activator block assign it a group number. Then press E (not holding it this time) and assign the same group to the trap. There are many different types of trap blocks available, search for “trap” in the creative menu to see all the options.
Spawning The Prefab With RWG
This is a nice easy option for getting the prefab to spawn in RWG. Click on the “Prefab Tags” button in the tab level tools 2. Here you will see all the available tags that tell world generation which group of prefabs it should be spawned with. Select the tag appropriate for your prefab and hit save. If you generate a new world your new prefab should be included in the new worlds prefabs.xml after generation.
Using the Trader Spawn Block
For trader POI’s you can add a trader by going into the creative menu and search for “trader” find the trader block and place where you want your trader to spawn (in A20 the icon is the old trussing ramp block and the model is a battery bank) Once you have it placed to choose which trader will spawn mouse over the block and press SHIFT + ALT + Right Mouse Button for the trader selection menu.
Traders will face this direction when spawned.
Adding Decals To Terrain
You can add various decals to terrain blocks by mousing over the block you wish to add it to and pressing SHIFT + ALT + Right Mouse Button Enter a id from 0-15 to add that decal.