lazyeels

LD27

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 roll (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

Features gotta creep!

OMG (to coin a popular acronym), there’s only a few days to go before the end of the Ludum Dare October Challenge! And as per usual I got insanely distracted by new things to add to Spacemines, one of which was Robot workers and the impeding Robot rebellion that would ensue should you have too many of them on your little asteroid.

workings

I realised however, that the Robot uprising could wait until I had sorted out some of the fundamentals. Actually I decided to ignore the fundamentals for the best part of the week, and move on to something a lot more interesting – Procedural content generation!  Say whaaaaaattt? I’d like to say that the key to figuring it out came from working it out on paper first!  I’d usually open up a text file and start coding  and hammering the sh*t out of the code until it worked, or at least gave the impression of working. I can’t tell you how nice it was to work it out on paper and then code it up, still took a while, but it was definitely worth doing in the long run, since I was more aware of where to start! Well, I stumbled upon an interesting little article.  I took the main idea of moving through an array (representing the world tilemap) in ever increasing circles as a starting point for generating the asteroids in Spacemines.  There was a slight issue however, how the hell do you move in a circle through an array which is essentially a square (or rectangle), sounds like a dark art! What was I saying?So then, back to my point! I want to produce a randomly generated asteroid that has some structure to it, and is not totally square and boring.  Here’s a pic of what I would like to achieve:

Image

The features I would like to draw your attention to are 1.)  the general shape, and 2.) the fact that there are some areas of the map which are inaccessible.  Based on the aforementioned article, and having missed a few steps out of the process, this is what I ended up with:

Image

Looks good enough for my purposes to be honest, although I’m aware I could delve in to Perlin noise for a better job, but it seems a bit heavy handed for what I want.

Asteroid Universe

How’s it going?

So now Spacemines has a universe (or asteroid belt) with a number of randomly generated maps to visit and mine the hell out of.

Clicking on a red square takes you to an asteroid, and the currently selected asteroid is marked in yellow.

The next step is to allow the user to dispatch their transporter to each one for colonisation should they discover them on their radar or probe (haven’t decided how a player discovers a new asteroid yet).

The good thing about these maps is that it suddenly adds a new dimension to the game, you are restricted by space but also how you arrange your buildings within that space. Big buildings need to be place carefully otherwise on some maps you just don’t have the room to place these 2×2 monoliths and they can be pretty important i.e. factories, research facility, HQ!!

myasteroid

The image below shows another potential candidate for colonising, once you’ve got the funds and dispatched your transporter across.

neighbour

Spacemines is pretty much there but due to a bit of feature creep and work on not-so-necessary aspects of the game it won’t be a fully fledged A* title as I had imagined it. However, you will be able to play it as I iterate over it in the next week or so (please forgive any bugs or crap game play at this point).  An early release will hopefully encourage some feedback so I can really polish it off.

Thanks for reading… next time we will be delving in to the Isometric world!

Space Mines K2013 (alpha) out now!

So I didn’t quite finish it, but if you wanted to try out Space Mines K2013 for the October Challenge check it out by clicking the image below:

spaceminesV2

Any comments or feedback would be awesome! Thanks for liking my weekly posts about its progress, and good luck with the $1 prize!!

P.S. most good looking pixel art is not mine (except that detailed in my previous blog posts), if I stole your work let me know, I just used an image search to borrow some place holders for a bit. 😉

LD28

Level Dev Editor

Hi everyone,

For the warm up weekend I created a level design tool to help me generate the kind of level data that would be a pain in the a*se to do manually during the Jam, plus I’m working with a team this time, and need to provide tools that will aid them in generating content for the game.  We’re also located in different countries so need to be able to work with the same tool.

You can see it working here (works in Chrome, but not sure about other browsers yet). Please don’t use it for the Jam as it uses my account and I would like to stay within the free-tier in terms of usage.

The current version allows you to:

1.) Place tiles to create a room or small map.
2.) Draw a room, by clicking and dragging a box (like any paint package rectangular select tool).
3.) Place the player and move them around with the arrow keys.
4.) Set starting positions of NPCs and mobs and save with level data.

Sadly I didn’t finish everything I set out to, I would like to add:

1.) Drag and drop a room maps and connect their doorways to their respective partners in other rooms.
2.) Upload tilesets, items, entities etc. via .csv upload (anybody have a solution to this, I’m having issues).
3.) Export all data to JSON (working on this bit now, hopefully will be ready in time for the Jam).
4.) Scrollable map area for larger maps.
5.) Add behaviours to NPCs and mobs i.e. random walks, A* path finding etc.

Download

You can download the level editor code here, it also includes a basic game framework I’ve been working using Javascript and canvas.

Running

All you need to do is set up a Google application on Google App Engine via the console, then add your application ID to the app.yaml file. Run the UpdateApp.sh script to update your site. The RunDevServer.sh script allows you to run the app locally (via localhost:8080).

It’s not fully functional, but you can create, save, and load levels you have designed, all saved to the cloud :-).

Screenshots

Dragging an area to create a room (Select the Room option from the Object menu).

Dragging an area to create a room (Select the Room option from the Object menu).

Try using the room tool over and over again to create interesting configurations.

Try using the room tool over and over again to create interesting configurations. Once done you can add door ways, a player friendly NPC’s and mobs.

If you have any queries let me know, otherwise thanks for listening (I mean reading).

LD29

LD’s like Xmas! You wait ages for it, and then it’s over in 3 days.

So much enthusiasm out there it’s infectious!  I’ll be entering in a team, LasagneGames, as programming monkey and so I declare my code base for the comp as requested by the rules.

Frame work:

Javascript + canvas get the code

The folder represents the beginnings of a game engine, which is a bit unfinished.  You can see an example of it in action here. Use WASD or arrow keys to move around.

If you can’t be bothered, here’s a video:

Features:

– asset loading (put all assets in the files.js including images and sound and it’ll be loaded by the asset manager)

– sound support.

– default input setup: WASD and arrow keys for player movement (also code for mouse and touch see utils.js).

– default sprite animation.

– smooth player centred camera (lerping).  Read a blog post on the code here.

– .tmx map loading and parsing. Or you can add your own tilemap (just pass in a tile map to the Tilemap() object in engine/tilemap.js).

– AppEngine boiler-plate code for hosting your game on Google AppEngine (for quick deployment).

Notes: 

– You’ll need to run the engine from your local host in order to view the example game as it needs to load the JSON files.

If you have AppEngine installed then you can run

python dev_appserver.py Lazyeels-GameEngineLD/

Then to view the game navigate to:

http://localhost:8000

Otherwise, just replace the example in game_class.js with your own game code or assign variable names to the JSON data and import as a .js file for development.

Due to a lack of time I haven’t provided a tutorial at the moment, but there’s plenty of code that you could just strip out for your own purposes.

Much of the code has been derived/based on/borrowed/stolen from various books on HTML and Canvas development including Foundation HTML5 Animation with JavaScript which is really really awesome!!

Good luck everyone with the Jam! Look forward to seeing your works of art!

LD30

Ludum Dare #30 – Lazyeels Game Engine v0.2

Hi Ludum Darers,

Just wanted to share my code library (Javascript) as referenced by the Ludum Dare rules.  It’s the start of a game engine, but I haven’t quite designed the API yet, so it’s very much in progress, and there are potential bugs.

I developed it to help me out essentially. So many of the previous dares I’ve done have been spent debugging collisions or basic stuff like loading everything, and so the games have not really had much depth or content.  This time I want to focus on the details of the mechanic and how the player handles, hence the engine.

I’ve used it for prototyping RPGs, platformers, and Isometric games, here is an example video:

The code can be downloaded here. It has an example level using Tiled, and a player object. You can see the result in the below video:

Features:

– Title and Loading screens (always forget those).
– Asset loader (images and sound).
– Tiled tilemap loader and renderer.
– Sprite animation.
– Camera (lerping).
– Collision detection.
– Sloped tiles (for platformers).
– Isometric stuff.
– WASD and arrow keys.

I’ve commented as much of the code as I could to help you out, but I recommend you delve in to the engine folders and find code you can use for your own projects, as the engine is not quite there yet.

Good luck with the Jam and see you all on the other side!

Tags: html5, javascript