Page 2 of 3

Re: SQL Support

Posted: Tue Jun 01, 2010 7:29 am
by Richyg
okay to break down the idea and where I'm at...

The game idea is a sports management simulation for a sport I've designed from scratch. The details of this aren't really important.

The game requires a considerably large database. One league will have around 20 teams and each team around 20 to 30 players (call it 25) plus staff etc. So each league has around 500 players. Each nation is likely to have on average 4 leagues (divisions) and this is to spread accross many nations (potentially 100+). So I'm talking around 200,000 players as a guideline but I want it to be able to handle more than this as I've designed it to be a dynamic world where new leagues, players and clubs are added as the interest in the sport expands.

As concerns my developments. I've got SQL to work to a certain extent, except it it unable to parse variables into the queries. From what I can understand from what I've read this is a LUA issue with SQLite3.

I'm not hardened to using SQL but is it possible to create such an extensive relational database in another way??

Re: SQL Support

Posted: Tue Jun 01, 2010 2:27 pm
by pygy
Aaargh. :-( the phone ate my beautiful answer :-(

You could build it using Lua tables.

Use a tree, with, for each level, a reference to its parent, and an index.

Code: Select all

for _, team in pairs( AllPlayers[uid].team.division.teams ) do
    SomethigWithThe( team )
end
Stats on all players/teams would be expensive, but they could be boosted by using data structures adapted to the tasks at hand.

You can save the data to disk by using a strategy similar to this (the code is for Lua 4), or this (it uses SQLite for storage, which is of no use here, but there could be good ideas for data marshalling). use one file per table.

For efficient loading, you could use the memoization example in the PiL chapter about weak tables.

Re: SQL Support

Posted: Thu Jun 03, 2010 7:26 am
by Richyg
@pygy - Thanks for the info because I think its led me to my solution.

lua-sqlite3!

http://www.nessie.de/mroth/lua-sqlite3/ ... ation.html

However, I'm not understanding the whole makefile stuff so has anyone got experience in doing this? if so I can get a dll and it has the functionality to bind variables to lua! basically giving me what I've been looking for all along! :D

Re: SQL Support

Posted: Thu Jun 03, 2010 9:14 am
by nevon
Richyg wrote:However, I'm not understanding the whole makefile stuff so has anyone got experience in doing this? if so I can get a dll and it has the functionality to bind variables to lua! basically giving me what I've been looking for all along! :D
In Linux you just have to do:

Code: Select all

./configure <options>
make
make check
sudo make install
But I don't know if that's how you do it in Windows as well.

Re: SQL Support

Posted: Thu Jun 03, 2010 2:04 pm
by bartbes
You don't, unless you have mingw32 or cygwin, check for visual studio project files (and install visual studio if they exist)

Re: SQL Support

Posted: Thu Jun 03, 2010 8:42 pm
by Richyg
I really can't get these make files to work.
I've been trying to use Visual Studio's command prompt and nmake function and it keeps erroring that there is an illegal character which is bizaare!

I trolled the net to find someone is using this wrapper for the very thing I'm trying to use it for so I'm really peeved i can't get it :(

Re: SQL Support

Posted: Sun Jun 06, 2010 8:40 pm
by Richyg
Sucess at LAST!!!!

I found a lsqlite3.dll file randomly on the net and it works. I've got bound variables working to find individual records in my sqlite3 database meaning I can finally continue with my project.
Maybe I can get some of my developments in order to show you all what the fuss was for at some point :D

If anyone needs the file you can get it here...
http://www.autoplaymediastudio.com/uplo ... ile_53.zip

Re: SQL Support

Posted: Sun Jun 06, 2010 8:52 pm
by Jasoco
Will it work cross-platform? DLL drums up fears of Windows exclusivity.

Re: SQL Support

Posted: Mon Jun 07, 2010 8:54 am
by Richyg
It may well have an issue between PC and MAC. I'm developing for PC, any MAC developments will be on a backburner and may require making two seperate installs with differing ways of controlling the libaries.

Re: SQL Support

Posted: Mon Jun 07, 2010 9:48 am
by Robin
And not to forget Linux.

Now, the great thing with LÖVE (and Lua) is that cross-platformness doesn't cost you anything: it's the default, so to say.

You're free to include DLLs (as long as their licenses permit that, of course), but it strikes me as unlövely to say the least.