Back to Space Fortress Overview
You arrive on the asteroid, the vacuum is harsh, unless there is an atmosphere, in which case the atmosphere is harsh (windy and acidy). You don't have any raw materials to start building affordable recreational space cars (such as the floatercycle). What do you do? Start digging. The best way to get going is to work underground. You might even find some good (or evil) under the surface.
Figure 1. Initial world with
lander, worker, and cursor.We have landed on our harsh moon. See the landing craft. See the little worker. See the sky on the top and the dirt on the bottom. See the mouse cursor. The player decides they want to start digging. They review the world that they have before them and determine that they will start tunnelling between the initial position of the worker, and the space lander they arrived on (which prompty ran out of gas).
The dirt looks very bland right now. It's homogeneous. As you dig deeper, you should be able to see some features. Maybe as workers pass a tile of dirt, depending on their perception, they can update the view with new information. Information like density (how long it takes to dig it), mineral content, radiation level, etc... This is an example of a tangent I get caught up in. It is also an idea for complexity that can be added at a much later time. Lets keep it just as dirt for now. And it's either there or not.
Figure 2. Using the cursor, we've designated an area to be mined.The game is paused right now (no game ticks happen on their own) so they imagine where they would like the layout of their excavation. They can highlight regions and set them as designated to be mined. They can do this by dragging the cursor across an area and it draws a box. When it is done, the tiles become highlighted, indicating that they're on the menu for miners. Weird shapes can be drawn in the designation by repeating multiple box area selections.
A UI thing I haven't worked out is if you should click a “Designate Mine” button that means your next drag will be mined, or if every time you drag it finishes with a context menu with your choices for that selection. This is a common task, so maybe a “Designate” button would be appropriate. A hotkey at least for expert users to grow into.
Figure 3. Available worker moves into position.The job system requires a whole story of its own. But I'd like to mention it here. A mining designation really is just a set of tiles. Who keeps track of these tiles? Who cares about these tiles? Tiles need to be mined. Mining is a job. Workers do jobs. So we need to turn designations into jobs. Nobody likes to micromanage all the time, so instead of RTS-style “pick-a-player, pick-a-dirt, execute” tedium, the order to mine a certain area gets passed on to
The mining manager looks at all of the tiles in the set. It will tell the view which tiles to highlight. It will also figure out which tiles should be real jobs. Like, the worker there couldn't hope to dream about mining the bottom-right corner of the designated area. It's surrounded in dirt. Only one tile, the one on the surface. can be mined. So when the worker says “I want a job”, and the Mining Manager says “I have one job, mine tile (228, 23)”. An artist's interpretation of how the mining manager sees the world is in figure 6.
Then the worker says “That's way over there, I'm going to move to an adjacent tile”. So it moves over to that tile, then starts to work. Once digging is complete, it will ask for another job. The mining manager will realize (as it subscribes to the status of the dirt) that a tile has been mined away, and will reconsider the designated set, and say “Hey! (228, 24) is now diggable, I sure hope somebody asks for a job” and so on.
Figure 4. We've been mining for a little while now. Look at the rubble accumulate.So, as mining jobs are assigned, the holes get bigger. Sometimes a tile of dirt will drop something after it has been dug. This is both good and bad. Good because it might be a tasty moonrock that can be sold or used to fuel your new ether-radio. Bad because no matter what, it will take up space. This figure doesn't really drive that home. But mining makes a lot of gross rubble that needs to be cleared out. Rubble hampers movement (maybe it takes two ticks for a worker to step across some), and as it accumulates it might even obstruct entire passages (become entirely solid). Rubble that falls from a tile is an entity, a better explanation what an entity is should come along, but for now think of it as something that isn't dirt (which is the terrain) but something that LIVES in the terrain, like a worker with no brain, or the landed useless spaceship.
That would make mining a job of digging and hauling. Like an anthill, a pile of rubble will build up on the top of your mining hole. I'm not sure if this would just be a pain or if it would keep people from violating the conservation of mass and make them mine more carefully.
Figure 5. Well done little worker!So, with 2d mining, a few issues come up. Issues like cave-ins. Since we assume that in the z-coordinates dirt is coming straight forward and backwards into and out of the screen, so there should be plenty of support. But... would certain soft-dirt collapse under pressure? What happens if we mine the space directly under the lander? Does it fall?
What about the whole rubble issue? I don't like the idea of having a new user have to learn about hauling and digging at the same time. It's the first thing you have to do, and that would be obnoxious. Maybe the first 100 tiles of dirt are fusion-blasted into nothingness, the rest are scrached with a spoon, leaving heaps of stone?
I just realized that I've been ambigous and with some definitions, and by defining them the problem seems less of an issues. I've been using the terms “dig” and “mine” interchangably. That is a problem! Digging is the act of turning a tile of dirt into hole. Hauling is the act of carrying something (such as rubble) from one place to another. Mining is the combination of digging dirt and hauling rubble. Aha! I think I like that. The mining manager keeps track of the set of tiles to be mined as well as all of the rubble objects that fall from mined tiles. These rubble objects need to be hauled in order for a mining job to be complete. See figure 6, dig jobs are designated as coordinates in the world, haul jobs are designated as the unique ID number for the generated rubble.
Figure 6. How the mining manager sees the world, two queues of available jobs.The haul jobs (consisting of an entity id, and a final destination) still need to know where to haul. Maybe if it isn't defined explicitly, it can be placed right on the surface somewhere, but only once the lack of hauling is obstructing any further mining. Also, for cases where you don't want an anthill, (you're just tunneling) maybe hauling jobs should only be offered once all the other work is finished, or if a pile of rubble obstructs future diggings it can be spread out a little. Or there could be preferences, or advanced designation options for "clean mine" and "quick mine", one hauls out rubble the other does not. By designating a "haul rubble here" area for a mining job, it becomes a clean mine. Again, the last few sentences are overkill, but it's nice to know there are solutions that could be implemented down the road.