Can I work with databases?

General discussion about LÖVE, Lua, game development, puns, and unicorns.
BGBgus
Prole
Posts: 10
Joined: Wed Apr 29, 2015 7:47 am
Location: Terrassa, Barcelona, Spain

Can I work with databases?

Post 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
User avatar
Skeiks
Citizen
Posts: 51
Joined: Wed Jan 28, 2015 1:51 pm

Re: Can I work with databases?

Post 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/
BGBgus
Prole
Posts: 10
Joined: Wed Apr 29, 2015 7:47 am
Location: Terrassa, Barcelona, Spain

Re: Can I work with databases?

Post by BGBgus »

A lua library, you say? I'm taking a look to that, thanks, Skeiks!
bobbyjones
Party member
Posts: 730
Joined: Sat Apr 26, 2014 7:46 pm

Re: Can I work with databases?

Post 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
BGBgus
Prole
Posts: 10
Joined: Wed Apr 29, 2015 7:47 am
Location: Terrassa, Barcelona, Spain

Re: Can I work with databases?

Post 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 ^^
User avatar
T-Bone
Inner party member
Posts: 1492
Joined: Thu Jun 09, 2011 9:03 am

Re: Can I work with databases?

Post 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.
BGBgus
Prole
Posts: 10
Joined: Wed Apr 29, 2015 7:47 am
Location: Terrassa, Barcelona, Spain

Re: Can I work with databases?

Post 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?
bobbyjones
Party member
Posts: 730
Joined: Sat Apr 26, 2014 7:46 pm

Re: Can I work with databases?

Post 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.
bobbyjones
Party member
Posts: 730
Joined: Sat Apr 26, 2014 7:46 pm

Re: Can I work with databases?

Post by bobbyjones »

You can have a high score database on a server and connect to it through luasocket
BGBgus
Prole
Posts: 10
Joined: Wed Apr 29, 2015 7:47 am
Location: Terrassa, Barcelona, Spain

Re: Can I work with databases?

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

Who is online

Users browsing this forum: pgimeno and 1 guest