Programming, game design, and faith

Sun halo

Tag: Game design

New Monty Hall door variant

(The inspiration came from a student’s submission for Remake Candyland.)

Three people play a board game. The first to reach the end of the track wins. You each have a favorite candy, and there are three cards randomly shuffled, one for each candy. The player, on their turn, draws a card. If it is their card, they advance a space. If it is someone else’s card, the other player advances a space. The player can draw once more if they choose.

We can restate this as the Monty Hall game: The player chooses a card but does not reveal it. A neutral game master looks at the other two cards and reveals one that is not the player’s card. The player can choose to keep their choice or switch. Probability would dictate that it is always better to switch.

We can mix this up by having a biased party look at the other two cards and choose whether to allow the choice or not.

Sorcery in video games

I read a question and some responses on the Christian Game Developers Facebook group yesterday. The question was, “How do you guys feel about heroes in fantasy games using magic?” There was some discussion of the prohibitions of sorcery in the Bible and the example of the converts in the NT who burned their magical books.

In the video games I have played, magic is pretty much the same thing as superpowers. Being able to control the wind or throw a fireball is not different from what X-men or Avengers do. One commenter said he doesn’t participate in any of these forms of entertainment. I admire the consistency of this stance, but I think these things are fantasy and fun to imagine.

I had to think about the broader issue of evil in video games when I started playing Diablo and Diablo II. I decided that the stuff in that game (cemeteries, winged demons, pseudo-scriptural text) is almost completely unlike anything related to real Christianity, so it was OK to play.

I stopped playing Diablo II when I saw some of my friends playing the game for hours and hours, waiting for the rare loot drops. I wondered, is this game fun or addicting? Over the years I have come to the conclusion that the real evil of Diablo and other such games is the Skinner box—making players addicted to the game by activating pleasure centers in the brain at random times. Some game companies monetize this by making players pay for loot boxes.

Please think about if you’re playing a game because it’s fun and uplifting, or because your mind is being controlled by pleasure seeking. This goes for creating games, too.

The crown that will last forever

Presentation at ACMS 2019, Indiana Wesleyan University, 31 May 2019
James Vanderhyde, Saint Xavier University, Chicago

Smash Trophy

Paul, 1 Corinthians 9:24:

Do you not know that in a race all the runners run, but only one gets the prize?
Run in such a way as to get the prize.

David Sirlin, Playing to Win:

Winning at competitive games requires a results-oriented mindset that many players are simply not willing to adopt.

Introduction

David Sirlin, competitive video game tournament champion, wrote a book (2005) that explains how to win at games. Sirlin begins the book by describing a “mountain” of competitive gaming: a few gamers are already “on the journey” to the mountain peak, but most only think they are. “They got stuck at a chasm at the mountain’s base,” and “they are imprisoned in their own mental constructs of made-up game rules. … ‘Playing to win’ is largely the process of shedding the mental constructs that trap players in the chasm who would be happier at the mountain peak.”

The book is very interesting and I recommend it. Sirlin covers many topics related to competitive gaming. Here are few highlights:

  • Shedding the “scrub” mentality (more on this later)
  • Doing whatever it takes: Being competitive requires dedication, training, and choosing the appropriate game. Sirlin gives plenty of advice.
  • The Art of War by Sun Tzu: This is a text written around 500 B.C. It is all about strategies for warfare, especially when not to fight. Sirlin applies this to competitive video games.
  • Champion play styles: Sirlin describes several play styles and then selects exemplars of each style—first one from the world of chess grandmasters, then one from the world of Street Fighter 2.

The scrub mentality

Common usage of the term “scrub” usually means the same thing as a newbie or “noob.” Sirlin means something more specific, however. He is referring to a player who loses but blames the loss on something external to the player: the game is broken, the opponent used a cheap move, the move should be banned, and so on.

Furthermore, the scrub is limited in game performance because of a set of self-imposed rules. They feel good about themselves because they never use “cheap” moves. This is the essence of the scrub mentality. They play by their own rules, rather than by the rules of the game, and if their opponents do not play by their rules, the opponents are labeled “cheap,” “boring,” “unfair,” “dirty players,” etc.

Conversely, players who play to win do whatever it takes to win, even if it means being labeled by scrubs. True competitors do not care about these negative labels. They prove they are the best by winning at tournaments.

For example, a popular competitive video game is Super Smash Bros., in which classic Nintendo characters are pitted against each other in hand-to-hand combat. The way this game works is that attacks do damage, and the more damage a character has sustained, the easier it is to throw them out of the ring. The first player thrown from the ring three times loses. In the first Smash game, a character named Kirby was considered more powerful than the rest of the characters and was even banned at some tournaments. Kirby has an undefeatable move where he sucks in an opponent and jumps off the edge with him. This is called “Kirbycide,” and it works when Kirby is ahead. In the second Smash game, the designers modified the Kirby character to make him much easier to defeat. At that point very few competitive players ever used Kirby. Many players consider Kirbycide to be a cheap move and are angered by it. Competitive players consider it a viable strategy. Watch this video for a competitive match including Kirby (Chu Dat vs. Chillin Dude). At 1:40 you can see the dreaded Kirbycide, and at 5:30 you can see another “cheap” move known as turtling. I don’t know why Chillin didn’t keep up the turtling; he would have won.

Perhaps you’ve played with scrubs. Have you read about them in the Bible?

Biblical scrubs

Jesus often faced the scrub mentality when teaching the Pharisees. “Why don’t your disciples wash their hands before they eat?” (Mark 7:1–23). “Your disciples are picking grain on the Sabbath!” (Matthew 12:1–14). The Pharisees played by their own rules, which they called the tradition of the elders, and expected everyone else to follow them, too. Jesus said to them, “Woe to you, teachers of the law and Pharisees, you hypocrites! You give a tenth of your spices—mint, dill and cumin. But you have neglected the more important matters of the law—justice, mercy and faithfulness,” and “You clean the outside of the cup and dish, but inside they are full of greed and self-indulgence.” (Matthew 23:23, 25).

Paul faced the scrub mentality when teaching the Gentile believers in Colossae: “Do not let anyone who delights in false humility … disqualify you. … [T]hey are puffed up with idle notions by their unspiritual mind.” (Col. 2:18). Whoever those teachers were that Paul was fighting against were again playing by their own rules and imposing their rules on others. “These rules … are based on merely human commands and teachings. Such regulations indeed have an appearance of wisdom, with their self-imposed worship, their false humility and their harsh treatment of the body, but they lack any value in restraining sensual indulgence.” (Col. 2:22–23). Like a scrub, the self-imposed rules are keeping you from succeeding at what you really want.

Have you seen the scrub mentality in your own life?

The game of life

Life is not a game, but let’s see how far the analogy takes us. A game has a system of rules and therefore an objective measure of progress. If you are playing by the rules, and winning more games, you are improving in your desired goal of playing to win.

God has a system of rules, the nature of God. God’s nature is knowable by revelation. It is prescribed to us (partly) as a moral code. When a person has not come to terms with the sinful nature and accepted the grace of God and the saving work of Jesus, “they are imprisoned in their own mental constructs,” like a scrub, even if they are trying to live a moral life. All they have to work with are the moral codes they either come up with on their own or inherit from their parents and environment.

Games have an objective measure of improvement. How are you improving in your Christian walk? According to the rules I listed, you are winning if you are conforming more to the nature of God. This is difficult to determine, although Jesus and Paul listed a few in the passages already cited: justice, mercy, and faithfulness (Matthew 23:23); compassion, kindness, humility, gentleness, and patience (Col. 3:12). Sometimes it hardly seems objective at all. Are you more patient than you were 5 years ago? Can you even tell?

Sirlin (p. 1) wisely shies away from applying his principles outside the game: “games are sharply defined by rules; life is not. Exploring extreme corner cases of a game is what high-level play is all about. Exploring extreme situations in life can easily be socially unacceptable, morally wrong, and illegal.” Granted, some extreme lifestyle choices are all three of these. However, fully relying on God also allows you to reach extreme corner cases of life. How about pursuing a call to preach the gospel in an unreachable corner of the world? How about increasing your tithe by 1% every year until the day you die? How about choosing to live in a “rough” neighborhood? How about praying for every student who comes into your office, even at a state school where you could be in danger of job termination? How about praying for your spouse every single day? Or really and truly living to “rejoice always, pray continually, give thanks in all circumstances” (1 Th. 5)? I hope I someday have enough faith to do any and all of these.

Conclusion

As I study and teach computer science and video game design in particular, I am finding connections to truth and life beyond the technical skills we typically focus on. “Playing to win” is significant as an apologetics argument for the Christian life, which seems irrational to some people. As far as I can tell, Sirlin himself is an atheist. His recommended reading list says The God Delusion by Richard Dawkins is “Possibly the most important book in the world. Not a joke. It will be overlooked.” I presume he sees the scrub mentality in religious people. I think he does not realize that his own work points to faith.

Paul, 1 Corinthians 9:25:

Everyone who competes in the games goes into strict training. They do it to get a crown that will not last, but we do it to get a crown that will last forever.

Smash Trophy

Switching strategies

On the Ludology podcast this week, they said that game balance depends in one respect on how easy it is to switch strategies mid-game. If it is too hard to switch strategies, the endgame becomes meaningless, because there is no point in playing further once a strategy becomes dominant. But if it is too easy to switch strategies, the beginning of the game is meaningless, because you can switch at the end to win without regard for the rest of the game. So the key to making the whole game meaningful is to balance how easy or hard it is to switch strategies.

Entity-Component-System architecture

Recently I have been learning about the Entity-Component-System architecture for video game programming. I think it will help out with my “World’s Tiniest RTS” game. I learned about it here, in Robert Nystrom’s Game Programming Patterns. I also heard on the Exploding Rabbit podcast how Jay Pavlina (of Super Mario Bros. Crossover fame) uses the pattern. Here is my Clojure code for it, currently:

(defn create-game []
  {:entities {}})

(defn create-entity []
  [(java.util.UUID/randomUUID)
   {}])

(defn add-entity [game entity]
  (update-in game [:entities] conj entity))

(defn add-component [game entity com data]
  (assoc-in game [:entities (first entity) com] data))

;;example
(let [e1 (create-entity)]
  (->
    (create-game)
    (add-entity e1)
    (add-component e1 :position [3 4])
    (add-component e1 :name "ball")))

Powered by WordPress & Theme by Anders Norén