Monday, September 4, 2023

Definition of a game

Having a technical definition that we can agree on may make communication easier since there are some things currently called "games" that really aren't games. So, what EXACTLY is a game? This may seem like a silly question but the following highly detailed answer will be useful whenever exact terms are needed.

A game can be defined with a series of dichotomies:

  1. If a piece of entertainment is interactive then it is a plaything. Otherwise it is media (eg: a movie, books).
  2. If a plaything has at least 1 hard rule then it is an activity. Otherwise it is imaginative play (eg: kids playing house, improvisational comedy).
  3. If an activity has a defined end, then it is an exercise. Otherwise it is a pastime (eg: jogging, fishing, D&D).
  4. If an exercise has scoring then it is a challenge. Otherwise it is recreation (eg: Karaoke, Square dancing).
  5. If a challenge has uncertainty, then it is a contest. Otherwise it is a measurement (eg: "who is taller?").
  6. If a contest has an opponent, then it is a conflict. Otherwise it is a puzzle (eg: Rubik's cube or the card game solitaire).
  7. If a conflict can interfere with an opponent, then it is a game. Otherwise (players can only outperform opponents) it is a competition.

Additionally, all conflicts can be further divided:

  1. If a conflict's opponent is another player, then it is competitive. Otherwise, the artificial opponent acts according to a rule system. Competitive games: baseball, western chess, Super Smash Bros Ultimate (when PvP). Competitive competitions (not a great term): judged gymnastics, competitive figure skating, talent show.
  2. If a noncompetitive conflict only has a single player, then it is solo. Solo games: board game final girl, UnderTale. Solo competitions: golf (when solo) due to par, the board game Turing Machine since when solo you compare your score to a "par" which acts as an opponent score.
  3. A noncompetitive conflict with multiple players is cooperative. Cooperative games: Spirit Island, Monster Hunter World online. Cooperative competition: board game Turing Machine (I don't know another example of an artificial opponent that you have to outperform. I don't think this game even officially has a cooperative mode)

Stop here for TL;DR.

This blog post was inspired by https://www.youtube.com/watch?v=2owa2s8GdlM (26:56) Luck and Skill in Games by GDC (2013 GDC, designer Skaff Elias) which stated that nearly every definition of game includes indeterminacy (which I called uncertainty). This video is great (the info is great; the presentation is ok) and it needs more love (hence the shout out). Although it already has more views than my blog will ever get so 🤷.

The above strict definition of game is for things that are definitely games (see examples in the conflict dichotomies). For everything that we call "games" the only common trait is that the entertainment is interactive (and therefore a plaything). Non-game playthings are not inferior but some considerations are different (game theory and min-maxing might not apply) and the interaction is of a different kind (you can't "play to win" if there is no winning).

Note that it is possible for an entertainment of 1 type to become another type by adding/removing criteria. Jogging for a while with no particular goal is a pastime but can be made into a solo competition like "let's see if I can run 3 laps around my house within 1 minute". Also a few of the terms used aren't the best ("competitive competition" is the worst). I'll welcome feedback if anyone can improve them (I said to my 0 readers).

The easiest way to justify my definition is to criticize Chris Crawford's definition which is a series of dichotomies (this is also where I got some of my terms):

  1. If a creative expression is made for money, then it is entertainment. If it was made for its own beauty then it's art.
  2. If a piece of entertainment is interactive then it is a plaything.
  3. If a plaything has goals associated with it then it is a challenge. Otherwise, it is a toy.
  4. If a challenge has an "active agent against whom you compete" then it is a conflict. Otherwise, it is a puzzle.
  5. If a player in a conflict is allowed to attack an opponent to interfere with them then it is a game. Otherwise, if players can only outperform opponents, then it is a competition.

Which I copied from https://en.wikipedia.org/wiki/Game#Chris_Crawford (then reworded) because I don't have time to read his 476 book "Chris Crawford on Game Design". I'll explain what's good with my definition and bad with his definition in order of the points:

-/1 (purpose) Chris's #1 isn't a dichotomy: there are other creative expressions such as tools which are made for utility. "Entertainment" would be difficult to define nor is it necessary since we don't need an infinitely regressive chain, we only need the term right above the common ancestor of all things that use the common usage of "game". Thus, my definition starts with entertainment since the meaning is intuitive and it is the term above plaything (which is the common ancestor).

1/2 (interactive) My #1 and Chris's #2 match (his lacks an alternate term). Plaything is the common ancestor of the common term for "game" and thus this point is an important inclusion since it separates entertainment that aren't considered games by any definition. The common term only requires interaction which influences how a thing is played with.

2/- (at least 1 hard rule) My #2 (which Chris doesn't have) is an important component of a game that's easy to meet the requirements of. Having at least 1 hard rule means that breaking said rule(s) is cheating. "Let's pretend we work in a cafe" is a plaything that you can't really cheat in because there aren't any enforced rules. It is possible to not be interacting properly but every rule is based on social expectations of how to play with others which is flexible compared to rules on what actions is/isn't allowed. You could argue that all rules in Dungeons and Dragons 5e are flexible due to the game master having all authority however every game master will have some kind of hard rules (which may differ by GM). It is definitely possible to cheat in D&D. You might think that the difference between "not playing properly" and "cheating" is subjective however the difference I'm making is that all rules for playing pretend are based on the social expectations of your group whereas D&D has rules that exist independent of groups (which each group applies as needed).

The card game Mao is an edge case since it does have a set of hard rules which aren't revealed then has "if you break these rules, you get penalty X" which acts as a meta-rule in the game. You could argue that breaking the hidden rules isn't cheating but it still definitely has hard rules. Additionally, some games have rules that change over time in which case to qualify it needs to have at least 1 hard rule at all times (although it need not be the same one). There may still be some other edge cases and gray zones that I haven't thought of but I've nailed it down as objectively as I could. Additionally, my #2 is important because separating plaything (the common ancestor) is the first deviation between technical definition and common definition of game.

3/- (a defined end) Chris's #3 implies what my #3 explicitly states. Games must have a pre-defined rule stating when the activity will end. Examples: after 10 minutes, when someone plays their last card, when all players pass, or when the round ends after someone scores at least 30 points. "Games" like D&D are called "tabletop role-playing games" but they don't meet my strict definition of game because they have no defined end and as such it isn't possible to win or lose (see my #4). It has at best a partially defined ending: you might say that if all players die (TPK) then the game ends but that's not entirely true since there's nothing stopping players from making new characters and continuing the same plot. A TTRPG only ends when the players and GM say it's over (for any reason). There's no rule that requires a typical TTRPG to end.

4/3 (scoring) My #4 matches Chris's #3 but I used a better term. Games must have a way to determine win/lose/tie. The scoring need not be quantitative (although it typically is). A talent show can use qualitative scoring if a judge decides which is better without providing a number (nor an audience vote count). Example of a competitive game with qualitative scoring: boxing. If 1 boxer falls over unconscious then the outcome is clear even without a judge but there's no number for how well each side did. A typical TTRPG has no way to win/lose: you play to have fun regardless of character death. In fact, the role-playing game Fiasco (which I think bills itself as a TTRPG which doesn't seem correct to me but I have no definition for TTRPG so I can't disprove it) a player will often intentionally kill their character because it makes for a better plot. A TPK in Fiasco sounds like it'd be a great time which emphasizes that there's no win/lose (having the most white dice isn't a player "win" either). I know I'm harping on TTRPGs not technically being games but they are seemingly asymmetric competitive games so I'm being clear on why that's not the case despite some considerations for asymmetric competitive games applying. In D&D 5e you don't/can't play to beat the GM nor is he playing to win.

5/- (uncertainty) Chris's #4 implies what my #5 explicitly states. The outcome of a game (the scoring) must initially be uncertain. The presence of an opponent (Chris's #4) does make an outcome uncertain because the opponent adds a means of failure. This requirement is listed right after scoring because scoring is the thing that is uncertain. All games will certainly eventually end but who will win the game and by how much isn't known before the game starts. For example: the first time "who is taller?" is done it is uncertain who is taller. It turns out that Alice is taller than Bob. Immediately after this competition is resolved Bob wants a rematch and it is found that their heights haven't changed in the past minute. It wouldn't make sense for Bob to keep demanding rematches because he has no chance of winning. The outcome is known before the rematch even starts. This goes against the intuitive definition of "game". For a game to be fair every player must stand some chance of winning otherwise it would be something else, like a performance demonstrating the perfect strategy. This is the problem for "solved games" which is a game theory term for games that have unbeatable strategies ("solutions"). Chess is effectively unsolvable but tic-tac-toe's solution is so simple that adults never bother playing the game. Uncertainty being a hard requirement is more of an axiom than something I can defend but the point seems well accepted (as per that GDC video). Additionally, it's difficult to lack uncertainty so this point is of no consequence. The importance of it being listed is to discuss how uncertainty is done in a game: player skill or random numbers/cards etc (better explained in that GDC video).

6/4 (an opponent) My #6 mostly matches Chris's #4. However (quoting wikipedia) "Crawford admits that this is a subjective test. Video games with noticeably algorithmic artificial intelligence can be played as puzzles; these include the patterns used to evade ghosts in Pac-Man." That's absurd. Pac-Man is a game by my strict definition. Chris should use a more objective definition like mine. It doesn't matter how dumb an opponent is: it's still an opponent (artificial or not). The board game Spirit Island is a cooperative game where the enemy is controlled by drawing a card from a deck (then following a few steps). This opponent is very predictable (especially if you don't have events), eg "noticeably algorithmic AI". Pac-Man and Spirit Island are obviously games (by my strict definition). Chris's #4 effectively excludes all cooperative games which is naive and unnecessary. Ideally all points in the definition of a game would be objective and this item is easy to enforce objectively (see next point).

7/5 (can interfere) My #7 matches Chris's #5. If an opponent has any way to interfere (or you attack it) then it should clearly be called an opponent. In the case of a solo/cooperative competition: that's where "is this an opponent?" becomes less clear. I say that if a human opponent (including a team) could do X but X is being done by a system instead then it's an artificial opponent. For example: a metal puzzle that you try to remove the ring from doesn't have an opponent because humans can't control physics. Conversely: when playing golf solo you can compare your strokes to par. This is an artificial opponent because a human could have had that many strokes.

After starting to write this post I saw https://www.youtube.com/watch?v=1kNi3cLB0sI (26:31) "RPGs Were Never About Roleplaying" by "Adam Millard - The Architect of Games". Which does a great job of defining each type of RPG and explaining the common ancestor (investing in a playable character). Likewise, everything that qualifies for the common term "game" does have a spot on my technical definition of game. And I identified the common ancestor as plaything.

Pure software RNG can be truly random

This is a sequel to https://skyspiral7.blogspot.com/2014/09/truly-random.html so read that first. I noticed that Wikipedia was using the phrase "true random" without ever defining what is required for a generator to be truly random. Wikipedia seems to imply that true randomness requires measuring physical things for entropy and that software alone can't do it.

In my last post about randomness, I said "A truly random event has an outcome (or occurrence) that can never be predicted" which is true but not specific enough. If God is the only person who can predict the event and humans never can then that should also be considered true random. But "humans can never predict (even using tools like computers)" is still more strict than it needs to be.

The whole point is indeed to be impossible to predict but consider a 6 sided die: if a computer knows the exact inputs it could predict the result. If a computer doesn't know the inputs then it would have to guess the height from table, spin, initial orientation, and size of die at a minimum (table's friction, die's friction, die's weight, and die's fairness are minor). However, there are way too many possible values to guess compared to the 6 possible outcomes. This means that given a lack of information about the inputs it is easier to guess the outcome than to simulate the process. This makes the process effectively truly random since without the inputs there's no possible formula. Therefore, I propose this definition: a truly random event has an outcome (or occurrence) that can't currently be predicted with more certainty than evenly spread over every possible outcome. Given more information something can lose the "true" status but as long as it is "true" then prediction is impossible which means that a pure software pseudorandom number generator could achieve true randomness (hold your fire there's more requirements to come). To explain why I'll use OTP as an example.

I won't explain how a One Time Pad (OTP) works since it isn't very relevant (you can look it up: it's simple). OTP's perfect encryption relies on the lack of pattern which is only possible if the keys are truly random. Suppose Alice encrypted a message using OTP but the key was digits of pi. Eve knows that Alice's message starts with "DearBob" so she subtracts and sees that the keys would have to be 3141592 and Eve realizes that this is pi. Using that information Eve is able to crack the entire message. These keys are not truly random because the rest of the numbers were predicted with certainty. If Alice tries again using a pseudorandom number generator seeded once at the start, then Eve can do the same thing by guessing the generator and seed (again not truly random). One feature of OTP using truly random keys is that even if the first few letters can be guessed it will tell you nothing about the rest of the message because the rest has no connection at all to the previous numbers. In order for a pseudorandom number generator to meet that requirement it would need a new seed for every number generated, which is to say it would use entropy as-is (stretching the entropy isn't allowed since that would form a small pattern).

Wikipedia says that a cryptographically secure pseudorandom number generator (CSPRNG) needs 2 things. The first is that given the sequence so far it shouldn't be possible to guess the next bit with more than 50% accuracy. The second requirement is that if the entire state of the CSPRNG is revealed or correctly guessed, the rest of the sequence (forward and back) can't be figured out. The first requirement obviously meets my definition of true random and the second does as well because if a pattern is revealed then "true" status is lost. I won't say that all CSPRNG are true random because Wikipedia makes it sound like there's different levels of strength based on what's required and that's technically also true for true random but I just don't know enough about CSPRNG.

It is possible for software to obtain good entropy without special hardware. /dev/random for example looks at timings of low level stuff and as such is truly random (assuming it doesn't stretch the values). Measuring background static, radioactive decay, etc isn't needed (although such hardware might have a higher bandwidth of entropy). Now you might be saying that /dev/random can be fed information and in that case yes it would lose its true random status and if it can lose "true-ness" then it was never true to begin with. However, that's how all "true random" works: they can all lose their status. Rolling dice is considered true random and yet it's possible to roll dice in a way to intentionally feed it specific input values (spin etc) which destroys the entropy and makes it possible for a computer to pre-calculate the result with high certainty. Thus, destroying the entropy causes the process to lose its "true" status. That's universally true: true randomness requires entropy (which is unknown info) and by knowing that info (thus demoting the entropy to regular input data) you also cause the true randomness to be demoted to pseudorandom.

Now you may be thinking that no one can know or control certain quantum stuff and while technically true (for now at least) that isn't useful because the device that reports the value can be hijacked. Assuming that your atomic decay detector hasn't been hijacked is the same as assuming that no one has messed with /dev/random. Now imagine a "change my mind" booth meme and try to think of a reason why pure software entropy is "not as random" as hardware based entropy. That's not to say hardware entropy is useless: it might (or might not) have higher bandwidth (depending on device vs software entropy's source).