Quake3World.com Forums
     Programming Discussion
        qfiles.h


Post new topicReply to topic
Login | Profile | | FAQ | Search | IRC




Print view Previous topic | Next topic 
Topic Starter Topic: qfiles.h

The Illuminated
The Illuminated
Joined: 08 Sep 2000
Posts: 1085
PostPosted: 01-20-2010 12:55 AM           Profile Send private message  E-mail  Edit post Reply with quote


Heya, I am really new to the Q3 code base and trying to find my way around where things are stored and what sort of limits exist with the default Q3 base (1.32b). I am trying to understand what exactly makes up a BSP file and what sort of limits exist before I hopefully hit them. I found the following in the file qfiles.h:

Code:
// there shouldn't be any problem with increasing these values at the
// expense of more memory allocation in the utilities
#define   MAX_MAP_MODELS      0x400
#define   MAX_MAP_BRUSHES      0x8000
#define   MAX_MAP_ENTITIES   0x800
#define   MAX_MAP_ENTSTRING   0x40000
#define   MAX_MAP_SHADERS      0x400

#define   MAX_MAP_AREAS      0x100   // MAX_MAP_AREA_BYTES in q_shared must match!
#define   MAX_MAP_FOGS      0x100
#define   MAX_MAP_PLANES      0x20000
#define   MAX_MAP_NODES      0x20000
#define   MAX_MAP_BRUSHSIDES   0x20000
#define   MAX_MAP_LEAFS      0x20000
#define   MAX_MAP_LEAFFACES   0x20000
#define   MAX_MAP_LEAFBRUSHES 0x40000
#define   MAX_MAP_PORTALS      0x20000
#define   MAX_MAP_LIGHTING   0x800000
#define   MAX_MAP_LIGHTGRID   0x800000
#define   MAX_MAP_VISIBILITY   0x200000

#define   MAX_MAP_DRAW_SURFS   0x20000
#define   MAX_MAP_DRAW_VERTS   0x80000
#define   MAX_MAP_DRAW_INDEXES   0x80000


I have a really large BSP file (@30Mb) and I still want to add more to it but I have no idea if I am close to any of the above limits because I don't have information or tools to tell me what I have in my BSP file. I assumed (read somewhere) that the actual Q3 BSP file size was limited to 30Mb but this is not true because I compiled a BSP last night is was 30.3Mb and it runs fine.

My question is: How can I find out how close I am to the above limits? Does anyone know of a tool that can audit or tell me the contents / size of my BSP file?



_________________
Well he was evil, but he did build alot of roads. - Gogglor
My Website & Twitter


Top
                 

god xor reason
god xor reason
Joined: 08 Dec 1999
Posts: 21100
PostPosted: 01-20-2010 09:06 AM           Profile   Send private message  E-mail  Edit post Reply with quote


Those are hex values so you could just use something like the windows calculator to convert them. And I think q3map2 outputs the totals while it runs doesn't it? Maybe the -v flag would show you.




Top
                 

The Illuminated
The Illuminated
Joined: 08 Sep 2000
Posts: 1085
PostPosted: 01-21-2010 12:38 AM           Profile Send private message  E-mail  Edit post Reply with quote


Here are the values in decimal for reference:

Code:
// there shouldn't be any problem with increasing these values at the
// expense of more memory allocation in the utilities
#define   MAX_MAP_MODELS      0x400         // 1024
#define   MAX_MAP_BRUSHES      0x8000   // 32768
#define   MAX_MAP_ENTITIES   0x800         // 2048
#define   MAX_MAP_ENTSTRING   0x40000      // 262144
#define   MAX_MAP_SHADERS      0x400      // 1024

#define   MAX_MAP_AREAS      0x100   // MAX_MAP_AREA_BYTES in q_shared must match!
#define   MAX_MAP_FOGS      0x100         // 256
#define   MAX_MAP_PLANES      0x20000      // 131072
#define   MAX_MAP_NODES      0x20000      // 131072
#define   MAX_MAP_BRUSHSIDES   0x20000   // 131072
#define   MAX_MAP_LEAFS      0x20000      // 131072
#define   MAX_MAP_LEAFFACES   0x20000      // 131072
#define   MAX_MAP_LEAFBRUSHES 0x40000   // 262144
#define   MAX_MAP_PORTALS      0x20000   // 131072
#define   MAX_MAP_LIGHTING   0x800000      // 8388608
#define   MAX_MAP_LIGHTGRID   0x800000      // 8388608
#define   MAX_MAP_VISIBILITY   0x200000   // 2097152

#define   MAX_MAP_DRAW_SURFS   0x20000   // 131072
#define   MAX_MAP_DRAW_VERTS   0x80000   // 524288
#define   MAX_MAP_DRAW_INDEXES   0x80000   // 524288


I did check the /verbose option for the q3map2 compiler and it produces a mountain of stuff to look through. I was hoping that someone had created a simple utility to check the stats of a BSP against the q3 engine limits. Part of the problem with the /v option is that the terminalogy is different between the list above and the additional complier output. For example metasurfaces and luxels?

I checked the q3 source and it says the BSP is split into 17 lumps with some of them linked to the above code limits, are there no totals in the BSP file to say how much is in each lump section? Maybe to compare to the above list?



_________________
Well he was evil, but he did build alot of roads. - Gogglor
My Website & Twitter


Top
                 

Immortal
Immortal
Joined: 12 Mar 2005
Posts: 2205
PostPosted: 01-21-2010 12:53 AM           Profile   Send private message  E-mail  Edit post Reply with quote


I believe you're looking for -info

"q3map2.exe -info [path to .bsp file]

Here's an output of a random bsp:
Code:
4 models              160
24 shaders         1728
892 brushes      10704
6147 brushsides 73764
0 fogs                     0
1976 planes       31616
61 entdata          3675

354 nodes          12744
359 leafs            17232
968 leafsurfaces    3872
1314 leafbrushes   5256

131 drawsurfaces 19388
673 drawverts     53840
420 drawindexes    1680

0 lightmaps                0
0 lightgrid                  0
  visibility

  total               181280
                            177 KB
                               0 MB




Top
                 

The Illuminated
The Illuminated
Joined: 08 Sep 2000
Posts: 1085
PostPosted: 01-21-2010 02:01 AM           Profile Send private message  E-mail  Edit post Reply with quote


yep thats it, perfect thanks :)

My current bsp info:
Code:
Abstracted BSP file components (*actual sizes may differ)
      253 models            10120
      282 shaders           20304
    25993 brushes          311916
   262979 brushsides      3155748 *
        0 fogs                  0
   128068 planes          2049088
      953 entdata          130555

     2661 nodes             95796
     2915 leafs            139920
    48733 leafsurfaces     194932
    40329 leafbrushes      161316

    32142 drawsurfaces    4757016 *
   267426 drawverts      21394080 *
   216594 drawindexes      866376

      192 lightmaps       9437184
    30753 lightgrid        922590 *
          visibility       111008

          total          30988084
                            30261 KB
                               29 MB
---------------------------------
        0 seconds elapsed



_________________
Well he was evil, but he did build alot of roads. - Gogglor
My Website & Twitter


Top
                 

Mentor
Mentor
Joined: 12 Mar 2005
Posts: 3958
PostPosted: 01-21-2010 05:06 AM           Profile Send private message  E-mail  Edit post Reply with quote


192 lightmaps... stock Q3 crashes after 256 lightmaps, ioquake3 hard-limits it (patch by yours truly; I didn't expect anyone to even get remotely close to that limit).




Top
                 

The Illuminated
The Illuminated
Joined: 08 Sep 2000
Posts: 1085
PostPosted: 01-21-2010 06:26 AM           Profile Send private message  E-mail  Edit post Reply with quote


I recently created a map called focal point for a competition and that map had 266 lightmaps, bsp info:

Code:
C:/Program Files/Quake III Arena/baseq3/maps/focal_final.bsp
Abstracted BSP file components (*actual sizes may differ)
       16 models              640
       56 shaders            4032
     4557 brushes           54684
    38674 brushsides       464088 *
        0 fogs                  0
    11704 planes           187264
       94 entdata            7643

     1081 nodes             38916
     1098 leafs             52704
    12138 leafsurfaces      48552
    10289 leafbrushes       41156

     3941 drawsurfaces     583268 *
    28153 drawverts       2252240 *
    13710 drawindexes       54840

      266 lightmaps      13074432
     7714 lightgrid        231420 *
          visibility        37016

          total          15621780
                            15255 KB
                               14 MB


The competition version of the map loads with surfaces missing in IOquake which I posted about on the IOQ3 forums and sadly no one replied. You submitting a patch to limit the lightmaps sort of answers my question I posted on the forums. Strangely enough the above map works fine with Q3 pointrelease 1.16n and 1.32b, so I am not sure how it can crash with excessive lightmaps. :confused:



_________________
Well he was evil, but he did build alot of roads. - Gogglor
My Website & Twitter


Top
                 

Mentor
Mentor
Joined: 12 Mar 2005
Posts: 3958
PostPosted: 01-21-2010 07:53 AM           Profile Send private message  E-mail  Edit post Reply with quote


As soon as you start crossing that 256 limit, the engine begins overwriting internal buffers. This might or might not result in a crash (it's non-deterministic) but it is always a Bad Thing.




Top
                 

Mentor
Mentor
Joined: 12 Mar 2005
Posts: 3958
PostPosted: 03-19-2010 02:52 PM           Profile Send private message  E-mail  Edit post Reply with quote


sock, I filed it as a bug: http://bugzilla.icculus.org/show_bug.cgi?id=4578

I expect to see it fixed soon(ish).




Top
                 
Quake3World.com | Forum Index | Programming Discussion


Post new topic Reply to topic


cron
Quake3World.com
© ZeniMax. Zenimax, QUAKE III ARENA, Id Software and associated trademarks are trademarks of the ZeniMax group of companies. All rights reserved.
This is an unofficial fan website without any affiliation with or endorsement by ZeniMax.
All views and opinions expressed are those of the author.