World of Tanks Map format.

Post questions about game models here, or help out others!
User avatar
Coffee
ultra-veteran
ultra-veteran
Posts: 518
Joined: Thu Aug 06, 2015 5:57 pm
Has thanked: 74 times
Been thanked: 205 times

Re: World of Tanks Map format.

Post by Coffee »

SkaceKachna wrote: I use https://github.com/SkaceKamen/wot-model-converter for exporting objects ... (I started writing it, but now It's community project with multiple contributors)
I found that before.. Some of the code is straight out of my Model Editor.. :) Yes.. I'm AKA Phux_and_the_Wheel_Bearing.
It's no big.. all you needed to do was PM me and I would of gave you the code.. (Or.. maybe I did already .. My memory is bad)
EDIT: I figured out how to unpack those 8_8_8 normals... the code is posted here : viewtopic.php?f=16&t=12567&start=705
Anyway. I will need something like this later for Terra to manage the tanks one can put on the map.

Back to BSMO...
So these look to be dead entries but they have valid Bounding Box data.. But with out and index key.. they are useless.
We need to look at the code that puts these node entries together and make sure the indexes for the dead entries are NOT used!
I'd love to change the world but I can't get my hands on the code.
SkaceKachna
advanced
Posts: 66
Joined: Thu Jan 14, 2016 11:32 am
Has thanked: 9 times
Been thanked: 19 times

Re: World of Tanks Map format.

Post by SkaceKachna »

Coffee wrote: I found that before.. Some of the code is straight out of my Model Editor.. :) Yes.. I'm AKA Phux_and_the_Wheel_Bearing.
It's no big.. all you needed to do was PM me and I would of gave you the code.. (Or.. maybe I did already .. My memory is bad)
Oh, so it was you! Sorry for stealing ("borrowing" :D) your code. I found some obscure exe capable of converting models and I was desperate to make my converter working. I had no idea from where it originated, and frankly I was just happy I finally had some clue how to do it. I added you to credits.
Coffee wrote: Back to BSMO...
So these look to be dead entries but they have valid Bounding Box data.. But with out and index key.. they are useless.
We need to look at the code that puts these node entries together and make sure the indexes for the dead entries are NOT used!
OK, while you're looking at BSMO, I'll try to match entries in BSMI with models in BSMO. I have map renderer ready, so it should be easy to decide if the index is right or wrong...
User avatar
Coffee
ultra-veteran
ultra-veteran
Posts: 518
Joined: Thu Aug 06, 2015 5:57 pm
Has thanked: 74 times
Been thanked: 205 times

Re: World of Tanks Map format.

Post by Coffee »

Thanks for the Credit :)
It really is no big.

So far your BSMA tables is working out fine.

Here is some insight. If the FX type contains "dual" at the end, it has 2 UV coordinate sets.
I'd love to change the world but I can't get my hands on the code.
SkaceKachna
advanced
Posts: 66
Joined: Thu Jan 14, 2016 11:32 am
Has thanked: 9 times
Been thanked: 19 times

Re: World of Tanks Map format.

Post by SkaceKachna »

Cracked most important informations from BSMI:

http://wiki.vbaddict.net/pages/BSMI

1. Table contains matrixes (OK)
3. Table contains model indexes for each matrix (multiple matrixes can refer one model)

So we now have: models, their geometry (partially), material (but no textures) and their position/rotation/scale.
We're so close!
User avatar
Coffee
ultra-veteran
ultra-veteran
Posts: 518
Joined: Thu Aug 06, 2015 5:57 pm
Has thanked: 74 times
Been thanked: 205 times

Re: World of Tanks Map format.

Post by Coffee »

Ok.. here is my dataset for getting the materials

Code: Select all

    Public visual_sections() As visual_sections_
    Public Structure visual_sections_
        Public shader As String
        Public entries() As visual_entries_
    End Structure
    Public Structure visual_entries_
        Public Property_name As String
        Public Proerty_value As Object
    End Structure
And this is my (sloppy) code to get the data from the BSMA data

Code: Select all

    Public BSMA_PropertyType() = {" ", "Bool", "Float", "Int", "?", "Vector4", "String", "?"}

    Public Sub get_BSMA_data(ByVal t_cnt As Integer)
        'ms is pointing at the BSMA secion after this next line
        Dim ms As New MemoryStream(table_Rows(t_cnt).data)
        Dim br As New BinaryReader(ms)
        ms.Position = 0
        BSMA.t1_start = br.BaseStream.Position
        BSMA.t2_dl = br.ReadUInt32
        BSMA.t1_dc = br.ReadUInt32
        ReDim BSMA.bsma_t1(BSMA.t1_dc)
        For k = 0 To BSMA.t1_dc - 1
            BSMA.bsma_t1(k).fx_index = br.ReadUInt32
            BSMA.bsma_t1(k).index_start = br.ReadUInt32 ' t3 ref
            BSMA.bsma_t1(k).index_end = br.ReadUInt32 ' t3 ref
        Next
        BSMA.t1_start = br.BaseStream.Position
        BSMA.t2_dl = br.ReadUInt32
        BSMA.t2_dc = br.ReadUInt32
        ReDim BSMA.bsma_t2(BSMA.t2_dc)
        For k = 0 To BSMA.t2_dc - 1
            BSMA.bsma_t2(k).bwst_key = br.ReadUInt32
            BSMA.bsma_t2(k).shader_string = find_str_BWST(BSMA.bsma_t2(k).bwst_key)
        Next

        BSMA.t3_start = br.BaseStream.Position
        BSMA.t3_dl = br.ReadUInt32
        BSMA.t3_dc = br.ReadUInt32
        Dim pos = BSMA.t3_start + 8 + (BSMA.t3_dl * BSMA.t3_dc)
        br.BaseStream.Position = pos
        BSMA.t4_start = br.BaseStream.Position
        BSMA.t4_dl = br.ReadUInt32
        BSMA.t4_dc = br.ReadUInt32
        ReDim BSMA.bsma_t4(BSMA.t4_dc)
        For k = 0 To BSMA.t4_dc - 1
            ReDim BSMA.bsma_t4(k).matrix(16)
            For i = 0 To 15
                BSMA.bsma_t4(k).matrix(i) = br.ReadSingle
            Next
        Next
        BSMA.t5_start = br.BaseStream.Position
        BSMA.t5_dl = br.ReadUInt32
        BSMA.t5_dc = br.ReadUInt32
        ReDim BSMA.bsma_t5(BSMA.t5_dc)
        For k = 0 To BSMA.t5_dc - 1
            BSMA.bsma_t5(k).vector4.X = br.ReadSingle
            BSMA.bsma_t5(k).vector4.Y = br.ReadSingle
            BSMA.bsma_t5(k).vector4.Z = br.ReadSingle
            BSMA.bsma_t5(k).vector4.W = br.ReadSingle
        Next

        br.BaseStream.Position = BSMA.t3_start + 8
        ReDim BSMA.bsma_t3(BSMA.t3_dc)
        For k = 0 To BSMA.t3_dc - 1
            BSMA.bsma_t3(k).Property_key = br.ReadUInt32
            BSMA.bsma_t3(k).value_type = br.ReadUInt32
            BSMA.bsma_t3(k).value_type_string = BSMA_PropertyType(BSMA.bsma_t3(k).value_type)
            BSMA.bsma_t3(k).value = br.ReadUInt32
            BSMA.bsma_t3(k).value_string = BSMA.bsma_t3(k).value.ToString
            BSMA.bsma_t3(k).Property_string = find_str_BWST(BSMA.bsma_t3(k).Property_key)

            Select Case BSMA.bsma_t3(k).value_type
                Case Is = 0
                Case Is = 1
                    If BSMA.bsma_t3(k).value = 1 Then
                        BSMA.bsma_t3(k).value_string = "True"
                    Else
                        BSMA.bsma_t3(k).value_string = "False"
                    End If
                Case Is = 2
                    BSMA.bsma_t3(k).value_string = CSng(BSMA.bsma_t3(k).value).ToString("0.000000")
                Case Is = 3
                    BSMA.bsma_t3(k).value_string = BSMA.bsma_t3(k).value
                Case Is = 4
                    'this never gets hit on with ENSK map.
                    Console.WriteLine(BSMA.bsma_t3(k).Property_key.ToString("x"))
                Case Is = 5
                    Dim v As vect4 = BSMA.bsma_t5(BSMA.bsma_t3(k).value).vector4
                    BSMA.bsma_t3(k).value_string = _
                        v.X.ToString("00.000000") + " " + _
                        v.Y.ToString("00.000000") + " " + _
                        v.Z.ToString("00.000000") + " " + _
                        v.W.ToString("00.000000")
                Case Is = 6
                    BSMA.bsma_t3(k).value_string = find_str_BWST(BSMA.bsma_t3(k).value)
                Case Is = 7
                    ' this only gets hit when BSMA.bsma_t3(k).Property_string  = "g_useNormalPackDXT1_safe"
                    BSMA.bsma_t3(k).value_string = "True"
            End Select


            'If BSMA.bsma_t3(k).value_type_string = "?" Then
            '    Console.WriteLine(BSMA.bsma_t3(k).Property_string)
            'End If
        Next

        ReDim visual_sections(BSMA.t1_dc)
        Dim index As Integer = 0
        For n = 0 To BSMA.t1_dc - 1
            If BSMA.bsma_t1(n).index_end <= BSMA.t3_dc Then 'ignore &hFFFFFFFF entries
                visual_sections(index) = New visual_sections_
                ReDim visual_sections(index).entries((BSMA.bsma_t1(n).index_end - BSMA.bsma_t1(n).index_start))
                visual_sections(index).shader = BSMA.bsma_t2(BSMA.bsma_t1(n).fx_index).shader_string
                For k = BSMA.bsma_t1(n).index_start To BSMA.bsma_t1(n).index_end
                    Dim ind = k - BSMA.bsma_t1(n).index_start
                    visual_sections(index).entries(ind) = New visual_entries_
                    visual_sections(index).entries(ind).Property_name = BSMA.bsma_t3(k).Property_string
                    visual_sections(index).entries(ind).Proerty_value = BSMA.bsma_t3(k).value_string
                Next
                index += 1
            End If
        Next
        ReDim Preserve visual_sections(index)

    End Sub
I'd love to change the world but I can't get my hands on the code.
User avatar
Coffee
ultra-veteran
ultra-veteran
Posts: 518
Joined: Thu Aug 06, 2015 5:57 pm
Has thanked: 74 times
Been thanked: 205 times

Re: World of Tanks Map format.

Post by Coffee »

And this is some sample of what this code produces.

Code: Select all

shader: shaders/std_effects/normalmap_specmap.fx
g_defaultPBSConversionParams : False
g_metallicConversions : 00.020000 00.080000 04.040000 00.620000
g_glossConversions : 00.050000 00.160000 01.500000 02.000000
specularMap : content/Environment/env440_borders/env440_border_SM.dds
alphaReference : 0
alphaTestEnable : False
doubleSided : False
normalMap : content/Environment/env440_borders/env440_border_NM.dds
diffuseMap : content/Environment/env440_borders/env440_border.dds

shader: shaders/std_effects/normalmap_specmap_dual.fx
diffuseMap2 : content/Buildings/bld6115_chouse/bld6115_thouse_UV2.dds
specularMap : content/Buildings/bld6115_chouse/bld6115_16_details_SM.dds
alphaReference : 0
alphaTestEnable : False
selfIllumination : 0.000000
doubleSided : False
normalMap : content/Buildings/bld6115_chouse/bld6115_16_details_NM.dds
diffuseMap : content/Buildings/bld6115_chouse/bld6115_16_details.dds

shader: shaders/std_effects/normalmap_specmap_dual.fx
diffuseMap2 : content/Buildings/bld6115_chouse/bld6115_thouse_UV2.dds
specularMap : content/Buildings/bld6101_thouse/bld61_roof3_SM.dds
alphaReference : 0
alphaTestEnable : False
selfIllumination : 0.000000
doubleSided : False
normalMap : content/Buildings/bld6101_thouse/bld61_roof3_NM.dds
diffuseMap : content/Buildings/bld6101_thouse/bld61_roof3.dds

shader: shaders/std_effects/normalmap_specmap_dual.fx
diffuseMap2 : content/Buildings/bld6115_chouse/bld6115_thouse_UV2.dds
specularMap : content/Buildings/bld6101_thouse/bld61_wall3_SM.dds
alphaReference : 0
alphaTestEnable : False
selfIllumination : 0.000000
doubleSided : False
normalMap : content/Buildings/bld6101_thouse/bld61_wall3_NM.dds
diffuseMap : content/Buildings/bld6101_thouse/bld61_wall3.dds
I'd love to change the world but I can't get my hands on the code.
User avatar
Coffee
ultra-veteran
ultra-veteran
Posts: 518
Joined: Thu Aug 06, 2015 5:57 pm
Has thanked: 74 times
Been thanked: 205 times

Re: World of Tanks Map format.

Post by Coffee »

Its all sorted but the Matrix.. Im not sure what code will show up.
ENSK has NO matrices in the BSMA data.. Its a zero length table.
I'd love to change the world but I can't get my hands on the code.
User avatar
Coffee
ultra-veteran
ultra-veteran
Posts: 518
Joined: Thu Aug 06, 2015 5:57 pm
Has thanked: 74 times
Been thanked: 205 times

Re: World of Tanks Map format.

Post by Coffee »

SkaceKachna wrote:Cracked most important informations from BSMI:

http://wiki.vbaddict.net/pages/BSMI

1. Table contains matrixes (OK)
3. Table contains model indexes for each matrix (multiple matrixes can refer one model)

So we now have: models, their geometry (partially), material (but no textures) and their position/rotation/scale.
We're so close!
If you found the indices for the models and their matrices, we can build the models.
There are LOTs of the same model on a map. light poles is a good example. Each with it's own matrix but common materials.

I'm going to go back to sorting out the rest of BSMO.
I'd love to change the world but I can't get my hands on the code.
SkaceKachna
advanced
Posts: 66
Joined: Thu Jan 14, 2016 11:32 am
Has thanked: 9 times
Been thanked: 19 times

Re: World of Tanks Map format.

Post by SkaceKachna »

I already found the matrices for models in BSMO ( http://wiki.vbaddict.net/pages/BSMI 3. Table assigns matrices to objects) ... so the last problem is indicies.
User avatar
Coffee
ultra-veteran
ultra-veteran
Posts: 518
Joined: Thu Aug 06, 2015 5:57 pm
Has thanked: 74 times
Been thanked: 205 times

Re: World of Tanks Map format.

Post by Coffee »

BSMO tables 8, 9 and 10 are empty


The Last table 11 has a uint32 and than a matrix

Uknown Uint32 Key?
16x float Matrix
I'd love to change the world but I can't get my hands on the code.
User avatar
Coffee
ultra-veteran
ultra-veteran
Posts: 518
Joined: Thu Aug 06, 2015 5:57 pm
Has thanked: 74 times
Been thanked: 205 times

Re: World of Tanks Map format.

Post by Coffee »

Whoohooo!

I found the UV2s.

Remember this table in BWSG?

Code: Select all

each item then looks:

P	Type	Desc
0	uint32	unknown (probably describing block type?)
4	uint32	stride
8	uint32	block size
12	uint32	chunk index
16	uint32	offset inside chunk
Now, chunk index refers to next table which finally points to raw data.
If the unknow at the top is zero.. this block is vertices.
if it is 10 (0xa) than it is UV2 coordinates. Stride will = 8 (2 floats per UV coord)
UV2 coordinates are streamed unlike the other UVs that are indexed as part of the vertices.

for k = 0 to poly_cnt-1
p1 = indi_1
p2 = indi_2
p3 = indi_3
v1 = vertex(p1) <-- indexed
v2 = vertex(p2)
v3 = vertex(p3)
UV2 = uv2_array(K) <--- this is NOT indexed. it is stored as a stream.
I'd love to change the world but I can't get my hands on the code.
SkaceKachna
advanced
Posts: 66
Joined: Thu Jan 14, 2016 11:32 am
Has thanked: 9 times
Been thanked: 19 times

Re: World of Tanks Map format.

Post by SkaceKachna »

Nice!
User avatar
Coffee
ultra-veteran
ultra-veteran
Posts: 518
Joined: Thu Aug 06, 2015 5:57 pm
Has thanked: 74 times
Been thanked: 205 times

Re: World of Tanks Map format.

Post by Coffee »

I was up until 4 am looking for the Indices.
I can't find them.


The models that can be crushed have 2 states. Things like fence sections.
Also... Some models have collision models. This is easy to find.. they never have a texture to go with them.
There must be some settings for these in the data.

Here is a pic of the blr201_Piggaery.primitives_processed

The blue areas are the collision model.
You do not have the required permissions to view the files attached to this post.
I'd love to change the world but I can't get my hands on the code.
User avatar
Coffee
ultra-veteran
ultra-veteran
Posts: 518
Joined: Thu Aug 06, 2015 5:57 pm
Has thanked: 74 times
Been thanked: 205 times

Re: World of Tanks Map format.

Post by Coffee »

OK...
BWWa is the info on the water.

I will created the data set and post it here so you can see it.
It's just a bunch of settings.
I'd love to change the world but I can't get my hands on the code.
SkaceKachna
advanced
Posts: 66
Joined: Thu Jan 14, 2016 11:32 am
Has thanked: 9 times
Been thanked: 19 times

Re: World of Tanks Map format.

Post by SkaceKachna »

Good, water is important, too. For the indicies, the suspect is "BWSS.chunk", based solely on its size. Or maybe it contains textures? Isn't it too small for textures?
My attempt to decode it was unsucessfull, as it isn't just tables, it has some raw data inside ....

The collision groups are a bit stupid, why don't they use same system as tanks ... well, we'll have to think with lemons :D
Post Reply