Home - Decentraland-Community-Modules/DCL-TCG-Framework-SDK7 GitHub Wiki
Introduction:
This document is meant to act as a guide on how to use the Decentraland TCG Framework. The TCG Framework provides a variety of easy to use interfaces for creating your own trading card games in Decentraland, including the following features:
- Create custom game cards with various keywords/effects/models
- Customise decks/collections of cards that can be used at game tables
- Create card game tables with various networking types (local, P2P, server) & player types (human, AI)
- Player account progression (interface for experience/levelling), allowing players to unlock cards at given levels
- NFT card ownership, allowing unlocks when a player owns/wears a Decentraland wearable
The TCG Framework itself contains 3 base folders:
- TCG-Assets: all assets (models, images, etc.) developed for the project
- TCG-Framework-Client: source for all scene code
- TCG-Framework-Server: source for all server code
Most creators will likely only be interested in the ‘TCG-Assets’ and ‘TCG-Framework-Client’ folders, but we’ve provided both the server and asset sources for more advanced creators.
NOTES FOR NON-PROGRAMMERS:
This document is set up with the expectation that you have at least some understanding of programming (in or out of Decentraland). What follows is a brief set of notes that is meant to make this document an easier read for no/low code-experienced creators:
Comments: Portions of code that are meant to explain what is happening in the program: they do not run/are ignored by the program.
//this is a single line comment
/** <- comment starts there
* this is a multi-line comment
* comment ends there -> */
Functions & Parameters: Functions are a series of actions done by your code when you call that function. Parameters are values that can be passed to a function to modify what is done/act as a local variable for that function.
//function named ‘FunctionExample’, takes a parameter named ‘param’, which is a number
export function FunctionExample(param:number) {};
Enums: enums represent a predefined set of values that can be referenced in code and are recognized by VSCode, providing auto-fill suggestions. They are used often in the framework for creating easy to change settings.
Indexing: Many parameters require unique keys for indexing. When an object is created with a given key, it is indexed to that key; if you create a new object with a key you’ve already used you will overwrite that pre-existing object.
Ex: if you create a deck manager with the key of ‘dm-1’, then create another deck manager using that same key you will overwrite the first deck manager.
Enums: enums represent a predefined set of values that can be referenced in code and are recognized by VSCode, providing auto-fill suggestions. They are used often in the framework for creating easy to change settings.
Defaults: Any parameters that are marked as ‘optional’ (marked with ‘?’ in the data interface) have built-in defaults that will be used if now parameter is provided. These defaults are standard across all data interfaces. Below is a listing of parameters that are usually optional, along with their default data values:
Parent:Entity -> defaults to ‘Undefined’
Position:Vector3 -> defaults to {x:0, y:0, z:0}, zero’d position
Scale:Vector3 -> defaults to {x:1, y:1, z:1}, 1 times scale
Rotation:Vector3 -> defaults to {x:0, y:0, z:0}, zero’d rotation