Feb 19

Tile Based Map Generation with SabreCSG

Now that i’m finished with my metaballs implementation I’ve started working on creating map assets and building out test levels for my game. Since I’m creating this myself I tried to find a tool or asset pack that could help me speed up the creation of the tile assets for the map.

To keep things easy and reusable I decided the level design would be a 3D tile based.

So I needed to find something that could:

  • Create tile based models
  • Do per face texturing
  • Create reusable components
  • Easy to learn
  • Free – if possible

 

A brush based tool like Valves Hammer from the Source Engine seems like an easy way to build out a map. I had seen ProBuilder and ProBuilder free, but I didn’t really want to be tied to a free package that might be missing features I need down the line and force me to purchase the full version.

I found SabreCSG, a brush based asset that is completely free, I didn’t get around to even testing ProBuilder free because Sabre seems to do the job for me.

 

Tile Models

The creation of models was pretty easy with SabreCSG, my only issue I had was with some of the weird rotations the system puts on brushes when you extrude or split them, which caused issues with my procedural generation.

Once I figured out a scale that would fit the player on one tile I started building out some prototype blocks that I will be using in my maps.

tile models

 

Map Generation

As great as tools like probuilder and SabreCSG are for building models quickly, I wanted to have some rapid prototyping of levels. The easiest way I could implement this was to create a prefab out of each of the models I created above, then use Excel to layout my map by specifying which ID should be used in each cell, along with its Y axis Euler rotation, then iterate through the CSV file and spawn the prefabs in the correct locations.

Using the Unity resources folder, I put all my prefab models in a folder called Tiles and ensured I labeled my tiles with IDs so when the resource folder was loaded into an array, all of my tiles would be in the correct position in the array.

 

prefabs

The excel file just contains the ID and the Y axis Rotation in a cell, separated by a space.

csv grid

 

The magic happens in an Editor script I wrote which reads the CSV file and spawns the prefabs. It is attached to the CSGModel gameobject so the prefabs are spawned under it and become brushes. The only thing the script doesn’t do yet is clear out any existing prefabs, so if you want to make big changes, its easy enough to delete everything under the CSGModel object and generate the map again.

To call the above functions, I made an Editor script to run them from the Editor. If you haven’t created any Editor scripts yet, you should! They’re so helpful and speed things up.

 

MapGen Editor

 

Now I can generate some test levels quickly!

Test Level

 

Feb 07

Metaballs in Unity


I’ve recently been getting into Unity to see if I could make a little basic game. My first idea has taken me down the road of procedurally generating meshes for objects in Unity . One method of doing this is creating an Isosurface using various algorithms. In my case I was trying to create Metaballs.

Metaballs are points in space, which exert a “force” which decreases the further you get away from it. Where this “force” hits 0 is where the surface is drawn.
When multiple metaballs are close to each other, the force they exert on a point will be greater than a single metaball alone. And so it appears the surface of the metaballs grow towards each other like in the demo above.

Marching cubes

An algorithm used to draw the mesh is Marching cubes. After initially looking at the example script from Unity3d community I thought I was a bit out of my depth, but I soon got it working and was creating blobby objects.

There is plenty of material online regarding how marching cubes work and how you create a isosurface from a series of points within a 3D grid. Paul Bourke’s article helped immensely.

The performance impact increases vastly as the number of metaballs increase, as it requires traversing the full 3D grid each time to see if it was in range of the metaballs radius.

Reducing grid computation

One way to increase performance was to decrease the number of points that needed to be computed to find where the metaballs surface should be. A simple implementation will iterate through the full grid.

However, we compute which of the 8 vertices of the voxel the metaball surface should intersect as per Marching Cubes. Using some fancy lookup tables we can then choose a direction to compute next based on which vertices were intersected.
Effectively this allows us to only compute the voxels which contains the surface of the metaball. Rather than all of the other voxels which are empty 90% of the time!

Surface Nets

In the past few months I tried to build in an alternative meshing method which uses Naive Surface Nets rather than the traditional meshing done by Marching Cubes. I managed to get it working, based on the work in Mikola Lysenko’s blog. This meant I could march across the same points, but generate fewer vertices and faces for the mesh, hopefully increasing performance.
I also encountered some weird bugs during my learning like the below.

 

Metaballs!

Finally I have managed to optimise my metaballs algorithm to create a decent amount of metaballs and generate a mesh at a good resolution that it doesn’t look too blocky.
There are much faster ways to do what I have done using the GPU through a compute shader. However since I am targeting android with my little game, I need to do it on CPU until our mobile GPUs catch up with desktops.

Jun 05

Offspring Fling! – Backlog #3

Offspring Fling - Complete

A fun little platfomer, with arts reminiscent of Kirby

This challenge is getting tougher, i’m getting through a lot of the shorter games and have moved onto larger RPG’s and open world games which will take a bit longer to complete.

Offspring fling is a game where you control a mother bird, who is trying to save her offspring. How does she save them?  Well she flings them across levels into a door where they vanish into who knows where.

Offspring Fling - Mother

 

Offspring’s art style is cute, simple and reminds me of the older Kirby games. The levels themselves start very basic, introducing you to the puzzle concepts the game will soon throw at you. It was a quick game to complete, but gives itself replayability by challenging you to complete the levels in super short timescales, surpassing even “gold” challenges with  “developer” speed ones.

 

Offspring Fling - Level

Flinging your kids is bad, people!

The only major annoyance I had with Offspring Fling was the controls, the DPAD and the Analogue sticks had inverted Y axis controls from each other. Sometimes when I switched between the two control methods it threw me off because instead of putting down the offspring, I would throw them right into a poisonous flower!
Until next time, check out the next game on the backlog challenge; NightSky

 

May 28

Unturned – Easier Heightmap method!

You may have seen our previous guide on how to get a heightmap for a map in Unturned, a free to play open world zombie survival game, with a built in map maker utility.

This guide will show you an easy, quick way to get a realistic looking map.

 

Tools Required

Your going to need a couple of programs to get this working.

 

Getting the map data

  1. Go onto Terrain.party
  2. Drag the blue marker to the area you wish to get a heightmap for.
  3. In this example we have chosen The Mull of Kintyre and the Isle of Arran. You can use the controls on the right of the website to make the area of selection larger.Mull
  4. Click the export button on the right and name your download.
    save
  5. Now extract the zip file you downloaded from the site. There will be several files in the directory. You will want to use the (Merged) version.

Congratulations you have your heightmap data!

Adding the heightmap to unturned.

In this section we will generate our map with our heightmap image.

From the last section we have our heightmap file, this image may be too large for the map size we want, we need to resize it to fit the Unturned map sizes.

The image we saved from terrain.party was 1081 x 1081 pixels.
We either need to resize it to one of the below sizes, which would squash it/stretch it.
Or only use a section of the heightmap image.

This below table shows the resolution you need for each map size.

 

HeightMap Resolution Map Size
513×513 Large
257×257 Medium
129×129 Small

I will resize / crop the heightmap to fit a Large map.

  1. In Photoshop / GIMP / Paint.net create a new image 513×513 (or your desired map size resolution)
  2. Add in your heightmap image. In photoshop, I opened the image then selected the entire image (ctrl+A) and then pasted it as a new layer into into the 513×513 project. this is so we can keep the full resolution of our original image.Uncropped
  3. You can now either stretch or shrink the image to fit the specified resolution. Or you can keep it the same resolution and crop it to fit the 513×513 image size. In this example I stretched it to fit the resolution.island
  4. Flip the image horizontally as Unturned flips it for some reason. Then save the image as heightmap.png
  5. Open up Unturned in Steam.
  6. Go to the WorkShop > Editor
  7. Create a map of the size fitting your heightmaps resolution. In my case, Large.map
  8. After clicking Add, minimize Unturned.
  9. Open up the Unturned folder in your Steam/Steamapps/common folder
  10. Open the maps folder
  11. Open the Folder with the name of the map you just created, in my case MullofKintyre
  12. Open the terrain folder
  13. Delete the Heights.dat file if it exists.
  14. Copy your Heightmap.png file into the terrain folder.
  15. Go back to Unturned. Click on your map and click edit.
  16. The map will be black, so hit terrain > materials > then in the bottom right Bake Global.

 

Enjoy your map!

mullofkintyre

May 28

Unturned – Creating a heightmap from real world locations

Unturned is an free to play open world zombie survival game, with a built in map maker utility.

Right now the game has no ability to automatically import real world location data into its maps.

This guide will show you how to use real world heightmap data to create a realistic looking map.

 

Tools Required

Your going to need a couple of programs to get this working.

 

Getting the map data

  1. Download Google Earth
  2. Open Google Earth and find a nice place that you wish to use to create your map.
    In my example I have chosen the Faroe Islands in Scotland
  3. From the top toolbar, select a placemarker and place it on the area you want to use.
    The properties panel for it will open up and give you the longitude and latitude of the location, For me it is Latitude: 61°54’26.74″N Longitude: 6°49’11.20″WGoogle Earth - Faroe Islands
  4. Now go to http://dds.cr.usgs.gov/srtm/version2_1/SRTM3 or http://viewfinderpanoramas.org/dem3.html, but we will focus on the former. These sites contain global heightmap data.
  5. Select the region your location is in. In my example it would be EurasiaSRTM3
  6. The site will give you a list of files for each North/South, East/West coordinate.SRTM3 - 2
  7. Now since in my example the coordinates were Latitude: 61°54‘26.74″N Longitude: 6°49‘11.20″W,  round them up, you get N62 W7
  8. On the site with the heightmap data, search for your coordinates. For me it will be N62E007.hgt.zip. Now unfortunately it wasn’t on the first website, but I found the heightmap for the Faroe Islands on http://viewfinderpanoramas.org/dem3.html
  9. Download the zip file and extract it somewhere easy to get to, my downloads, desktop etc.  You should have a .hgt file ready for use!HGT Files

Congratulations you have your heightmap data!

Making the heightmap data usable

 

Unturned requires a heightmap image, not raw data, this section will show you how to get the heightmap image you need for your awesome map!

 

  1. Create a folder on your desktop or somewhere for you to work.
  2. Download and install MicroDEM for opening the raw heightmap data.
  3. Open MicroDEM from your start menu. When it starts it will ask you to open a project, click close.
  4. It will then ask to update several things, click yes to everything as it comes up.MicroDEM update
  5. Once the program is updated, at the top right, click the second icon from the left, then browse to your HGT file from earlier and open it.DEM Open Browse
  6. If you have multiple heightmap files and want to merge them together, go to File > Open > Open and Merge DEMs, then select the multiple hgt files.
  7. You should now have a nice heightmap image!Faroe Map
  8. If you want to confirm you got the right area, right click the image and go to Export > Quick Map to Google Earth. It will overlay your heightmap image on Google Earth, so you can confirm you got the right area!Overlay
  9. Back in MicroDEM. We need to make sure the depth is correct for the heightmap.
  10. Right click your image, select Display Parameter then Elevation
  11. What we do here is set the range of colours so we get nice smooth transitions and set our sea level correctly. Select Gray Scale (monochrome)elevation
  12. The “Missing” colour block, which is black, is our sea level colour, Black = Deep, White = High.
    If your map shouldn’t have any sea in it, and there is some black parts on your heightmap, this is missing data. You should change your Missing colour block to a grey closer to the shade around the missing area, so you don’t have sudden oceans or rivers where there should be none.
  13. Click t he z Range button
  14. The “z Range” defines the range of heights that will map to our grayscale, 0-255 values.
    The Max and Min values are the range of heights picked up from the heightmap data. So in my example since 2593 is the highest elevation, that is the max for the z range. These areas will be bright white. Min is the lowest elevation in the heightmap, as such they will be black.
    Any “missing” data will be black as well as I have said previously.You can change these values to make a height map overall more flat, or steep. Simply raise or lower the Max value. Raising it say, to 4000, will put the range from 853 to 4000, meaning our actual highest elevation in the heightmap of 2593, will be just about halfway on the z range, so it will be a grey colour rather than white. Effectively flattening the map. Lowing the Max value will have the opposite effect.In my example I left the values default.
  15. Click OK to close the z Range and Elevation Window. Your image should now be a nice grayscaled heightmap.
  16. Click File > Save image > name your file > Save Type as PNG > Click Save.Heightmap
  17. You can now Close MicroDEM.

Adding the heightmap to unturned.

In this section we will generate our map with our heightmap image.

From the last section we have our heightmap.png file, this image may be too large for the map size we want, we need to resize it to fit the Unturned map sizes.

The image we saved from MicroDEM was 389 x 830 pixels.
We either need to resize it to one of the below sizes, which would squash it/stretch it.
Or only use a section of the heightmap image.

This below table shows the resolution you need for each map size.

 

HeightMap Resolution Map Size
513×513 Large
257×257 Medium
129×129 Small

I will resize / crop the heightmap to fit a Medium map.

  1. In Photoshop / GIMP / Paint.net create a new image 513×513 (or your desired map size resolution)
  2. Add in your heightmap image. In photoshop, I opened the image then selected the entire image (ctrl+A) and then pasted it as a new layer into into the 513×513 project. this is so we can keep the full resolution of our original image.Non cropped
  3. You can now either stretch or shrink the image to fit the specified resolution. Or you can keep it the same resolution and crop it to fit the 513×513 image size. In this example I stretched it to fit the resolution.stretched
  4. Flip the image horizontally as Unturned flips it for some reason. Then save the image as heightmap.png
  5. Open up Unturned in Steam.
  6. Go to the WorkShop > Editor
  7. Create a map of the size fitting your heightmaps resolution. In my case, Large.
  8. After clicking Add, minimize Unturned.
  9. Open up the Unturned folder in your Steam/Steamapps/common folder
  10. Open the maps folder
  11. Open the Folder with the name of the map you just created, in my case Faroe Islands
  12. Open the terrain folder
  13. Delete the Heights.dat file if it exists.
  14. Copy your Heightmap.png file into the terrain folder.
  15. Go back to Unturnned. Click on your map and click edit.
  16. The map will be black, so hit terrain > materials > then in the bottom right Bake Global.map

May 28

NightSky Backlog – #4

 

Nightsky - 1

A relaxing, beautiful looking game with impressive level design

Starting this challenge was a great idea, I’ve played a few games now that I wouldn’t have glanced at before because I’ve been too busy playing the latest open world survival or AAA title. It’s fun!

NightSky is a simple platform game where you roll about as a ball, trying to get to the end of the level. Easy right?

It starts of simple, bouncing over a bumpy floor, flying off to the side of the screen, but progressively gets more technical and introduces physics challenges which are always fun to beat.

Nightsky - 2

Mechanical rolling flipper carts!

The level design is great, it takes advantage of the physics of being a rolling ball and throws you in mechanised vehicles, forcing you to rethink how you are controlling the character. It ends up as being a challenging, peaceful little puzzle game.

Nightsky - 3

The art style is lovely too, the contrasting colours doesn’t take anything away from how good it looks; very crisp and edgy, which build directly into the level design, giving you a seamless world for you to roll around in. The music

May 24

SkyDrift – Backlog #2

SkyDrift - Complete

SkyDrift – It’s like pod racing, except your a plane.

 

The second game of the backlog challenge is complete. SkyDrift is an action racer where you fly planes of various different stats and race around a course, picking up power ups to destroy your competitors and fly your way to first place.

SkyDrift looks to be quite a polished casual racer, the graphics look nice, the effects work great to give you a real sense of speed and the controls work fluidly as you slice in between two cliff faces to pick up a power up. But it’s not without its shortcomings; there is only about 4-5 different race tracks, along with 3 modes, a sprint race with  power up rings which increase your speed. A normal race with power ups and a survival race where the person in last place is destroyed every 30 seconds or so. SkyDrift - Podracing!

Despite all this, SkyDrift was pretty fun, though I did get bored of the same map over and over again during the campaign, that may be the fault of completing the game in the one sitting.

Onward to the next game in the challenge!

SkyDrift - Heated

May 19

VVVVVV – Backlog #1

VVVVVV – My first backlog game complete!

VVVVVV Complete

One down a bazillion to go!

Did I pick a first game to tackle or what? VVVVVV is one of those Nintendo-hard games that somehow makes you relive the same death over and over again until finally, though luck or good timing, you dodge some spikes and combo-flip yourself to victory!

I went into VVVVVV not knowing what to expect to be honest. I think I picked it up in a humble bundle somewhere.. and it has been sitting in my library for who knows how long. As part of the backlog challenge I picked a short looking game for the evening, installed it and dove in.

The story revolves around a crew being teleported into some strange dimension and scattered across the map, your job as captain is to flip gravity and fall to their rescue. One of the biggest positives about it was the sound track! The music throughout the game keeps you going makes you feel epic when your flipping over spikes and lasers to save your buddies. The game is so simple to control, Analogue to move, A to flip gravity and cause the Captain to fall up or down in order to traverse the weird dimension and survive the traps setup to slow you down.

Checkpoint, flip, die, checkpoint, flip, die..

I admit I got frustrated at some points where the level was beating me, its easy to pick up but oh man can be difficult, as can be seen by my 776 deaths above.

Looking at the Steam reviews most people recommend you stay calm and don’t get too agitated or it will just get worse. Good timings and hand eye coordination are a must to keep the pace up on this fun little game.

VVVVVV - Start

What do you think about VVVVVV? Leave a comment below!

Let me know what game I should play next in my backlog!

 

May 18

Steam Backlog Challenge

Steam BackLog
A backlog of Steam games; an ultimate first world problem.

I’ve attempted to break my steam backlog a few times now. Unfortunately it ends up breaking me and I go back to whatever recently multiplayer purchase me and my friends are currently on.

Too much time is spent trying to rank up in online games and compete in the repetitive cycle of Minecraft or Rust. I feel like I’m missing out on some great games I picked up in sales that I’ve never got round to even booting up. Things like Mass Effect or Dead Space, even the whole Bioshock series have gone unplayed in the vast backlog of steam games.

This time though, I tell myself it will be different! With my current count showing around 200 games which still need to be completed and with some motivation, I will be push through and experience all of these wonderful works of art!

Categories

The Challenge

 

With the help of howlongtobeat.com and some rapid gaming, I aim to get through a good number of the games on my list. With each completion I will review the game with my overall feelings and key take-aways from the game.

Some games will be easy, only requiring a few hours to complete the main story.  Others however, will take much longer, beasts like Dragon Age and The Witcher series will certainly take me a lot longer.

The main thing is to not constantly add the backlog. I’ve backed away from some of the recent humble bundle deals, realising I never get round to playing them. My most recent purchase was The Talos Principle DLC: Road To Gehenna, which has been a fantastic challenge so far.  I’ve made a point to complete games I immediate buy, but then I always go back to the tried and true multiplayer games.

Lets see how it goes! Look forward to posts and reviews about AAA games that have been around for years and obscure indie games picked up from sales all-round.

 

May 07

Come join our new servers!

Saor-Gaming Servers

Hello everyone!

Our server is now in the data centre. I’ve been working hard setting up some of the most popular games for us to  play on.

Everything appears to be working fine 🙂

We have dedicated hardware at our disposal to set up new game servers and add resources to our current ones if needed.

Some of the servers are up and running, however others, though playable, some still need some configuration, like Gmod, L4D2 and Minecraft.

Otherwise, Rust, Space Engineers and TF2 are more or less ready to go!

We also have a 32 slot teamspeak server, but as time progresses we may upgrade and request a community license to increase it up to 512 slots.

Check them out!

Garrysmod 20 slot build server
185.141.204.242:27015

TeamFortress 2 Classic Map Cycle
185.141.204.242:27016

Left 4 Dead 2
185.141.204.242:27017

Minecraft 50 slot Survival
185.141.204.242:25565

Rust 100 slot Survival
185.141.204.242:28015

Space engineers
185.141.204.242:27026

Teamspeak
185.141.204.242:9987

Older posts «