However, our original version from last installment had a major flaw, it couldn’t recognize it’s own entities. For all practical purpose, our merged polygons behave just as a single large DD3 room. Since we now are using the correct ones here, it means that if we use the regular Dungeon Designer CORRIDOR command, the corridor can actually connect to our rooms, and even break the walls. We’ve already taken care of some of that, namely the sheets and layers. When making new entities like this, we want to make sure it plays nice with existing stuff.
This slows down drawing obviously, so if you can live // with the flat look until the next manual redraw than leave this out // but it does look much more impressive with this here. This is required if we want to see the effects applied to // our updated drawing.
Update the screen with the edited entity and the walls entity Abusing the pen thickness value to create an identifier so we can recognize // our own entities without affecting other entities on the sheet // Pen thickness is used when working with Plotters, and isn't used by modern CC3+ As when drawing the floor, we find the layer id for WALLS, and if it doesn't exist // we just create it, and then assign the ID to the ELayer property of our walls char* wallslayer = "WALLS" 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.
You’ll find the download link for my complete code at the end of the article.
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.
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