Rocking and Rollin’ K240 style

Header

And hello there! This is the second instalment of Space Mines K2013 aka “K240 and Space Mines plagiarism tour”.

In this part I’ll introduce you to the main parts of the game mechanic.  So let’s get stuck in…

Actually, wait a sec, before  we go on, I need to tell you that the majority of the graphics are ‘borrowed’ from an image search and therefore totally not mine. I did the menu’s etc. but actual graphics that look good are someone else’s, thanks, you know who you are. They’re used here as place markers and to put together a general feel, later i’ll do everything in Blender3D.

There are two main components at the  moment – building, and buying/selling.

Build menu

A building we will go,…

Starting the game

When you begin the game your base or HQ is set up for you.  Here you can access statistics on your population and a few other things, if I have the time to implement them.

Build Menu

This is where you find all the buildings you need in order to set up various aspects of your colony.  For instance, you might want to produce ore to sell and as a building material by setting up some mines. You’ll also need some accommodation for your employees to live in!

Big buildings

These are 2×2 squares in dimension. I was going to leave them out as I wasn’t sure how to handle them. Then I stumbled on the following article about K240 and how large buildings may have been implemented.

In a nutshell, big buildings in K240 are simply single  buildings copied over to adjacent squares.  A reference then points them back to the original building portion, or something like that.

The main issue I had was making sure the cursor resized to the large building when clicking on it, rather than treating it like a bunch of single square buildings.  The code goes something like this (it may not be pretty, but it works for now. Any suggestions on alternative implementations are welcome):

// Get the type of building chosen from build menu

startX = Math.floor(mouse.x/level.tile.width);

startY = Math.floor(mouse.y/level.tile.height);

building = getBuildingChoice();

If the building object returned has an attribute of large = true, then place large building by checking adjacent squares for an empty space:

if(building.large){

    if(isEmpty(startX+1, startY) and isEmpty(startX, startY+1) and isEmpty(startX+1, startY+1)){

        tilemap[startX][startY] = building;

        // Large buildings with be created which are a copy of the original

        //so there's only one true instance.

        tilemap[building.x+1][building.y] = new Large(building.x+1, building.y);

        tilemap[building.x][building.y+1] = new Large(building.x, building.y+1);

        tilemap[building.x+1][building.y+1] = new Large(building.x+1, building.y+1);
    }
} else {

    // place small building
tilemap[startX][startY] = building;
}

Selection Menu

Mine Info

What’s happening down in the mines!?

Right, so you built something,  now to find out what’s going on in there!  This is where the selection menu comes  in to play.

This tells you how many people are working, how much ore it produces (in the case of a mine) and how much it cost to build.

You can also upgrade your buildings to increase their capacity in terms of workers and storage (or living space, i.e.  for accommodation).

Building Simulation

So it’s probably worth mentioning, that there is a little more to this building stuff than may be apparent. When you first start you have a population of say 100 people (it changes every new game). So now you have 100 people without jobs or  a roof over their head.  If a building requires workers, then workers will be fed in to them until they are at full capacity.  Same goes for living, as you build accommodation, the population will begin to set up home.

This means you need to have enough work for people, but also enough people to work. If there are only 3  people working  in a mine that runs with 10, then they’re going to get p*ssed off and become overworked.  Eventually they’ll just leave by boarding the transporter.  You can hire them back, but obviously that costs money.

The Transporter

The transporter

Do you sell burgers?

This takes us nicely on to the transporter.  In K240 the transporter was a very important aspect of  the game.  You could buy blue prints for new technology, colonise other asteroids, and sell your goods.  Similarly the transporter in Space Mines K2013 has a similar role (one could say identical).

Unfortunately my transporter is not yet developed to the same degree. At the moment you can sell  ore, and buy food and workers.  Once you dispatch the transporter it sets off  for Earth with all your ore.  Once it returns to your colony (in a few days), that’s when you get paid for your ore, not before. So you need to plan ahead.  Anything like food supplies and workers are already on board and so can be added  to your inventory immediately.

Conclusion

I think that’s about it for now.  Naturally I’ve skipped over a ton of stuff, but will provide more details and how I intend to do the graphic side of things and new mechanics such as the research component.

You can try out the current (basic and rather buggy) version below.  It works great in Google Chrome, but I can’t speak for other browsers at the moment.

Space Mines K2013

Thanks for reading!

footer

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s