How to use SQLite with Love (Using additional binaries)

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
Quinico
Prole
Posts: 4
Joined: Fri Mar 09, 2012 5:15 pm

How to use SQLite with Love (Using additional binaries)

Post 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? :?
User avatar
tsturzl
Party member
Posts: 161
Joined: Fri Apr 08, 2011 3:24 am

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

Post 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.
Quinico
Prole
Posts: 4
Joined: Fri Mar 09, 2012 5:15 pm

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

Post 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.
coffee
Party member
Posts: 1206
Joined: Wed Nov 02, 2011 9:07 pm

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

Post 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
User avatar
trubblegum
Party member
Posts: 192
Joined: Wed Feb 22, 2012 10:40 pm

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

Post 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.
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

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

Post 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.
User avatar
nevon
Commander of the Circuloids
Posts: 938
Joined: Thu Feb 14, 2008 8:25 pm
Location: Stockholm, Sweden
Contact:

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

Post 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.
User avatar
tsturzl
Party member
Posts: 161
Joined: Fri Apr 08, 2011 3:24 am

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

Post 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?
Post Reply

Who is online

Users browsing this forum: No registered users and 48 guests