Using external database in AGS game

Started by TheNaiker, Mon 02/05/2016 10:39:06

Previous topic - Next topic

TheNaiker

Hi,

I am currently writing a sport manager with AGS (thst's odd, I know). Now, since I am thinking to include quite a big number of teams, I'd like to include all data in a separate database. In fact I am a bit worried about some tables, like the one reserved for players and the one for their names/surnames, since they would store some thousand of records. I know the basics about SQL, but I can't figure how to manage it with AGS, since I'd like to read and write data from a database. Using text files and their functions inside AGS wouldn't probably be appropriate (loop 2-3000 rows of text every time to find data of a player?), and I don't know how much is "safe" to build very long structs with 2000+ elements.

So... How could I make it? I didn't find any plugin about that, and I couldn't get any help from the previous topics about the subject.

Hi, this signature is not funny because my imagination is actually on holiday.

Monsieur OUXX

#1
I've written a tiny xml parser but it's genuinely shit (it cannot handle large files, and it won't help you with querying nayway).
Apart from that, if you really want to use authentic, robust SQL, then you have no choice: you need to find a way to interface AGS with a database engine (MySQL, etc.). Obviously, I suggest a local engine, installed on the computer, but noawadays I believe you can even connect to remote databases with not too much extra hassle apart from authenticaton stuff (of what a time to live in).

AGS cannot communicate with external programs natively. You could make a plugin but I don't know how good you're at programming, and it's a lot of work.

I would suggest one of these solutions :

- There is the Lua Plugin, which allows you to use Lua, and therefore the billion libraries it offers. I'm 110% sure you can do SQL with that. It's the simplest opinion imo. The only trouble will be for you to iterate on the queries results using AGS script language. It's surely possible, but annoying. Calin Leafshade, the creator of that plugin, can surely help you with manipulating the data structures.

- There is that plugin that allows you to do C# in AGS. Same principle as Lua plugin, but with C#. You'll need to google how to query SQL with C#.

- There is a plugin that interfaces with Windows' DLLs or command line (I can't remember which, and I can never find this plugin each time I look for it) but in both cases there are ways to do SQL using the command line or low-level DLLs. Just google it.
 

TheNaiker

Thanks for answering. I guess I'm going to use SqlLite with the lua plugin (I don't want an online database) and asking Calin for giving me some hint about how to use that properly.

Thanks again.
Hi, this signature is not funny because my imagination is actually on holiday.

Guilhem

Hi,

I came here for the exact same reason : thinking about using AGS for a sport management game. It led me to the same question - can SQL be used along with AGS?

Did you progress on that topic?

Cheers,

Khris

Definitely possible, because I did that to store the high scores of Floaty Rog.
I'm not making a direct connection to the SQL server though, I'm sending and receiving HTTP requests using the agsSock plugin. A small PHP api is used to handle the DB.
Not suitable for a local DB though.

edmundito

Another recommendation is that you may need to not use sql db to do this but instead export all the data in JSON; this is actually what most commercial games with lots of data do. Then with the Lua plugin you may be able to load, parse and organize the data.
The Tween Module now supports AGS 3.6.0!

SMF spam blocked by CleanTalk