SQLite for Panda3d

Hello,

I was looking for a way to store data from my game without just putting stuff in plain text files or using a full blown database like PostgreSQL.

I’ve used BerkeleyDB in my dayjob, but SQLite uses a BSD license (means do anything you want with it).

I discovered that pysqlite was what I needed. The best part is they already provide SQLite in DLL format and ready for use in Python (.pyd).

Since I already have Python 2.4 installed on my system outside of Panda3d I just ran the installer. After installation, I went to Lib/site-packages and made a copy of the pysqlite-2 directory and placed it into the same directory under my Panda3d Python location.

Then from ppython.exe test to make sure you got everything:

from pysqlite2 import test
test.test()

If you see a bunch of dots like this:

Then SQLite and Python has created a testDB on your hard drive. It should be in the root Python directory I believe.

Anyway, just thought I’d share this with others. I haven’t fully tested it out yet other than the above test to see if Python would import the module though.

Hope this helps.

Steve

Thanks for the information.

What sort of game are you writing that you need a db if i may ask

Hi Martin,

Well, a game with quests and stuff like that. Like everyone tries to make, an RPG :slight_smile:

Of course trying and what I actually complete are two different things! :wink:

I just wanted something with persistence and so it wasn’t real easy for people to look in a text file and see the answers to questions and such. The plan is to have it so others can login to the main “server” and play along. I’m not into massive multiplayer, only small groups so several others maybe playing at the same time.

Steve

Sounds great

It’d be nice to see this integrated into Panda3D core, don’t you think so? I see a thousand uses for a DB in just about any program, games included.

Yeah, but its simple enough to just install it yourself. I was orginally heading the “compile it yourself” route when I discovered the job was already done.

Steve

Ok, taking a closer look at it I recognise it’s really quite simple. By far more simple than some pipelines, in fact. :wink:

Thanks for sharing that!

Hi Marc,

Your welcome!

Steve