About a year ago I decided to stop working on Simblob, and started working on a transportation game (more about the design here and here). My progress has been rather slow, in part because I keep playing other games instead of writing one.

One of the components of the transportation game is the Warehouse. If you view your transportation network as a graph, the Warehouse is an internal node, the Supplies and Sinks are the endpoints, and the transport types (trucks, ships, trains) are the links. The Warehouse is a key component of your transportation system. Goods come in and goods go out. Sometimes goods are stored, repackaged, relabeled, inspected, and assembled. In the network, Warehouses can be used as:

  • Buffers. Goods come in, a stored for a time, and then go out. The time the goods are supplied is earlier than the time they are needed. For example, it may take several months to produce the toys that will be bought in the Christmas shopping season; those toys need to be stored somewhere until shoppers are ready to buy them.
  • Switches. Goods come in from several sources and go out to several sources. For example, a grocery store chain may have supplies coming in from farms, ranches, orchards, etc., and may have those same goods go out to several neighborhood stores.
  • Caches. Goods aren't needed all the time, and their demand is unpredictable, but when the demand is there, the customers want the goods right away. The solution is to keep some near the customers, so that when they need some, they can get it quickly.
  • Transformer. Goods arrive in one condition but leave in a better condition. For example, a Warehouse may add tracking, labeling, and pricing information to the goods before sending them on to stores.
  • Multiplexing. Goods arrive in large shipments from suppliers, but each store needs a small amount of each good. The Warehouse can repackage the goods into smaller units. For example, an electronics retailer may receive a truck full of VCRs, a truck full of TVs, and a truck full of speakers, and the Warehouse can reshuffle these into three trucks, each with VCRs, TVs, and speakers. That way only one truck has to be sent to each retail store.

Warehouses are an interesting enough part of this game that I decided to try making a mini-game out of them.

In the mini-game, the goals (switching, multiplexing, etc.) are given to you, and your job is to design the warehouse to meet those goals. Goods come in from the left and exit on the right. There are multiple types of goods, each represented by a color (or shape). Your job is to get the goods from the left to the right, while achieving your goals.

"napkin" sketch of warehouse mini-game

The warehouse is laid out on a grid. The basic component is a conveyor belt, which takes up 1 grid space. The conveyor belt pieces are linked into a chain that defines the flow of goods through the warehouse. What makes the game interesting (I hope) is the special pieces you can add to the conveyor belt. A color filter only allows a certain color to pass. With it you can separate a mixed flow into separate products. Similarly, a shape filter only allows a certain shape to pass (I may end up combining shape and color filters into one). A counter filter has a counter, and only allows an object to pass when the counter reaches a particular value. For example, a 3-counter filter will allow every third object to pass. These filters are used to separate a stream of objects into smaller streams. Note that a 1-counter is the same as a regular conveyor belt; it filters nothing. A mixer mixes objects from multiple streams, in some proportion. For example, a mixer can be set to take 1 green circle and 2 purple triangles, and the resulting stream will have twice as many purple triangles as green circles. A packer takes multiple objects and packs them into a single object of a different type; an unpacker takes a single object and unpacks it into multiple objects. A carousel stores objects, up to its capacity, until the output stream(s) have space for unloading objects. It can be used to even out a highly variable flow. There are more objects I can imagine: shelves, aisles, employees, forklifts, labelers, inventory trackers, etc.

The game involves a series of levels of increasing difficulty. Each level has a grid, some supplies, some demands, some parts to use to construct the conveyor belt network, and some goals to meet. The grid may have objects on it already, which cannot be moved.

At each time step, all goods (objects) move one space, according to the rules of flow:

  1. The conveyor belt defines the directions the object can move.
  2. An object cannot move in the direction of an incompatible filter.
  3. An object cannot move to a spot that has an object, unless that object is about to move.
  4. Of all directions available to move, the object chooses one at random.
  5. If a box cannot move, it sits still. If it sits still too long, it breaks.

If you think about these rules hard enough, you'll see that they may be difficult to implement. In particular, rule #3 says that an object can move if another object can move. And that object too may be subject to this rule, leading to an entire chain of dependencies that have to be solved. I have an algorithm partially designed but I'm not yet convinced my algorithm will work; if it does not, I'll revise the rules.

The puzzles I'm less sure about, but here's what I've been thinking about:

  • Slow packers. Split the incoming supplies into several streams so that you can have several packers handling them, then coming the streams into one.
  • Irregular supplies. Demand is steady. Build a large buffer so that you can handle supplies being late.
  • Multiplexing. As described in the electronics retailer example, suppliers send large shipments of a single product type. Build buffers so that you'll have enough of each product type. Unpack the large supplies into small ones, mix the goods together, pack them into shipments that get sent to retailers.
  • Bad supply. Some of the incoming goods are faulty. The supplier will lower quality as much as he can get away with. It's too expensive to check everything, but if you check nothing, the quality will keep going down. Check some of the goods to keep quality high enough to satisfy customers.

Time, quantity, quality, costs, and profit can all be part of the goals. For example, incoming goods might cost $4/box, and outgoing goods might bring in $5/box. Each box you send through the system gives you $1 in profit. If a box breaks (due to sitting on the conveyor belt for too long), you lose the $4. You might be willing to have a less reliable system to keep costs down, or you may want to make it more reliable to minimize losses.

At this point the design is only on paper. I plan to create a prototype soon to try to judge how fun or interesting the game might be.



Amit wrote at January 06, 2007 6:14 PM

I don't think I'll end up with graphics as nice as this video of nanotechnology.

Frederic wrote at January 12, 2007 2:52 PM

rule #3 says that an object can move if another object can move. And that object too may be subject to this rule, leading to an entire chain of dependencies that have to be solved.

That is not a problem if you process turns for the free spaces instead of the objects. This is a classic problem in roguelike games, btw.

1. loop over all empty tiles
2. check if a nearby tile wants to move
here. Repeat for all neighbours.
3. one a tile is freed by movement,
continue with that tile.
4. animate all movements

That minigame looks like a really fun project, congratulations!


Amit wrote at January 15, 2007 4:34 PM

I think if I have free spaces, the algorithm will be simpler, but I was hoping to have an algorithm that works without any free spaces. New objects are coming in and old objects are going out, and it's possible (maybe rare) that the entire board will be full, with no free spaces, but I still want everything to move. ;)

Chris wrote at January 28, 2007 3:38 AM

Have a terminator piece/end/receiver that cannot take any pieces, if you try to put a piece there it results in an immediate pile up. So a blank 10x10 tile warehouse has 100 terminators (That are invisible/look like a floor piece) and everything you build replaces a terminator.

Amit wrote at January 28, 2007 10:54 AM

Chris, that's an interesting idea. I had been thinking of adding a “capacity” field for each tile, to enable a “shelf” tile that lets you stack up goods. A tile with capacity of 0 would be a good default to put on each space at the beginning of the game.

Anonymous wrote at February 16, 2007 4:55 PM

I grew up in a family company that built custom conveyors. I worked there for almost 20 year and I never thought about a game with conveyors.

Anonymous wrote at February 17, 2007 3:00 PM

In the 90ies I used to play a game on the mac called 'factory' or something similar, it was kind of what you described. Quite fun too.

Patrick Braga-Henebry wrote at October 16, 2007 6:22 PM

i used to play a game about conveyor belts and baggage, airport themed, where you had to get all the bags into the right color bins by toggling conveyor belts back and forth and toggling switches. it was a minigame in humongous games 'explore the airport,' if you're interested

Amit wrote at January 31, 2009 12:55 PM

This video and this video might also help explain why I'm so interested in this topic.

Amit wrote at May 22, 2010 5:28 PM

Manufactoria is a Flash game that features puzzle solving using using conveyor belts and color filters (my terminology). They have a series of colors instead of a single color, and you can both remove colors and add colors to the list with the pieces you place, and probably other things in the levels I haven't gotten to yet. It's a neat game.

Eric Nakagawa wrote at December 11, 2011 8:56 PM

I'd love to donate towards a project of yours! Big fan of you and your brother's work. Best of luck!

Amit wrote at December 12, 2011 11:36 AM

Hi Erik, thanks! Right now I'm not working on any game projects but I hope to next year.

Popular Posts