Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

패키지, 패치, 모드 내보내기

사용 사례

때때로 게임을 배포한 후에 기능을 추가하고 싶습니다.

이런 예시로는...

  • 다운로드 가능한 콘텐츠(DLC): 자신의 게임에 기능과 콘텐츠를 추가하는 기능.

  • 패치: 배포된 제품에 존재하는 버그를 고치는 기능.

  • 모드: 다른 사람들에게 게임의 콘텐츠를 만드는 기능을 허가함.

이 툴은 개발자가 초기 출시 단계를 넘어 확장하는 것을 도와줍니다.

PCK 파일의 개요

Godot는 리소스 팩이라는 기능을 통해 이를 허용합니다 (.pck 확장자명을 가진 PCK 파일).

이점:

  • 증가하는 업데이트/패치

  • DLC 제공

  • 모드 지원 제공

  • 모드에 필요한 소스 코드 공개 없음

  • 더 많은 모듈형 프로젝트 구조

  • users don't have to replace the entire game

파일을 사용하는 첫번째는 프로젝트를 내보내고 플레이어에게 전달하는 것입니다. 그 뒤, 나중에 기능이나 콘텐츠를 추가하려 한다면, 단지 PCK 파일을 통해 사용자에게 업데이트를 전달하면 됩니다.

PCK 파일은 보통 다음을 포함하지만, 제한은 없습니다:

  • 스크립트

  • 셰이더

  • 모델

  • 텍스처

  • 음향 효과

  • 음악

  • 게임으로 가져오기 적당한 다른 애셋

PCK 파일은 원래 게임이 런타임에 불러오는 완전히 다른 Godot 프로젝트가 될 수도 있습니다.

PCK 파일 생성하기

In order to pack all resources of a project into a PCK file open the project and go to Project/Export and click on "Export PCK/Zip". Also make sure to have an export template selected while doing so.

../../_images/export_pck.png

다른 방법은 명령줄에서 내보내기가 있습니다. 출력 파일은 PCK나 ZIP 파일 확장자명으로 끝나고, 그 뒤 내보내기 처리는 선택한 플랫폼에 맞는 타입의 파일로 빌드할 것입니다.

참고

누군가는 게임에 모드를 지원하고 싶을 것이고, 그러려면 사용자는 내보낸 파일과 비슷한 파일을 만들어야 합니다. 기존 게임이 PCK의 리소스를 위한 특정 구조를, 그리고/또는 스크립트를 위한 특정 인터페이스를 예상한다고 가정한다면...

  1. 개발자는 예상되는 구조/ 인터페이스의 문서를 공개해야 하며, 모드 제작자들이 Godot 엔진을 설치한다고 생각해야 합니다, 그리고 모드 제작자들도 게임의 모드 콘텐츠를 제작할 때 문서에 정의된 API를 준수할 것입니다 (따라서 잘 될 것입니다). 그런 다음 사용자는 Godot에 내장된 내보내기 툴로 위와 같은 PCK 파일을 만듭니다.

  2. The developer uses Godot to build a GUI tool for adding their exact API content to a project. This Godot tool must either run on a tools-enabled build of the engine or have access to one (distributed alongside or perhaps in the original game's files). The tool can then use the Godot executable to export a PCK file from the command line with OS.execute(). The game itself shouldn't use a tool-build of the engine (for security), so it's best to keep the modding tool and game separate.

런타임에 PCK 파일 열기

PCK 파일을 가져오려면, ProjectSettings 싱글톤을 사용합니다. 다음 예제는 게임 실행 파일의 디렉토리에 “mod.pck”로 보이는 파일을 실행하는 것입니다. PCK 파일의 루트에는 "mod_scene.tscn" 테스트 씬을 포함하고 있습니다.

func _your_function():
    # This could fail if, for example, mod.pck cannot be found.
    var success = ProjectSettings.load_resource_pack("res://mod.pck")

    if success:
        # Now one can use the assets as if they had them in the project from the start.
        var imported_scene = load("res://mod_scene.tscn")

경고

By default, if you import a file with the same file path/name as one you already have in your project, the imported one will replace it. This is something to watch out for when creating DLC or mods. You can solve this problem by using a tool that isolates mods to a specific mods subfolder. However, it is also a way of creating patches for one's own game. A PCK file of this kind can fix the content of a previously loaded PCK.

원래 파일을 덮어쓰지 못하도록 하려면 ProjectSettings.load_resource_pack() <class_ProjectSettings_method_load_resource_pack>`의 두 번째 인자에 ``false` 를 넘겨주면 됩니다.

참고

C# 프로젝트의 경우, 우선 DLL을 빌드해 프로젝트 디렉토리에 저장해야 합니다. 그 다음으로 리소스 팩을 로딩하기 전에 다음과 같이 DLL을 먼저 불러와야 합니다: Assembly.LoadFile("mod.dll")

요약

This tutorial explains how to add mods, patches, or DLC to a game. The most important thing is to identify how one plans to distribute future content for their game and develop a workflow that is customized for that purpose. Godot should make that process smooth regardless of which route a developer pursues.