+4 votes

I'm starting development of a multiplayer turn based strategy game and need a way to store information about the players, their units, stats and other information so that they aren't lost as soon as the server is closed. A database would be ideal for this but so far I haven't been able to find any information on how to connect to a database from within Godot. This could be useful for other types of games like RPGs, I think, and would allow for easy tuning of game balance if developed correctly.

TL;DR, how can I connect to a database from within the game engine?

asked Feb 26, 2016 in Engine by Zera (19 points)

3 Answers

–1 vote
Best answer

a database is not supported wirte now but I think a module for sqlite can be written, you can use dictionaries for most of things that you said.
but if you need a sqlite or something like that you can write a module for it or just open an issue for feature request in github.

answered Feb 26, 2016 by Mohammad Hadi Aliakb (575 points)
selected Feb 26, 2016 by Zera
I thought about using dictionaries, too, but the problem would then be how to persist those dictionaries (in case of server crash or anything like that). I guess the best option will be to write a C++ module to connect to a PostgreSQL database, then.
+6 votes

Try this SQLite3 plugin: https://github.com/khairul169/gdsqlite

answered Feb 26, 2016 by dragoon (64 points)

the repository has not been updated since 2017!

0 votes

The actual best candidate is https://github.com/khairul169/gdsqlite-native referenced as the 3.x version of this module in the original repository.

answered May 29, 2019 by frankiezafe (86 points)
edited May 30, 2019 by frankiezafe

You may wanna remove the comma at the end of the link. It's not working right now.

it took me 15 sec' before getting where the error was :)

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.