Page 1 of 1

How to use SQLite with Love (Using additional binaries)

Posted: Sat Mar 17, 2012 8:26 pm
by Quinico
Ok, well I want to use SQLite in my game to pull down information from a database, but I don't know how to go about doing it. I know I will have to make a different version for each platform (which I don't mind) but I still have no idea how to use it with LOVE. Any ideas? :?

Re: How to use SQLite with Love (Using additional binaries)

Posted: Sun Mar 18, 2012 3:50 am
by tsturzl
Is this something that can't be done with serialization? When you say pulling "down" from a database, does this mean you're pulling from a database that is online? If so I'd say make a web API for this, would work much better. I'd avoid databasing small amounts of information, whereas serialization would work better in a situation like that. Serialized objects/variables can be accessed more programmatic.

Re: How to use SQLite with Love (Using additional binaries)

Posted: Sun Mar 18, 2012 10:57 pm
by Quinico
tsturzl wrote:Is this something that can't be done with serialization? When you say pulling "down" from a database, does this mean you're pulling from a database that is online? If so I'd say make a web API for this, would work much better. I'd avoid databasing small amounts of information, whereas serialization would work better in a situation like that. Serialized objects/variables can be accessed more programmatic.
I need to use a database to hold a lot of information, such as user data.

Re: How to use SQLite with Love (Using additional binaries)

Posted: Sun Mar 18, 2012 11:16 pm
by coffee
Well, at least you have wrappers/bindings for Lua. It's a start, now you have to integrate/compile it with LOVE source (if possible).
http://lua.sqlite.org/index.cgi/doc/tip ... lite3.wiki

Re: How to use SQLite with Love (Using additional binaries)

Posted: Sun Mar 18, 2012 11:48 pm
by trubblegum
Do you have an alternative?
I use a thread running on the server to communicate with a web api which also supplies the website.
The server periodically sends backup requests, which are responded to with account updates.
I don't think your database calls will not be noticeably quicker going directly from a bundled SQL client than they would be going to a web server.

Re: How to use SQLite with Love (Using additional binaries)

Posted: Mon Mar 19, 2012 8:06 am
by Jasoco
Remember that using your own libraries that are only available on certain platforms will basically make your game unplayable on those other platforms. Löve is supposed to be cross-platform. Adding libraries that only have say a Windows version will alienate Mac and Linux users. And vice versa.

Public service announcement. The more you know.

Re: How to use SQLite with Love (Using additional binaries)

Posted: Mon Mar 19, 2012 8:42 am
by nevon
Do you need to make a lot of calls to the database? If not, I would just go with serialization and storing it in a flat file. You can store a ton of data like that. It won't be as fast as if you stored it in a database, but it'll be a lot easier to set up, and if you're only loading/storing data every now and then (saving/loading the game, for example), it's probably going to be fast enough.

Re: How to use SQLite with Love (Using additional binaries)

Posted: Tue Mar 20, 2012 5:16 pm
by tsturzl
If you're storing user data for your game, then making a full on Database is way overkill. Look into serialization, its also easier to access than SQL.

When I think "a lot" of data I think of something like having several hundred/thousand/million users accessing something. In which serialization would be horrible. If you're making an online game where you have to sign in, then databasing is probably best, however, SQLite isn't your tool. You'd probably need a server to handle all the Databasing functions then, because giving your end user direct access to read and write to your database is like giving a thief the keys to your house.

You can either make a Web API to communicate with your client, or you can make a server which handles all these actions.

Really I can't see any need to store THAT much data all client-side that could not be done more effectively using serialization.

What exactly are you trying to accomplish?