Archive for the ‘Fringe Planet’ Category

Hi folks, I’m fairly busy with Fringe Planet – the game is coming along really nicely 🙂 I’ve got a bunch of really interesting ideas for the green slime games blog, but currently all my blogging is going on at the Fringe Planet development blog! Here are a couple of useful links:

I’ve had few questions about how I store 3d shapes inside a 2d texture. Or in other words, how do I turn this :

Into this:

Let me preface this by saying that all structures are contained in a 32x32x32 voxel cube – I’ll explain the reason for this later.

So where do we start? Let’s look at a graphics file. My method of storing data uses a PNG file, and the reason for this is simple – every pixel has four channels associated with it. A red, green, blue and alpha channel. Each of these channels can contain a value from 0 to 255. Depending on these numbers, the pixel will be a different colour (or transparency). So that is already a fair chunk of data that can be held in single pixel – but how can we use these pixels to actually store 2d data?

Well, it is easy to imagine how to store 2d data in a picture :

Now one solution to this problem would be to have slices of 3d data, each one over laid onto the other. And this would look something like this :

However, I didn’t want to use that approach – it works, but seems clunky to me. So I decided to go in a different direction. There are four whole channels per pixel to play around with, so it seems like a sub-optimal solution not to use them all.

So, a tiny bit of maths. Let’s look at the number 255 in binary:

11111111

Well, that was exciting 🙂

Let us imagine the lightest pixel in the universe, where all the channels are set to 255 – pure blinding white with no transparency, it would look like this:

r(255) , g(255), b(255), a(255)

Now if we translate this into binary (and this is the most important part) we get the following:

11111111 11111111 11111111 11111111

Now lets imagine the most pathetic of all pixels, where all the channels are set to 0

r(0), g(0), b(0), a(0)

And if we convert that to binary, unsurprisingly we get four sets of zeros:

Now wait a second! what if we represented empty space as a 0 and a voxel as a 1? Suddenly, BOOM, you have a data structure that can hold what voxels are occupied in a row. And this is in one pixel – so if a I have a 2D set of different colours that represent different rows of voxels, I have 3d data in a 2d image! This is why I take things in a 32x32x32 cube – everything meshes together to make a nice optimal solution!

Now this is not an old trick ( the BBC used a similar idea to hold level data in hex values – I wrote about it here many years ago ). But it does mean that you can store 3d data in a png file. There are a couple of additional things that I do. Firstly you will see that though the width of the file is a sensible number, the height is 33. This is because I use the last row (or the first row depending on your conventions – I don’t judge!) to hold material data. The very first pixel on this row is the index I use to represent an empty voxel, and the first mini image is used as a checksum – it is the empty space in and around the 32x32x32 cube. If I find any of the subsequent images trying to write in that area, I know something has gone horribly horribly wrong. The second and other pixels in that row are used to indicate what material the voxel I’m placing in each one should be (earth, copper, lavarite etc; ). Once I’ve gone through this row, I know how many images I’m going to need to process, and perform a quick check sum to make sure that I have the same number of mini images as I do last row pixels.

And that, my friends, is how you can store 3d information in a 2d picture 🙂

A quick confession however – the image at the top of this blog post actually has the alpha channel removed – because otherwise when your browser tries to display it, it will look like this :

But assuming wordpress hasn’t done anything to garble the image – you should be able to download it, open it up in a graphics editor of your choice and see the invisible pixels 🙂

If you have any questions or comments feel free to use the box below, or hit me up on twitter. Hope you have a fantastic day!

So obligatory: it’s been a while since I’ve posted/spammed the interwebs with my random musings. Life sometimes gets a tiny bit crazy. However, I’m back now with a small update with what is new with my life.

At the end of last year, I lost my job (boo! hisss!) – and after the initial shock it suddenly occurred to me – I was in a financial position that would allow me to focus on my real passion, game development (yay!). I sat down in a dark, candle lit room and started drafting down ideas: gameplay concepts, themes, badly drawn stick figures doing things to each with weapons of mass destruction. That kind of thing.

And from those scribbles an idea started to solidify. I’ve always loved simulation games, a hobby that started many, many moons ago with SimEarth. Since then, I’ve played a lot of them: RimWorld, Dwarf Fortress and Prison Architect, to name a few. I dread to think how much time I’ve spent commanding virtual people to build/slaughter things [edit: I just checked my steam stats for RimWorld and Prison Architect and can confirm I’ve spent *way* too long playing both]. There is something supremely satisfying watching your people work with blue prints you create in order to build something magnificent. Seeing how they interact with each other, watching behaviours and friendships form. Poking one place in a simulated world and watching something happen. Slowly, but surely, FringePlanet started to take shape.

Fringe Planet is a simulator game. It’s set in a universe where both science and magic co-exist. It’s heavily voxel inspired. It has quite the grand road plan (which will be appearing on it’s homepage: http://fringeplanetgame.com). It’s aimed at the single player PC market place (via steam) but a Mac/Linux version is fairly high on the priority list as well.

It has been under development for about three months now, and I’ve got to the point where it has actually started to look and feel like a game. That re-assuring feeling you get when you’ve taken an idea, written a bunch of code, and got it into a playable state and a little voice in your head actually says “wait, this is actually really fun”.

So, I then took the next big step, and formed my own company. I’m a director of a company now – it’s a bit weird thinking about the reality of that. I even had to record the official minutes of the meeting where the company was formed. Attendance of which consisted of the Director of the company (me), the shareholder of the company (me), the secretary of the company (me) and the company mascots (my cats – though they were busy playing at the time so may not have been paying that much attention).

I’ve applied for funding from various sources, and will be blogging about that process in the future – alas, my funds are not infinite and the earliest realistic release date for FringePlanet will be early next year (though I am planning to run a private alpha before that).

I’ve got into a regular schedule of development work: Mondays are “code clean up” days – refactoring code, documenting things, cleaning up any debug code, fixing any bugs that occur during the daily play through. Wednesdays are “idea” days – fleshing out game mechanics, working on specific implementations. Saturdays are “eye candy” days – making things look prettier, creating textures/models etc;. Every night after I finish work I create a daily build of the game. I’m using a raspberry pi powered GitLab for version control (it’s even got a speaker attached to it and it plays a fanfare whenever I push). Working on Fringe Planet has very much become my life.

I’ll be blogging about both the game and the journey, and of course, spamming twitter randomly about it – GreenSlimeGames.com will be my personal blog about the journey, professional type blog posts/news about the game will be on FringePlanetGame.com.

This is all a very definitely scary process – biting the bullet and making game development my full time job – but it is the most satisfied I’ve felt in my life.