Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Unitary[ Create game_design.md #154

Merged
merged 3 commits into from
Sep 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions docs/unitary/game_design.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# Game Design
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove space between # and Game.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks the markdown. If you want it to be header 1, it has to have a space.


This guide explains principles that can help you decide how to implement quantum effects in your game idea.

## State
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove space.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, this is needed for markdown.


When you design a classical game, you define how your game objects transition from one state to another. For example, the level, heath, position, and progress of players and NPCs all change according to your game mechanics.

A quantum game enables you to use quantum mechanics to evolve the state of your game objects. Game objects whose state changes unpredictably–in a way that feels natural, as opposed to random–are best suited to quantum effects.

A poor choice for a quantum object might be a block that releases a coin the first time it’s knocked from below, but never again. The coin block has a finite binary state. A single interaction does a poor job of enabling the player to experience quantum effects.

An equally simple (but more interesting) choice for a quantum object might be a door. You can design your game mechanic to redirect your player to another part of your game through the door, depending on its state. Your game mechanic can enable the door to behave in unpredictable, non-random ways through a combination of quantum principles.
##Superposition
On its own, superposition is probabilistic behavior. List the states that a property of your game object can manifest. The unitary library will allow the game object to be a combination of these states, using a principle called superposition.

When you retrieve the classical state of your object, it has a specific state (100% probability). If you create a superposition of states, the probability is shared by a combination of some or all of the states on your list (while your game object remains in a quantum state).

You can put your game object into a probabilistic state by using the `QuantumEffects` API:
* By applying a `Split` effect.
* By applying a `Superposition` effect.
* By using the `effect_fraction` argument when you call an effect that supports it.

---
You can apply this principle to any property of the door, such as the destination beyond the door, whether it is locked, and so on.

---

## Entanglement
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove space.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same.


Entanglement links the fate of any two (or more) quantum objects. The relationship can be mutual (objects share a single fate) or exclusive (objects have opposite fates). In quantum mechanics, entanglement means that when you observe the classical state of one object, you immediately know something about the state of the other.

As your quantum state grows, entangled objects can prompt non-obvious outcomes for your game objects.

You can create entanglement when you apply an effect conditionally between quantum objects, by using the `quantum_if()` method.

---
You can design a game mechanic that links properties of the door to the player’s actions in the game. For example, the location or destination of the door might be linked to other doors or rooms that the player has visited, or to a key that the player uses to unlock the door.

---

## Interference
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove space.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same.


Interference describes a situation where two or more quantum objects influence each other's outcomes. Whereas entanglement describes whether two objects are likely to be related, interference is an effect where quantum objects can make an outcome more (or less) likely.

When designed well, your player can experience interference effects unexpectedly during game play.

Interference requires the following:
* Your objects must be in superposition.
* Your objects must be entangled.
* Your objects must have phase.

You can create the opportunity for interference effects by using the `Phase` effect, or the `effect_fraction` argument when you use a `QuantumEffect` that accepts the argument.

---
The location or destination of a door might depend on previous engagements with the door.

---

## Measurement
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove space.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same.


A quantum state is a complex superposition of classical states. When you need to control the classical flow of your game, you need to retrieve a classical state from the quantum state. This is the act of measurement.

Your game mechanic defines when you need to measure the quantum state.

Use the `pop` method on your `QuantumWorld` object to retrieve the classical state of your quantum objects.

---
If you need to choose a destination for the player who walks through the door, you might need to measure the quantum state.

Alternatively, you could enable your player to play in superposition if the door could send the player to multiple possible destinations. In this case, the player becomes entangled with the state of the door.

---

## Simplicity
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove space.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same.


Keep the quantum state of your game simple. A smaller quantum state makes your game easier for the player to understand. A smaller quantum state also improves your ability to run your game on a near-term quantum computer.

Simplicity is a process. Use this opportunity to think again about the division between the quantum state and the classical state of your game.

## Composability
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove space.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same.


The Unitary library allows for any quantum object to have up to four states. This attribute balances the limits of current classical computing and quantum computing hardware with expressivity and creativity.

The current set of quantum games, like Quantum Chess and Tiq Taq Toe, generate engagement through the interaction of quantum objects rather than quantum objects with a multitude of states.

When you design your quantum game, think about expanding the set of probable outcomes through the interaction of quantum objects, rather than adding more states to your object. In some cases, you might need to think differently about the data that you track about your objects.

For ideas about working with the four-state limitation, see the following section.

## Example: Quantum Chess
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove space.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same.


In Quantum Chess, the positions of pieces on the board are the state that will be quantum.

There are multiple ways to think about position. You could assign each piece a square value. You would then have a list of 64 values, {a1, a2, … h8} assigned to each piece. Or you could assign each square a piece value, which would give you a list of 13 values assigned to each square. But an even simpler construction is to just say whether each square is “occupied” or “unoccupied”, and have a separate data structure tell you what piece is on a square if it is occupied.

Loading