프로젝트 조직¶
소개¶
Godot는 프로젝트 구조나 파일 시스템 사용에 있어 제한을 두지 않기 때문에 엔진을 배울 때, 파일을 조직하는 것은 도전적인 것처럼 보일 수 있습니다. 이 튜토리얼에서는 좋은 출발점이 될만한 워크플로를 제안합니다. 그리고 Godot로 버전 제어를 사용하는 것도 다룰 것입니다.
구성¶
Godot는 본질적으로 씬 기반이고, 파일 시스템을 메타데이터나 애셋 데이터베이스가 아닌, 있는 그대로 사용합니다.
다른 엔진과 달리, 많은 리소스가 씬 자체에 내장되어 있기에, 파일 시스템에 있는 파일의 양은 상당히 적습니다.
그것을 고려해보면, 가장 일반적인 접근법은 애셋들을 씬과 가능한 밀접하게 묶어내는 것입니다; 프로젝트가 커지다 보면, 프로젝트를 더 유지할 수 있게 만듭니다.
예로서, 보통은 하나의 폴더에 기본 애셋을 넣습니다, 스프라이트 이미지나, 3D 모델 메시, 머티리얼, 그리고 음악 등이죠. 그런 다음 별도의 폴더를 사용하여 만든 레벨을 저장할 수 있습니다.
/project.godot
/docs/.gdignore # See "Ignoring specific folders" below
/docs/learning.html
/models/town/house/house.dae
/models/town/house/window.png
/models/town/house/door.png
/characters/player/cubio.dae
/characters/player/cubio.png
/characters/enemies/goblin/goblin.dae
/characters/enemies/goblin/goblin.png
/characters/npcs/suzanne/suzanne.dae
/characters/npcs/suzanne/suzanne.png
/levels/riverdale/riverdale.scn
Style guide¶
For consistency across projects, we recommend following these guidelines:
- Use snake_case for folder and file names (with the exception of C# scripts). This sidesteps case sensitivity issues that can crop up after exporting a project on Windows. C# scripts are an exception to this rule, as the convention is to name them after the class name which should be in PascalCase.
- Use PascalCase for node names, as this matches built-in node casing.
- In general, keep third-party resources in a top-level
addons/
folder, even if they aren't editor plugins. This makes it easier to track which files are third-party. There are some exceptions to this rule; for instance, if you use third-party game assets for a character, it makes more sense to include them within the same folder as the character scenes and scripts.
가져오기¶
3.0 버전 이전의 Godot에서는 프로젝트 밖에서 파일을 접근하는 것으로 가져왔습니다. 이것이 큰 규모의 프로젝트에는 유용하지만, 대부분의 개발자들에게는 조직의 번거로움을 초래했습니다.
이 때문에, 애셋은 이제 프로젝트 폴더 내에서 투명하게 가져옵니다.
Ignoring specific folders¶
To prevent Godot from importing files contained in a specific folder, create
an empty file called .gdignore
in the folder (the leading .
is required).
This can be useful to speed up the initial project importing.
주석
To create a file whose name starts with a dot on Windows, you can use a
text editor such as Notepad++ or use the following command in a
command prompt: type nul > .gdignore
Once the folder is ignored, resources in that folder can't be loaded anymore
using the load()
and preload()
methods.
Ignoring a folder will also automatically hide it from the FileSystem dock, which can be useful to reduce clutter.
Case sensitivity¶
Windows and recent macOS versions use case-insensitive filesystems by default,
whereas Linux distributions use a case-sensitive filesystem by default.
This can cause issues after exporting a project, since Godot's PCK virtual
filesystem is case-sensitive. To avoid this, it's recommended to stick to
snake_case
naming for all files in the project (and lowercase characters
in general).
주석
You can break this rule when style guides say otherwise (such as the C# style guide). Still, be consistent to avoid mistakes.
On Windows 10, to further avoid mistakes related to case sensitivity, you can also make the project folder case-sensitive. After enabling the Windows Subsystem for Linux feature, run the following command in a PowerShell window:
# To enable case-sensitivity:
fsutil file setcasesensitiveinfo <path to project folder> enable
# To disable case-sensitivity:
fsutil file setcasesensitiveinfo <path to project folder> disable
If you haven't enabled the Windows Subsystem for Linux, you can enter the following line in a PowerShell window running as Administrator then reboot when asked:
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux