A framework which comes with prepared scenes and classes to kickstart your card game, as well as a powerful scripting engine to use to provide full rules enforcement.
The previous PR #182 for this matter was lacking quite a bit of work.
This conversion fixes all of the compile-time errors, and a significant portion of run-time errors. From this, I think you should be able to make a working version of your own card game. It might work on earlier versions, but I'm only using stable for now.
Here's what still needs to be done, broken down into categories:
GUT
[ ] GUT GUI needs to be updated. GUT now expects you to use the gut tab in the editor, instead of a scene.
[ ] Many GUT tests fail on the Demo and in general. Without the GUI working, it is hard to tell which ones.
[ ] yield_for and yield_to are now deprecated and should be changed to wait_for_signalwait_seconds.
[ ] Maybe GUT should be a submodule?
DEMO / BASE SCENES
[ ] Main menu title text is wrong size
[ ] Library card and deck builder don't work as intended. Part of the issue is that PopUpPanels are no longer Controls but Windows.
[ ] Demo does not show cards. They're properly loaded into cfc.deck but never make it to the Scene Tree. They work properly in GUT tests.
REWRITES
[ ] Font handling (mostly in cardfront.gd) has changed. Instead of a font file copy for each use (which provides font.size that can be changed) Godot now uses a single FontFile with theme_fonts (and theme_override_font_size). Some if it is started.
[ ] super._ready() Many issues stemmed from the fact that lifecycle functions no longer call their super version of those functions. The fix for this means that every derived class needs to use super._ready() as the first line in their _ready(), which also means that users will need to do that in their derived classes. Some way to rewrite these classes to prevent that would be nice for the end user.
[ ] ViewPortCardFocus.gd:155:180 $VBC/Focus is a PopUpPanel node. This node used to be a Control but is now a Window - which means there is no 'modulate' property. If we want to continue the soft fade in/out either a way using Window should be done, or it should be changed to a different node type. It might need a re-write with the change. Also note the effect on test_piles.gd:95
[ ] Script.get_global_name will be exposed in 4.3 which should allow us to get the class_name of a script object. I think it would be able to simplify logic in a few places.
[ ] I mostly just wrote the tween logic to replace what already existed, but they could definitely use a re-write all over the place to take advantage of their new lightweight run and forget attitude and being scope-specific.
[ ] Godot 4 does not allow overriding build-in functions (neither did 3, but 4 is more specific about it). Overridden functions should be re-named and any calls to them also to make it clearer what the call is trying to do. Off the top of my head Pile.gd:add_child() but I know there are more
SPECIFIC
These may or may not address other listed items
[ ] pile.gd pre_sorted_order is never given a value
[ ] CardTemplate.gd:359 the logic is not neat (is not and is ! are not allowed in syntax). It can be fixed when 4.3 is released
[ ] test_facedown.gd:55 _previously_focused_cards does not seem to work in the test only. It works in other places (have not gotten to test demo yet).
OTHER
[ ] Github actions uses godot 3.4.4, so no builds will be able to pass until that is fixed
[ ] I'm not sure if breakpoints are carried over - if so, they should be deleted. They're to mark all of the code I touched
[ ] Lots of unused variables left over and their warnings.
[ ] Tweens are mostly handled correctly, but there are a few that don't work properly. Some are just added to the scene tree without tweeners (normally @onready var _tween = create_tween() not being in a function)
[ ] Documentation might need to be updated
There may be more things.
My intention is to keep working on it, but I wanted to share the "working" version for feedback and collaboration.
The previous PR #182 for this matter was lacking quite a bit of work.
This conversion fixes all of the compile-time errors, and a significant portion of run-time errors. From this, I think you should be able to make a working version of your own card game. It might work on earlier versions, but I'm only using stable for now.
Here's what still needs to be done, broken down into categories:
GUT
yield_for
andyield_to
are now deprecated and should be changed towait_for_signal
wait_seconds
.DEMO / BASE SCENES
REWRITES
super._ready()
Many issues stemmed from the fact that lifecycle functions no longer call their super version of those functions. The fix for this means that every derived class needs to usesuper._ready()
as the first line in their_ready()
, which also means that users will need to do that in their derived classes. Some way to rewrite these classes to prevent that would be nice for the end user.$VBC/Focus
is a PopUpPanel node. This node used to be a Control but is now a Window - which means there is no 'modulate' property. If we want to continue the soft fade in/out either a way using Window should be done, or it should be changed to a different node type. It might need a re-write with the change. Also note the effect on test_piles.gd:95class_name
of a script object. I think it would be able to simplify logic in a few places.SPECIFIC
These may or may not address other listed items
pre_sorted_order
is never given a valueis not
andis !
are not allowed in syntax). It can be fixed when 4.3 is releasedOTHER
@onready var _tween = create_tween()
not being in a function)There may be more things.
My intention is to keep working on it, but I wanted to share the "working" version for feedback and collaboration.