Sets the width of the walls to 2 map units PENTREC FindSheet(std::string sheetName, bool create)
Helper function for finding a sheet by name I opted to modify my FindSheet() utility function so it also can create the sheet if necessary and requested. If it exists, use it, if not, create a new one. So, what I opted to do is to figure out if the drawing contained a sheet called FLOORS or not. For some tools, that may be fine, but for this to work properly and be able to merge as it should, we really need it to go to predefined sheets, this is also important for making the tools work with the standard dungeon tools. In practice, this means it ends up on whatever sheet is the current sheet. When we feed DLApnd() NULL as the first argument, it adds the entity (the second argument) to the main drawing list. This will help us now.īack in last installment, in the DDDrawPoly() function, we built the polygon the user drew, and then added it to the drawing by calling DLApnd(NULL, p). I used this because we only scanned the FLOORS sheet for entities to merge with. Last time, I did make a utility function to find the entity for any sheet by name. This means the floors needs to go on the FLOORS sheet and BACKGROUND (FLOOR 1) layer, while the walls go to the WALLS sheet and layer. By default, the DD3 dungeon tools use a set of predefined sheets/layers, so I will use the same ones for my project here. Sheets and LayersĪn obvious criteria for well-behaved entities is that they go to the right sheet and layer.
#DYNAMIC DUNGEONS CODE#
You’ll find the download link for my complete code at the end of the article.
#DYNAMIC DUNGEONS FULL#
Since we are editing existing code, this means it will be a bit more code snippets this time, as opposed to full functions. I assume you are familiar with my code from the previous installment, so I won’t repeat everything here. When we finish up today, we will still have some of the limitations, but we should be a bit further along the desired path. Today, we’ll be working on adding some more functionality, and working on making everything a little more well-behaved.
Our solution had some limitation, like the inability to make a structure that had a hole in the middle, and it was overall just a proof of concept. So, when we finished up last time, we had a working solution that allowed us to draw the floor by drawing multiple individual partly overlapping polygons, and our code automatically joined these into a single polygon. To be able to follow this article series, you should have read my earlier articles in the series. At the end of the video, you’ll also see that I show the classic dungeon tools correctly interacting with my entities. In this issue, I will continue on with that project, and add some improvements to it, such as taking care that our entities are placed on the right sheets, meaning we will need to dive into sublists, and I will also automatically generate walls to go along with our floors.Īs last time, I prepared a short video to show the tools in action.
#DYNAMIC DUNGEONS HOW TO#
Last time in the developer series I started our Dynamic Dungeons project with the intention to showcase how to make some simple tools for a more fluid dungeon editing experience. Remy Monsen | Decem| CC3 Plus, XP Development