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 / DBO format extract - Simple textured plain.

Author
Message
Zep
15
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 6th Mar 2018 09:00 Edited at: 6th Mar 2018 09:06
Simple parsing of a DBO file. made a textured plane with make object

Some things I don't understand or are not described in the DBO Format Doc.

Some things are floats, but I read them as bytes (for what I need, I didn't need the actual float values)

I stepped through the whole file byte-by-byte comparing to the DBO Format doc as I went along.

This is what I came up with. The numbers at the END of the lines is the last number of that offset. I started counting at 1 (not 0)

Green Gandalf
13
Years of Service
User Offline
Joined: 3rd Jan 2005
Location: Cornwall UK
Posted: 6th Mar 2018 11:52
Which version of the DBO format docs are you using? The format was changed about 10+ years ago. If you're using the one mentioned in the Help files (dated 2003?) then I'm about 95% certain it has been updated since then.

If that old version is the one you're using I'll see if I can find an updated version somewhere. It was probably included with one of the DBP updates. All i know is that I've seen it somewhere....

Good work unraveling that info though - just wait till you try to digest an animated model with 60 limbs and 3 sets of texture coordinates.
Zep
15
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 6th Mar 2018 13:52
Quote: "Which version of the DBO format docs are you using?"


Dec. 8, 2003.

I haven't found anything newer so far.

Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 6th Mar 2018 14:43
heres the one I used to write my DBO2X exporter for both static and skinned meshes. Most embedded codes are DWORDs.

Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others

Attachments

Login to view attachments
Zep
15
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 6th Mar 2018 14:56
Quote: "heres the one I used to write my DBO2X exporter for both static and skinned meshes. Most embedded codes are DWORDs.
"


Yes, that has a little more of my missing info. Thanks!
Green Gandalf
13
Years of Service
User Offline
Joined: 3rd Jan 2005
Location: Cornwall UK
Posted: 6th Mar 2018 18:42 Edited at: 6th Mar 2018 18:43
Bored of the Rings

Where did you find that revised version? Like Zep I couldn't locate a more recent version than 2003 - although I'm fairly sure there was one at one point. It's absence from the Help file looks like an oversight to me.
Mage
11
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 6th Mar 2018 19:41
I would greatly appreciate a DBO file specification if one is available.

Bored of the Rings wrote: "heres the one I used to write my DBO2X exporter for both static and skinned meshes. Most embedded codes are DWORDs.
"

I had hoped you might speak about this issue. I noticed you talking about your tool in the AppGameKit chat. Does your attachment detail animation and vertex weights or is it just limited to mesh?
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 7th Mar 2018 09:15
@Green Gandalf - to be honest I'm not 100% sure. Over the years I have kept backups of all DBPro versions and somewhere along the line managed to find a 2005 doc version of the DBO format.
@Mage-the attachment has details on animation and bone weights.
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
Zep
15
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 7th Mar 2018 09:50
I've managed to fill in the blanks on my plane test, except for the last few bytes

Any ideas? This is after the reading code block size.

(36 bytes I can't find explained in the Doc)
2,0,0,0 (?) 1053
8,0,0,0 (?) 1057
0,0,0,0 (?) 1061
0,0,0,0 (?) 1065

150,1,0,0 (???) 1069
4,0,0,0 (bytes?) 1073
0,0,0,0 (val?) 1077

0,0,0,0 (?) 1081
0,0,0,0 (?) 1085 (End of File)
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 7th Mar 2018 10:18
@Zep-you need to read in embedded codes as DWORDs not bytes.
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
Zep
15
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 7th Mar 2018 10:22
Quote: "@Zep-you need to read in embedded codes as DWORDs not bytes.
"


You have noticed I have groups of 4 bytes each?

Effectivly a DWORD.
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 7th Mar 2018 10:32 Edited at: 5th Apr 2018 11:19
@Zep-you need to use DWORD instead of reading in BYTE if you want to get the correct code counts.
Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others
Zep
15
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 7th Mar 2018 10:34 Edited at: 7th Mar 2018 10:35
Tell me 4 bytes is not a DWORD.
Zep
15
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 7th Mar 2018 10:48
Quote: "I stepped through the whole file byte-by-byte comparing to the DBO Format doc as I went along."


BTW, First Post.
Zep
15
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 7th Mar 2018 14:04 Edited at: 7th Mar 2018 14:20
Quote: "Good work unraveling that info though - just wait till you try to digest an animated model with 60 limbs and 3 sets of texture coordinates.
"


Thankfully, for what I need it for, I won't have any of that -- limbs, animations, bones or what not. My "levesl" are a simple 1 object, 1 "root frame".

Just need to parse the "Level", be able to change textures on the faces and/or add more textures, then rewrite/reload the file.

I'm a simple man with simple needs

Honestly though, once you can parse the DBO format, what you suggest shouldn't be too hard.
Zep
15
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 7th Mar 2018 14:11
I found some newer *.cpp/*.h files for the DBO Format in the RC U7 update zip . I should be able to figure out those last 36 bytes with that, I hope. Haven't dug into them yet. Maybe tomorrow.
Zep
15
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 7th Mar 2018 14:52 Edited at: 7th Mar 2018 15:14
I just have to laugh sometimes at the "DBO format/code"...9 bytes to define a byte or a bool. (code (DWORD)+length(DWORD)+ the byte (BYTE))
For example, a bool:
125,0,0,0 (code 125-mesh use material)
1,0,0,0 (bytes 1)
0 (bool 0 or 1)
That could have been done in 3 bytes. (or even 2), instead of 9

4 bytes to define a "block code" that is a byte in length. (ie frame matrix 102, 125 mesh use material, or whatever)

There appears to be no "block code #" longer than 1 byte.

Even if there was, 0xFFFF (2 bytes) would give you access to 65,535 different codes (edit: +1, don't want our "Professional Programmer" getting his panties in a knot).
Mage
11
Years of Service
User Offline
Joined: 3rd Feb 2007
Location: Canada
Posted: 7th Mar 2018 19:11
Bored of the Rings wrote: "@Mage-the attachment has details on animation and bone weights."

Thanks that's a huge help. I haven't had time to look through it but it sounds like it will be great considering the results you yourself have been reporting with your tool.

Zep wrote: "I just have to laugh sometimes at the "DBO format/code"...9 bytes to define a byte or a bool. (code (DWORD)+length(DWORD)+ the byte (BYTE))"

I had noticed this when I peeked at the original 2003 document. I'll probably just need to write a wrapper function to sort out this song and dance in a pain free manner.
WickedX
9
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 8th Mar 2018 01:25 Edited at: 8th Mar 2018 01:28
Have you guys seen this? https://forum.thegamecreators.com/thread/123900

Here is the output for a 1x1 plane.



Attached is the executable. Just drag the DBO file to the exe.

Attachments

Login to view attachments
Zep
15
Years of Service
User Offline
Joined: 31st Aug 2002
Location: From PA, USA. Currently reside in Hanoi, Vietnam
Posted: 8th Mar 2018 02:48
Quote: "Have you guys seen this?"


That helped a little more. 2 being the code for
DBOBLOCK_ROOT_ANIMATIONSET

so that, solves this. (I think, tho the doc says it should be reading 4 bytes, not 8) or (reading 8 bytes, but setting the last 4 to 0) Not sure yet.
2,0,0,0 (?) 1053
8,0,0,0 (?) 1057
0,0,0,0 (?) 1061
0,0,0,0 (?) 1065

And this.
150,1,0,0 (406) 1069 (code 406 - custom data)
4,0,0,0 (bytes) 1073
0,0,0,0 (val=0) 1077

I wrongly assumed all the block codes were 1 byte in length. So that 150,1 threw me off. (406), There are a few other codes like that in the doc (not in a simple plane though)

I've stared into the abyss to long....

Time to do something productive now with this new found knowledge.
Bored of the Rings
13
Years of Service
User Offline
Joined: 25th Feb 2005
Location: Middle Earth
Posted: 5th Apr 2018 11:27 Edited at: 7th Apr 2018 09:26
so for the DBO codes, you read in a DWORD, and if it's a real DBO embedded code, the size of the data block is current byte position+4, then current byte position+8 for the actual data. e.g. dwCODE=memblock dword(1,bpos) (or use banks if you want to). dwCodeSize = memblock dword(1,bpos+4), pBlock = memblock dword(1,bpos+8) where bpos is the current bytes buffer position when reading in the DBO data.

Professional Programmer, languages: SAS, C++, SQL, PL-SQL, DBPro, Purebasic, JavaScript, others

Login to post a reply

Server time is: 2018-06-24 08:04:59
Your offset time is: 2018-06-24 08:04:59