Integrating SQLite Into Godot 4.2! Advanced Godot!

Поділитися
Вставка
  • Опубліковано 28 вер 2024

КОМЕНТАРІ • 105

  • @omr-top
    @omr-top 9 місяців тому +3

    first 😁

  • @Xero_Wolf
    @Xero_Wolf 7 місяців тому +2

    THANK YOU! I can't believe it took me so long to integrate SQL databases into my workflow. It's so simple it feels like I was a caveman just mucking about in the dirt before. lol

  • @astrahcat1212
    @astrahcat1212 9 місяців тому +3

    Yes of course want a database tutorial, trying to learn it for resume

  • @dwiss2556
    @dwiss2556 7 місяців тому

    This was a life saver for my current project. I was banging my head in dealing with loads of people in a world that i dont need to actively show but handle nonetheless and keep persistent over sessions. This just solved all my issues!

  • @acoalexdev
    @acoalexdev 8 місяців тому +3

    I would like to ask for some guidance on how to make this database accessible from different devices. My ideal scenario would be to have a mobile app where the database is online and every app can insert/remove data. I apologize if this is a basic question, but I am new to this topic. Thank you for the awsome video and your help.

  • @owenlloyd2528
    @owenlloyd2528 9 місяців тому +8

    Thank you for this. Edit: SQLite in user:/ seems the way to go, handling data for more complex and/or larger projects, eg quest systems, own dialogues, achievements and etc.

  • @BrnLng
    @BrnLng 9 місяців тому +1

    Very nice to know! Seems to be a good way to handle complexity better.

  • @ArkhKGB
    @ArkhKGB 4 місяці тому +2

    Sorry if you've done it in other videos but I think you should mention parameterized queries (you don't want to get a Bobby table incident) and transactions. For example if you make a crafting system it would be better to wrap the loss of materials and inserting new item inside a transaction so you don't get a way to duplicate things if the player crashes the game at the right moment.

    • @FinePointCGI
      @FinePointCGI  4 місяці тому

      Yeah it's one of my main misses in this tutorial... I should have brought it up but I never did

  • @njdarda
    @njdarda 2 місяці тому

    incredible, comprehensive tutorial. exactly what i was looking for.

  • @kronos548
    @kronos548 6 місяців тому +1

    for any wondering, i just tested. you can just build your database in the db browser, no need to construct it in godot (assuming doing something like an item db, that doesn't need to be written during play)

    • @FinePointCGI
      @FinePointCGI  6 місяців тому

      You def can, however in my exp I find its bad in practice. Most of the time its fine but you should always have your code check to see if the db exists before trying to hit it. It can help with dealing with random in production errors.

  • @izk4773
    @izk4773 3 місяці тому

    Thank you, this is a great video and is helping me with a school project!

  • @IgnisLux-wh7ty
    @IgnisLux-wh7ty 3 місяці тому

    Thank you this helped a ton.

  • @The1Corrupted
    @The1Corrupted Місяць тому

    Thank you SO much for this tutorial

  • @Amipotsophspond
    @Amipotsophspond 9 місяців тому +4

    when would you want to use a SQLight data base vs some other storage? is it faster for X data, smaller for Y data, easier to use with Z data, able to handle huge amounts of A data, really easy to store B data remotely, really useful with C data, perhaps D data can be encrypted in a easy way, E data has low overhead storage, or something else with F data. I guess you address my question at 24:13 data normalization, I would like to know more about selecting the best storage from available options. if you do make the data base video perhaps you could have a section on it, but don't go out of your way too much.

    • @FinePointCGI
      @FinePointCGI  9 місяців тому +8

      I actually was going to talk about this but didn't, I thought it would take away from the tutorial.... (though I realize now I should have). I'll create an additional tutorial to explain it further. To answer your question though:
      SQL excels in managing complex data with interconnected elements. Imagine a scenario where a person works for a company, and this company has several employees, including that person. In SQL, this would be organized into three tables: person, company, and employees. The company table house company informaiton that would be linked to employees that house employee data like salary position etc, and these employees are also llinked to the person table which houses name address etc. The reason this is nice is it alows you to segment your data in a nice logical format that you can scale.
      When managing this kind of data with JSON, you would need to load the entire file and parse the data, which can be painful to handle. Imagine having 500 employees do you store all of there info in a single json or multiple files then you have to worry about directories and storting..
      Also SQL is generally faster for more complex operations. It's not the best choice for simple tasks like storing basic save data. However, for more complex data involving save data, weapon data, stats, and level information, SQL is significantly more efficient. A huge advantage of SQL is the ability to read and write data simultaneously, which becomes very important as your data volume grows.
      I hope my ramblings make some sense let me know if you have more questions.

  • @richslonaker2768
    @richslonaker2768 6 місяців тому +1

    So, in my game player data will be stored in the database, as will inventory items and their characteristics, and enemy data (different enemy types have varies characteristics)... I want them all to be connectable in game via the database... how would you approach this? Would love a follow up video on databases.

  • @theBSH
    @theBSH 9 місяців тому +1

    i get SQL error: out of memory when inserting data , what should i do ?
    Edit : you have to add open_db() before it

  • @HuangShengHong
    @HuangShengHong 7 місяців тому +1

    Are the args in select_row(), update_row(), insert_row() sanitized and using prepared statement to avoid sql injections? I didn't see it mentioned in the document.

  • @rabios9911
    @rabios9911 5 місяців тому +1

    Another easy way to do this is with a SQLite nuget with C# in visual studio you just have to connect your godot project with VS. You can pretty much set it up in 2 mins. Even if you prefer gdscripts you can still just make one c# script for your database and make everything else in gdscript.

    • @ollie-d
      @ollie-d Місяць тому +1

      This is my general approach for things, but doesn't work if you're building for web since C# is currently has no web support in 4.x

  • @dshcfh
    @dshcfh 9 місяців тому +1

    33:43 The code right here is broken but functional, you iterate over every column and create an image from the data, including the name and score. It will break once you add another column.

    • @FinePointCGI
      @FinePointCGI  9 місяців тому +3

      I'm not sure I'm following, I just added another column and it's fine. Query result will return a list of objects and our code iterates though each object not column
      We are picking which column we want to pull our data from by doing I.picture which returns the picture.

    • @dshcfh
      @dshcfh 9 місяців тому

      @@FinePointCGI I see now, I was thrown off because I'm not used to the soft typing of gdscript. You're right.

  • @cogspace
    @cogspace 2 місяці тому

    The reason DB Browser doesn't get installed into your program menu is because you told it not to. At 10:33 the installer asks if you want to add shortcuts to your Desktop or your Program Menu and you left both boxes unchecked. Admittedly a bit of a weird default but, you know, this is why you RTFM. =)

  • @exomat7
    @exomat7 5 місяців тому

    Does someone know how to insert an array of ImageTextures into my database? When setting a blob to an Array it just saves the directory of the images and not the image files right?

  • @zorannio
    @zorannio 8 місяців тому

    Great tutorial!
    Is it possible to store sounds, like mp3 as a blob and play them in godot as well? If yes, could You provide additional info on how to do it?
    Additional question: isnt just better to store link to image and have image inside folder, instead to store the image itself into database?

  • @Dutch-linux
    @Dutch-linux 6 місяців тому +2

    actually it says for html5 3.3+ so anything from 3.3 and higher is supported !!! that includes godot 4

    • @nlight8769
      @nlight8769 4 місяці тому

      That's what I was about to say

  • @ShivrajDeshmukh99
    @ShivrajDeshmukh99 7 місяців тому

    can we export the app with sqlite and run it on an android device? i'm having trouble while exporting sqlite, could you make a video or give instructions on it?

  • @diemissonlima7274
    @diemissonlima7274 25 днів тому

    In Godot's assetlib I didn't find godot-sqlite! Postgree only appeared, can you integrate SQL without installing it through assetlib?

    • @FinePointCGI
      @FinePointCGI  25 днів тому +1

      yes you can dowload it directly from the github
      github.com/2shady4u/godot-sqlite/releases/tag/v4.4

    • @diemissonlima7274
      @diemissonlima7274 25 днів тому

      @@FinePointCGI Okay, I'll try! thanks

  • @ChichiKugel
    @ChichiKugel 6 місяців тому +1

    If i want to insert a data into my database table it says as a error "SQL error: database is locked" can anyone help me? xD

    • @ChichiKugel
      @ChichiKugel 6 місяців тому

      NVM I found the reason why... It was because it was opened in DB Browser xDDD

  • @orozcoapaza1660
    @orozcoapaza1660 6 місяців тому

    It's really cool how fast you debug using breakpoints, something I kind of avoid cause I don't understand well how it works, do you have any tutorial about debugging?? thanks for your awesome content...

  • @jammjumble9928
    @jammjumble9928 8 місяців тому

    Do you know to get the id of the row that was last inserted? I tried scope_identity and _last_insert_rowid + a bunch of other ways I thought could maybe work but nothing does. I don’t know if I’m just formatting them wrong or if they aren’t supported.

  • @TheErudito
    @TheErudito 8 місяців тому

    The same proyect with program language c# or not

  • @Sharmiyt_
    @Sharmiyt_ 5 місяців тому

    Iam working on a project Vegetable calculator ,how to save my all data and set data when load() ! . I crated a main scene and instance button and delete .the instance scene contains a script for calculate amount and has 3 lineedit and labe to display amount . how to load datat through instance and set instance.name and instance.rate through database ?..............

    • @Sharmiyt_
      @Sharmiyt_ 5 місяців тому

      Or is their any way to save my entire node with instanced scene's ?..

    • @FinePointCGI
      @FinePointCGI  5 місяців тому

      I would look at my SQLite entity framework tutorial. What I would do is make model objects the instance scene. From there I would set up my single light database with those model objects using entity framework and then put all the data inside of there and when I instance my scene is load the data.
      You could in theory save your node directly using Godot's binary writer but you will get a lot of extra data saved like position rotation, things like that so it's not super efficient but it's not a horrible way to go

  • @alimaxTeam
    @alimaxTeam 9 місяців тому

    Thank you excellent tutorial,
    I have question now after you export release and you run the game on other computer we'll have problem the game will not access to the data becaused SQLite is not installed, how to let godot including SQLite dll file?

    • @FinePointCGI
      @FinePointCGI  9 місяців тому

      For me I didnt hav ethis problem but in your export settings under the last tab you can include directories and that should work. If not just copy the DLL to the main folder of your export and it should just work.

  • @DexterFstone
    @DexterFstone 9 місяців тому

    Tnx very useful tutorial
    Can u make a tutorial about new Android plugin version 2 in Godot 4.2

    • @FinePointCGI
      @FinePointCGI  9 місяців тому +1

      I want to I just need to learn how it works

    • @DexterFstone
      @DexterFstone 9 місяців тому

      @@FinePointCGI thanks man u are the best

  • @malk9978
    @malk9978 9 місяців тому

    What about security? Can we encrypt the database? Or put credentials?

    • @FinePointCGI
      @FinePointCGI  9 місяців тому +1

      The addon does not support it but sqlite does so hopefully the team will add it.

  • @ArabGameDev
    @ArabGameDev 8 місяців тому

    hi
    i insert 1000 rows and the db file is 50kb then i deleted all rows and the file is still 50kb ??

    • @FinePointCGI
      @FinePointCGI  8 місяців тому +2

      Correct that's because when you delete data from a database it doesn't technically go away. What it does is it says that area is no longer occupied but it still says the same size so when you insert data it should reuse that empty space. If you want you can run a pragma to reduce the file size I'll have to look for which one it is

    • @ArabGameDev
      @ArabGameDev 8 місяців тому

      @@FinePointCGI does sqlite has encryption with godot

    • @FinePointCGI
      @FinePointCGI  8 місяців тому +1

      @@ArabGameDev The plugin that Godot has does not support that as far as I know. I do know the c# plugin does support it however.
      One way around it is to create a key in your code and to encrypt your data before you insert it and after you select it.

  • @GodotDevKen
    @GodotDevKen 9 місяців тому

    udpated PostgrSQL godot 4.2 pls

  • @jay.rhoden
    @jay.rhoden 9 місяців тому

    For someone wanting to export a game to iOS, test exporting before you get too far into this. Last I checked (about 1 month ago) Godot 4 exports to iOS don't work with SQLite on my setup.

    • @FinePointCGI
      @FinePointCGI  9 місяців тому

      I know sqlite itself works on IOS ive used it for work projects but I think the plugin itself doesnt support it or something with how GD extension works.

    • @jay.rhoden
      @jay.rhoden 9 місяців тому

      @@FinePointCGI Yes, I was using SQLite successfully in Godot 3.5, but couldn't get it going in Godot 4.1. I ended up ripping SQLite out so I can get my app migrated to Godot 4.
      (Perhaps whatever problem I encountered has been resolved now, I don't have much reason to revisit the decision to pull it out of my code at the moment)

    • @bissash05
      @bissash05 5 місяців тому

      @@jay.rhoden Do you know if something changed with Godot 4.2.1?

    • @jay.rhoden
      @jay.rhoden 5 місяців тому

      @@bissash05 I rewrote my code to load/save a Dictionary to/from JSON, and haven't needed to move back to sqlite. So I don't know if the situation has changed.

  • @choms99
    @choms99 23 дні тому

    M Y
    B O Y
    M O C H I
    Really useful to use as a guide to get started with the addon and as an overview when considering if it will be useful for a specific project. Great stuff!

  • @Sharmiyt_
    @Sharmiyt_ 2 місяці тому

    !....

  • @dueddel
    @dueddel 9 місяців тому +8

    I somehow didn't expect an SQLite integration being that easy! Awesome.
    As a web developer for a living an actual database is definitely an alternative to using resources in Godot (which I somehow prefer over JSON files). Thank you for your efforts of creating such more in-depth videos (unlike others who explain how to add a node to the scene tree and nothing else which doesn't help anyone at all).

  • @KenReed-z1x
    @KenReed-z1x 9 місяців тому +4

    Once you realize your multiplayer RPG can only handle so many networked objects (players and mobs) so now you use real world solution by using docker so you can spin up instances of your map and they all need to connect to the same database without overloading your database connection so you have to use cockroachdb so you can have multiple instances of the database. Disclaimer: Not all games are the same.

  • @adenashiscave
    @adenashiscave 9 місяців тому +3

    This is fantastic! I've been wishing I could use a database in Godot, and this is exactly what I wanted. Great video!

  • @statixvfx1793
    @statixvfx1793 8 місяців тому +3

    +1 for a crazy database tutorial! Fantastic work!

  • @shiv8859
    @shiv8859 2 місяці тому

    Error : No suitable library found for GDExtension: res://addons/godot-sqlite/gdsqlite.gdextension. Possible feature flags for your platform: mobile, android, etc2, astc, arm32, arm64, template, debug, template_debug, single
    the res://addons/godot-sqlite/gdsqlite.gdextension dose not have compile architecture.os !.
    LOCATION :
    "res://addons/godot-sqlite/bin/"
    PATH : libgdsqlite.android.template_debug.arm64.so
    It ONLY SUPPORTS amrabi-a8v architecture into APK ,
    If i use "armeabi-v7a", "x86", "x86_64" then the APK CRASH even I use GRADLE into APK OR ABB
    ANY SOLUTION !..................
    HOW TO FIX ?.......................

  • @koomooboo
    @koomooboo Місяць тому

    What happen when you rollout a new version of the game with a updated db schema? Is there a way to run migrations on the users' device?

  • @proatgaimz
    @proatgaimz 3 місяці тому

    awesome plugin, although i would not use the wrapper functions that takes in dicts, sql is easy to learn and i think i prefer the control of forming my of queries.

  • @gm3794
    @gm3794 8 місяців тому +1

    I can't find "Godot Sqlite" in AssetLib.
    Do I have to copy something downloaded somewhere so that I can find it?

    • @FinePointCGI
      @FinePointCGI  8 місяців тому

      Try SQLite and see if it comes up. You can also head out to their git
      github.com/2shady4u/godot-sqlite

    • @gm3794
      @gm3794 8 місяців тому

      @@FinePointCGI Thank you

    • @jeffersonSeb
      @jeffersonSeb 7 місяців тому

      Hi, try download latest version of engine. I have the same error and this fix it.

  • @robertbutchko5066
    @robertbutchko5066 8 місяців тому +1

    I have no idea how you made SQL seem approachable but thank you so much! Forgive me if this is a dumb question, but would it be straightforward to make the database an online database so different players could share it at once?

  • @jay-ar6593
    @jay-ar6593 9 місяців тому +2

    This guy is a beast!

  • @AlwaysEast
    @AlwaysEast 3 дні тому

    This is a massive game changer.

  • @TheBunzinator
    @TheBunzinator 3 місяці тому

    aAAAARRRRGGGHHHH!!!! It's SQL!!! NOT sequel!!!!!!!!!!!!!!!!

  • @alabvix
    @alabvix 2 місяці тому

    And how about packing the database with the .exe ?

  • @eyadsafi86
    @eyadsafi86 Місяць тому

    Thanks very helpful video

  • @erkintek
    @erkintek 2 місяці тому

    My name is John'truncate user

  • @Sharmiyt_
    @Sharmiyt_ 2 місяці тому

    ERROR : armeabi-v7a , x86, x86_64 " .os " in bin not there , only " arm64-v8a " can export to APK or ABB in SQLite , Is there any solution ?.... HELP !....

    • @shiv8859
      @shiv8859 2 місяці тому

      Me to

    • @shiv8859
      @shiv8859 2 місяці тому

      No suitable library found for GDExtension: res://addons/godot-sqlite/gdsqlite.gdextension. Possible feature flags for your platform: mobile, android, etc2, astc, arm32, arm64, template, debug, template_debug, single

  • @voimakeino5392
    @voimakeino5392 9 місяців тому +1

    isn't the html5 require +3.3+ the "+" means 3.3 or higher?

    • @FinePointCGI
      @FinePointCGI  9 місяців тому +1

      3.3 and higher I believe however I'm not fully sure

  • @_devcat3919
    @_devcat3919 6 місяців тому

    thank you so much for this tutorial everything is perfect and working just like what you uploaded 2yrs ago is really helpful for someone who used to be in making queries sql

  • @bayueden1373
    @bayueden1373 3 місяці тому

    can I use this as an alternate of using Resource? I mean will my game runs slower if I directly assign my variable with the queries result from my database?

    • @FinePointCGI
      @FinePointCGI  3 місяці тому

      It shouldnt slow down much if at all. The idea is to allow you to control your data better and able to segment your data.

    • @bayueden1373
      @bayueden1373 3 місяці тому

      @@FinePointCGI Appreciate it, this is a great video thank you for sharing!

  • @CivilizedWasteland
    @CivilizedWasteland 6 місяців тому

    Is it possible to parse the database into a dictionary?

  • @KevinLYT1
    @KevinLYT1 6 місяців тому

    What are the case usages for using SQLite?

    • @FinePointCGI
      @FinePointCGI  6 місяців тому

      SQLite is amazing for more complicated data. IF you ever need to have subsets of data its very useful so think of it like this
      i have 1000 items each one is a json file managing that is painful but if its all in one db its simpler to work with.
      If you put them all in one file then if you only want one item you need to load the entire file then pick the one you want but with sqlite you can just select the one you need based off of id or name.

  • @malk9978
    @malk9978 9 місяців тому

    I have this error in the editor -> "GDScript bug: Native class "SQLite" not found." Anyone experiencing this like me?

  • @dumpworth9473
    @dumpworth9473 3 місяці тому

    Thanks for the tutorial. This will be very helpful!

  • @Avenroot
    @Avenroot 3 місяці тому

    Awesome vid! Thank you

  • @87Romez
    @87Romez 8 місяців тому

    Amazing video, very informative and helpful. Thanks for your contribution! One thing that I think is missing (I'm searching for the answer now with little success) is how to access the database when it is stored remotely (on a web server). Works great when the database is stored locally, but I think a lot of people want online functionality!
    EDIT: also, it doesn't appear to work locally when exporting to android. open_db() fails to return anything when running the android build :( any help would be appreciated!

    • @MrDasfried
      @MrDasfried 8 місяців тому

      I think sqlite is not meant for that usecase. I believe postgresql would be better.... But there are plenty of other dbs as well ofcourse

    • @FinePointCGI
      @FinePointCGI  8 місяців тому

      I agree sqlite is designed mostly for local only access you could use SQLite if you wanted to you could use it with an API and use it as your main database however that would not scale at all.

  • @dvdpeeters
    @dvdpeeters 9 місяців тому

    Hello, big thanks for the tutorial, I guess using sqlite is for clientside only ? And how can we prevent our players to change the data on local ?

    • @FinePointCGI
      @FinePointCGI  9 місяців тому +1

      You can encrypt your database to prevent that. I do not believe the addon supports it though

    • @dvdpeeters
      @dvdpeeters 9 місяців тому

      Thx for your answer^^

  • @armarosniak
    @armarosniak 9 місяців тому +1

    This is awesome. I was thinking about exporting it as JSON, but I'm considering storing the data with SQLite!
    P.S.
    You are the best Godot Engine UA-camr I know. I started developing the game in earnest in June, and started watching your videos in October. I've learned more since then than I ever did before.
    Sincerely, you are the Best of Best tutor.