Showing posts with label Level Creation. Show all posts
Showing posts with label Level Creation. Show all posts

Friday, October 16, 2015

Update 45: Rebuilding random levels

Using the new resources I have, I've rebuilt the level generator, generating diorama levels with a wooden border again. I was pleasantly surprised how well the level generation code looked and worked, after not looking at this code for a year. Here are a few screenshots showing the progress. At this point I only have 5 variations of tiles, so there is a lot of repetition, but it's easy to add more tiles. Here are some screenshots: 








Next is path-finding!

Monday, January 27, 2014

Update 29: Random Levels - Part 3

With the theory done and a solid prototype, it was time to implement the more advanced level creation into the main engine. I started by implementing the 6 tiles I needed, a vertical, horizontal, and the 4 turn pieces. I considered refactoring the pieces so that there were just two tiles and then rotate them to fit, but I realized it would be better to create the extra variation. Here is a screenshot all 12 tiles available now:



I moved my prototype code over to the main engine, replaced a few lines of code that were specific to the console app and generated my first dynamic level with a river.



With that working, I brought in the rest of the tiles (the previous screenshot was just river and a blank tile). The following two screenshots show two random maps with more of the pieces.





I can't begin to explain what a giant leap forward this is for me.

Sunday, January 26, 2014

Update 28: Random Levels - Part 2

Happy with my new random levels, I quickly discovered that some of my map combinations didn't make much sense, especially when rivers or roads were involved. In the sample below, you can see two river tiles are connected with a tile with no river - it just doesn't look right.



To make better maps, I needed to a river/road to start on one edge and finish on the opposite edge. I started a prototype to solve the problem, migrating over a few level data structures from my game - fortunately my design and structures were generic enough to allow this. My initial plan was to take my level area, draw a continuous river/road across the level, and then fill in the blank tiles with random tiles. To work through this, I created a simple console application to output ASCII, using these tiles as samples:

╔0══╗╔1|═╗╔2══╗╔3|═╗╔4|═╗╔5══╗╔6══╗
║   ║║ | ║─────║ └────┘ ║──┐ ║║ ┌──
╚═══╝╚═|═╝╚═══╝╚═══╝╚═══╝╚═|═╝╚═|═╝

With the templates in place, I started work on the tiles. The first level, running my current level creation algorithm, looked like this, again highlighting how ridiculous this all looks:



Next, I went to work drawing the river first, and then filling in the remaining tiles. This wasn't too difficult, starting with a simple (3x3 level): 



...and scaled nicely, getting more complex quickly (8x8 level):



Finally, I adjusted the path-finding of the river, so that it wouldn't drop back on itself. Essentially, if I start from the left, let my river go up, down and right, but never backwards (left). The output looks like this:



This is exactly the result I was looking for. Additionally, it scales up easily, I ran some 100x100 samples in less than a second.  The next phase is to recreate these tiles in my game, the next post will be about this process. If you'd like to play with the prototype, I've posted the level creation tool online here.

Saturday, January 11, 2014

Update 27: Random Levels - Part 1

After scaling up my levels and populating them with the new assets, I went to work creating randomized levels. The original xcom had 10x10 tiles that were randomly added to a level to create a 100x100 sized level. This worked very well to create a new experience in every level, even though the buildings were often recognizable.



I've only created four 10x10 tiles so far, but I've made them all prefabs. In the screenshots below, you can see two of the prefabs highlighted. Note that this is only a 20x20 level, with only 4 tiles of 10x10 each. 




Now when I load a level I am able to randomly choose, arrange and rotate these tiles to create a random level. This is a huge step forward for my project. By creating 10x10 prefabs with content in the center, I can really create some interesting levels. Here are a few more samples:




This last sample is a 30x30 sample (9 tiles total) from a five tile set (one of the tiles is blank):

Friday, January 18, 2013

Update 5: Starting the Engine Prototype

With a basic plan, and some knowledge of the Unity Development Engine courtesy of some online training programs, a few books (see references at the bottom of the post) and some videos, I'm ready to start the engine prototype. The goal of this prototype is to have a basic turn based game. No fancy effects, just a 3D map, with player and enemy objects that can move and shoot each other.

With this is mind, I created a short work plan with a list of tasks that would have me building the prototype in a few months. I know that much of what I will be developing will be brand new and slow. Shooting, moving, path finding, object selection, map building: it's all going to be a new adventure. 


So far, I've been able to replicate the same basic prototype level I created in Google Sketch-up and added a camera to examine the level. I wasn't 100% happy with the result, but I also had to look back at it and say “it’s OK, lets look at this more later”. It just seemed to me that I started with this powerful graphics engine and made things look so… BUDGET, by making it into an isometric view. I can see myself definitely going back to a Perspective view soon.

But lets look at the positives. I created a level. I added a camera that could scroll and move. I then downloaded a free model that had WASD movement (with keys) built in. It even shoots... It was progress. Next I'm going to add some enemies and some basic shooting.