Skip to main content

A machine learning game framework based on Pygame

Project description

MLGame

mlgame mlgame

Python 3.9 pygame


這是一個遊戲AI競賽的框架,依照此框架所開發的遊戲,可以透過AI來玩遊戲,並進行AI競賽。

Table of Contents

! 重要 !

  1. 此次更新為大幅度更新專案架構,原有的指令方式、遊戲皆無法執行,因此請注意遊戲與MLGame的搭配。

使用方式

終端機範例

  • 列出 help 文件

    python -m mlgame -h
    
  • 命令列格式

    python -m mlgame [options] <game_folder> [game_params]
    
    • 執行打磚塊遊戲
      python -m mlgame \
      -f 120 -i ./path/to/ai/ai_client_file_name.py \
      ./path/to/game/arkanoid \
      --difficulty NORMAL --level 3
      
      • AI和遊戲的資料夾路徑可以使用相對路徑或是絕對路徑
      • 遊戲參數game_params須參考各個遊戲

位置引數(Positional Argument)

  • game_folder
    • required
    • 遊戲資料夾所在的路徑,此路徑下需有config.py

功能性引數(Functional Argument)

options

  • --version 顯示MLGame版本號
  • -h, --help
    • 提供參數的說明
  • -f FPS, --fps FPS
    • 設定遊戲的遊戲更新率(frame per second),遊戲預設為每秒更新30次。
    • default : 30
  • -1, --one-shot
    • 表示遊戲只執行一次,沒有加上這個參數,遊戲皆會不斷重新執行。
    • default : False
  • --nd, --no-display
    • 加上此參數就不會顯示螢幕畫面。
    • default : False
  • --ws_url WS_URL
    • 加上此參數,會建立一個websocket connection,並將遊戲過程中的資料傳到指定的路徑,若路徑失效,則遊戲無法啟動。
  • -i AI_Client, --input-ai AI_Client
    • 指定要玩遊戲的AI,AI的檔案中,需要包含MLPlay這個class。
    • 若有多個玩家,可直接參考下方案例,路徑可以使用絕對路徑與相對路徑。
      -i ./path/to/ai/ai_01.py -i ./path/to/ai/ai_02.py 
      
    • AI數量需符合遊戲需求,每個遊戲都會有最小值與最大值,不足的會以最後一個AI自動補足,多的會自動刪去。
      • 遊戲若需要2個AI,給到1個AI則會同時扮演1P 2P
      • 遊戲若需要2個AI,給到3個AI則會自動排除最後一個

game_params

  • optional
  • 執行遊戲的參數依照每個遊戲有所不同,格式為--name_of_params value_of_params

相關專案

  1. PAIA-Desktop
  2. 範例遊戲 easy_game
  3. 打磚塊 arkanoid
  4. 乒乓球 pingpong
  5. 賽車 Racing Car
  6. 迷宮自走車 Maze Car

Future Work

  1. Non-python Client Support
  2. test case

Change Log

View CHANGELOG.md

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

mlgame-9.5.2.7a0.tar.gz (72.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mlgame-9.5.2.7a0-py3-none-any.whl (39.1 kB view details)

Uploaded Python 3

File details

Details for the file mlgame-9.5.2.7a0.tar.gz.

File metadata

  • Download URL: mlgame-9.5.2.7a0.tar.gz
  • Upload date:
  • Size: 72.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.6

File hashes

Hashes for mlgame-9.5.2.7a0.tar.gz
Algorithm Hash digest
SHA256 124f1767bf557a78968bf057bbf4d0675c6678cfc37bb0d2551455ac2a78f9bf
MD5 1151b72af93e9ff446bab64d8d52ef52
BLAKE2b-256 317c3c22eeed2f42912dca40891c6dfbfe5854b7b128e0c7518004277ce02fc8

See more details on using hashes here.

File details

Details for the file mlgame-9.5.2.7a0-py3-none-any.whl.

File metadata

  • Download URL: mlgame-9.5.2.7a0-py3-none-any.whl
  • Upload date:
  • Size: 39.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.6

File hashes

Hashes for mlgame-9.5.2.7a0-py3-none-any.whl
Algorithm Hash digest
SHA256 2d5b6785278c71f03de912ad8dde2eb2e857f481bd8a3290f15cb6ded7191284
MD5 133bf29e70d4ccc313d8f93512fdab8c
BLAKE2b-256 a697c7e2184a329d3e7e9120cb881fce22366671088ce6e05d8922e5185ac27d

See more details on using hashes here.

Supported by

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