A Look Inside the Turn-based Pizza Business Simulation


Jan 25, 2003
Author: ares32585

The simulation is perhaps one of the most important elements of a turn-based business simulation like Pizza Business. Without the portion of the game code that does the actual simulating, Pizza Business would be a truly boring, inane, and ultimately joyless game. In Pizza Business, you are the owner of a pizza restaurant and have to manage the various aspects of such a restaurant: hiring staff; and buying ingredients, ovens, tables, and chairs. Once you have your restaurant setup for the day, you click the “End Turn” button and, shortly thereafter, the statistics for the just-simulated turn appear. But what really happens between the clicking of “End Turn” and the appearance of the stats dialog? Does the “simulation” actually simulate a pizza restaurant or does it merely generate a few random numbers and only pretend to actually be simulating?

First, a little background about the simulation needs to be established. Relatively early on in the development of the game, we decided that it would be best if we made the simulation be turn-based rather than real-time. What was the reason for this decision? None of the programmers on the team were graphics programmers; therefore, there would not (and could not) be a 2d or 3d graphical representation of the restaurant and what was occurring inside the restaurant. Without this visual feedback, what use would a real-time simulation be to the player? Playing such a game would be similar to flying an airplane using flight instruments only – all the player is able to use to determine the current status of the restaurant are representations of data in tables, graphs, and lists. Obviously, if the game world will be represented only through textual data, it would be beneficial if the player could peruse and study the data without any time constraints; this is why a turn-based simulation is used.

”Does the “simulation” actually simulate a pizza restaurant or does it merely generate a few random numbers and only pretend to actually be simulating?”

In general, the simulation in Pizza Business is made up of objects(tables, chairs, ovens, ingredients) and entities which act on or make use of the objects(waiters, manager, cooks, and customers). It is this seemingly simple interaction between entities and objects that forms the basis for the entire simulation.

In the game, a simulated “turn” is 24 hours long with each minute of those 24 hours being simulated. The “day” begins with the simulation determining the number of customers that will be visiting the restaurant. This number is based upon two factors: the restaurant's popularity rating and the amount of advertising (if any) that the restaurant has. The correlation between the restaurant's popularity rating and the number of customers that will visit a restaurant is a direct relationship – for each positive point of popularity rating, one customer will attempt to visit the restaurant. The main reason for this direct correlation is to allow the restaurant to “grow” indefinitely if the player continues to improve the restaurant's popularity rating. One important exception to this rule, however, is that 20 customers will visit a player's restaurant each day regardless of a restaurant's popularity rating. This is done so that even if the player has a popularity rating of “-500000” there will always be the opportunity for the player to increase his popularity rating and make a little cash. If this “buffer” of customers did not exist, once a restaurant's popularity rating dropped below 0, there would be no way for the player to draw customers (with the exception of advertising which will be discussed shortly). But even advertising might not help in such a scenario, as it is not inconceivable that if the restaurant's popularity rating was that low, the restaurant would also likely be short on cash, thereby making it impossible to buy advertising. This “customer buffer” is in the game to ensure that the player will always have a chance to recover from even the worst situation.

”It is this seemingly simple interaction between entities and objects that forms the basis for the entire simulation.”

Advertisements also play an important role in determining the number of customers that will visit your restaurant. Each individual advertisement in the buy/sell dialog has a “quality” rating, although this rating is not visible to the player in order to emulate the fact that it is often impossible to tell how well an advertisement will work. An advertisement's quality rating does not specifically determine the number of extra customers that you will receive, with the one exception being advertisements bought on the very first turn of the game. During all other turns, the number of extra customers that an advertisement will generate is still based on the advertisement's quality rating, but it is also based on the number of customers your restaurant had the previous day. In fact, advertisements will generate an extra number of customers equal to a certain percentage of the customers the restaurant had on the previous day. The percentage is determined by the advertisement's quality rating. Although the customer generation does not use extremely complex algorithms, it gets the job done and, in the end, that's all that counts. But are you still not convinced that the simulation of Pizza Business is more than a glorified random number generator? Well, read on, then.

Once the number of customers that will visit the restaurant has been determined, each customer is randomly assigned an “arrival time.” The simulation then enters its time loop and begins simulating each minute. When it's time for a customer to arrive, the customer checks to see if there is a chair for him to sit on. If there isn't, he leaves and the restaurant's popularity rating suffers. If there is a chair, he takes a seat and waits for a waiter. A waiter (if one is hired and not currently busy) will take the customer's order. If the proper ingredients are not available for the pizza that the customer wants, then the order cannot be taken and the customer leaves the restaurant. If, however, all the necessary ingredients are available, the order is then sent to the cooks. A cook (if one is hired and not currently busy) will then begin preparing the pizza. When he's done preparing the pizza, he puts it in an oven (if the restaurant has bought any and if they're not currently full). When the pizza is done cooking, the waiter takes the pizza to where the customer was sitting. If this whole series of events has not taken too long and the customer has not left the restaurant, the pizza is then given to the customer and is paid for. The customer then begins eating the pizza. Once the customer finishes eating the pizza, he leaves the restaurant and the popularity rating of the restaurant increases because of his good experience. This sequence of events is then repeated for each customer that enters the restaurant. That's all for now; I hope this article has given you some insight into the simulation that goes on “behind the scenes” in Pizza Business.