visionvortex.de

Since I didn't start this devblog from day one... shame to me... I've got to get you up to speed. So let's drop some information regarding the UI-Controller and Walkers. The UIController is a component that basically allows you to construct a procedural map setup in the Unity3D ui and save it as a prefab. I attached mine to an instance of  a 2D ToolKit tilemap from Unikron Software. An interface controller pushes the map values to the tilemap for better visualization. But you can really attach the PMap Controller to any GameObject. PMap creates the data for you. Nothing more, nothing less. What you do with this data is entirely in your hands.

But now let's take a look on the process. For the purpose of this article I'll use a Walker that was modeled after the common Game of Life Rules. What it basically does, is creating cave like structures by filling the map with values of solid (1) or empty (0) randomly and then iterating with a set of rules. Ok, let's add the Walker to the chain. PMap features a intricate system where you have UIControllers that don't really do anything by themselves. The real magic happens inside of the walker class, which is just a regular c# class. No MonoBehaviour, no ScriptableObject. I'll go through how this process works internally at a later time. But for now, all you have to do is add a new UIController Component to the Component Chain.

 

Add a GOLCaverUIController

 Above you can see a GOLCaverUIController with the default settings. The Scene view shows what cave will be built. Wait, that's not a cave. That's a mess! Right. The GOLCaver walks iteratively. Its Iteration property is set to 0. So what you are seeing is the pre-fill of the map. each field is randomly filled according to the Random Fill Probability. By the way. There are some other Walkers attached, but those are deactivated at the moment. I was just too lazy to destroy the complete setup! Lets increase Iterations...

Increase iterations on the GOLCaver...

Now this is starting to look like something! By the way, all this is done using the same random seed, which is placed in the PMap Controller. So all this is perfectly repeatable. After iteration 3 nothing spectacular will happen. Most setups come to a good conclusion after 3 or 4 iterations. What you notice is, that there are some disconnected caves. You don't want this. Most of the time. This is where the White Strip Size properties come into play. Setting this will simply exclude a few lines in the center in X or Y direction from being pre-filled. The result is, less disconnected islands and generally a more open cave.

Setting the White Strip Size

This is already looking better. But not perfect. That's where the power of modular comes into play. You could start building a special targeted GOLCaver that fixes all of those islands etc. or you could simply add another walker after the GOLCaver. This one's called ConnectivityCarver and it connects everything.

Connect my map!

That's it for this entry. I hope you got a basic idea of how things work with PMap. Any comments are totally welcome! CU! Bye!

Back to Top

(c) visionvortex.de 2017