Godotのディレクトリ構造を調査する

作成日
更新日

デフォルトのファイル

最初の2Dゲームを作ったとき

.
├── art
│   ├── House In a Forest Loop.ogg
│   ├── House In a Forest Loop.ogg.import
│   └── playerGrey_walk2.png.import
├── fonts
│   ├── FONTLOG.txt
│   ├── LICENSE.txt
│   ├── Xolonium-Regular.ttf
│   └── Xolonium-Regular.ttf.import
├── hud.gd
├── hud.gd.uid
├── hud.tscn
├── icon.svg
├── icon.svg.import
├── main.gd
├── main.gd.uid
├── main.tscn
├── mob.gd
├── mob.gd.uid
├── mob.tscn
├── player.gd
├── player.gd.uid
├── player.tscn
└── project.godot

シーンとスクリプトを除くと次の通り

.
├── art
├── fonts
├── icon.svg
├── icon.svg.import
└── project.godot

art フォルダ

  • ゲーム内で使用する画像やアセット(スプライトなど) を保存するフォルダ
  • 例えば、背景、キャラクター、エフェクトの画像などが入る

fonts フォルダ

  • フォントファイル(.ttf, .otf)や、Godotのカスタムフォントリソース(.tres, .res) を入れるためのフォルダ。
  • UIやHUDのテキストに使われる

project.godot

  • プロジェクトの設定ファイル(Godot のプロジェクトメタデータ)。
  • エンジンがこのファイルを見てプロジェクトとして認識します。

シーンファイル

*.uid ファイルはシーンファイルでは内部で定義されているっぽい。

スクリプトファイル

  • .gd ファイル
  • .gdファイルを作ると .gd.uidも作成される
    • リソースのユニーク識別子(UUID)を保持するためのファイル

整理の方法

オープンソースのプロジェクトを見てみる

全部クローンして見てみる。

learn-gdscript

GDQuest/learn-gdscript Learn to Code From Zero With Godot 3というWebでGDScriptの勉強ができるサービス。

フォルダ構造(一部割愛)

.
├── BigFont.tres
├── BigFontTheme.tres
├── CHANGELOG.md
├── LICENSE
├── README.md
├── addons
│   ├── ColorPickerPresets
│   ├── crypto_uuid_v4
│   ├── gdscript-course-builder
│   ├── gdscript-slice-exporter
│   └── gut
├── app-practice-screen.png
├── app-practice-screen.png.import
├── asset_lib_icon.png
├── asset_lib_icon.png.import
├── autoload
│   ├── Events.gd
│   ├── Events.gd.uid
|   ~
│   ├── UserProfiles.gd
│   └── UserProfiles.gd.uid
├── course
│   ├── Documentation.tres
│   ├── README.md
│   ├── common
│   ├── course-learn-gdscript.tres
│   ├── documentation.csv
│   ├── documentation.csv.import
│   ├── extra-content.md
│   ├── glossary.csv
│   ├── glossary.csv.import
│   ├── glossary.tres
│   ├── lesson-1-what-code-is-like
│   ├── lesson-10-the-game-loop
|   ~
│   ├── lesson-9-adding-and-subtracting
│   ├── number_lessons.py
│   ├── screenshot.png
│   └── screenshot.png.import
├── default_env.tres
├── export_presets.cfg
├── game_demos
│   ├── DrawingTurtle.gd
│   ├── DrawingTurtle.gd.uid
│   ├── DrawingTurtle.tscn
│   ├── DrawingTurtleLabel.tscn
│   ├── WrappingNode2D.gd
│   ├── WrappingNode2D.gd.uid
│   ├── font_turtle_label.tres
│   ├── panel_turtle_label.tres
│   ├── run_and_jump
│   ├── shadow.svg
│   ├── shadow.svg.import
│   ├── turtle.png
│   ├── turtle.png.import
│   ├── turtle.svg
│   └── turtle.svg.import
├── gut
│   └── integration
├── gut_panel.png
├── gut_panel.png.import
├── html_export
│   ├── compile.md
│   ├── index_template.html
│   └── static
├── i18n
│   ├── __pycache__
│   ├── check_and_integrate_translations.py
│   ├── extract.py
│   ├── fr
│   ├── it
│   ├── ja
│   ├── match_and_merge_po_translations.py
|   ~
│   ├── working-with-translations.md
│   └── zh_Hans
├── icon.png
├── icon.png.import
├── make_release
├── markdown-to-bbcode.py
├── project.godot
├── requirements.txt
├── resources
│   ├── ContentBlock.gd
│   ├── ContentBlock.gd.uid
│   ├── Course.gd
│   ├── Course.gd.uid
|   ~
│   ├── Lesson.gd
│   ├── Lesson.gd.uid
│   ├── QuizInputField.gd
│   ├── QuizInputField.gd.uid
│   ├── ScriptSlice.gd
│   └── ScriptSlice.gd.uid
├── run
├── script_checking
│   ├── GDQuestCodes.gd
│   ├── GDQuestCodes.gd.uid
|   ~
│   ├── error_database.csv
│   └── error_database.csv.import
├── tests
│   ├── TestGDScriptCodes.gd
│   ├── TestGDScriptCodes.gd.uid
│   ├── TestResourcePaths.gd
│   ├── TestResourcePaths.gd.uid
│   └── gdscript-error-list.txt
├── ui
│   ├── LoadingScreen.gd
│   ├── LoadingScreen.gd.uid
│   ├── LoadingScreen.tscn
│   ├── UICore.gd
│   ├── UICore.gd.uid
│   ├── UICore.tscn
|   ~
│   ├── components
│   ├── icons
│   ├── screens
│   └── theme
└── utils
    ├── RegExpGroup.gd
    └── RegExpGroup.gd.uid

TD-Godot-Games

TutorialDoctor/TD-Godot-Games かなり古いがディレクトリだけ見てみる。

.
├── 2d Senses
│   ├── Assets
│   ├── Credits.txt
│   ├── Levels
│   ├── README.md
│   ├── engine.cfg
│   ├── icon.png
│   ├── icon.png.flags
│   └── screenshot.png
|   ~ 割愛
├── Fading Credits
│   ├── Assets
│   ├── README.md
│   ├── Scenes
│   ├── engine.cfg
│   ├── icon.png
│   └── icon.png.flags
├── Floppy Bird
│   ├── Assets
│   ├── Credits.txt
│   ├── Intro.txt
│   ├── Levels
│   ├── README.md
│   ├── engine.cfg
│   ├── icon.png
│   ├── icon.png.flags
│   └── screenshot.png
├── Godot Dev Process.md
├── GodotSnippets.gd
├── Platformer Starter
│   ├── Assets
│   ├── Credits.txt
│   ├── Levels
│   ├── README.md
│   ├── addons
│   ├── engine.cfg
│   ├── icon.png
│   ├── icon.png.flags
│   └── platformer.png
├── Play_Video
│   └── test.md
├── Playground
│   ├── Assets
│   ├── README.md
│   ├── Scenes
│   ├── engine.cfg
│   ├── icon.png
│   ├── icon.png.flags
│   └── screenshot.png
├── README.md
├── Read File
│   ├── README.md
│   ├── Scenes
│   ├── Scripts
│   ├── engine.cfg
│   ├── gdscript.md
│   ├── icon.png
│   └── icon.png.flags
├── StoryBoard
│   ├── Assets
│   ├── Credits.txt
│   ├── Intro.txt
│   ├── Levels
│   ├── README.md
│   ├── engine.cfg
│   ├── export.cfg
│   ├── icon.png
│   ├── icon.png.flags
│   └── screenshot.png
└── starwars
    ├── Assets
    ├── Scenes
    ├── engine.cfg
    ├── icon.png
    ├── icon.png.flags
    └── readme.md

engine.cfgproject.godot の先祖らしい。2.x では engine.cfgを使っていたらしい。 つまり、いろんなデモがまとまったプロジェクトであることがわかる。

例えば、Floppy Bird にフォーカスするとさらに中身は次のようになっている。

.
├── Assets
│   ├── scripts
│   │   ├── GodotSnippets.gd
│   │   ├── Level1.gd
│   │   ├── Level2.gd
│   │   ├── Level3.gd
│   │   ├── Menu.gd
│   │   ├── bird.gd
│   │   ├── btnToLevel.gd
│   │   ├── loopSprite.gd
│   │   ├── prog.gd
│   │   ├── scale.gd
│   │   ├── sound.gd
│   │   ├── stream.gd
│   │   └── tunnel.gd
│   ├── sounds
│   │   ├── Samples
│   │   ├── Streams
│   │   └── sounds.txt
│   └── sprites
│       ├── Backgrounds
│       ├── Bird_256
│       ├── FLappy Game
│       ├── Grass_256
│       ├── HealthBar_256
│       ├── Lamp_256
│       ├── Tree_256
│       └── grass_moving
├── Credits.txt
├── Intro.txt
├── Levels
│   ├── Level1.xml
│   └── Menu.xml
├── README.md
├── engine.cfg
├── icon.png
├── icon.png.flags
└── screenshot.png

v2.x 系では tscnもないね。.xmlファイルを利用しているみたい。

Nakama Godot Demo

heroiclabs/nakama-godot-demo

v3.4.4 のプロジェクトで古いが、リアルタイムチャットとかがあって面白そうなので覗く。

  • NakamaGodotDemoの中身をのぞいてみよう
.
├── addons
│   └── com.heroiclabs.nakama
├── assets
│   ├── background
│   ├── theme
│   └── world
├── default_env.tres
├── icon.png
├── icon.png.import
├── project.godot
└── src
    ├── Autoload
    ├── Main
    ├── UI
    └── World

godot-open-rts

lampe-games/godot-open-rts

Godot v.4のプロジェクト。

  • Godotのプロジェクト「OpenRTS」の中身をのぞいてみよう
.
├── CHANGELOG.md
├── LICENSE
├── LOGO_LICENSES.md
├── README.md
├── assets
│   ├── logos
│   │   ├── LOGO_LICENSES.md
│   │   ├── godot_logo_vertical_monochrome_dark_312x357.png
│   │   ├── godot_logo_vertical_monochrome_dark_312x357.png.import
│   │   ├── lampe_games_white.svg
│   │   └── lampe_games_white.svg.import
│   ├── models
│   │   ├── kenney-spacekit
│   │   └── primitives
│   ├── translations
│   │   ├── main_menu.csv
│   │   ├── main_menu.csv.import
│   │   ├── match.csv
│   │   └── match.csv.import
│   ├── ui
│   │   ├── background.png
│   │   ├── background.png.import
│   │   ├── icons
│   │   └── kenney-crosshairs
│   └── voice
│       └── english
├── build
├── export_presets.cfg
├── icon.svg
├── icon.svg.import
├── makefile
├── media
│   ├── banner_1400x650.png
│   ├── logo.kra
│   ├── logo_650x150.png
│   └── screenshots
│       ├── screenshot_1400x650.png
│       ├── screenshot_2_1920x1080.png
│       ├── screenshot_3_1920x1080.png
│       └── screenshot_4_1920x1080.png
├── project.godot
├── source
│   ├── Constants.gd
│   ├── FeatureFlags.gd
│   ├── FeatureFlags.tscn
│   ├── Globals.gd
│   ├── Logos.gd
│   ├── Logos.tscn
│   ├── Main.gd
│   ├── Main.tscn
│   ├── Signals.gd
│   ├── Utils.gd
│   ├── data-model
│   │   ├── MatchSettings.gd
│   │   ├── Options.gd
│   │   └── PlayerSettings.gd
│   ├── generic-scenes-and-nodes
│   │   ├── 2d
│   │   ├── 3d
│   │   └── control
│   ├── main-menu
│   │   ├── Background.tscn
│   │   ├── Credits.gd
│   │   ├── Credits.tscn
│   │   ├── Loading.gd
│   │   ├── Loading.tscn
│   │   ├── Main.gd
│   │   ├── Main.tscn
│   │   ├── Options.gd
│   │   ├── Options.tscn
│   │   ├── Play.gd
│   │   └── Play.tscn
│   ├── match
│   │   ├── AirNavigation.gd
│   │   ├── FogOfWar.gd
│   │   ├── IsometricCamera3D.gd
│   │   ├── Map.gd
│   │   ├── Map.tscn
│   │   ├── Match.gd
│   │   ├── Match.tscn
│   │   ├── MatchConstants.gd
│   │   ├── MatchSignals.gd
│   │   ├── MatchUtils.gd
│   │   ├── Menu.gd
│   │   ├── Menu.tscn
│   │   ├── Navigation.gd
│   │   ├── Terrain.gd
│   │   ├── TerrainNavigation.gd
│   │   ├── debug
│   │   ├── decorations
│   │   ├── handlers
│   │   ├── hud
│   │   ├── maps
│   │   ├── players
│   │   ├── resources
│   │   ├── units
│   │   └── utils
│   ├── resources
│   │   └── main_menu.theme
│   ├── shaders
│   │   ├── 2d
│   │   └── 3d
│   └── utils
│       ├── IconOverview.tscn
│       ├── IconRenderBooth.gd
│       ├── IconRenderBooth.tscn
│       └── Set.gd
└── tests
    └── manual
        ├── Match.gd
        ├── TestAllUnits.tscn
        ├── TestNonQuadraticMap.tscn
        ├── TestOneUnit.tscn
        ├── TestPlayerVsAI.tscn
        ├── TestUnitsFightingEachOther.tscn
        └── maps

気づいたこと

だいたい決まっているフォルダは次の通り

  • addons: プラグインをいれる
  • assets: アセットをいれる

ちょっと派閥があるが、ソースコードはまとまっている方がいい

  • sources / src/ : ソースコードを入れる
    • ここには tscnファイルもはいる

必須ファイル

  • project.godot: プロジェクトファイル
  • icon.svg / icon.png: プロジェクトアイコン
    • 同時に icon.svg.import / icon.png.import ファイルも自動で作成される

また、Godot独自のファイルは次のような形式のものが多い。tscntresproject.godot など。だいたいこんな感じで書かれている。

; コメント
[タグ]
プロパティキー = 値
サイトアイコン
公開日
更新日