INGAME database?

BlitzMax Forums/BlitzMax Beginners Area/INGAME database?

DCI(Posted 2007) [#1]
The game idea ive been tossing around, is going to use an INgame database.. I really want nothing to do with sql or php. i would like all of the database functions to be in blitz, requiring NO external software.

IS blitz capable of writing information to a text, or other data file.. and then capable of searching that information, deleting, updating or replacing individual fields within that file, or multiple files? or do i HAVE to use an external method for databases?


DCI(Posted 2007) [#2]
IF blitz is capable of doing these things on it's own, can you give me an example of the code?


FlameDuck(Posted 2007) [#3]
I don't understand your question. PHP is not a database, and I doubt you'll find any database whose primary interface isn't some variant of SQL.

From what I gather you're looking at something like SQLite maybe? There are a few wrapper modules around, I'm sure searching will locate them, or maybe someone else is going to come along and post a link for you.


DCI(Posted 2007) [#4]
what im looking for, are blitz commands and examples of usage, to do the following things, To create files, to search said text file, to add new lines to the text file, and, in a line that says something like this:

993842,5283,5238,584,348

to go in and edit a given value in that line, like replace the 584, with another number as update by the game, say, changing the amount of armor that unit #993842 has on it's chest

how to change individual fields, in a given entry, etc


Gabriel(Posted 2007) [#5]
It sounds very much as though you want XML. There are various modules for XML around. I personally prefer Brucey's LibXML module.


Paposo(Posted 2007) [#6]
Hello.

if you use fixed length registers is very easy replace any value using random acces. if you use single delimited registers you need rewrite all file when you modify any value and the new value and original value not have same lenght.

Bye,
Paposo


Brucey(Posted 2007) [#7]
I really want nothing to do with sql

Why shut yourself off from tools that would make your life easier?

What's great about BlitzMax, is that there are lots of modules available that can help you get a job done. I might see that such-and-such a module can help with problem A, and another with problem B, which used together can quickly get my app finished - rather trial-and-erroring some of my own code on the way.

Of course, there's absolutely nothing wrong with recreating the wheel everytime you want to do something

But then of course, there's nothing wrong with learning something new either ;-)


FlameDuck(Posted 2007) [#8]
Of course, there's absolutely nothing wrong with recreating the wheel everytime you want to do something
Except "you'll never finish".


Czar Flavius(Posted 2007) [#9]
You talk about a database but seem to be adding things to a simple text file.. What are you going to use this for? Perhaps you don't need a database for it? Blitz can perform basic file access functions such as creating files, searching them for text, editing text etc. These are not database functions, however. At least not in the usage you seem to be after.


ImaginaryHuman(Posted 2007) [#10]
I dont see what the big thing about using XML is - it makes it easier for human-readable files to give them meaning, but what's the point in storing general dabase info as XML when it could just as easily just be raw data? Why does a web technology end up being used for everyone's non-web applications?


Gnasher(Posted 2007) [#11]
i would firest creat a datastructure to hold the item object in, in this object you would have all the data for the item ex Armor[ name, Ac, Effect1..10, color..]

then you need to creat a jaged linked list (if you want or some other algo) where you can travers and look for you items that you want [loots of cool examples here on thebord]

saving is no problem you save em in to a textfile in a flat maner.

hope it give you an idea how to solve your porblem

//Gnasher