Skip to main content

A highly customizable Genius Invokation TCG Simulator for AI training

Project description

Dottore Genius Invokation TCG Simulator

PyPI Version Documentation Status Python 3.10 Coverage Status license

A Genshin Impact Genius Invokation TCG simulator intended to be used for Reinforcement Learning.

This package aims to help programmers code things based on Genius Invokation TCG with ease. e.g. AI, desktop application, website...

The simulator is modeled as a finite state machine, where all game states are immutable. Optimizations are done to make sure immutability doesn't impact performance.

Basic rules of Genius Invokation TCG can be found on Fandom.

Installation

Please make sure your Python version >= 3.10 before installing.

pip install dgisim

RL Environment Usage Example

from dgisim import LinearEnv

env = LinearEnv()
rl_net = ...  # your RL network

for episode range(100):
    env.reset()
    game_state, encoded_state, reward, turn, done = env.view()

    while not done:
        ...  # do the training on the encoded_state
        game_state, encoded_state, reward, turn, done = env.step(action)

For more details please check the documentation.

Try the Simulator in Browser

Try the Simulator in CLI

Run Locally

Once installed, you may start by trying the CLI to play the game first.

You might want to run a simple python program like this:

from dgisim import CLISession

session = CLISession()
session.run()

Run Remotely

You may try the CLI online on Google Colab

CLI Simple Usages

See CLI's tutorial for showcase and explanations of the CLI.

Features

The package allows:

  • Customization of player agents
  • Customization of characters
  • Customization of cards
  • Customization of game modes

This simulator is modeled as a finite state machine, which means any intermediate state can be standalone and be used to proceed to other states.

The GameState class represents some game state in the state machine. It uses passed in Phase object to determine how to transform to another state, which means the game flow is highly customizable. (Default Mode and some Heated Battle Modes are implemented already)

Everything in the GameState object are immutable, so traversing game history and exploring different branches of possibilities in the future are not error-prone. stable simulator did optimizations for immutability. The unchanged data are shared among neighbouring game states.

GameState implements __eq__ and __hash__, enabling you to use any game state as a key in a dictionary, and discover game states on different 'game branches' being actually the same.

An ActionGenerator can be returned by any valid GameState to help generate valid player actions.

Development Milestones

Currently a full game can be played with any combination of the characters and cards implemented.

  • Implement all game phases (Action Phase, End Phase...)
  • Implement all cards (99/217 implemented) (latest-details) (stable-details)
  • Implement all characters with their talent cards (30/60 implemented) (latest-details) (stable-details)
  • Implement all reactions, death handling, revival handling etc.
  • Implement all game logics to support the implemented cards and characters
  • Implement interactive CLI for better debugging experience
  • Ensure 99% unittest coverage checking behaviour of characters and cards
  • Implement lazy player agent for minimal testing purposes
  • Implement random player agent for testing purposes
  • Implement player action validity checker
  • Implement player action choices provider

Future Plans

I have the plan to implement a simple cross-platform GUI interface for the simulator. But that will be in a separate repo.

Once this project is done, I'll be reading relative papers and develop an AI for this game. The AI is supposed to be used for learning strategies and making decks, but not against another player directly.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dgisim-0.3.4.tar.gz (134.0 kB view details)

Uploaded Source

Built Distribution

dgisim-0.3.4-py3-none-any.whl (161.0 kB view details)

Uploaded Python 3

File details

Details for the file dgisim-0.3.4.tar.gz.

File metadata

  • Download URL: dgisim-0.3.4.tar.gz
  • Upload date:
  • Size: 134.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.11

File hashes

Hashes for dgisim-0.3.4.tar.gz
Algorithm Hash digest
SHA256 a165a01d6f71918e4ee3f2117ab9e434e9500fbf704265b923b4b5365f1c4996
MD5 3fa8912400edb7cdd4d9cdff3e2d1ce1
BLAKE2b-256 53064809abb69fea22bf396a05b941d08ac60132f1a0af19806d604e0588e5b0

See more details on using hashes here.

File details

Details for the file dgisim-0.3.4-py3-none-any.whl.

File metadata

  • Download URL: dgisim-0.3.4-py3-none-any.whl
  • Upload date:
  • Size: 161.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.11

File hashes

Hashes for dgisim-0.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 76a90970baca3e4deac2c2bfca0634d1f961de9fbf520f9dfb1d52bd77c93c8f
MD5 f4128d0c371694ca77bceafb0a72f163
BLAKE2b-256 382f6b7636dadcddd47523fb20afa4ddbd51a1ba175fe26ab666eb9531eda362

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page