Tuesday, January 02, 2007

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.

Updates: [2014, 2015, 2016] See Great Permutator's clever puzzle pieces; also see Manufactoria, Factorio, Big Pharma, and Project Automata.