Thursday, December 13, 2012

Practice 2012: Designing for Thousands of Autonomous Agents

Stone Librande, the lead designer on the new SimCity, gave a lecture about the autonomous agent system that the game is based on.

  • SimCity has been in development for three years. Unlike its predecessors, it has added a multiplayer component, both cooperative and competitive, and an agent-based system.
  • The first SimCity has a 2 MB filesize. In comparison, Stone's PowerPoint presentation was already 10 MB. The early SimCity games only had graphical indications of traffic, but no actual cars that drove on the road.
  • An agent is a carrier of information, bringing data from a source to a sink. Some examples of agents in SimCity include people, electricity, water, education influence, and fire and crime alert systems.
  • Resources in the game include citizens, happiness, money, goods, sickness, taxes, water, and electricity. The agents that carry these resources are people, cars, trains, buses, and garbage trucks. The paths the agents use are streets, power lines, water pipes, and railroads. The units where the resources are spent at include houses, shops, and workplaces.
  • Previous iterations of SimCity had a cell-based system. A police station, for example, had an area of effect so it could fight crime at any area in its vicinity. In an agent-based system, however, there must be a path between the house and the police station in order for it to work. If there's no path, the house can get robbed and the police station would ignore the crime, even if the house was right next to the station.
  • The benefits of an agent-based system.
    1. It's more realistic. The sims (citizens) need to work to get money, shops and factories need workers to operate, and there are real actual traffic jams.
    2. The gameplay is deeper. Streets and paths are as important as buildings. The game feels like a puzzle in motion and not just an Excel sheet.
    3. The game is more engaging. Every sim has a name and motivation, and the players will care about them. The city has a mesmerizing daily rhythm and there's a fluid liquid-like experience. There are actual rush hours twice a day, when people all scurry to work and come home from work.
  • The problems of an agent-based system.
    1. Agents are slow. They can't get answers immediately and sometimes they won't always arrive at the destination. The economy is driven by many game loops and it's difficult to design.
    2. Agents are dumb. Designers constantly have to keep an eye on performance and programmers ruin the fun of the designers. The agents will always get absorbed by the first available sink. If they're looking for a job, they will stop at the first open position they can find, even if it's not optimal to the player. The player might want them to go work at the power plant because he needs power, but the agent would get a job at the 7-11 only because it was the first sink.
    3. Agents are deliberately dumb. The team made an early game design decision to not let players tell the sims what to do. If the agents were too smart and made intelligent decisions by themselves, it would be very hard for the players to understand why.
    4. Agents create design issues. Statistical analysis of agent behavior is difficult to do and it's hard to predict what will happen even for the designer. There are lots of bugs and it's tricky to troubleshoot problems because of the large agent network. The developers end up not trusting the agents.
  • In the early design phase, the designers used lots of Excel and had to figure out correct sizes of all the units. Stone made giant one-page diagrams of all the game flows including residential flow, commercial, and industry.
  • In the residential flow, there's a 3x3 grid of possible city blocks, with one axis being wealth and the other being density. Stone made sure that the densest and wealthiest block was not the best one, because players would get to that and feel like they've "beaten" then game. There are cons to becoming too wealthy or too dense. Wealthier people waste more electricity and power for the amount of land that they take. Stone wanted there to be no right answer to play the game.
  • The game has a happiness system. Sims will be happy if they shop or go to parks, but sad if there's pollution, illnesses, or traffic. Unwealthy people who have no happiness will become homeless. The player will have to reduce trash from the city to get the homeless people to leave.
  • In the industry flow, sims will have to work to get one money token, in which they can spend at a shop. Wealthy people would always shop at expensive stores, and unwealthy people shop at cheap ones.
  • How do you work with tens of thousands of agents? Stone created an agent flowchart that defined agent behavior. He realized that if the flowchart was too big, it made the agents too complicated, so he deliberately dumbed down a lot of the AI and split up roles. The sims, for example, used to work until they get money and then shop until they're out of money. This was a complicated flowchart and also created a weird situation where everyone worked one day and then shopped the next day, but not do both on the same day. So he split up the sims into a worker type and a shopper type with one-track minds, and it made the day flow more realistically.
  • Tourists can also come to the city by train, boat, or plane and spend their money. A household can also have children who will wander the streets until they find a school. If there are no schools, the children end up being criminals.
  • Stone makes a lot of one-page infographics instead of wireframes and documents. This is more engaging for the team to see.
  • The game has about 25 high-end systems and thousands of agents following their own agendas.
  • SimCity is definitely more entertainment than it is a simulation. The developers are not aiming for realism; the game is ultimately a puzzle game.
Question and Answer
  • Stone waits until the last possible moment to balance numbers. He generally keeps the numbers simple and flat so it's easier to think about them. For example, workers always get one money token from working and always spend one money token when shopping. If they decide that expensive shops would require two money tokens, this is a change they make near the end of development. These are also things they plan to retune constantly.
  • The past designers of SimCity always wanted to make an agent-based game, but the technology was not ready for it before.
  • Stone hopes that SimCity and The Sims never merge together into one game.
  • The employee test involves building something on-site using the Glassbox engine in 3-4 hours. Their first task after they're hired is to spend a week building a prototype of their own design using the engine.
  • The game uses tiltshift photography and makes the city look like a small toy set.
  • The game needs a lot of tutorials and thought balloons from individual agents to teach mechanics. They wanted the teaching to be more organic and approachable. For example, in previous games, you needed to build the entire electricity and water system before sims would even move into your city. This was not particularly engaging to players who expect to jump right into the game and build houses. In the latest game, players can build houses and have sims move in, and then the sims would complain about not having water and electricity. The game plays towards player expectation and teaches through the agents about what's needed.
  • There are three designers on the team (Stone himself, a multiplayer designer, and a city simulation designer) and about 10 to 12 scripters who script the flowcharts. The scripters are also considered to be designers but more on the technical side.

No comments: