Virtual Supermarket
The Free University in Amsterdam wants to do research into means to influence the spending behavior of people in order to encourage healthier purchases through pricing strategies. Apparently there is little to no consensus about which strategies work the best (pricing down the healthy food, pricing up the unhealthy, discounts vs. taxes, etc.) To study this, they commissioned us (read me, I’m the only person working on this) to make a “serious game” type application, in which people can get their groceries as much as possible “like in real life”. The point is, that the client believes that a web-shop kind of application would not suffice as it is to far removed from the “real” thing.
Buzzwords
- serious games
- physics
- customizable data through CSV files
- low-poly, modular modeling
Technology
For this project, I chose to use the Unity3D engine, which has a really well designed data pipeline. I have created all the models using Cinema 4D. The textures are based on images taken from the internet and modified in Photoshop to fit the UV mapping (and to remove some too-obvious branding where necessary). Unity3D imported these models with ease. Of course, constructing the “Virtual Supermarket” was not as simple as it sounds. To make the whole setup as efficient as possible (within limits: the project has a tight schedule and costs have to be kept down, so I don’t have the time to optimize and streamline every detail as much as I would like to), I have de-constructed all the elements into re-usable bits and pieces. Think of it like IKEA furniture or LEGO: every shelf is actually the same, thus one model is reused dozens of times. Also, every rack itself is made of very few little other components, each of which is re-used in every instance of every rack. The whole thing results into a big tree of furniture made of re-usable components, made again of smaller re-usable components, etc.
Lighting a supermarket can be rather dull, as the light is supposed to be dull, but to get a slightly more “realistic” feel, I kept it at that dull lighting, which in turn though meant, that I had to use a lot of small light. I did not want to use too much ambient light, because it really just flattened the scene too much. So, to compensate, I baked all the shadows of the furniture onto the walls and floor of the room. This resulted in a very good look for no additional performance loss.
The target platform will be both the home computer of test subjects, as well as a laptop that will be taken to test subjects that do not possess a computer with internet connection. Because such systems are possibly at the lower end of the performance spectrum, optimizing is paramount. The final program must sport almost 500 different items, and of each of them there will be about a dozen in the racks, so I have kept the complexity of the item models as low as possible. Where possible, I simply use cubes and it doesn’t get much fancier than eight-sided cylinders (except for some very complex shapes that could not be approximated better). To make up for this, I use real photographs of groceries, which are very recognizable for the users and thus compensate a lot for the low polygon count.
Interaction
The interaction is an interesting challenge, as the target audience can be quite the opposite of the average gamer. On top of that, the user is supposed to be able to “get groceries” rather than “fragging the opponent”, and thus the focus is less on fast paced action as on realistic movement and careful selection.
To navigate the supermarket, the arrow keys are used to move forward and backward as well as to turn left and right (W, A, S, D alternative available). For the more expert ones (especially for me when testing the application!) Q and E can be used for strafing. The mouse is used to select objects in the environment: hovering over selectable objects makes them light up, the left mouse button is used to pick them up (when it’s an item) or trigger functionality (like the GUI or the information badge next to price tags). Keeping the right mouse button or the space bar pressed, the mouse can be used to look around (the cursor then disappears until the button is released).
The GUI allows to see what items the user has in the shopping cart and to eventually remove undesired items. It also shows the price as well as eventual discounts. Additionally, for every available item, additional information is available through a badge next to the price tag. Finally, the GUI is used to “check out” the items in the shopping cart by walking up to the counter. A dialog informs the user if the available budget is exceeded and allows to amend by offering the contents of the cart for inspection and removal of items, until the sum is within the budget again.
Another tricky thing was implementing physics within the shopping cart. This meant parting from the classic first person shooter controls and using a more “physical” approach. Now, the shopping cart is entirely controlled by the physics engine, which means that selected items fall into the cart and tumple around freely. To decrease strain on the processor and to avoid the physics calculations to go astray (basically the broccoli where shooting out of the cart!), I also implemented a time-out feature: after a given set of seconds, the items in the cart are taken out of the simulation and are “frozen” into place. It can result in less-than-realistic heaps, but the effect is barely noticeable and greatly improves the user experience.
Data
The client wants to be able to easily implement various scenarios. The prices of all items must be adjustable, plus two kinds of discounts must be available: a normal “percentage” discount that is taken off the normal price for each purchased item, and a “volume” discount of the type “buy X and pay only Y” (with X and Y obviously being adjustable). On top of this, it has to be possible to do this by the scientists themselves, who only use Excel and SPSS. To make it possible, I used the CSV (Comma Separated Values) format, which SPSS is able to export and import. CSV files are used to determine the prices, the discounts and the descriptions of all items. Additionally, images can be specified that are used as advertising posters in the supermarket, so if there is a discount, an image can be used to point it out next to the price tag. This means that part of the scene is determined at load-time, by parsing the CSV files and loading additional textures. All price tags in the supermarket are generated this way, and where specified, special signs are activated and covered with textures that are specified in the CSV file and placed in a folder by the client, i.e. they are not pre-included in the program.
Screenshots
The project is not yet concluded, so the shots here only have little groceries in the supermarket. I am working hard to fill them up, and I hope to update this page again as soon as I have more to show.
in Games