Space Miner Automatic Planet Generation P1


I thought I would make a shot at automatic planet tile generation for Space Miner. This would save a lot of design time and open interesting opportunities in the future for automatic generation of random planets.

Generating a tilemap in LibGDX turns out to be quite easy, here is a small code snippet to help you get started:

TiledMap map = new TiledMap();
MapLayers layers = map.getLayers();

TiledMapTileLayer layer1 = new TiledMapTileLayer(100, 100, 16, 16);

//Create cells and use them to fill in the layer
Cell cell = new Cell();

Texture text = new Texture(“data/PlanetSurface/EarthTiles.pix.png”);
TextureRegion tr = new TextureRegion(text, 0, 0, 16, 16);
cell.setTile(new StaticTiledMapTile(tr));

layer1.setCell(0, 0, cell);

//Add more cells and setCell here


I have tested this code with one celltype pasted onto a 1000×1000 map on my cheapish android phone. The map was generated quite fast, and the fps was smooth.

Ok, so now we know how to generate a TiledMap without a pre-defined map file. How would we go about generating a whole planet?

What I will test is to divide the planet into x amount of areas based on the center of planet to surface angle.

Areas divided into degrees with 0 facing up:
1 = 337.5 to 22.5
A2 = 22.5 to 67.5
A3 = 67.5 to 112.5
A4 = 112.5 to 157.5
A5 = 157.5 to 202.5
A6 = 202.5 to 247.5
A7 = 247.5 to 292.5
A8 = 292.5 to 337.5

Each Area (A1 – A8) will have its own flat surface tiles. To build stuff like mountains, tiles from neighboring Areas will be used.

Possible Areas to use tiles from when generating the surface inside a specific area:
A1 => A7, A8, A1, A2, A3
A2 => A8, A1, A2, A3, A4
A3 => A1, A2, A3, A4, A5
A4 => A2, A3, A4, A5, A6
A5 => A3, A4, A5, A6, A7
A6 => A4, A5, A6, A7, A8
A7 => A5, A6, A7, A8, A1
A8 => A6, A7, A8, A1, A2

Adding more Areas would make the planet more smooth, but 8 is probably good as a starting point.

The start of generation will be to select a certain height from center at 0 degrees (middle of A1) and select the flat tile from A1 there. From there the automatic generation would place surface tiles moving clockwise until a full revolution is done. Care must be taken that the last tile will fit into the first one.

From the first tile, a random selection of the next tile will occur from the list of possible tiles to select. Depending on the height from centrum of the planet, increasing height tiles will be chosen with a higher/lower ratio than decreasing height tiles. This should generate planet surfaces with mountains and valleys.


Space Miner with round planets?

Well, I’ve finally started work on a larger Space Miner update, I have been putting this off for a little while.

Right now when entering the landing phase, what you are presented with is a flat map which repeats if the ship goes too far right or left. What I really want to add are circular maps which would be much more like real planets. You would be able to enter the landing phase with a movement perpendicular to the planet center, and basically be in a circular orbit.

By doing the landing phase like this, it is possible to enter a planet with a high perpendicular velocity and thereby have much more time to make a good landing and even to locate a good landing place. It will also become possible to zoom out to get a better overview of how high the ship is.

I will do some testing with the different sized tilemaps and see if very large maps can be run on Android phones. Ideally I would like to be able to have a large planet with a diameter of thousands of tiles minimum. I really want to have relative sizes between the planets, this would mean that the smallest planets are much, much smaller than the largest ones.

LibGDX ViewPorts and why you should love them

The LibGDX ViewPort is an extremely useful feature which I really really like. Basically it gives you a virtual screen with fixed width and height (800×600 for example). You tell the virtual screen to fit itself onto the real screen with different sets of rules. I tell my game Insane Tower Builders to stretch out onto the real screen.

The great thing with this is that you can design your UI on only one screen (the virtual one), and let LibGDX take care of fitting it onto all different sizes of mobile screens out there. Of course the end result might look a bit different on screens with different width / height ratios than the virtual one. If the virtual screen width / height ratio is chosen right, this should not be a big issue except for some edge cases.

Different virtual screens can be chosen depending on the real world screen size to mitigate edge case problems and give high resolution displays better graphics.

Space Miner update

Hi hello,

Well, Space Miner finally received some love tonight. Long overdue, but I really wanted to add the most critical features to Insane Tower Builders first.

Difficulty for the campaign mode has been added with the following choices: Easy, Normal, Hard, Hardcore

Difficulty modifies the following attributes in the game:
life supply used by crew
fuel consumption by rocket
Solid rocket price, thrust and burn length
Ship price, fuel tank size, cargo size and mass
rocket price and thrust

To keep things fair for people playing on high difficulty, Highscore will be divided by 10x for each difficulty level under Hardcore.

Hardcore is the “normal” difficulty as it has been since the release of the game. In Easy difficulty, the player should not have to think too hard on resource management to get to a planet.


Have fun!

Insane Tower Builders update

Insane Tower Builders just received an update, yay!

I have been seeing some increasing oscillations in large towers which make the whole tower wobbly. Bad thing is that they increase over time, almost makes it look like a wind is blowing on it. I am attempting to remove this by adding some linear and angular damping to each block in the tower. I might have to play around with the values a while to get it right.

I also added a new block, the Zed90x40. This is a tactical block which could be copied and tied together in interesting ways.

Zed90x40 zedexample




Added small angular and linear damping to reduce tower oscillations
Fixed graphical bug when logging in an existing user
Added new block: Zed90x40
Added About / Blog button to main menu
Added Rate button to main menu

Technology of choice

Back in early 2014 I was posed with a problem, what technologies should I lean on for creating games on mobile platforms?

After some searching I decided to go with the open source community driven LibGDX framework to take care of most things graphical/sound/input/IO for me. The really great thing with this framework is that I can compile my code into both a desktop and an android version (iOS, BlackBerry and HTML5 is also supported).

Basically I do much of my game testing and debugging directly on my desktop, while doing later tests on Android. I believe this to be a much faster way of prototyping than doing it directly on target.

I also needed something to help me out with online functionality, like leaderboards and user management. The choice there came to Shephertz, which is a very good framework for this purpose. This framework can also be used on multiple 

Armed with these two frameworks I could start doing some simple development, which in time grew to my first game Space Miner.

Blog about my life in general and my mobile game development in particular

Hello hi!

My first blog post, ever. It feels quite strange to talk to people who are not there, but I like new experiences so here goes nothing!

My name is Kim Lillås. I am 32 years old and live in Finland, it can get a bit cold here from time to time. I have a wife and two children, one seven year old daughter and one four year old son.

For as long as I can remember, I have been a gamer. When I was about five, my father bought this very simple handheld football game. Since that I have gone through a Commodore 64, Nintendo 8bit, Playstation 1, 2 and 3, Nintendo Wii and a large assortment of PCs. Gaming and programming was always a large part of what made computers interesting to me.

My story as a game programmer basically starts in January 2014, when I decided to try my hand at making mobile games on my free time. A few months ago I released “Space Miner” on Android, and about a week ago I released “Insane Tower Builders“, also on Android.

I have been thinking of a way to reach out to anyone who might be interested in knowing more about what I am doing, and the status of my projects. I think a blog is a good format for me, as I like to write while designing web pages is not one of my stronger sides.

So welcome, and I hope you will like it here!