db0 / godot-card-game-framework

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.
http://dbzer0.com/projects/godot-card-game-framework/
GNU Affero General Public License v3.0
895 stars 96 forks source link

Decouple core from custom #104

Closed zombieCraig closed 3 years ago

zombieCraig commented 3 years ago

Currently it's very hard to upgrade. This is mainly because core has dependencies on Custom. We should consider moving default information into core and then using custom for additional information that core could function without. The goal should be that upgrades are simply a matter of copying over a new src/core folder. Some things of note so far:

Currently CardConfig has all the customization details. Suggestion, use a method where you can extend the new core/CardConfig into a custom/CardConfig or have CardConfig check for a res://custom/CardConfig.json or something to extend/overwrite existing values.

This issue was created to start a discussion as there are a couple of ways to solve this. Once there is a direction we could break this down into small issues/PRs.

db0 commented 3 years ago

All good points, some things

Currently CardConfig has all the customization details. Suggestion, use a method where you can extend the new core/CardConfig into a custom/CardConfig or have CardConfig check for a res://custom/CardConfig.json or something to extend/overwrite existing values.

This is why it's in "custom" ;) There is no reason for multiple CardConfig at the moment, as it only specifying the sort of fields each label is. You can add all the labels names for all types of cards in CardConfig without issue, as the card is populated only by the fields actually defined in its json.

The only reason why I see one would need multiple CardConfigs, is when they might want a different "SHRINK_LABEL" per card type. Can you describe a scenario where you'd need multiple CardConfigs?

db0 commented 3 years ago

I've adjusted and republished 1.1 so that CARD_LABELS are not constants anymore, as that made it not possible to overwrite them in an inheriting scene. Now they are initialized inside _init_front_labels() and this can be overriden in extended classes.

Do you see any other area where there's an issue with coupling?