[PLUGIN] USQLite

What is “USQLite”:

This is my implementation of SQLite API for Unreal Engine 4.
This is one of most complex and useful Unreal Engine extensions I’ve built so far.
This system empowers you to save and load any data to and from SQLite Databases in Unreal Engine 4 without forcing you to write a single line of SQL Code (or Blueprint Spaghetti).
If you’re developing a Game that heavily relies on persistent data that must be reliably saved and loaded all the time, such as RPG Games, your best bet is implementation of a Database such as SQLite to record Player’s progress, instead of relying on binary or text files to save your Game…

But learning SQL programming may become a daunting and lengthy process for some.
With this system in place, you can create reliable Databases for your Games, and never care less about SQL syntax.

Making use of a powerful custom serializer engine, based on Unreal Engine’s Code Reflection System, this tool is capable of helping you to do amazing and unique data persistence in runtime that otherwise would be impossible.
For example: Unreal Engine’s “SaveGame” system can’t easily save Actor References and restore them to your Properties in real time, but with this system you can:

  • Execute Multi-Threaded SQLite Functions!
  • Create & Edit Database Assets in Unreal Editor!
  • Auto Generate SQL Code through Property Reflection!
  • Setup Property Versioning to support old Game Versions!
  • Save & Load Object References (Pointers) and easily restore them!
  • Save & Load data without conflicts across multiple streamed Levels!
  • Save & Load Actors or Component References and even Arrays of References!
  • Save & Load any kind of Struct as well as basic types like Ints, Strings, Vectors, etc!
  • Save & Load from Background Thread, while players are sill interacting with Game World!
  • (Optional) Progress Bar System can accurately report loading status without freezing the Game!
  • (Optional) HUD System can generate and show Loadscreens when saving or loading the Game!


Real-Time Auto-Generated SQL Code for Properties:

https://i.imgur.com/W3lCyyC.png



Auto-Generated Loadscreens:

https://i.imgur.com/b0CmlxV.png

https://i.imgur.com/xW7fDoV.png



Search, Delete, Copy & Paste Database Records within Unreal Editor:

https://i.imgur.com/9V1HbGi.png

https://i.imgur.com/SylX5Bl.png



[DEMO PROJECT]:


This package is now released on Unreal Marketplace!

Hi BrUnO,
really impressive looking plugin. Looks like a dream come true!

I’ve been trying to implement a simple login data structure and save it with hard-coded test data, to no avail. Could you let me know if I am doing it correctly?
I am new both to Unreal and SQLite (coming from Unity and MySQL), so I might be completely off.

I first created a database, with some simple columns (UUID, USERNAME, PASSWORD) - all of these are strings.
I then created a class (AccountData), that is child to SQLSerializable_OBJ. It creates three variables (UUID, USERNAME, PASSWORD), these are strings, marked as public and Save Game tagged.
Finally, I added a blueprint to the Level. This holds a reference to the database. It checks if the client is a dedicated server, then creates a new instance of the AccountData class, populates the three variables with string data, and then calls the Immediate Command Save on the populated AccountData object.

Should I be seeing the data in the editor table by this point? Because I don’t see any rows in the database at all.

Thanks,
Tomas

I went ahead and setup the logic and interface for my inventory components but I’m having issues when there saved they all just read all the same for each index in the DB which is just a empty slot, I have my player stats setup to save and that’s all working but this structure array I’m having issues with :frowning: i also have arrays inside the inventory array structure not sure if that is support or not? Thanks

Is it also normal for all actors and components using the db interface to be inserted into a DBs which there currently not saving to when Save All Data is used?

Yeah it seems a load of plugins on the marketplace are having the same issues, not sure why they would of made that change i guess its because they moved to VS 2017.

When a player joins a server I want to create a Object Instance?! (Character) with a specific name and save that object ref into the DB.
The object has a variable steamid (save game is marked) which also exists in the DB. Once I trigger the event nothing happens. What am I doing wrong?
I am in PlayMode when checking the DB for entries.
I tested both Immidate Command: SAVE )Object) and Generate SQL from OBJECT: INSERT

No Inserting For Primary key Integer. Tutor please!
Add to your DB write and read by different operators: int (11) NOT NULL AUTO_INCREMENT, timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, ALTER TABLE ". $ F. " ADD ". $ _ POST 'p']. " INT NOT NULL AFTER ". $ P. " SELECT * FROM object LIMIT 1, SELECT id FROM create WHERE idskill = “. $ _ POST ‘UseValue’].” AND Creator = ‘". $ Ex [0]. "’ AND use = 1, SELECT * FROM link ORDER BY id ASC

Add column type formula Excel?

Well, take a look on this screenshot, this BP for sure is not working. It just try to explain what i try to achieve.

well, that makes sense now. sorry for wasting your time :slight_smile:

good, its basically the same, i just need to use object instances.

this is what i did real quick, its working, but is this the proper way to do it?

So I’ve created the database, set it up in game mode and UI element but when I tell it to save nothing happens? nevermind, when the game runs I get an update but … why can’t I create new rows from a single object even if I give my “Text primary key not null” a different name?

I wanted this plugin to store my character sheets stats in one place but they all get created from the same UI object : / is that even possible ?

Right now I have a character creator that I plan to use to create all the NPCs, that creator is outputting a very complex struct variable.
I wanted to assign all that data into a database using your plugin

Does that sound feasible?

I’m trying to do that and I sort of understand what you said but not really (I’ve googled it and I’m still confused, sorry) :frowning: how do you create a Uobject blueprint?
Correct me if I’m wrong but as I understand, you’re saying to create a Uobject blueprint containing my character sheet struct, then creating an instance of it with a different name using “new object instance” to set and load variables from?

Sorry to bother again but I’m still a bit stuck.
As you said I’ve created an object blueprint containing my struct and I spawn a copy, assign its values and save (1)
Then the database is updated correctly (2)
But when a new map is loaded the database empty itself (3) and trying to load from the same instanced object returns no data

Do you know why that might be?

Bruno,

I’m using Unreal Source 4.21 and when I try to build the Server, I get this error (see image). Any idea what is causing it or what I need to do to fix it?

I’ve ported several prototypes and projects running on this plugin today to UE5 and everything seems to just work. No code changes required.

any chance on getting missing posts revived? ie how to add to integrate into an existing project?

I don’t think EPIC is able to restore these posts anymore.
You can download demo project (to copy blueprint graphs), paste them into your own project and follow the videos bellow to get it working:


Also, note in demo project the use of a "DBID " string on the character blueprint.
You can add such property to your blueprints and create your own ID for actors registered in the database, instead of relying on constructed names.

thanks! will this be able to serialize and save a component that is part of an actor?

Yes, actor components are supported.

here is another resource i found that may help others

1 Like

Hey, just started experiements with your plugin to learn how it works but I have a question. I created two different databases, first one is for player stats, and the other one is for placeable actors (workbench, chests etc.).

When I save the game, both database have same entries. I’m sure if it’s intented, but it’s like I see the Workbench ID in PlayerStats database. The value is Null of course but is it normal? They don’t share common variable names.

Also I’m having FPS drops for 1-2 seconds when I save the game. I just replicated the demo project (the rpg one, where the character has skills) Is it expected or there are ways to have more smooth saving process?

Thanks!