3D Rad - Free 3D game maker - Forum

This forum is now archived!

This forum is locked, and is a read-only version. A new community-ran forum can be found at classdev.net

News:

The 3DRad community can be found at classdev.net.

Pages: [1]

Author Topic: A demo of RadSqLite database in action  (Read 2076 times)

jestermon

« on: June 02, 2010, 05:55:19 PM »
Review the polls post, to see the origins of this fun little tool
http://www.3drad.com/forum/index.php?topic=4486.msg36780#msg36780

This is a fully working little database using 3D Rad. There is a small 483k dll that has sqLite built in, that provides full sql database management. no more text files.

It's lightning fast, and extremely powerful.

This is the demo release in a compiled project. As soon as the poll for this project closes (in 3 days of this posting), I'll release the source for the demo, as well as full instructions on how to use this fun toy.

To get you started (for the non-sql guys), you can type in the following commands to test it.

insert into test (name,surname) values ('Albert','Einstein');
insert into test (name,surname) values ('Doctor','Dolittle');
select from * from test;

create table players (name char(30), score char(10));
insert into players (name,score) values ('me','1000');
insert into players (name,score) values ('you','200');
select * from players;
select * from players where name = 'you';
delete from players where name = 'me';
select * from players;
drop table players;

That should be enough to get you started

Have fun.

Edit: for sql-guy... All data is stored as char(xxx) in this demo. numerics, blobs and other stores will be explained in the manual
hard coded limitations.(for game use). 1000chars per record, 500 max row reply for selects, 2048 length for sql requests... only 22 lines for display in 3D Rad, if you go over that, the Rad may fall over... remember this is just a demo.
« Last Edit: June 02, 2010, 06:02:23 PM by jestermon »
« Reply #1 on: June 02, 2010, 06:11:21 PM »
Wow, you sure get things done quickly jestermon. I love how simple SQL commands are, I'll definitely put this to use!
« Reply #2 on: June 02, 2010, 06:52:26 PM »
Had a play with it, excellent stuff. I like your ability to find simple solutions to a range of problems jestermon. This should also solve our transferring strings between scripts problem, right?

How will you control this from within a script then? Putting the same SQL commands to a dll function?
Is it possible to add a username and password to the db so its contents can only be accessed from within a specific project?

psikotropico

« Reply #3 on: June 02, 2010, 11:08:03 PM »
I'm looking for a girl like you... ;D ;D  she codes, I cook for her... ::)
now serious... wow!  this is freakin awesome... can't wait for this weekend to play with your toys...  ;D
is this resource designed to work in conjunction with your ImageMagic tool? it could be useful to display the data in tables and so on...
very well done
« Last Edit: June 02, 2010, 11:31:03 PM by psikoT »
« Reply #4 on: June 03, 2010, 01:50:57 AM »
Cool, so can i store a score, close the project then reopen and still have the score saved?

jestermon

« Reply #5 on: June 03, 2010, 09:00:17 AM »
Just to clarify what an sql database is, (for those that do not know), and to explain what can be done with RadSqLite.

A database is:
"Databases consist of software-based "containers" that are structured to collect and store information so users can retrieve, add, update or remove such information in an automatic fashion. Database programs are designed for users so that they can add or delete any information needed. The structure of a database is tabular, consisting of rows and columns of information."

SQL is:
"Structured Query Language (pronounced sequel or ess-queue-ell). A computer language designed to organize and simplify the process of getting information in and out of a database in a usable form, and also used to reorganize data within databases."

SQLite is:
SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. SQLite is the most widely deployed SQL database engine in the world. The source code for SQLite is in the public domain.

RadSqLite is:
RadSqLite is a dll that has the SQLite engine embedded, and is specially written to provide an interface from 3D Rad, by using its float array dll parameter, to pass information between 3D Rad and the dll.

RadSqlite has simplified the entire sql process by wrapping all the complexity in 4 simple function calls. Namely;
a.  setDatabase(); sets the name of the database to create or use.
b.  doSql();  executes all sql commands passed to it.
c.  getRecordcount(); gives the number of records returned by a query
d.  getRecord(); returns the data for a specified record from a query

RadSqLite comes in 2 parts. The dll, and a script. The dll does all the donkey sql work, with the built in sql engine. The script provides a set of functions that can be pasted into any 3D Rad script, and provides the full interface to the dll. All you do is call the functions, and it does all the work for you.

The database that gets created and used is a specially formatted text file that resides on the disk. All information is stored there, and can be easily retrieved.

All scripts that use the functions, have access to the database, which means that very complex data structures can be passed between different scripts in the same game, between game levels, or even in different games. Because the data is stored on disk, all information is permanent until it is deleted.

Because sqLite is the most widely used database engine in the world, there are thousands of tools to help manage, manipulate, import and export data in many forms. For example it is easy to import a csv (comma separated value) file into the database. This will for example allow you to set up waypoints, tree location vectors, dynamic terrain locations, Friendly and Enemy position, or whatever game data you need, in a spreadsheet, and then move this information into your database.

Like in the real world, most technology today is a spin-off of the space programs.
Because I need to store and retrieve vast amounts of game data for my Rad-Elite project, such as galaxy maps, planet locations and info, player status and position, as well as many other game states that can be carried across the entire game, the need for a database driven game has become essential in order for the project to succeed.
RadSqLite is a spin-off of the Rad-Elite space program, as are many of the other tools that I have posted recently.

So as I say in the space program... more to come :)
« Last Edit: June 03, 2010, 09:05:11 AM by jestermon »

jestermon

« Reply #6 on: June 03, 2010, 09:15:25 AM »
Thanks for the support guys.
I hope the previous post has answered some of your questions, and some not yet asked.

Code: [Select]
Cool, so can i store a score, close the project then reopen and still have the score saved?Yes

Code: [Select]
Is it possible to add a username and password to the db so its contents can only be accessed from within a specific project?Sadly no, the file format is open source. But..you can encrypt the data before storage..
If you need it, I can add an encryption function, so that you can control the key. It will be safer and faster done in the dll, than in the script.


Quote
I'm looking for a girl like you... ;D ;D  she codes, I cook for her... ::)
How well do you cook? :P

jestermon

« Reply #7 on: June 03, 2010, 09:50:38 AM »
I was looking around at some tools that will be useful for using with RadSqLite, and I think I found the ideal (one of many) tool for this.
SQLite Database Browser by tabuleiro is a marvelous little GUI tool that allows you to manage your sqlite databases like a simple spreadsheet. It supports sql, and also has import/export features. Perhaps this may give a better idea of what RadSqLite can give you in your games.
This program is open source, and on the public domain, and may be freely used and distributed as well.
http://sourceforge.net/projects/sqlitebrowser/

PS: You can create and maintain you game tables using this or similar tools (unless the data is encrypted by RadSqLite..as proposed earlier)

Edit: attached a screenshot of the Rad planets sqlite database, using this tool
« Last Edit: June 03, 2010, 10:41:28 AM by jestermon »
« Reply #8 on: June 03, 2010, 11:23:35 AM »
This is sweet.. You're official the DLL guru of Rad now.
My every day job is several terabyte sized oracle databases and I can tell you this is a huge plus to Rad even if it is just sqllite :)

jestermon

« Reply #9 on: June 03, 2010, 12:11:38 PM »
Thanks Shadmar ..

I see from your "order by" that you will have a lot of fun with this program. It's got 99% of the standard sql commands, so you can really fly with it.

It may take a while to introduce its real power to the community, but it's going to be great seeing it put to use in games to come.

You stick to the terabytes, I'll stick to building toys, any day. :)

psikotropico

« Reply #10 on: June 03, 2010, 12:53:38 PM »
How well do you cook? :P

better than programming... ;D

It may take a while to introduce its real power to the community

yeah... only for those that are blind... I will remake all menus and GUI from my game so, are you happy now? hope you don't release a makeasupercoolgamenow dll in the near future

jestermon

« Reply #11 on: June 03, 2010, 01:12:37 PM »
How well do you cook? :P
better than programming... ;D
It may take a while to introduce its real power to the community
yeah... only for those that are blind... I will remake all menus and GUI from my game so, are you happy now? hope you don't release a makeasupercoolgamenow dll in the near future
Haha psikoT, you are delightfully funny :)
Pages: [1]