Writing artificial intelligence (AI) might be the best job in games. It’s creative, challenging, and blurs the line between game design and programming. AI is used for a variety of tasks ranging from the mechanical (such as auto-attacking enemies) and bot AI, to flocking group intelligence, even to deep-thinking military generals. Games that emphasize story and character-based immersion such as Lords of New Yorkrequire an additional, essential AI ingredient: personality.
What is Lords of New York?
Lords of New York is a 1920s poker rpg. You play Vince, a gifted card-playing mobster competing in the secret poker tournament Lords of New York. Overlooked as a contender by your boss, your talents for cheating and intimidation at the poker table keep your head above water as you slug out victory after victory. With only six months left in the tournament, you must travel around New York, improving your skills, gaining items, running boxing rackets, and defeating the best card players in the city. As if being the best wasn’t difficult enough, you’re soon accused of murder—one you didn’t commit! Nevertheless, you are arrested, booked, and sent to prison.
Prison is awful. While you stare at the walls, the world outside carries on. You see your turf chipped away, you lose contact with your boxer, and find your position within the tournament buried and forgotten. Meanwhile, you must survive inside and continue playing poker, albeit for different types of currency. If you find a way back to the streets, time will not be on your side. You'll have to raise cash, defeat opponents, and quickly become one of the front-runners again.
Lords of New York is a fully voice-acted, story-driven game that features several new technologies, with two being most notable. The first is a new type of 2D animation system built to allow dynamic body language with the characters. The other is the personality-driven AI where playing poker isn’t about the cards, it’s about the story and the people. The combination of these two technologies brings the characters to life and, while the 2D animation is something that everyone can see, the poker AI is less obvious.
The idea of Lords of New York popped into my head during the fall of 2003, just when the poker boom was heating up. I watched my friend Keith playing online poker—eight games at once. He clicked quickly from room to room, chatting away with me about code, paying little attention to any one game. He’d fold, fold, check, fold, check, and so on.
“That looks boring,” I said.
He nodded and added, “It is, but if you add enough games, it’s all right.”
“Why don’t you just play a single game for more money?”
Poker’s too slow for that. The right move is almost always to fold,” Keith explained, clicking away.<
What if I made a poker game that made each hand exciting?”>
“I like the idea,” he said, his Boston accent turning “idea” into “idear” “…but I’m still not going to play it.”
“Why not?” I asked, a bit offended that one of my best friends was already canning my make-believe game.
He finally looked over at me and said, “Why would I play any [poker] game that wasn’t for real money?”
I didn’t have an answer. Instead, I dramatically replied, “I’m going to make it—and you will love it.”
“Yeah, yeah,” Keith dismissed, and returned to staring at his screen.
Keith was right, of course. Poker is a game about the risk/reward/thrill of money. It’s a game designed to encourage folding. It involves real people, real money. With that, I put the idea out of my mind—or so I thought.
Birth of Lunchtime Studios
Some things just don’t go away. When people ask how Lords of New York began, in truth, I can’t remember. There was the conversation with Keith, and then it’s almost as if the idea began working on itself within my mind and I was just along for the ride.
In 2006, writing AI for real-time strategy games was my dream job. Sadly, that same year I lost it when Stainless Steel Studios, one of the premier real-time strategy game companies, shut its doors. To help recover, I began building my own games and game technology. While I had several titles in mind, the one screaming the loudest at me was 1.4;">Lords of New York then, but I still had the idea of taking out the boring parts of poker and making each hand fun.
In 2009, my wife and I formed Lunchtime Studios with the mission of building high-quality, story-based games that are innovative and memorable. Like our role-model companies The Walt Disney Studios and Pixar Animation Studios, we focus on compelling stories and build the technology needed to realize our vision. With that in mind, we knew Lords of New York, with its gameplay angle and strong story focus, was the right game for Lunchtime Studios’ first big step. We needed more than just story, though. The fundamental problems of a single-player poker rpg were still there, and we had no idea if we had a solution that worked.
After many hard years of building our own game engine, creating a new way to animate in 2D, holding down full-time jobs, as well as being parents, we began to show Lords of New York to the public. We got great, valuable fan feedback, which we used to make better and better demos. We started winning awards and after showcasing at PAX, my old friend and greatest critic Keith called me up. I sent him a link to our demo and waited.
“So…I checked it out,” said Keith, giving nothing away.
“And what did you think?”
For the next 15 minutes, I heard a laundry list of flaws—flaws a AAA game developer would find. Keith was right again, all things that need to be done or redone in the final year of development.
“I didn’t get the story, where’s the tournament?” Keith asked.
“It’s a prequel. The story begins 2 years later. It’s just to give you the flavor. It’s where you (Vince) learn to play poker. We’ll have a tutorial—things like that.” I said.
“Oh…Makes sense. The voices were funny, most of the time. But I clicked through some. I really just wanted to get to the poker.”
“How was it?” I asked, hoping my voice didn’t crack.
“Good. Really good. I love the poker abilities,” Keith said.
“Really?” I asked, my voice pitching up.
“Yeah, and I absolutely loved that quests motivate poker.”
The easiest way to explain what I thought about his feedback is to try and visualize a 1980s glam-rock concert. Imagine the lead singer standing, legs apart, holding his arm and microphone high in the air over his huge, hair-sprayed locks. Fireworks erupt behind him—the final note of his catchiest song blasts into the audience. Fair to say, I had a hair-spray moment.
PAX Prime Demo 2015 - https://www.youtube.com/watch?v=6VAqSthNYMM
Audience and Design
As a child, I remember standing in the doorway to our computer room, watching over my dad’s shoulder as he played games like Bards Tale* and Civilization*. Years later, on visits home I’d find him at the same desk, with the same coffee mug, deeply engrossed in the same type of single-player games. As much as I love playing MMORPGS (massively multiplayer online role-playing games) and other multiplayer games, I knew I’d always be a voice for people like my dad, the single-player gamers.
While writing AI for Empire Earth*, I found that other developers on the team had different notions about the goal of our AI. One of those developers (ok, it was Keith) began a conversation with:
“Since the point of the AI is to train people on how to play multiplayer games…”
Keith was surprised when I told him that multiplayer training wasn’t our goal. He argued against us building an AI targeted at single-player gamers. All these years later, I wonder how different the AI would have been if multiplayer training had been our goal.
The AI for Lords of New York is also a single-player one. It’s geared toward story, immersion, and personality. We don’t worry about training people for playing poker in Vegas. Our focus is on the emotion of the moment. We want to reward the gamers by making their experiences as rich as possible. Our AI must enhance the story and create moments that are powerful, funny, relatable—human.
The philosophy behind how we implement single-player AI is as important as choosing its goal. Typically, AI developers fall into two camps: One that prefers traditional AI, where there are established algorithms and rules. Traditional AIs tend to create difficult and fair opponents, such as IBM’s Deep Blue chess brain. The other is user-focused AI, where the emphasis is entirely on the user experience. Here, the rules are out the window. Much like the movies, a magic show, or novels, the entire focus is on the customer and building an amazing experience for them—whatever it takes.
Cheating and AI
If you’re ever curious about what type of AI developer you’re dealing with, ask them if it’s ok if an AI cheats. If the answer is no, then they build traditional AI. If yes, they had better follow up with, “But never get caught.” Nothing ruins an experience more than the illusion of the world being shattered by obvious AI cheats or incredibly predictable behaviors with no variance.
The funny thing about AI cheating is that it’s the key to having fun. In RTS (real-time strategy) games, a common cheat I would employ is to watch the military strength of my opponent. If the AI got too powerful compared to the player (depending on difficulty), then I’d find some of my own poor, unsuspecting soldiers standing off-screen and kill them until I was a better match for the human player. Another type of cheat I used was rewarding a player's decisions. If I saw that my opponent built lots of anti-aircraft guns, I’d send over more airplanes to be shot down. This gave the player that “Ah, good thing I built those guns” feeling. Cheating, as dirty as it sounds, is especially important in user-focused AI because the user experience trumps everything.
Luckily, cheating is built into Lords of New York as RPG (role-playing game) talents. The AI has them, and so do you. For example, if you have a great hand and continually raise, you will show anxiety on your character through body language. If you face an opponent with skills in reading body language, they will pick up that you have a good hand and may even call you out to the others. Before going deep and big into a hand, you may have to use defensive skills like a poker face while controlling your reactions for a time. If you face a cheating player with the peek ability, like you, they can catch a glimpse of one of your cards on the pre-flop. If you end up switching a bad card for one up your sleeve, however, they won’t know.
The most difficult cheating decision we face about whether the AI should know your hand or not is in preventing people from the early game ruining exploits of: “Start a poker match, go all in on a no-limit game. If they don’t win, reload.” That’s a tricky problem to solve since you can recover—and may even need to lose—your money at times in Lords of New York. We won’t eliminate early-game big moves, but we may do some very early game checking on the player to make sure he or she has the kind of hand that would allow a big move early in the game.
Will I hesitate to let the AI know your hand in key situations to make the game more enjoyable? Not at all, but it’s mostly unnecessary. The AI has its own talents to use and doesn’t need to know what you have in your hand to deploy them.
Random Numbers in AI
One of the big surprises about AI in games is that at times, a random number can be the perfect decision maker, be fun, and save large amounts of developer time. While developing Empire Earth, I designed a detailed attack strategy for the AI whereby it would find the weak spot of your town, put guys on a helicopter, and drop them at the most ignored spot they could find. Once players discovered they were being struck from the inside, they would shout out with amazement at the cleverness of an attack, and how they’d never seen such coordination and complex behavior in a game before.
Did it work? Well, the sneak attacks did, but only once did I ever hear about it through word of mouth or from user feedback on forums. That attack took quite a bit of developer time to code, and only once did anyone ever mention they saw (and understood) what was happening.
I learned my lesson, until Rise and Fall*, where this happened again. I would have the AI group up into divisions, combine into a massive force, and charge with a curved front line like you’d see in a battle scene from Lord of the Rings or Troy.
As it turns out, just like the Romans fighting in the woods of Germania, trees don’t make large formations easy to use. I did a lot of work for something that looked impressive and cinematic but could almost never happen given the terrain of the game, since we had very few massive, open spaces.
The feedback from gamers often produces some of the best ideas. I’d read forum debates about what our AI was thinking. I’d bite my lip and stay silent when they speculated on a sophisticated AI decision when I knew it was just a random number. Sometimes, however, the feedback would give me an idea for something purposeful. I’d change the random number solution to do exactly what that gamer thought the AI was doing in the first place. Don’t worry, your favorite game’s AI isn’t just random numbers. If that was all we needed, AIs would be easy to write and quite boring and confusing to play against. Random numbers are, however, an important element in AI, as many decisions are random numbers compared against a (it’s hoped) well-thought-out chance percent.
Build an AI Personality
Personality is the glue that binds story to poker. Building characters who make sense both in the story and at the poker table requires that our poker AI actions must make sense with actions in the story. To build characters who are believable in and out of poker, we combine poker logic and story, and craft a noticeable personality. We only achieve harmony if the personality traits match the poker talents, which match the character’s story. For example, Tony’s (playable expansion pack character) skills are in statistics and probabilities. It’s unlikely you’ll see him cheating, but he’s going to have a better idea of his chance to win than say, The Bull, who likes to taunt players.
When we build a character, we lay out its personality and role in the story, and then match its talents. Lastly, we set personality trait values to match the character’s skills and story. This means a player like Tony, who is incredibly smart at poker, will have higher scores in intelligence, memory, and risk analysis than other characters. In addition, while not related to a talent, since Tony is a fairly even-keeled guy, his temperament is also above average.
Personality can’t carry the AI alone. If we have an AI with no notion of good/strong hands, table positions, etc., then our characters wouldn’t work. We give the AI the tools to understand the game and world around them by building repositories of world information, called “information centers.”
Information centers are responsible for computing or knowing about a single area of information. Not all are just knowledge bases. Some track an AI’s mood, or may just occasionally answer questions such as “Is this a must-win hand?” A few information centers are:
- Poker Odds. Each player takes what they know of the current hand and computes the odds that he or she will win.
- History. What is the play style of the current players? When do they raise and win, when do they fold? Lots of different stats are tracked and are available to be queried by the AI.
- Situation. Answer questions for special-case situations.
- Motivation. Determine how badly the AI wants to win the current hand (vengeance, desperation, and so on).
- Quest. Our poker revolves around story. While there are games that can be played for just money, often there may be a quest-specific response to a hand that will trump some other decision factors.
- Mood. Important in when and how to use players’ poker talents.
Every time we need a new AI question that relates to the world, we use the information center pattern. The power of this pattern is apparent once we apply filters (or lenses).
Poker Odds information center (and current hand) displayed on each character’s portrait for debugging.
Filters live between the AI brain and the information centers. We want information centers to contain or compute correct information regardless of the type of opponent or his personality. It’s in the filter that we alter the data to make it match the opponent’s personality.
Think of a filter as a lens. If you look at text in a book through a fisheye lens, it looks much different than if you look at text through normal glass.
The ability to distort the truth based on a character’s stats (such as intelligence, memory, temperament, and so on) is what allows us to build a base of poker AI truth that makes sense for the person you’re playing against.
One of the main heuristics used to alter how a filter changes the data coming out of an information center is a linked personality trait. For example, the more intelligent a player, the less the filter will alter the scores of “Is this a good hand?
The process of getting data out of an information center as seen in Figure 1 involves the following steps:
1.A request is made from the AI brain to an information center.
2.Input passes through a filter and may be altered on the way to the information center.
3.The information center computes the accurate result.
4.The result coming back from the information center may be altered by the filter.
5.The AI brain uses the filtered data, believing it is unfiltered data.
Figure 1: The process of sending a request and getting a result from an information center,
Here’s an example of accessing hand odds:
1.Given a hand of 9 of clubs and Q of hearts in a two-player game, ask for the odds.
2.Data is unaltered and flows into the Hand Odds information center.
3.Hand odds computes that there is a 55.3 percent chance of winning in this pre-flop round.
4.The filter uses intelligence to shift the result within a range, resulting in a 42.8 percent chance.
5.The AI now thinks that they have a 42.8 percent chance to win and uses this as one of several data points needed to make a “check, raise/bet, fold, use ability” decision.
The primary strategy in Lords of New York is to learn about a character’s personality, then work to exploit his weaknesses in poker. By using filters to manipulate how the AI sees data means that the gamer (human) can target those elements of a character's personality to influence play. For example, you are Vince, skilled in cheating and intimidation, playing against Tony, an intelligent player, skilled in statistics and probability. He’s such a smart guy that to get him off his game, you’ll want to rely on things that affect his intelligence and memory, such as poison or spiking his drink to cloud his mind.
Matching your tactics to the right player’s personality is key. Targeting intelligence against a player like The Bull, who’s an aggressive, intimidating guy, would likely have little impact.
All Together Now
In cooking, there are so many things that can go wrong with a dish. Great ingredients have to be added in the correct proportions and cooked just the right way to unlock their secrets and lead to perfect textures and flavors. Even with an expertly crafted dish, all that work can result in a bland experience without the right seasoning. Building a character for Lords of New York is no different. Just like a fantastic meal is the result of ingredients, cooking, and seasoning coming together in the right way, we blend together animation, voice, story, poker talents, and personality to build believable, flawed, human characters.
We match a character's story with his poker talents and those to his personality. We want gamers to figure out their opponents through their own innate knowledge of human behavior. They won’t realize they are doing this, and that’s the point. Be so immersed in the story that poker and the reason for playing poker makes intuitive sense. We’ve a ways to go, but an article written by SPONG summed up Lords of New York perfectly: “…it instead focuses on what people really care about: other people.”
A game about people—not poker, but people. If building a game was like cooking a meal, then personality is the salt in our dish. Personality alone isn’t impactful, but when added correctly, it enhances what’s already there. Without personality, gamers won’t connect to our characters, won’t know how to predict their actions, and won’t know how to defeat their opponents. If all ingredients are added just right, gamers won’t think about characters as poker opponents, but as people, and that’s what Lords of New York is all about.
For more such intel resources and tools from Intel on Game, please visit the Intel® Game Developer Zone
Other Popular Deals
- Best Alternative Apps for your Android PhoneThe 10 best job hunting apps on Android
- The 10 scariest horror games on AndroidAndroid app stores: 5 best alternatives to Google Play Store
- Best Android apps for rooted devices18 apps for a memorable Valentine's Day
- Top 15 Android games that you should playThe 20 best looking games for mobile phones
- 8 Android apps to tickle your funny bone17 must have apps for any Android device (plus alternatives)
- 5 apps to get the Android Lollipop look on your smartphoneTake control of your Android device with these apps
- 7 weird and strange apps for your Smartphone10 neat Google apps you may not know of
- 10 essential Indian apps for Android devicesPerfect Viewer