Skip to content

TinyTakinTeller/TakinGodotTemplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

52 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Takin - Godot Template

Godot 4.3 template for game projects (GDScript).

Fusion of curated plugins, essential features and best practices to kick-start new projects.

๐Ÿšจ TODO: This template is a work in progress.

โ™ฆ๏ธ Examples

[CLICK HERE] Preview Screenshots

โญ Features

โœจ Game

  • Foundation
    • ๐Ÿ–ผ๏ธ Scene Manager - Custom transitions and loading screens.
    • ๐ŸŽต Audio Manager - Reliable music tracks and sound effects.
    • โš™๏ธ Configuration - Persistent game options and statistics in INI file.
    • ๐Ÿ’พ Save Files - Modular save system for game data, optional encryption.
  • Localization
  • Accessibility
    • ๐ŸŽฎ Controller Support - Grab UI focus for joypad and keyboard users.
    • ๐Ÿ” Multiple Resolutions - Video options: display mode, window zoom.
    • โšก Optimizations - Native web dialog to capture clipboard, and more...
  • UI/UX
    • ๐ŸŽฌ Boot Splash - The main scene, allowing custom transition to main menu.
    • ๐Ÿ  Main Menu - Display buttons to enter other menus, version and author.
    • ๐Ÿ”ง Options Menu - Audio, Video (display, vsync), Controls (keybinds), Game.
    • ๐Ÿ“œ Credits Menu - Renders CREDITS.md file in-game with formatting.
    • ๐Ÿ““ Save Files Menu - List of files: Play, Import, Export, Delete, Rename.
    • โธ๏ธ Pause Menu - TODO: ...
  • Placeholder
    • ๐ŸŽจ Theme - TODO: ...
    • ๐Ÿ–Œ๏ธ Images - CC0 Public Domain: Dannya save file icon, Maaack icons.
    • ๐ŸŽถ Music & SFX - CC0 Public Domain: Kenny SFX and OGA Music (loop).

๐Ÿ’ซ Development

  • Singletons
    • ๐Ÿ“ข Signal Bus - Observer pattern for cleaner global signals.
    • ๐Ÿ“– References - Map of preloaded resources for convenience.
  • Scripts
    • ๐Ÿงฐ Utility - Datetime, File, Marshalls, Math, Node, Random, String.
    • ๐Ÿ› ๏ธ Objects - ActionHandler, ConfigStorage (INI File), LinkedMap.
  • Tools
  • Workflow
    • ๐Ÿš€ Deployment - TODO: ...
    • โœ… Actions - Verify style and formatting in GDScript code on push to Github.

๐Ÿ“‚ File Structure

  • .github
    • docs
    • workflows
  • godot
    • addons (Plugins)
    • assets (.png, .mp3, .csv, .ttf, ...)
    • autoload (Globals)
    • resources (.tres, .gd)
    • scenes (.tscn, .gd)
    • scripts (static/const/object .gd)
    • shaders (.gdshader)
    • snippets (.cpp, .js, ...)
    • CREDITS.md
    • export_presets.cfg
    • gdlintrc
    • project.godot (ProjectSettings)
  • .gitattributes
  • .gitignore
  • LICENSE
  • README.md

๐Ÿ“œ Conventions

  • Clean Code
    • Use snake_case for files, folders, variables, functions.
    • Use PascalCase for nodes, classes, enums, types.
    • Use typed variables and functions.
    • Use style inspired by GDScript Style (see gdlintrc).
    • Function definition order: override, public, private, static.
    • Consider using good design patterns when programming.
    • Consider maintaining enum values when appropriate.

๐Ÿงฉ Plugins

๐Ÿ”ง Editor

โš™๏ธ Engine

  • Logger
    • The Log inspired by Log4J allows logging.
  • Scene Manager
  • Audio Manager
    • The Resonate addon handles music tracks and sound effects.
    • For a complex audio project, consider using FMOD or WWise.

๐Ÿค– Code

The Globals (autoload Scenes) and Scripts (statics, consts, objects) are available from anywhere in the project. The latter is independent of (not managed by) the Scene Tree.

Otherwise, Scenes must be loaded or added to the Scene Tree.

๐Ÿ’Ž Globals

  • Configuration
    • Configure Project, use ConfigStorage object for user config presistence.
  • Data
    • Configure structure of save files, use as setter and getter of save file data.
  • Overlay
    • Container for debug elements, e.g. FPS counter.
  • Reference
    • Preloads & holds references to Resources in dictionary by name.
    • When creating a new Resource type, consider creating a getter here.
  • SignalBus
    • Exchange global signals for cleaner observer pattern.
  • Wrapper : Extend functionality without modifying the original.
    • AudioWrapper - Calls Resonance plugin with enums instead of string names.
    • SceneManagerWrapper - Calls SceneManager plugin with custom resource.
    • TranslationServerWrapper - Extends localization to work in tool scripts.

๐ŸŽฌ Scenes

Scenes are split into component, node and scene folders.

  1. Component : Add as a child to extend parent functionality by composition.
  2. Node : Add as a standalone building block of a larger construction.
  3. Scene : Presentable collection of other scenes, nodes and components.
  • Component
    • Audio
      • ButtonAudio - Audio events on signals (focus, click, release).
      • SliderAudio - Audio events on signals (drag start, drag end).
      • TreeAudio - Audio events on signals (cell selected, button clicked).
    • Control
      • ControlExpandStylebox - Resize target node to fill parent container.
      • ControlGrabFocus - Grabs focus of node for controller support.
      • ControlResizeTextFont - Custom UI scaling if "stretch mode: disabled".
  • Node
    • Menu
      • MenuButton - Localized menu button.
      • MenuDropdown - Localized dropdown option button.
      • MenuSlider - Localized menu slider with accessibility buttons.
      • MenuToggle - Localized menu toggle button (ON or OFF).
  • Scene
    • BootSplashScene (Main Scene) - Smooth transition to menu scene.
    • MenuScene - Manages menu scenes as children.
      • MainMenu - Display buttons to enter other menus or next scene.
      • OptionsMenu - Manages options (persistent app settings) scenes.
        • AudioOptions - Configure Music and SFX volume or mute.
        • VideoOptions - Display, Resolution, VSync, FPS Limit, Anti-Alias.
        • ControlsOptions - Change (add or remove) keybinds.
        • GameOptions - Custom options, e.g. toggle autosave.
      • CreditsMenu - Renders CREDITS.md file in-game with formatting.
      • SaveFilesMenu - List of files: play, import, export, delete, rename.
    • PlayScene - TODO: ...
      • PauseMenu - TODO: ...

๐Ÿ“„ Scripts

  • Const - Collections of commonly used constants.
  • Enum - Collections of organised values.
  • Object
    • ActionHandler - Implements the (light) command pattern design.
    • ConfigStorage - Persists (save & load) app settings in INI file.
    • LinkedMap - Dictionary data structure that tracks order of keys.
  • Util
    • DatetimeUtils - Useful for save file metadata (e.g. last played at).
    • FileSystemUtils - Robust functions to extract file paths and names.
    • MarshallsUtils - Convert data formats with optional encryption.
    • MathUtils - Integer power function.
    • NodeUtils - Collection of node manipulation functions.
    • RandomUtils - Weighted Loot Table and random string functions.
    • StringUtils - String functions for validation and transformations.

๐ŸŒธ Snippets

  • ConfirmationDialogJsLoader
    • Native HTML/CSS/JS dialog to access clipboard in web build.
    • Supports transfer of Theme resource properties to CSS style.
    • Useful because Godot Nodes cannot read or write to web clipboard.

๐ŸŽ‰ CI/CD

๐Ÿš€ Deployment

  • Github Pages
    • TODO: ...
  • Itch.io
    • TODO: ...

โœ… Workflows

  • quality_check.yml
    • Automatically check gdlintrc coding style standards.

โšก Hacks

Godot Engine has known issues requiring hacks (workarounds) until officially resolved.

Below is a list of issues needing workarounds implemented in this template.

  • Desktop
    • TODO: issues #3145, #6247 with window_mode before boot.
  • Web
    • Issue #81252 with clipboard hacked by native JavaScript dialog.
    • Issue #96874 with Boot Splash hacked by CSS in Head Include.
    • Issue #100696 with play_stream hacked by explicit args in func.
    • TODO: Issue #43138 with window_mode restricted to user focus.

TODO: Test the template on following platforms.

  • Linux
  • MacOS
  • iOS
  • Android

๐Ÿ“– Instructions

๐Ÿ“˜ Get Started

After setup, you should have no errors and no warnings.

  • Click Use this template in Github, then open the project in Godot Engine.
  • Setup GDScript Toolkit python package to use formatter and linter plugins.
  • Open (Import) the project for the first time in the Godot Editor.
  • Enable all plugins, then restart the project "Project > Reload Current Project".

On Godot 4.3 you must also:

Fallbacks=null
fallbacks=[Resource("res://assets/font/noto_sans/woff/noto_sans_arabic.woff"), Resource("res://assets/font/noto_sans/woff/noto_sans_hebrew.woff"), Resource("res://assets/font/noto_sans/woff/noto_sans_hk.woff"), Resource("res://assets/font/noto_sans/woff/noto_sans_jp.woff"), Resource("res://assets/font/noto_sans/woff/noto_sans_kr.woff"), Resource("res://assets/font/noto_sans/woff/noto_sans_sc.woff"), Resource("res://assets/font/noto_sans/woff/noto_sans_tc.woff"), Resource("res://assets/font/noto_sans/woff/noto_sans_thai.woff")]

โ“ FAQ

For questions and help, open a Github Issue or contact my Discord tiny_takin_teller.

  • Opening the project for the first time, I have errors/warnings?
    • Try (re)enable all Plugins and then select "Reload Current Project".
  • Warning "ext_resource, invalid UID" when opening the project?
    • Resolve by re-saving the mentioned scene (.tscn), e.g. rename root node.

๐Ÿ’ผ Editor Layout

Editor layout can be changed via "Editor > Editor Layout > ..." in Godot Editor.

To use my layout, locate editor_layouts.cfg in Editor Data Paths and add:

[takin_godot_template]

dock_1_selected_tab_idx=0
dock_5_selected_tab_idx=0
dock_floating={}
dock_bottom=[]
dock_closed=[]
dock_split_1=0
dock_split_3=0
dock_hsplit_1=395
dock_hsplit_2=170
dock_hsplit_3=-382
dock_hsplit_4=0
dock_filesystem_h_split_offset=240
dock_filesystem_v_split_offset=0
dock_filesystem_display_mode=0
dock_filesystem_file_sort=0
dock_filesystem_file_list_display_mode=1
dock_filesystem_selected_paths=PackedStringArray("res://")
dock_filesystem_uncollapsed_paths=PackedStringArray("res://")
dock_1="FileSystem,Scene,Scene Manager"
dock_5="Inspector,Node,Import,History"

๐Ÿซ‚ Contribute

  • Open a new Issue for discussion first, later Fork and open a pull request.

๐Ÿ’• Acknowledgements

About

Godot 4 template for game projects (GDScript).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published