Page 1 of 2

Can I work with databases?

Posted: Wed Apr 29, 2015 8:01 am
by BGBgus
Hi,

I just registered minutes ago. I've been looking for a game engine o framework to develop my own videogame for a project on the college. After asking advices and reading comparisons, I've decided to choose Löve2D, but there's still one thing I must know before start working on this.

Can I use a database (like MySQL or SQLite, even an ORM, I don't really care)? I guess the answer is “yes”, but, how? I looked at the Tutorials in the wiki, but haven't find anyone about working with databases. May you help me, please?

Thanks for advance

Re: Can I work with databases?

Posted: Wed Apr 29, 2015 11:07 am
by Skeiks
I think you would have to use a lua library to get that functionality. Here's one I found.

http://keplerproject.github.io/luasql/doc/us/

Re: Can I work with databases?

Posted: Wed Apr 29, 2015 11:46 am
by BGBgus
A lua library, you say? I'm taking a look to that, thanks, Skeiks!

Re: Can I work with databases?

Posted: Wed Apr 29, 2015 2:12 pm
by bobbyjones
BGBgus for what purpose do you need database in love2d? If its for back end you can use any server for the back end like node or any other service that may have better support for Databases or what have you

Re: Can I work with databases?

Posted: Wed Apr 29, 2015 2:37 pm
by BGBgus
Hi bobbyjones,

I could use an online server, I hadn't thought about it. But I don't want to lose data for those player who may play offline...

Thank you, any way ^^

Re: Can I work with databases?

Posted: Wed Apr 29, 2015 6:52 pm
by T-Bone
What are you trying to do? Databases are great for storing large bulks of data. Databases for games are typically used if you're going to store tons of gamers' save data on a server, not storing individual players' save games on their local computers. But I guess it depends on the game, if your games stores tons of data it might make sense.

Re: Can I work with databases?

Posted: Wed Apr 29, 2015 7:00 pm
by BGBgus
First of all, thanks for answering, T-Bone.

It's a simple 2D platforms game, I wouldn't really need a database, but I'm making it on a course's project, so I SHOULD use a database. I guess I'll store some high scores or something like that.

In some other project, you'd recommend me to store the data in files, maybe?

Re: Can I work with databases?

Posted: Wed Apr 29, 2015 7:05 pm
by bobbyjones
You should use files on client. And database on backend. And using a database for high scores is a wonderful idea. If you must use a database on client you can use SQLite3. P.S you shouldn't need one for client. Please don't do it lol.

Re: Can I work with databases?

Posted: Wed Apr 29, 2015 7:06 pm
by bobbyjones
You can have a high score database on a server and connect to it through luasocket

Re: Can I work with databases?

Posted: Wed Apr 29, 2015 7:38 pm
by BGBgus
Thanks again, bobbyjones, I'll check this 'luasocket' library. I hope it's no too tricky xD

And I should think on encrypting those files on the client... would be great if someone plays it, but don't need cheaters!