Releases: db0/godot-card-game-framework
v2.2.0
New Features
CardFilter
class can now callcustom_check()
. This allows any game to extend it with extra functionalityCardFilter
class can now filter against array/dictionary size- Added option to specify if a pile should have sorted popups
Tweaks
- Removed unnecessary use of seed rng during visual rng
- Prevents info panels moving outside viewport
- SelectionWindow now uses SignalPropagator
- SelectWindow can select direct cards
- Selection Window will now properly turn cards face-up
- Made the rich text card front the default card front
- Changed the Cost/Power values to use icons and no-text.
- Preview Popups will now tween their position when changing it
- Details Panels can now multiple columns, so that they don't grow infinitely long, pushing the card out of the viewport.
Bugfixes
- Avoids card becoming unplayable randomly.
- Avoids crash when Scripting Engine is used on non-card objects
- CardViewer now works with "scale" resizing properly
ScriptingEngine
- Can now set a card state to be "any" and the script will trigger
Regardless of where the card is. - ScriptingEngine filters can now filter using CardFilter objects
- Added KEY_FILTER_EACH_REVIOUS_SUBJECT to use in tasks utilizing KEY_SUBJECT_V_PREVIOUS.
- Added KEY_UP_TO to use with KEY_SUBJECT_V_TUTOR
- Added
_pre_task_exec()
in ScriptingEngine - Alterant Engine can now take into account script subject
- Added signal when card scripts finish
- Fixed per_ in alterant engine not working
- Prevents crash when card container empty while looking for card index.
v2.1.0
Important for Upgrades
- Further improvements in card set and script loading should make game init much faster.
Now supports for loading scripts and sets through the compiler via preload()
To upgrade to this version, you MUST create a class calledSetPreload
somewhere in your custom folder.
You can copy over"res://src/dreamscape/cards/sets/SetPreload.gd"
from CGF to get started. - Your SetScript files'
get_scripts()
function needs to be extended to require a second, boolean variable. You can use it to return script results that are otherwise onformated
and they will be stores permanently in cfc, in case you want to be able to retrieve an individual card's script for permanent modificatio outside of the Card class.
New Features
- Added new
CardFilter
class which can be fed the properties of any card and return true/false if the card fulfils the filter. - Added new method
has_card()
in CardContainer - Added new method
has_card_name()
in CardContainer - Added new method
has_preview_card()
in CVPreviewPopup - Added var to disable manipulation buttons on CardContainers
Tweaks
- Added failsafes to avoid crashing when cards are being de-instanced during scripting engine runs
- Made Number properties carrying string values more robust in comparing and setting
- More attempts to ensure RTL fonts are not set to an improper size
- Fixed card focus sticking to the wrong x scale when quickly hovering over it.
sort_scriptables_by_name()
can now handle 'card_name'- SelectionWindow now pops up exclusive in display mode
- CardFilter can now handle comparing tags
- Improved Quickstart (thanks @trillyc)
ScriptingEngine
- Added new task
spawn_card_to_container
which allows new cards to be spawned directly to containers.
It also allows for the player to be asked to select a card out of selection from the whole card library, using CardFilters
v2.0
Important for Upgrades
- Scripts have now been adjusted to be able to work as constants. You can keep your existing script setup but your MUST change all non-constant references to constants. More specifically, any of use of KEY_DEST_CONTAINER or KEY_SRC_CONTAINER needs to be switched to a String value, instead of a CardContainer class as it was until now. Due to this fairly significant backwards breaking change, we're moving the CGF to version 2.0
New Features
- Added
state_changed
signal on Card - Added
target_found
signal on Targeting Arrow - Added
process_more_card_inputs()
overridable method - Targeting Arrow can now be a child of any Control node. Not just cards.
- Can now pass custom rich text effects to the cardviewer to use. They are inherited by all richtext labels in it.
- Added
cfc.quit_game()
to allow the cgf-related stuff to be deinstanced (for example when returning to a main screen)
Tweaks
- Improved CardBacKTexture so that it converts the StreamTexture into ImageTexture
- Added all CGF tweens to a group cgf_tweens, for easy manipulation
- Prevents the browser export from setting MOUSE_MODE_CONFINED, to prevent the browser reporting it as an error
- CardViewer will now correctly scale the grid according to resized card sizes
ScriptingEngine
- Significant improved the loading times of scripts during game init. Now scripts are only loaded during game load and not every time the board loads (as we do not need to use dynamic values anymore)
- Script Loading from files now multithreaded (not in HTML5) to enable faster load times.
- Added SP.KEY_FAIL_COST_ON_SKIP
- common_pre_execution_scripts() now also sends the trigger_details, which allows the extending code to inject extra trigger properties.
- Added KEY_NEEDS_SUBJECT which causes the task to be checked during the cost checks, but will not abort if the task will not change anything. It will only abort if the task ends up with invalid subjects.
- On-Drag targeting, will not start when costs cannot be paid
- Can now modify spawned cards while spawning them.
- Added a "repeat" directive for tasks, which will repeat that task that amount of times. Accepts a per directive as a value as well.
v1.15
Important for Upgrades
- New property
CFConst.FONT_SIZE_CACHE
has to exist. Best practice is to set it to "user://CGFFontCache.json"
New Features
- Now each card type has exported variables for the canonical card size as well as the various scaling. This finally allows the game to utilize different card sizes at the same time. CardContainers and BoardGrids for different card sizes now also need to have a defined card_size matching the card they're going to host.
- Added exported vars for controlling card tween duration (@stevosaurus)
- Mouse will not teleport to a card's top-right when dragging starts. (@stevosaurus)
- Adjustments to prevent Rich Text Labels from sizing at 4 font size
- Recursive rescaling will also now take into account MarginContainer margins
- Added font_size_caching which should now reduce time lost while calculating font sizes.Requires CFConst.FONT_SIZE_CACHE
ScriptingEngine
- Added new ScEng key KEY_ADJUST_RETRIEVED_INTEGER which allows the script to tweak the retrieved integer before applying it.
- Added KEY_DIVIDER for per calculations, to allow to check "per X cards" and only count full sets.
- Added KEY_ORIGINAL_PREVIOUS to allow per_ to user task's prev_subjects. Had to refactor slightly to make this work.
v1.14
Important for Upgrades
- New property
CardConfig.BOOL_PROPERTY_TO_HIDE_IN_CARDVIEWER
has to exist. Defaults to"hide_in_dekbuilder"
but this const allows you to set it to anything else. CardConfig.TYPES_TO_HIDE_IN_DECKBUILDER
renamed toCardConfig.TYPES_TO_HIDE_IN_CARDVIEWER
- New property
CardConfig.REPLACEMENTS
has to exist. Defaults to an empty dictionary. See comments for its description
New Features
- Selection Window can now be used independently of the ScriptingEngine
- Selection Window function can how handle both an Array of Card objects, as well as an array of card names.
- Selection Window can now be used as a mere display (using 0 selection and "display" type)
- Card Name can now be a rich text label
- Added code in card_front which can add extra formating to the card name.
- Added new signal "shuffle_completed" emited after a pile is shuffled
- Can now set replacement strings for specific properties. For example you can replace a Cost of "-1" with "X".
- The above is also imported in an exported var in the CardViewer class. This means can extend it with further replacements that will appear only in the CardViewer classes.
- Can now specify Strings as valid values for card properties marked as numbers in CardConfig. They will be excluded from numerical filters and comparisons in the scripting engine, so you need to provide appropriate logic.
- Added new function in
cfc.hide_all_previews()
which will hide all currently opened card preview popups. - SignalPropagator will now emit its own signal duplicating the signal it just received. Allows any object (including non-scriptables) to hook into the card triggers from a central spot.
- Larger focus card (coming form the viewport) will now not have an opaque background.
ScriptingEngine
- Can now set multiplier in the per definition
- CustomScripts will now correctly abort when costs cannot be paid
- New boolean var on Card class "is_executing_script" which is turned on while ScriptingEngine is running for this card's script. Games can hook into it to prevent multiple executions.
- Moved the spot where previous_subjects are assigned to after the task is triggered. This allows tasks to change the subjects list and this will can then be used in the next script's
"subject":"previous"
tasks
v1.13
Tweaks
- Right click in the Card Viewer filter buttons, will not press that button and unpress all the others
- Can now filter also on properties not defined in CardConfig
- Improved performance when showing/hiding the viewport focus
- Improved performance when loading the card viewer in grid mode.
New Features
- In Cardviewer, added button which presses all filter buttons.
ScriptingEngine
- Added new
nested_script
task allows to execute more tasks recursively. It allows for infinite amount of nests, which can create pretty complex combinations of scripts. - Added new selection window functionality which creates an dialogue window to the player to select an amount of cards from those selected as subjects. Typically should be combined with boardseek, tutor or index subjects.
Controlled by the following new keys:KEY_NEEDS_SELECTION
,KEY_SELECTION_COUNT
,KEY_SELECTION_TYPE
,KEY_SELECTION_OPTIONAL
,KEY_SELECTION_IGNORE_SELF
v1.12
Important for Upgrades
- Removed the automatic resizing of label nodes using a compensation label. I cannot make this work consistently, and in both games I've created, I never used this feature. I doubt anyone else will. Just more trouble than it's worth.As a result the following properties from CardFront are obsolete and need to be removed if you're setting them:
_rect_adjustment
text_expansion_multiplier
compensation_label
New Features
- Created a Card Library framework. Refactored Deckbuilder to inherit from new class
CardViewer
. new CardLibrary inherits from the same class. - Added support for Rich Text Labels on card fronts and info panels
- Made CardContainers capable of being aligned using control nodes. To do so, you need to set their placement as "CONTROL" and then place them in a dedicated control node which you can make a part of your table layout.
- If piles are scaled, cards will now appear to scale up/down as they move into/out of them.
- Sample board using a Control-node based layout can be seen in
CGFBoardControlLayout.tscn
- Added way to see the contents of a pile sorted. And new demo button for it labeled "VS"
v1.11
Important for Upgrades
New CFConst poperties added:
THUMBNAIL_SCALE
PREVIEW_SCALE
FOCUSED_SCALE
These allow you to adjust how much to scale the cards depending on where they're placed.
You NEED to add these to CFConst.
New Features
- Integrated the Dark Theme provided by Mounir Tohami as the default theme of the CGF which gives a good guideline on how to integrate themes into the game and quickly change the look.
- Can now filter against godot groups
- Can now filter against
get_class()
- Added new overridable function
common_pre_run()
which can be used to run custom methods in an extended scripting engine before execution - Added new signal in cfc
cache_cleared
which fires every time the cache is cleared, which typically signifies a game-state-change - New card method
set_to_idle()
Tweaks
- Targeting Arrow can now handle any node type (not just area2d)
- ScriptingEngine's trigger_card renamed to trigger_object and can now accept any Node class
- ScriptEngine's 'boardseek' now uses new board method
get_all_scriptables()
which can be extended to gather any type of object needed. - Refactored ScriptObject
- ScriptingEngine's
shuffle_container()
will now wait for animations to finish before shuffling, and then wait until its own animation is finished before proceeding. - Card resizing when
VIEWPORT_FOCUS_ZOOM_TYPE
is set to "resize"now happens recursively which allows games to easily use this feature without manually specifying all the rects in the card_front.
This allows a designer to design the card layout in the GODOT GUI and then the game will automatically handle the scaling.
This is not perfect as when scaling too high or too low, some elements might get slightly out of alignment compared to the scale 1,1, but it should be good enough.
Bugs
- Hands other than the first will now correctly rotate cards while in oval shape.
- Debug button unclicked will re-hide the debug info.
- Fixed CFUtils.shuffle_array() to be able to handle 2-element arrays as well
- Fixes for changing pile opacity when adding/removing cards
- Fixes for manipulating pile cards while they're in the popup container
- Fixes for adding and removing cards at the same time from pile.
v1.10
Tweaks
- Deckbuilder seach is now case insensitive
- Targeting Arrow is now decoupled from the Card class and can be extended to target other objects, or even assigned to non-Card classes.
New Features
- Deckbuilder now support a grid layout
ScriptingEngine
tutor
andboardseek
subjects now accept a new keysort_by
which can resort the gathered cards based on a property, a token, or even randomly.modify_properties()
task can now acceptper_
as value- Scripts can now check the value of a counter before proceeding
- Scripts can now compare potential subjects against the properties/state of the card owner/trigger of the script
v1.9
Important for Upgrades
Main.tcsn has been modified with a new node called FocusInfo
which shows card details under the viewport focus. For this scene, the "Info Panel Scene" to use needs to be specified. It is an exported variable so you can set it in the inspector.
A sample such scene has been provided in res://src/custom/CGFInfoPanel.tcsn
. If this is not set, the game will crash when mousing over the cards.
If the deckbuilder is also inherited in a custom scene, it will likewise has the same FocusInfo
node for which the "Info Panel Scene" has to be specified in the inspector.
New mandatory CardConfig property added: TYPES_TO_HIDE_IN_DECKBUILDER
(Array). Any card type specified here will not be shown in the deckbuilder.
New mandatory CardConfig property added: EXPLANATIONS
(Dictionary). It stores details about tags and keywords that you want to display under your card popups in game or deckbuilder.
You will need to specify these new CardConfig properties, even if they're empty
New CFConst poperty added: VIEWPORT_FOCUS_ZOOM_TYPE
. Set to either "resize" or "scale" (default = "resize"). If set to scale, will magnify the card during viewport focus using godot scaling. If set to resize, will resize the card's viewport dupe's dimentions. This prevent blurry text, but needs more setup in the card's front script.
Game has been adjusted to allow the ScriptingEngine to work non-Card classes. To enable this the following changes have been made which might affect your game if you've extended the Card or ScriptingEngine classes
- Card
card_name
property has been renamed tocanonical_name
- Card
retrieve_card_scripts
function has been renamed toretrieve_scripts
- ScriptingEngine and ScriptObject
owner_card
variable has been renamed toowner
and is not expected that it be a Card class
Bugs
- Fixed crash when window x-axis resized to minimum
- Improved readability of card text in viewport focus
New Features
- Can now mark card definitions with a new meta_property:
"_hide_in_deckbuilder": true
. If you do, they will not be shown in the deckbuilder. - Can now mark card types as not visible in deckbuilder.
- Deckbuilder will now display the total or filtered count of cards shown
- Added new class: GameStats, which can be used to submit stats to your own instance of CGF-Stats
- Can now show extra info below card focus viewport, such as keyword explanations or illustrator info
- Can now extend deckbuilder DBListCardObject and
ScriptingEngine
- spawn_card task now expects a card name, instead of a scene path. Spawned cards have to be defined along with the other cards for this purpose. The card name will be used to setup the spawned card.