{"author_name":"lazyeels","cat":"October Challenge 2013","comments":[],"epoch":1381337760,"likes":0,"metadata":{"p_key":"37764","p_author":"lazyeels","p_authorkey":"17400","p_urlkey":"73380","p_title":"Rocking and Rollin\u2019 K240 style","p_cat":"October Challenge 2013","p_event":"LD27","p_time":"1381337760","p_likes":"0","p_comments":"0","p_status":"UPD5","us_key":"17400","us_name":"lazyeels","us_username":"lazyeels","event_start":"1377216000","event_key":"18","event_name":"LD27"},"text":"<p><a href=\"http:\/\/lazyeels.files.wordpress.com\/2013\/10\/build1.png\"><img class=\"aligncenter size-large wp-image-215\" alt=\"Header\" src=\"http:\/\/lazyeels.files.wordpress.com\/2013\/10\/build1.png?w=700\" width=\"700\" height=\"113\" \/><\/a><\/p>\n <p>And hello there! This is the second instalment of Space Mines K2013 aka &#8220;K240 and Space Mines plagiarism tour&#8221;.<\/p>\n <p>In this part I&#8217;ll introduce you to the main parts of the game mechanic. \u00a0So let&#8217;s get stuck in&#8230;<\/p>\n <p>Actually, wait a sec, before \u00a0we go on, I need to tell you that the majority of the graphics are &#8216;borrowed&#8217; from an image search and therefore totally not mine. I did the menu&#8217;s etc. but actual graphics that look good are someone else&#8217;s, thanks, you know who you are. They&#8217;re used here as place markers and to put together a general feel, later i&#8217;ll do everything in Blender3D.<\/p>\n <p>There are two main components\u00a0at the \u00a0moment &#8211; building, and buying\/selling.<\/p>\n <div id=\"attachment_186\" style=\"width: 194px\" class=\"wp-caption alignright\"><a href=\"http:\/\/lazyeels.files.wordpress.com\/2013\/10\/build.png\"><img class=\"size-medium wp-image-186\" alt=\"Build menu\" src=\"http:\/\/lazyeels.files.wordpress.com\/2013\/10\/build.png?w=184\" width=\"184\" height=\"300\" \/><\/a><p class=\"wp-caption-text\">A building we will go,&#8230;<\/p><\/div>\n <p><strong>Starting the game<\/strong><\/p>\n <p>When you begin the game your base or HQ is set up for you. \u00a0Here you can access statistics on your population and a few other things, if I have the time to implement them.<\/p>\n <p><strong>Build Menu<\/strong><\/p>\n <p>This is where you find all the buildings you need in order to set up various aspects of your colony. \u00a0For instance, you might\u00a0want to produce ore to sell and as a building material by setting up some mines. You&#8217;ll also need some accommodation for your employees to live in!<\/p>\n <p><strong>Big buildings<\/strong><\/p>\n <p>These are 2&#215;2 squares in dimension. I was going to leave them out as I wasn&#8217;t sure how to handle them. Then I stumbled on the following\u00a0<a title=\"K240 Buildings\" href=\"http:\/\/amiga-dev.wikidot.com\/project:k240-buildings\" target=\"_blank\">article<\/a>\u00a0about K240 and how large buildings may have been implemented.<\/p>\n <p>In a nutshell, big buildings in K240 are simply single \u00a0buildings copied over to adjacent squares. \u00a0A reference then points them back to the original building portion, or something like that.<\/p>\n <p>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. \u00a0The code goes something like this (it may not be pretty, but it works for now. Any suggestions on alternative implementations are welcome):<\/p>\n <div style=\"background-color: #fff\">\n <p><code>\/\/ Get the type of building chosen from build menu<\/code><\/p>\n <p><code>startX = Math.floor(mouse.x\/level.tile.width);<\/code><\/p>\n <p><code>startY = Math.floor(mouse.y\/level.tile.height);<\/code><\/p>\n <p><code>building = getBuildingChoice();<\/code><\/p>\n <p>If the building object returned has an attribute of large = true, then place large building by checking adjacent squares for an empty space:<\/p>\n <p><code>if(building.large){<\/code><\/p>\n <p><code>\u00a0 \u00a0 if(isEmpty(startX+1, startY)\u00a0<\/code><code>and isEmpty(startX, startY+1)\u00a0<\/code><code>and isEmpty(startX+1, startY+1)){<\/code><\/p>\n <p><code>\u00a0 \u00a0 \u00a0 \u00a0 tilemap[startX][startY] = building;<\/code><\/p>\n <p><code>\u00a0 \u00a0\u00a0\u00a0 \u00a0\u00a0\/\/ Large buildings with be created which are a copy of the original<\/code><\/p>\n <p><code>\u00a0 \u00a0 \u00a0 \u00a0 \/\/so there's only one true instance.<br \/>\n <\/code><br \/>\n <code>\u00a0 \u00a0 \u00a0 \u00a0 tilemap[building.x+1][building.y] = new Large(building.x+1, building.y);<\/code><\/p>\n <p><code>\u00a0 \u00a0 \u00a0 \u00a0 tilemap[building.x][building.y+1] = new Large(building.x, building.y+1);<br \/>\n <\/code><br \/>\n <code>\u00a0 \u00a0 \u00a0 \u00a0 tilemap[building.x+1][building.y+1] = new Large(building.x+1, building.y+1);<\/code><br \/>\n <code>\u00a0 \u00a0 }<\/code><code><br \/>\n } else {<\/code><\/p>\n <p><code>\u00a0 \u00a0\u00a0\/\/ place small building<br \/>\n tilemap[startX][startY] = building;<br \/>\n }<br \/>\n <\/code><\/p>\n <\/div>\n <p><strong>Selection Menu<\/strong><\/p>\n <div id=\"attachment_191\" style=\"width: 196px\" class=\"wp-caption alignright\"><a href=\"http:\/\/lazyeels.files.wordpress.com\/2013\/10\/mineinfo.png\"><img class=\"size-medium wp-image-191\" alt=\"Mine Info\" src=\"http:\/\/lazyeels.files.wordpress.com\/2013\/10\/mineinfo.png?w=186\" width=\"186\" height=\"300\" \/><\/a><p class=\"wp-caption-text\">What&#8217;s happening down in the mines!?<\/p><\/div>\n <p>Right, so you built something, \u00a0now to find out what&#8217;s going on in there! \u00a0This is where the selection menu comes \u00a0in to play.<\/p>\n <p>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.<\/p>\n <p>You can also upgrade your buildings to increase their capacity in terms of workers and storage (or living space, i.e. \u00a0for accommodation).<\/p>\n <p><strong>Building Simulation<\/strong><\/p>\n <p>So it&#8217;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 \u00a0a roof over their head. \u00a0If a building requires workers, then workers will be fed in to them until they are at full capacity. \u00a0Same goes for living, as you build accommodation, the population will begin to set up home.<\/p>\n <p>This means you need to have enough work for people, but also enough people to work. If there are only 3 \u00a0people working \u00a0in a mine that runs with 10, then they&#8217;re going to get p*ssed off and become overworked. \u00a0Eventually they&#8217;ll just leave by boarding the transporter. \u00a0You can hire them back, but obviously that costs money.<br \/>\n <strong>The Transporter<\/strong><\/p>\n <div id=\"attachment_199\" style=\"width: 195px\" class=\"wp-caption alignright\"><a href=\"http:\/\/lazyeels.files.wordpress.com\/2013\/10\/buyandsell.png\"><img class=\"size-medium wp-image-199\" alt=\"The transporter\" src=\"http:\/\/lazyeels.files.wordpress.com\/2013\/10\/buyandsell.png?w=185\" width=\"185\" height=\"300\" \/><\/a><p class=\"wp-caption-text\">Do you sell burgers?<\/p><\/div>\n <p>This takes us nicely on to the transporter. \u00a0In K240 the transporter was a very important aspect of \u00a0the game. \u00a0You could buy blue prints for new technology, colonise other asteroids, and sell your goods. \u00a0Similarly the transporter in Space Mines K2013 has a similar roll (one could say identical).<\/p>\n <p>Unfortunately my transporter is not yet developed to the same degree. At the moment you can sell \u00a0ore, and buy food and workers. \u00a0Once you dispatch the transporter it sets off \u00a0for Earth with all your ore. \u00a0Once it returns to your colony (in a few days), that&#8217;s when you get paid for your ore, not before. So you need to plan ahead. \u00a0Anything like food supplies and workers are already on board and so can be added \u00a0to your inventory immediately.<\/p>\n <p><strong>Conclusion<\/strong><\/p>\n <p>I think that&#8217;s about it for now. \u00a0Naturally I&#8217;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.<\/p>\n <p>You can try out the current (basic and rather buggy) version below. \u00a0It\u00a0works great in Google Chrome, but I can&#8217;t speak for other browsers at the moment.<\/p>\n <p style=\"text-align: left\"><strong><a title=\"Space Mines K2013\" href=\"http:\/\/spaceminesk2013.appspot.com\/\" target=\"_blank\">Space Mines K2013<\/a><\/strong><\/p>\n <p>Thanks for reading!<\/p>\n <p><a href=\"http:\/\/lazyeels.files.wordpress.com\/2013\/10\/footer.png\"><img class=\"aligncenter size-large wp-image-216\" alt=\"footer\" src=\"http:\/\/lazyeels.files.wordpress.com\/2013\/10\/footer.png?w=700\" width=\"700\" height=\"99\" \/><\/a><\/p>","time":"October 9th, 2013 11:56 am","title":"Rocking and Rollin\u2019 K240 style"}