Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / [LOCKED] The DBO Format Project

Author
Message
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 12th Mar 2018 10:50
In this thread, I will document my adventures in reading/saving/and reloading a Simple DBO File with some extra "visual" information I may or may not include. This will use all native DBPRO Commands, no DLLS.

I always start my projects with 3 files.

This project will have these 3 files.
DBO Project.dba
Functions.dba
Globals.dba

Now as you follow along...you may face-palm and think "Why'd he do it that way?"

Sometimes it's simply because I don't know any better, and other times I do "have my reasons" for my madness. So I will be doing this "my way".

So tune in tomorrow, and we'll get started with the basic main shell DBA and some needed functions and globals for the project and get started.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 12th Mar 2018 19:42
Sounds interesting and potentially useful. Good luck with this.
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 13th Mar 2018 00:59
Let's get some basic stuff out of the way and create our project with 3 files mentioned above and put the beginning code in. As I said before, sometimes there is a reason for my madness...it may not be readily apparent as we start...So I will try to call my madness "My Way" and also denote the "DBPRO way" in the comments. I like to use global vars, probably to much.

All we will do this session is get the file size of our DBO, load the object for visual purpose, and setup some basic function and vars. Our simple object and the media are atached. unzip and drop them into the project folder.

DBO Project.dba

Functions.dba


Globals.dba

Attachments

Login to view attachments
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 13th Mar 2018 06:54 Edited at: 13th Mar 2018 06:56
Later today, After I teach my English classes, we'll start with the first bit of code of actually deconstrucing the simple DBO test file.

I'm also trying to make a little google-sheet of the various things we'll see as we deconstruct the simple object.

Next small step (later today) to add to the previous code will be: The DBO Header info.
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 13th Mar 2018 09:05 Edited at: 13th Mar 2018 09:09
Alright! Let's get started on The Header! (almost!!)

If you're following along, you should already have the 3 files for this project created and have downloaded the attachment and extracted it to the project folder.

Sometimes I may add all the code, other times I may just tell you where to insert some code. Today we will insert...
This post we will do some setup, the post following we will start to parse the header data.

Under "gosub InitGlobals2" in the main project file, we'll add a function call:



In our functions.dba file we will add some function to the ones already there...We'll add Readfile() and MakeDWORD()



Let's add the arrays and some other info we are going to need to the Globals.dba file (add inside the InitGlobals2 routine.




Next post coming soon...a few minutes or more
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 13th Mar 2018 09:34
Ok!

Let's parse The Header!

The Header consists of 5 parts.
1. Length of String (dword)
2. The String itself (Always "MAGICDBO") (string)
3. The Version # of the DBO File. (dword)
4. Reserved 1 (dword)
5. Reserved 2 (dword)

Insert this under readfile() in the main project we just added...you'e following along...right???



Let's add some things to our Do/Loop to visualize what we just added...

Add under Part 1 the File size info in



And with that...We have parsed The Header! Awesome!

Next time (tomorrow), we'll start parsing the Data-Blocks...
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 13th Mar 2018 09:45 Edited at: 13th Mar 2018 09:46
If you did everything correctly so far...you should have something like this...

Attachments

Login to view attachments
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 14th Mar 2018 03:52
Let's start reading the Data Blocks! Today we will get the Root Frame and it's Code Size.

We'll insert our new code under our

//*********************************************************
//Get DBO Header Done**************************************
//*********************************************************

in the main project file

Our first Data Block code will be for the Root Frame (Code 1)
and it's Code-Size

main project file


We'll also add some global varibles into our "globals" file
inside the "InitGlobals2" routine.

globals.dba



Let's also tweak our DO/LOOP in the main dba file to this


Coming next installment...Getting the Frame Name
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 15th Mar 2018 05:06 Edited at: 15th Mar 2018 05:11
I lied...We won't be doing the Frame Name code now...maybe later today.

We're going to start needing a little more screen real estate, so let's take care of that before we do Frame Name.

In our main dba file, Let's add this right above the "sync" command in our do/loop,
it will let us toggle the object on/off and also show our values of our counters.



And in our globals.da we'll add this at the end of our //Data Blocks section of InitGlobals2



Soon... We'll rock n roll and retrieve the Frame Name data block.
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 15th Mar 2018 09:36
If you're following along, and I hope you are, soon things are about to get hairy! Don't get lost!

Ok, Frame Name time!

Our next block code after the Root Frame (code 1)
will be the block code for Frame Name (code 101)

It consists of a DWORD (the code 101), a DWORD (length of the frame name string block)
and the string (the name) itself.

At the end of our current
//*********************************************************
//Data Blocks *********************************************
//*********************************************************

section, we'll add this in our main dba file.



Also, let's replace our do/loop with this



We'll also add this at the end of our //Data Blocks section in our globals.dba file in the InitGlobals2 routine




Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 15th Mar 2018 09:48 Edited at: 15th Mar 2018 09:58
So our app should look like this now (press the "1' key to hide the object):



You can see by looking at our counters near the bottom of the screen.
We are 44 bytes into the file itself (Counter), and 12 bytes into the Root Frame (CodeIndex).

Our next bit of fun will be the Frame Matrix, but we may tweak some things as far as text display before that to be able to toggle through the different codes we explore.

Attachments

Login to view attachments
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 15th Mar 2018 10:13
And that was not good..as I completed the last post...The laptop just went black...had to hit the power button to restart.

So backing up now just in case...Last time something like this happened, I had to wait for the laptop to cool down, then windows wouldn't boot, and I had to restore from the recovery CD I brought with me, (un)fortunately.

If the laptop goes down, worst case scenario is I continue on my desktop when I get back to the USA at the end of April if I can't make the laptop boot.
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 16th Mar 2018 11:53
I haven't forgotten about this. Just taking a day or two to work on my other projects.

Frame Matrix is coming soon!

We'll add a new function and a new array!
Mage
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 18th Mar 2018 01:21
Zep wrote: "This will use all native DBPRO Commands, no DLLS."


Zep wrote: "if DLL EXIST(1) = 0 then LOAD DLL "kernel32.dll", 1"
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 18th Mar 2018 02:16
I was talking about Plugin DLLs that add commands to the DBPRO language, of course.

Anyway...
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 18th Mar 2018 02:21 Edited at: 18th Mar 2018 02:26
Ok! Let's get back to this.

We're going to do a little setup first.
We'll create our new function, do a little memblocking
and add a new multi-dimensional array of floats to
store our Frame Matrix.

What is a Frame Matrix? I have no idea, but I think you
use it with some later Codes in the Code Block to
do various calculations with. I believe the Frame Matrix
should not be changed, but that is speculation on my part.

We'll add this to our globals.dba
at the end our our current //Data Blocks section.

globals.dba


Let's also add our new function MakeFLOAT(), to read a FLOAT from 4 bytes under
our MakeDWORD function.

functions.dba


Let's stop here for a few minutes...
In the next post, we'll read our Frame Matrix into the array
and maybe(?) display it.
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 18th Mar 2018 05:17
Quote: "Let's stop here for a few minutes..."


A few minutes turns into a few hours...Forgot I had some classes to teach. Soon...a few hours or so.
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 18th Mar 2018 06:16
Alright!

Let's read in our Frame Matrix and store it in a float array.

We'll also add a another function to display it.

Under the "// End Get The Frame Name" in our main dba file,

Add this



And we'll add this to our do/loop in the //Special Keys and Text section
under the previous keystate() commands we added before in the main dba





Then we'll add the function to display the Frame Matrix. (press the F1 key to see it)
maybe press 1 first to hide the object before pressing F1

So, add this to our functions.dba file at the bottom.

functions.dba



As you can see by pressing F1 to view the Frame Matrix...ours is quite simple
as we have a simple object, but trust me, those 1s and 0s are floats
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 18th Mar 2018 06:26 Edited at: 18th Mar 2018 06:32
If you've done everything right, you should end up with these screenshots.

Notice we are now 120 bytes into the file (counter) and 88 bytes into the root frame code block (CodeIndex).



And here is a shot of our Frame Matrix when pressng F1.



Next up...We will decode the Frame Mesh (code 125).

Attachments

Login to view attachments
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 18th Mar 2018 06:50
Note:

We are NOT going to be doing Animations, Bones, Siblings, Sub Blocks...etc... or Custom Code in this example or any other crazy things.

I am only showing what I needed to build an object and change/add to some of its properties (Mainly Textures)

My Level is quite much like our tester2.dbo object, only much bigger.

At the end of this project, we will change the white plane in our test object, add a texture, retexture that white square (plane)
and re-display the object with our changes. All by changing the data we have read in already and adding/changing it and then displaying the changes we made to our object.

To do the other stuff I don't need, this tutorial will give you the foundation you need to create that stuff yourself.

Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 18th Mar 2018 07:39
Quote: "Next up...We will decode the Frame Mesh (code 125)."


However, before that, we will be adding/changing our "//Special Keys and Text" in our do/loop
to toggle the display(s) of what we have already done, to save screen real estate and to display future Block Codes.

Sort of like we just did with to display the Frame Matrix.
Bored of the Rings
User Banned
Posted: 18th Mar 2018 10:43
from "Our Professional Programmer" to clearly an amateur-> you need to learn to read before learning how to program. Code 125 is "Mesh Use Material".
Good riddance....
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others

Attachments

Login to view attachments
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 18th Mar 2018 11:04
Quote: "Code 125"


Of course, that was a typo. But keep the snark coming "Professional Programmer". I enjoy it.
I've already decoded the whole file in my other project. These are cuts from my completed project.

Quote: "Good riddance...."


Bye bye, don't let the door hit you on the way out.
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 18th Mar 2018 11:37 Edited at: 18th Mar 2018 14:18
And BTW,

Our resident "Professional Programmer" did little more than copy Lee's Object .cpp and .h files and plugged what was returned into an X File template.

So take anything he (or other naysayers) says in this thread with a grain (a mountain?) of salt

Cut and Paste coding at its finest. *Golf Clap*
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 19th Mar 2018 00:42
In a few hours, we'll start to decode the Frame Mesh (Code 103). This is another piece of code you may need to index into later, so we'll add another counter.

I will also rework our do/loop to clean up the screen and move our groups of text commands to different functions (Like we did previously with the Frame Matrix). I may do/post this first, in fact.

Exciting times are ahead!
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 19th Mar 2018 06:35 Edited at: 19th Mar 2018 06:38
Ok, Back at it!

First lets clean up/replace our do/loop in our main dba file

main dba file


Let's add these functions to display our text

functions.dba


And let's replace our DisplayFrameMatrix() function with this:
functions.dba


And finally, so our new text functions display correctly, let's add some global vars.

At the bottom of our "//Header Info" section
globals.dba


And at the bottom of our "//Data Blocks" section.
globals.dba


Press the various named F keys to see that Data Block. (Currently F1 thru F4)

That's it for today! We'll decode the next Data Block (The Frame Mesh: 103) tomorrow!.
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 20th Mar 2018 08:33
I'm going to take 2 or 3 days off here for the Waifu's birthday (Many Parties for that here in Vietnam). We'll hit it again in a few days.
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 21st Mar 2018 00:46
I may have a few minutes today to knock out another code (103)...We'll see.
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 21st Mar 2018 02:02
Let's quickly knock out the Frame Mesh code 103

under
//End code to loop and store our Frame Matrix

in our main dba file

We'll add this
main dba


and we'll add this to our do/loop at the bottom of the
//Key Descriptions
section in our do/loop
main dba



next we'll add the DisplayFrameMesh() function at the bottom
of our functions.dba file

functions.dba


And finally, we'll add some variables to our globals.dba file
at the end of the
//Data Blocks
section

globals.dba


As you can see, we now have a Frame Mesh Size. That means
in the next installment, we'll add yet another counter
to increment as we step thru the Frame Mesh.
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 21st Mar 2018 02:07
Oh my...we forgot to call our new function

add this to our do/loop in the
//Special Keys and Text
section, under our other F key keystate checks.

main dba


Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 21st Mar 2018 12:38
While we're fixing thing, let's replace our DisplayFrameMatrix() function so it more accurately depicts we are looking at floats.

functions.dba

Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 2nd Apr 2018 15:21
Sorry for the delay. I am wrapping up my 2 year English teaching stint here in Vietnam and preparing to head back to the USA later this month.

So between birthday parties, end of class parties and other things (packing!) I won't have time for this until probably mid June as I move back to the U.S. and get settled, buy internet, etc...I may even have to...ack!...Find a real job.

Happy Trails!
Bored of the Rings
User Banned
Posted: 3rd Apr 2018 08:02 Edited at: 3rd Apr 2018 10:17
Quote: "Our resident "Professional Programmer" did little more than copy Lee's Object .cpp and .h files and plugged what was returned into an X File template.
"


actually that's incorrect. The program is totally written in Darkbasic Pro, no C++ code written at all. So you need to get your facts straight before making accusations. All templates etc and program code in pure darkbasic pro. I could paste my code here which would be extremely long, but you wouldn't understand it. Have you actually read on Directx and learnt it? My guess is probably not. You as an amateur will struggle finishing this so called tutorial. You will never finish it because you don't know what your doing. Good luck, you certainly will need it as I did all this that your attempting to teach yonks ago. Oh on another note, yes you will need to find a real job ha
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
Mage
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 3rd Apr 2018 08:49
Bored of the Rings
User Banned
Posted: 3rd Apr 2018 09:16
Quote: "Zep was warned."


ok, well that explains a lot after seeing that link.

I want to emphasise that as a programmer by profession, I do not and will not copy other people's code. I don't need to, I have my own style of coding. On the other hand, I am not always right and I still learn off other programmers if they have a better approach in tackling a programming problem.



Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 3rd Apr 2018 12:00
You guys need to get over yourselves.

Zep--
Bored of the Rings
User Banned
Posted: 3rd Apr 2018 12:21
you need to get banned....
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 4th Apr 2018 00:29
Lol
Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 4th Apr 2018 15:16
I would suggest both of you, go back and look at the threads you are upset about, and see who threw the first personal attack or contributed snark. (I just re-read them BTW)

I think (if you're honest), you'll find the results interesting.

Being proven wrong is not the same as a personal attack or snark.
Bored of the Rings
User Banned
Posted: 4th Apr 2018 15:53
yawn
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
Mage
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 4th Apr 2018 19:24
Zep wrote: "Being proven wrong is not the same as a personal attack or snark."

This is a subtle attack and deliberate attempt to bait me into an argument, referencing one of the previous threads.
https://forum.thegamecreators.com/thread/221747#msg2620138

It violates this rule:
Seppuku Arts wrote: "3.12 We do not tolerate 'trolling', the process of posting inflamatory messages for the sake of starting an argument, or being plain obnoxious."
The Next
Web Engineer
16
Years of Service
User Offline
Joined: 3rd Dec 2007
Location: United Kingdom
Posted: 4th Apr 2018 22:09
@Zep

Your recent attitude towards others on the forums has put a fair few peoples backs up, it has now reached staff. I have been reviewing the posts and would have to agree that when people are attempting to help you, there is a tendency to have a bad attitude when their response is not the one you wish to hear or people disagree. The forums are intended to be a place for respectful constructive discussions and you are currently not helping with that.

You have been warned multiple times by moderators about your attitude towards other users of the forums. Consider this a final warning the next time a moderator has to step in about bad attitude towards users they will issue a ban for the length of time they see fit.

The DBPro boards may not be the most active these days but they are still held to the high standard we expect of all forum users so ignoring multiple warnings from mods will not be tolerated.
Windows 10, Intel i7 3.8 GHz, 16GB DDR3, NVIDIA GTX 780 4GB Superclocked

Zep
21
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 5th Apr 2018 01:23
Quote: "@Zep

Your recent attitude towards others on the forums has put a fair few peoples backs up, it has now reached staff. I have been reviewing the posts and would have to agree that when people are attempting to help you, there is a tendency to have a bad attitude when their response is not the one you wish to hear or people disagree. The forums are intended to be a place for respectful constructive discussions and you are currently not helping with that. "


Maybe those "offended" need to stop digging up old threads in attempts to rile me up.

I have a bad attitude because someone else so thick-headed can't take being proven wrong?

I have a bad attitude because I ask a simple question and am replied to in a snarky manner?

I don't think you objectively read all the involved posts in question here.

Quote: "You have been warned multiple times by moderators about your attitude towards other users of the forums. Consider this a final warning the next time a moderator has to step in about bad attitude towards users they will issue a ban for the length of time they see fit."


I recall one. Can you show me more? Any fool can push the "report post" button. I choose to take care of it myself if the situation warrants it.

We have a saying in America, "Don't dish it out if you can't take it", some posters on this board need to take that to heart.

Zep--
Mage
17
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 5th Apr 2018 01:54
Zep wrote: "I have a bad attitude because someone else so thick-headed can't take being proven wrong?"

Again he issues a subtle attack and deliberate attempt to bait me into an argument, even after being warned for a final time.

Seppuku Arts wrote: "3.12 We do not tolerate 'trolling', the process of posting inflamatory messages for the sake of starting an argument, or being plain obnoxious."


The Next wrote: "You have been warned multiple times by moderators about your attitude towards other users of the forums. Consider this a final warning the next time a moderator has to step in about bad attitude towards users they will issue a ban for the length of time they see fit."
Bored of the Rings
User Banned
Posted: 5th Apr 2018 06:07 Edited at: 5th Apr 2018 09:18
Quote: "We have a saying in America, "Don't dish it out if you can't take it", some posters on this board need to take that to heart."


Talking about yourself again. lol. Try practising what you preach. Or are you too thick headed. double lol.

Still not finished this so called tutorial then? you never will. not a clue. It's called [MODEDIT: Swearing even with asterix is not permitted] baffles brains. A saying we have in the UK. I'm so bored with this thread, I'm off to do some real work in a real job. Haven;t got time for trolls.
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
The Next
Web Engineer
16
Years of Service
User Offline
Joined: 3rd Dec 2007
Location: United Kingdom
Posted: 5th Apr 2018 09:23
Zep has been banned for a week, you were warned by another mod and then by myself. I won't be dragged into a pointless debate over when and where you have been warned and what for the fact is a mod has warned you more than once and as such you are now taking a short break.

This thread is now locked.
Windows 10, Intel i7 3.8 GHz, 16GB DDR3, NVIDIA GTX 780 4GB Superclocked

Login to post a reply

Server time is: 2024-04-20 05:57:21
Your offset time is: 2024-04-20 05:57:21