Text Database

An asset by KoBeWi
The page banner background of a mountain and forest
Text Database hero image

Quick Information

0 ratings
Text Database icon image
KoBeWi
Text Database

Advanced loader for text data files (JSON, CFG). It can load your files and perform a complex data validation. If you like keeping your data in text files, this will be useful as it ensures that your data is correct, i.e. without typos.Data collections in TextDatabase are arrays of dictionaries. You can e.g. store items, enemy data, or level metadata etc. in a JSON or CFG files, where each item/enemy/level/etc is a Dictionary with some properties. You can define fields for your data, which can be either mandatory, or just allowed, and the loader will ensure that your fields are correct.Example usage:var database = TextDatabase.new()database.add_mandatory_property("price")database.add_valid_property("attack")database.load_from_path("res://items.json)var data = database.get_array()Example valid file:[ { "name": "Sword", "price": 100, "attack": 5 }]Example invalid file:[ { "name": "Shield", "defense": 1 }]It's missing "price" and "defense" is not a defined property, so the file won't load. You can catch errors like this, so you can avoid unexpected behaviors due to data typos.btw, ConfigFiles (CFG) are much better than JSON. Here's the Sword example as CFG:[Sword]price = 100attack = 5You can store multiple items in one file and load multiple files into database. Just use load() multiple times on one database and then get_array() will return data from all files. Or you can use get_dictionary() instead and access the entries by name.Explaining all functionality would be very long, so just read the README, which you can find in the asset's repository (: You can also find an example project in there.

Supported Engine Version
4.0
Version String
1.3
License Version
MIT
Support Level
community
Modified Date
4 months ago
Git URL
Issue URL

Advanced loader for text data files (JSON, CFG). It can load your files and perform a complex data validation. If you like keeping your data in text files, this will be useful as it ensures that your data is correct, i.e. without typos.

Data collections in TextDatabase are arrays of dictionaries. You can e.g. store items, enemy data, or level metadata etc. in a JSON or CFG files, where each item/enemy/level/etc is a Dictionary with some properties. You can define fields for your data, which can be either mandatory, or just allowed, and the loader will ensure that your fields are correct.

Example usage:
var database = TextDatabase.new()
database.add_mandatory_property("price")
database.add_valid_property("attack")
database.load_from_path("res://items.json)
var data = database.get_array()

Example valid file:
[
{
"name": "Sword",
"price": 100,
"attack": 5
}
]

Example invalid file:
[
{
"name": "Shield",
"defense": 1
}
]
It's missing "price" and "defense" is not a defined property, so the file won't load. You can catch errors like this, so you can avoid unexpected behaviors due to data typos.

btw, ConfigFiles (CFG) are much better than JSON. Here's the Sword example as CFG:
[Sword]
price = 100
attack = 5

You can store multiple items in one file and load multiple files into database. Just use load() multiple times on one database and then get_array() will return data from all files. Or you can use get_dictionary() instead and access the entries by name.

Explaining all functionality would be very long, so just read the README, which you can find in the asset's repository (: You can also find an example project in there.

Reviews

0 ratings

Your Rating

Headline must be at least 3 characters but not more than 50
Review must be at least 5 characters but not more than 500
Please sign in to add a review

Quick Information

0 ratings
Text Database icon image
KoBeWi
Text Database

Advanced loader for text data files (JSON, CFG). It can load your files and perform a complex data validation. If you like keeping your data in text files, this will be useful as it ensures that your data is correct, i.e. without typos.Data collections in TextDatabase are arrays of dictionaries. You can e.g. store items, enemy data, or level metadata etc. in a JSON or CFG files, where each item/enemy/level/etc is a Dictionary with some properties. You can define fields for your data, which can be either mandatory, or just allowed, and the loader will ensure that your fields are correct.Example usage:var database = TextDatabase.new()database.add_mandatory_property("price")database.add_valid_property("attack")database.load_from_path("res://items.json)var data = database.get_array()Example valid file:[ { "name": "Sword", "price": 100, "attack": 5 }]Example invalid file:[ { "name": "Shield", "defense": 1 }]It's missing "price" and "defense" is not a defined property, so the file won't load. You can catch errors like this, so you can avoid unexpected behaviors due to data typos.btw, ConfigFiles (CFG) are much better than JSON. Here's the Sword example as CFG:[Sword]price = 100attack = 5You can store multiple items in one file and load multiple files into database. Just use load() multiple times on one database and then get_array() will return data from all files. Or you can use get_dictionary() instead and access the entries by name.Explaining all functionality would be very long, so just read the README, which you can find in the asset's repository (: You can also find an example project in there.

Supported Engine Version
4.0
Version String
1.3
License Version
MIT
Support Level
community
Modified Date
4 months ago
Git URL
Issue URL

Open Source

Released under the AGPLv3 license

Plug and Play

Browse assets directly from Godot

Community Driven

Created by developers for developers