Difference between revisions of "User:Infinithil"
Infinithil (talk | contribs) m |
Infinithil (talk | contribs) m |
||
Line 126: | Line 126: | ||
Alright, you’re on the home stretch to having a feature complete building! Compared to the time involved in the previous tutorials, this one will be a breeze. | Alright, you’re on the home stretch to having a feature complete building! Compared to the time involved in the previous tutorials, this one will be a breeze. | ||
− | We’re going to do two things, Navmesh your 3 building models <span style="color:#006400">(Navmeshing is a process to teach AI how to walk through a space)</span>, and add a special type of collision called Obstacle Navcutting. Obstacle Navcutting is not an official term, it’s what I call it because of the pieces involved. We’re making use of an old trick Bethesda used in Hearthfire to dynamically manipulate the Navmesh at runtime. | + | We’re going to do two things, Navmesh your 3 building models <span style="color:#006400">(Navmeshing is a process to teach AI how to walk through a space)</span>, and add a special type of collision called Obstacle Navcutting. <span style="color:#FF0000">Obstacle Navcutting is not an official term, it’s what I call it because of the pieces involved. We’re making use of an old trick Bethesda used in Hearthfire to dynamically manipulate the Navmesh at runtime.</span> |
Revision as of 19:22, 9 January 2018
Greetings, you people!
My name is Infinithil, I am from Germany and work as a civil servant.
In my free time, I work on my first addon pack for SimSettlements and help around the SimSettlements Wiki.
Have a nice day!
Finished additions: Toolkit_Chapter_05_Randomized_Clutter
Workshop area
Toolkit_Chapter_05.5_Helping_the_Player
This tutorial assumes you know basic navigation and keyboard shortcuts to navigate the Creation Kit. If not, please go back and check out the Creation Kit 101 primer.
All of my guides will highlight things that are specific to your experience level: Green for beginners, and Red for seasoned modders. So if you’re new, you aren’t meant to understand the red messages, and if you’re a vet - you can probably skip the green.
Contents
Preamble
This guide is for things that I’ve started doing since the mod’s release that didn’t fit easily into any of the other tutorials, but are important enough to justify their own guide.
These are steps that will bring your buildings even closer to perfection in the eyes of the player.
Just like the Advanced Possibilities guide, this tutorial will grow over time.
Menu Selectable Building Plan
As of patch 2.0.0, players can now directly select the building model for a plot. To facilitate this, the ExtraPlaqueInfo property of the building plan is used (found by expanding the Advanced section of your building plan). To set this up so that the player can select your building and get the appropriate prompt, follow these steps.
- In the Object Window, expand Miscellaneous and click on Messages, then filter for kgSIM_BuildingInfo_Template
- Duplicate the kgSIM_BuildingInfo_Template form (right click it and choose Duplicate).
- Open the duplicated form and change the data to match your building plan (check out some of the other kgSIM_BuildingInfo messages for ideas about what kind of information you might include). After these steps is an image of the template and below that is a list of the fields along with a basic explanation of each.
- Once your message is configured, open your building plan, expand the Advanced section and point the ExtraPlaqueInfo property to your new message.
File:Toolkit Chapter 05.5 Helping the Player image1.jpg
ID: Change the ID to something to help you pair it with your building plan.
Title: The title will show up on the plot Plaque below your building plan name. This should be any basic information the player might need and show be relatively short.
Message Text: This is the information that will be displayed to the player when they select your plan from the build menu. It is broken down into 4 sections.
Heading: The first line tells the player the building name, author name, and which add-on pack it’s coming from. Replace Building Name with what you named your building, replace Author Name with your name, and replace Addon Pack Name with whatever you are going to call your Addon. If you are uncertain still, just make something as a placeholder and you can come back and change it again later.
Detailed Information: This is a more detailed version of what you included in the Title field. You can make this section as long as you like.
Benefits: This is where you would describe any modifiers your building plan would apply that are beneficial to the settlement. If you aren’t adding any special modifiers, this section can be removed.
Costs: This is where you describe any negative modifiers that would impact the settlement. If you aren’t adding any negative modifiers, this section can be removed.
Scrappable Buildings
Many of you will have noticed I released a new mod file called Sim Settlements Helper. This file was to make it possible for players to scrap everything in the mod.
On Xbox and some slower computers, conditions can arise where objects from Sim Settlements get left behind. I’m not even talking about uninstallation, I’m talking about the scripts getting backed up and things being created at unexpected times so that Sim Settlements misses them in cleanup stages. So rather than forcing the player to use console commands, allowing them to scrap the objects in workshop mode is clean easy solution already available in the game.
You can easily add this to your own stuff, here’s what you do.
- Start by creating a new FormList, go to the Object Window, expand Miscellanous, click on FormList and right-click in the right half of the window and click new.
- Give your formlist a unique ID, I tend to include the word Scrap in it. Leave your FormList open and drag the window to the side so we can add things to it.
- Now expand World Objects and click on one of the highest level categories (activator, container, door, etc), in the filter type in your prefix.
- Click on the first thing on the right (if nothing shows up, skip to the next category), then hold shift and scroll down to click on the last thing in the list, this should highlight them all. Now drag all of these into your FormList.
- Repeat this process for all 11 of the WorldObject major categories.
- Now click OK to save your FormList.
- Next, go to the Object Window, expand Items and click on Constructible Object.
- Right-click on the right hand side and choose New. This will bring up the constructible object form.
- Enter a unique ID.
- Right-click in the box under Recipe Filters and select Add, find: “WorkshopRecipeFilterScrap” and add it.
- In the Created Object dropdown, find your FormList (you can use the filter just above it to narrow down this list.
- Then press OK to save the Constructible Object.
- You’re done!
So long as you followed the advice to create custom named duplicates of items you are spawning in your StageItemSpawns array (as tutorial 4 taught you), everything your building plans create will be scrappable.
They will also return any items to discourage anyone from using this as a cheat to generate unlimited resources.
Performance Settings Support - new in 1.1.9
In the City Manager Holotape is a section called Performance Settings. This allows players to turn off certain objects in our building plans to help with performance issues.
There are two ways you can take advantage of these.
The Removal Method: For objects that need the same classification throughout all of your building plans or that are only used in one building plan, you can simply add the ActorValue kgSIM_PlotSpawn_PerformanceClass set to one of the following numbers:
1 = Detailed model - a very complex model that could cause fps issues due to large textures or high polygon counts
2 = Detailed light - small lights that could be removed without making the building completely dark 3 = Animated Object - objects that loop through an animation like flags or machines
4 = Special Effect - smoke, fire, water, etc
5 = Radio
6 = Sound Emitter
7 = Actor type - NPCs, pets, etc.
8 = Container - Container type object holding lootable items (not currently in use)
9 = Clutter
10 = Water Plane - Water planes cause everything beneath them to be water as well, so players building plots up in the air may want to be able to turn them off.
Couple of important rules with this method:
- Never apply or alter this AV on the kgSIM forms that are part of Sim Settlements, or you’ll flag them for every building plan instead of just your own.
- Don’t apply the AV if you want your object to appear no matter what. So if you have an activator running a script, you definitely don’t want it being skipped or removed.
If you want to apply the classification to an object, but only on certain building plans, you have two options:
- Create a copy of your object with the appropriate AV value from the list above, then change out the version in your building plan StageItemSpawn records with your new copy.
- Use the iType field in your StageItemSpawn record as described in the downgrade method below.
The Downgrade Method: Use this method if you’d like to replace your object with a less intense version, for example: replace a high-poly model with a low-poly version, or a shadow light with a non-shadow light. To do this, instead of applying the ActorValue to your object, you instead use that same number in the new StageItemSpawn field called iType.
Then add your downgraded model as a new entry immediately following that one. Your downgraded model should have nothing entered in the iType field, and should have the EXACT same sSpawnName value.
If the player has that type disabled, your downgraded one will be displayed instead.
Toolkit_Chapter_06_Settler_Navigation
This tutorial assumes you know basic navigation and keyboard shortcuts to navigate the Creation Kit. If not, please go back and check out the Creation Kit 101 primer.
All of my guides will highlight things that are specific to your experience level: Green for beginners, and Red for seasoned modders. So if you’re new, you aren’t meant to understand the red messages, and if you’re a vet - you can probably skip the green.
Preamble
Alright, you’re on the home stretch to having a feature complete building! Compared to the time involved in the previous tutorials, this one will be a breeze.
We’re going to do two things, Navmesh your 3 building models (Navmeshing is a process to teach AI how to walk through a space), and add a special type of collision called Obstacle Navcutting. Obstacle Navcutting is not an official term, it’s what I call it because of the pieces involved. We’re making use of an old trick Bethesda used in Hearthfire to dynamically manipulate the Navmesh at runtime.
Obstacle Navcutting is something special you need to do to Sim Settlements buildings. If you are used to building workshop creatable buildings, or want to go on to doing so with the skills you’ve learned here, you won’t need to do this step.
When objects are spawned by code the way they are in Sim Settlements, their navmesh (the other part we’ll be doing to the building in the next section) is not immediately recognized by the game. The player has to first exit the game and come back in for it to work.
So we’re going to add some rudimentary boxes to show the NPC how to get around!
- Go to the Cell View, make sure World Space is set to Interiors and open the cell kgSIMObstacleNavCutDisplays.
- This is a cell with pre-created boxes (those bright-pink eye sores) laid out along with the approximate sized items they will work for. File:Toolkit Chapter 06 Settler Navigation image1.jpg
- Now find the SCOL for your first building level, and float it somewhere above the cement pad (catch those falling models!).
- Next, fragment the collection with Alt+U.
- Your goal here is to add those pink boxes to your walls, and any large object that is between the doorway and any furniture the settler needs to get to activate such as a bed, or a shopkeeper marker.
- They don’t need to cover vertically, in fact they should be sunk below the floor by a about 20% of their height.
- Remember in the first tutorial, I suggested you bake your major pieces of furniture into the model? This is one of the reasons. It’s very easy to simply pick a box that matches the furniture approximately.
- Leave plenty of space. The doorway size you’ve seen in the game is about as narrow a gap as you should leave between any two of these boxes if you want the NPC to be able to walk between them.
- Overlapping corners is NOT necessary, if the space between two of these is less than half a doorway width, the NPCs generally won’t even attempt to walk between them.
- Don’t worry about furniture up against walls if it will not block a path to things the settler will not activate (Settlers will only activate objects of the Furniture type that you placed).
- If your building has two or more stories, do not worry about the upper floors, those will be handled by our NavMesh in the next section.
- Note: These boxes are markers, so they will not show up in the game!File:Toolkit Chapter 06 Settler Navigation image2.jpg
Obstacle navcut as viewed from underneath of the SecuriStop Armor Store. Your box layout should look similar from the bottom. Notice the large gap near the doorway, and the very small box used for the counter. Better to go too small, than too big.
- Once you’ve set up the boxes, you’re going to follow the normal steps to create the SCOL/Nif/Static - with a few differences:
- When naming your SCOL, add _Obstacle to the end of the name.
- When you’re in Nifskope, do NOT press Save right away like we normally do, first you’re going to do a few additional steps:
- Throughout this section I will refer to “Blocks” some people refer to them as “Nodes”, which is essentially any one of these entry lines inside of Nifskope - it’s a little more complex than that - but for our purposes, that will work!
- Click the > next to 0 BSFadeNode to expand it.
- Look at the revealed Blocks and expand them one at a time until you find one with a bunch of things under it with kgSIM_Obstacle in the name.
- Click on the NiNode that has all of the kgSIM_Obstacles under it, count the number of entries that do NOT have kgSIM_Obstacle in them.File:Toolkit Chapter 06 Settler Navigation image3.jpg
- Go down to Block Details, and change the Num Children field to be the number of
Non-kgSIM_Obstacles (You can edit that number by double-clicking it.).
- Double-click the refresh icon, and expand the Children list below. You should notice now that things have changed in the list of Blocks above. The one you have selected now only has some of them left under it equal to the Num Children you just entered. The rest are now down at the bottom of the file. This is normal.
- In the Children section, you’re going to make sure the entries left are all pointing to the NiNodes that are not kgSIM_Obstacles, to do so, double-click on one of the Children entries (aim for the number) and type in the ID of one of the ones you need to point at that was moved to the bottom of the blocklist. See below for a image example:File:Toolkit Chapter 06 Settler Navigation image4.jpg
In this we would click on 63 at the bottom of the file, and type in 84, so that the BaseFenceChainLinkHalfNoPost01 is moved back here. We’d then replace the 66 in the bottom window with 87, and so on.
All that should be left at the bottom of your file, offset slightly to the left, are the kgSIM_Obstacles.
- Click on 0 BSFadeNode in the Block List, then edit the Num Children entry in the Block Details. You’re going to take the number there and increase it by the number of kgSIM_Obstacle objects. So if the number is 2, and there were 6 obstacle objects, you’ll change that number to 8.
- Now, doubleclick the refresh symbol just below that number you edited and expand Children.
- For each of the None entries, enter the ID for one of the kgSIM_Obstacles.
See image below for an example of a what a correct node layout should look like once you’re finished with these steps.File:Toolkit Chapter 06 Settler Navigation image5.jpg
Your finished nif should look something like this. If you click on the down arrow next to 0 BSFadeNode, everything else should be hidden. If not, you did something wrong.
- Now before you save this, you should make a backup of the nif file you already created for this model, before you added the Obstacle pieces. Once you’ve made a backup copy, save over the original file - which will automatically update your Static form in the Creation Kit.
- Last step. Open the Static form (not the SCOL) of the building model you just edited, and check in Obstacle. This tells the game to look for the pink boxes when deciding how the NPCs should move around.
- Head into the game and give it a test! You should be able to command an NPC to walk into your building without it running into a ton of stuff! If it doesn’t appear to work at all (they run directly into the side of the building), you may have missed a step - or you may have left large gaps where you shouldn’t have.
- If you continue to struggle to get this to work, you can test changes to the model before you do all of the Node manipulation, though sometimes it will cause the game to crash to desktop - so be aware!
Some experienced modders will tell you that Navmeshing is a giant pain in the arse, and when doing it on a large scale- it can be. Doing so for three small models is nice and quick.
This may be difficult to explain in text/images, and I will try to get up a Youtube video explaining it as soon as possible. In the meantime, there are lots of video tutorials on Youtube for Skyrim Navmeshing, and the exact same method applies - I particularly like the tutorials by darkfox127
- Find your Static model (not the SCOL) for your level 1 building in the Object Window (I think you know enough now to find them… ok fine, WorldObjects->Static).
- Right-click on it in the Object Window and choose NavMesh Object. This will open your model up in the Render window.
- Rotate your view until you’re looking at an entryway to the building.
- For our purposes, Navmeshing will be done entirely on the floor of the model (Though technically you can do the roof as well if you like), so when I ask you to click and create points, I’m always asking you to do it on the floor.
- Right-click near one of the front corners of the doorway. A small green cube should appear, and the model of the building may no longer be highlighted green - this is normal.File:Toolkit Chapter 06 Settler Navigation image6.jpg
- Now, hold the Ctrl-key and right click in the other front corner. You should now have two green cubes. (If one of them turns a purple color, it means it was deselected, hold your Ctrl key and left-click to select it again)
- With the other two selected (highlighted green), Ctrl+Right-Click on the inside of your doorway (see image below). Another cube should appear, as well as a red triangle. Two of your cubes should be selected, and the other unselected. File:Toolkit Chapter 06 Settler Navigation image7.jpg
- Next, Ctrl+Right-Click in the opposite inside point of your doorway, to create another triangle. You should now have a nice rectangle.File:Toolkit Chapter 06 Settler Navigation image8.jpg
- Continue to follow this pattern around the inside of your building.File:Toolkit Chapter 06 Settler Navigation image9.jpg
Some important tips while working:
- The two green cubes will be connected to the next one you create to form a triangle, so be aware of which two are selected.
- NEVER create triangles overlapping each other, notice how the overlapping piece is bright red (see below). This will cause the NPC to get stuck!
- Instead, change the cubes you have selected so that triangles never cross over each other.
- Do not leave gaps in your NavMesh, the surface should have one continuous Navmesh.
- If you have a second floor, stairs can be a little tricky, they can just cover the entire stairs with two triangles, and when you get to the top, you could continue the upper floor without breaking the Navmesh. I will show you approximately how to do it with some images:
- Once you have your floor and stair surfaces NavMeshed. Click the NavMesh menu at the top and select Finalize Cell NavMeshes. Then close the NavMesh toolbar.
- Save your plugin.
The Navmesh can be difficult to test. It requires that your building is created, then you have to save and exit the game, and load back in before it is even recognized. With two story buildings, the NPCs will sometimes still struggle to navigate.
Hey what’s the big idea kinggath! I checked some of your model NavMeshes and you didn’t follow your own rules! During development, I became convinced that NavMeshes did not work on code created objects. I tested everything I could think of to make them work (you’ll notice some of my model NavMeshes have long “toungues” sticking out the front doors).
It was only when Transfer Settlements was released, that I brought up the issue with cdante (the MA). He was shocked to learn I was correct! He began testing fervantly and finally discovered that exiting the game and coming back in allows the Navmesh to start working again. So props to him for figuring that out!
So my answer is- I just haven’t gotten to it yet. In a future patch, I will correctly follow my own advice and fix the navmesh in all of the Sim Settlement models.
You’re Done!
Your Settlers should now navigate your building with ease (well as best as AI can). If you made it through all of the tutorials, your building is feature complete and ready for release!
The first few will take you a long time, but after a while they become very easy, especially if you sketch some ideas out in advance. I can usually put together a full model with all of the steps in an evening as long as I know what I want it to look like. I find the part that takes the longest is learning what all the different statics look like in the game so you know what to filter for!