Coder Social home page Coder Social logo

godot-game-template's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

godot-game-template's Issues

_set_new_scene(): wait for old nodes to be completely removed from tree before starting a new scene

func _get_current_scene_node() -> Node:
return get_tree().current_scene
func _set_new_scene(resource: PackedScene):
var current_scene = _get_current_scene_node()
current_scene.queue_free()
var instanced_scn: Node = resource.instance() # triggers _init
get_tree().root.add_child(instanced_scn) # triggers _ready
get_tree().current_scene = instanced_scn

Issue: a new scene can start before old nodes to be completely removed.

I noticed this reloading a scene which had get_tree().get_nodes_in_group("example_group") on ready: I was expecting 3 nodes, but I got 6. This happened because old nodes were not completely removed on reload.

Submit to the Asset Library

  • create separate repositories for each ggt-* addon
  • move the code to the new repositories
  • publish the addon to the Asset Library
  • remove the addons from this template and add them via the asset library

Idea: allow loader stages after scene loads, before it starts

Idea:
After pre_start, but before start the scene can add more "in-scene" stages to the progress-bar.

I think the pre_start function can be used for this, and maybe using yield to advance the progress bar (coroutines style) or by emitting signals.

I guess that in order to have proper progress-bar the number of "in-scene" stages need to be known before the scene is loaded, which is tricky, a simple solution is to pass it in the params, but I hope there is a more elegant solution.

Example use case:
The gameplay.tscn scene generates procedural level in the pre_start func

func start_button_pressed():
     Game.change_scene("res://gameplay.tscn",  
                                          { "show_progress_bar": true, 
                                             "in_scene_stages": 5    # tell the progess bar to reserve 5 extra stages
                                           })

# in gameplay.gd
func pre_start(params):
    generate_maze()
    yield()   # advance stage...  or use signal and wait for idle frame?
    generate_tiles()
    yield()
    generate_treasure()
    yield()
    generate_monsters()
    yield()
    generate_doors()


func start():
    play_start_game_sound()

Add `reparent_to()`

func reparent_node(node: Node2D, new_parent, update_transform = true):
	var previous_xform = node.global_transform
	node.get_parent().remove_child(node)
	new_parent.add_child(node)
	node.global_transform = previous_xform

This is not implemented in Godot because it's easy to do with GDScript.
However it seems like a handy feature to have in a game template (and also to avoid duplicating code).


Relevant Godot issues:

Add global game size variable

var size := Vector2.ZERO


func _ready() -> void:
	get_tree().connect("screen_resized", self, "_	on_screen_resized")
	register_size()


func _on_screen_resized():
	register_size()
	
	
func register_size():
	size = get_viewport().get_visible_rect().size

Bug+Fix: Transitions scene blocks _input even when it is translucent

The Bug:

Even when the scene transitions completes, the Transitions scene remains in the tree, but it is invisible (since ColorRect is animated to be alpha=0).

However, it still blocks _input events.
ie. if there is a button where the progress bar is located, it is impossible to click the button (or hover it), even when the progress bar is invisible.


The fix is simple, and I think as a bonus side affect it will probably (very slightly) improve performance (perhaps avoiding some needless process() and rendering of transparent textures).

The Fix:

Simply hide the ColorRect when its not needed:

transitions.gd (modified lines highlighted with <<<<<<<, unchanged functions omitted for brevity)

onready var background = $ColorRect

func _ready():
	background.hide()      # <<<<<<<

# Tells if transition is currently displayed
func is_displayed() -> bool:
        return background.visible          # <<<<<<<<
        #
        # I don't think these two lines are necessary, but maybe I'm missing something?
	# var is_screen_black = background.modulate.a == 1
	# return anim.is_playing() or is_screen_black


# appear
func fade_in(params = {}):
	background.show()  # <<<<<<<<
	progress.hide()
	if params and params.get('show_progress_bar') != null:
		if params.get('show_progress_bar') == true:
			progress.show()
	anim.play("transition-in")


func _on_fade_out_finished(cur_anim):
	if cur_anim == "transition-out":
		progress.bar.value = 0
	background.hide()         # <<<<<<<<<

# rest of file is unchanged

Use `set_focus_mode` on buttons

set_enabled_focus_mode: BaseButton's Enabled Focus Mode property has been deprecated due to redundancy and will be removed in Godot 4.0. Please use Control.set_focus_mode instead.
  <C++ Error>   This method has been deprecated and will be removed in the future.
  <C++ Source>  scene/gui/base_button.cpp:329 @ set_enabled_focus_mode()
  <Stack Trace> scenes.gd:57 @ _set_new_scene()
                scenes.gd:118 @ _on_resource_loaded()
                resource_interactive_loader.gd:51 @ _on_background_loading_completed()
                resource_interactive_loader.gd:30 @ _process()

Should the game template include a debug HUD/GUI?

After merging #37 I started wondering if a debug HUD may be useful for end users.

In https://github.com/crystal-bit/godot-game-template/tree/feature/version-scene there is a proof of concept: a Godot scene which is enabled globally and can be shown/hidden by pressing F1 at any moment (even during transitions).

Do you think having the godot-game-template should ship a debug HUD by default? Or should it be an add-on to install optionally?
Keep in mind that this debug HUD should work on PC, HTML5, Android and iOS. If this is hard to achieve, then I think it's better to create a separate add-on (which could be installed by other Godot-projects as well).

PS: for inspiration I suggest reading the Addons & Plugins wiki page and especially Shovel Knights debug features. If you know about similar resources, feel free to post them!

Github Action web deploy failing (403).

After I've created a repo from this template, the Build Action for Web is failing with error:

remote: Permission to jayypluss/BreezyWave.git denied to github-actions[bot].
fatal: unable to access 'https://github.com/jayypluss/BreezyWave.git/': The requested URL returned error: 403

Is there any action needed for this build action to work?

Link for the failing build line:
https://github.com/jayypluss/BreezyWave/runs/6251779089?check_suite_focus=true#step:9:99

Thanks!

Godot 3.3 update

  • Test project with Godot 3.3
  • Update Godot-CI (aBarichello)
  • Check godot-multi-builder (probably won't work with Godot 3.3 for Android export)

UPDATE: Android build actually works, but it's using an outdated Godot version

Write documentation

  • Update Readme
  • How to change scene (multithread, single thread, ...)
  • How to change scene and pass parameters
  • How to play a specific scene
  • How to restart the current scene (with no params and with latest params)
  • FAQ/common errors: get_tree().get_node().add_child(new_scene)
  • Godot API Incompatibilities (reload_current_scene(), goto_scene(), ...)
  • How to disable CI and why
  • How to contribute (main branch, feature branch, PR, changelog)

Project version in main scene

I think it would be useful to have the current version of the project shown on the bottom-left of the main scene. If people experience a bug with the template or a game made with it, they could immediately check which version is running, and it would be easy for non-developers as well.

Transition.gd bug

Hi, I recently started using your game template. Frickin' awesome, btw. But I ran into this error, and it appears to be unrelated to my own code.
transition bug

Any insight would be appreciated! Thanks again for the brilliant framework!

Use ResourceLoader cache

From Godot Third Person Shooter demo:

	if ResourceLoader.has_cached(path):
		emit_signal("replace_main_scene", ResourceLoader.load(path))
	else:
		res_loader = ResourceLoader.load_interactive(path)
		loading_thread = Thread.new()
		#warning-ignore:return_value_discarded
		loading_thread.start(self, "interactive_load", res_loader)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.