My DataBase V.2 [blitzmax]

Community Forums/Showcase/My DataBase V.2 [blitzmax]

Hardcoal(Posted 2013) [#1]
Ok Ive finished remaking my DataBase.

This is a hierarchal database for loading game data.

Advantages
----------
-hierarchal structure
-very readable as a text file (if not encrypted)
-you can create multi databases for reading and writing.
-easy to understand and easy to use

Example of DataBase text file
-----------------------------

    SpaceShip[Name[Lunar]
              Xpos[45]
              YPos[20]
              ZPos[12]
              Function[Name[Rotate]
                       Speed[45.6]]
              Function[Name[Move]
                       Speed[70]]
              ]
 


Example of DataReading
-----------------------


    ReadDataAsStr "Spaceship/Name/"    'Will Return 'Lunar' as Answer

    ReadDataAsStr "Spaceship/Function/Speed/"    'Will Return '45.6' as Answer

    ReadDataAsStr "Spaceship/Function|2/Speed/"    'Will Return '70' as Answer



This is a quick release I didnt over Test it and I made it in 4 days so its pretty young.
I made it for my use when I load a complex Game level when objects have childrens and may also have sub childrens and
each object have its own functions..
So its mainly for loading and saving data at this moment.


Here is an example of Actual DataText from my Editor

Name[Gold-star-graphic]
IsGlobal[1]
IsActive[Act_On]
ElementGroupName[Players]
EntityOrder[Normal]
FileName[Gold-star-graphic.png]
Health[100]
XPos[0.229999974]
YPos[-6.84999943]
ScaleX[1.71000099]
ScaleY[1.71000099]
ScaleZ[1.71000099]
ColorR[255.000000]
ColorG[255.000000]
ColorB[255.000000]
Alpha[1.00000000]
EntityFX[1]
Class[Name[Func_CloneElement]
      ClassTypeName[Func_CloneElement]
      DoNotClone[1]
      WorkOnce[1]
      IsActive[Act_On]
      DataCell[Name[CloneThis]
               DataType[Element]
               Location[Parent]
]      DataCell[Name[CloneTimes]
                DataType[Value]
                Value[5.00000000]
                String[5]
                Location[Parent]
]      DataCell[Name[RndPosition]
                DataType[Binary]
                Value[1.00000000]
                String[1]
                Location[Parent]
]      DataCell[Name[RandomSize]
                DataType[Value]
                Value[2.00000000]
                String[2]
                Location[Parent]
]      DataCell[Name[DontCloneClasses]
                DataType[Binary]
                String[0]
                Location[Parent]
]      DataCell[Name[CloneInternaly]
                DataType[Binary]
                String[0]
                Location[Parent]
]]
Class[Name[Func_FadeElement]
      ClassTypeName[Func_FadeElement]
      IsActive[Act_On]
      DataCell[Name[FadeValue]
               DataType[Value]
               Value[0.0299999993]
               String[0.03]
               Location[Parent]
]      DataCell[Name[Blink]
                DataType[Binary]
                String[0]
                Location[Parent]
]      DataCell[Name[ButtomValue]
                DataType[Value]
                String[0]
                Location[Parent]
]]




Yasha(Posted 2013) [#2]
I think this is a "serialization format" rather than a "database" (calling something a database implies you can make complex queries rather than just request elements), like JSON, S-expressions, and similar things.

It's very pretty to look at though. It captures a certain Blitzy feeling while keeping it declarative and data-centric. Very nice.


Hardcoal(Posted 2013) [#3]
Thanks Yasha.

Thats why I posted it as in its basic shape.
To get requests and remarks.
Its no problem adding commands now that the initial skelaton works..
I only did it as i said for load and save.
Also, this was one of my most smoother programming projects ever.
Almost every thing worked as expected.

So this databases uve mentioned do they have a blitzmax module?


Hardcoal(Posted 2013) [#4]
Any way ive allready fixed some stuff

https://www.dropbox.com/sh/1u0e3xjmgw78yko/CSUNG9vAnH


xlsior(Posted 2013) [#5]
So this databases uve mentioned do they have a blitzmax module?


Brucey made modules to interface with several databases: Oracle, MySQL, Postgresql, SQLite...

Overall, SQLite is really convenient since it can be linked directly into your program and you don't have any external dependencies. have your program and a single-file SQLite database, and you can run full SQL queries:

e.g. "select leveldata from levels where levelnum=17" --> would return your level data if you can squeeze it in a string.