Map Resource Manager

Discussion in 'Mapping' started by Blight, Apr 8, 2011.

  1. Blight

    Blight Member

    Messages:
    167
    Likes Received:
    0
    Trophy Points:
    0
    I had this idea while dealing with broken maps. Usually content is not loaded client-side due to a broken/corrupt/wrong res file.

    What if a program could handle the resource issue?

    I plan to spend my free time building a java application that does just that:
    • Load a new bsp file or select one from a list of previously loaded bsp files
    • Detect any custom textures in the bsp file
    • Detect files with the same name as the bsp file
    • Detect files in the materials/maps/<bspname> folder
    • Allow the user to add any folders or files
    • Build a list of all used files for final check
    • Write a .res file

    Things I'm thinking about:
    • Support for creating a directory structure with all resources included for easy upload
    • Support for versioning maps and affiliated resources

    I've talked to a few people and they seem enthusiastic enough, now I'd like to hear your thoughts about its necessity and/or improvements.

    Thanks in advance,

    Blight
     
  2. Chris0132'

    Chris0132' Developer

    Messages:
    9,482
    Likes Received:
    0
    Trophy Points:
    0
    There's already a program that does this, and better than writing a res file it packs it into the BSP.
     
  3. Blight

    Blight Member

    Messages:
    167
    Likes Received:
    0
    Trophy Points:
    0
    While I realise pakrat exists, it has so far not solved any of the issues I described, maybe mainly by people not using it. Also packaging content in a bsp file is not the same as managing the resources used, especially in the emires format of a res file.
     
  4. Chris0132'

    Chris0132' Developer

    Messages:
    9,482
    Likes Received:
    0
    Trophy Points:
    0
    Well yes empires does require a res file with at least one line in it for the map resources which doesn't work if you zip it, but I'm sure even the most retarded mapper can manage a one line res file.

    If you aren't confident with res files it's probably a lot better to zip the stuff, I only use res files because I have a simple directory structure and so don't have to worry about finding all the stuff.
     
    Last edited: Apr 8, 2011
  5. blizzerd

    blizzerd Member

    Messages:
    10,552
    Likes Received:
    60
    Trophy Points:
    0
    you failed quite a number of times on it chris, i remember you posting about it too

    dont be a hypocrit, if you dont need it dont use it, il be using it


    would be cool if you could make it generate a minimap for the map aswell

    like you provide the graphic, the tool makes all the locations (refs and flags) fit and makes all the necessary adjustments

    i bet you can also make it so refs are found in the map file and a graphical icon is put on the correct location with the correct color sceme for ref multiplier (standardising this is something that should be done anyway)

    it should just detect the resource nodes relative to each other distances, then make it so the user can crop his image or shrink the minimap nodes dimensions so it fits the image
     
    Last edited: Apr 8, 2011
  6. Metal Smith

    Metal Smith Member

    Messages:
    4,520
    Likes Received:
    3
    Trophy Points:
    0
    A program that would pull a directory list of all the files used by a bsp would be sweet.
     
  7. flasche

    flasche Member Staff Member Moderator

    Messages:
    13,299
    Likes Received:
    168
    Trophy Points:
    0
    yeh no matter if pakrat exists or not, if it works for empires and is easy to use it at least wouldnt hurt? if he wants to make it, why be against it chris? rather say thanks ...

    thanks :D
     
  8. Varbles

    Varbles Simply Maptastic. Staff Member

    Messages:
    2,093
    Likes Received:
    26
    Trophy Points:
    0
    pakrat is broken for steampires i think, and this tool sounds awesome and useful
     
  9. Grantrithor

    Grantrithor Member

    Messages:
    9,820
    Likes Received:
    11
    Trophy Points:
    0
    sounds cool, hope it works better than pakrat. I've used pakrat a billion times and still have ended up fucking something up.
     
  10. Blight

    Blight Member

    Messages:
    167
    Likes Received:
    0
    Trophy Points:
    0
    I got it to read bsp files,

    Still some issues though

    I think I can work out how many textures are used
    Also I can extract the textures

    Problems:
    1) How do I know if a texture is custom or not?
    Having a static reference list seems ugly, also when the devs add new textures it will have to change.
    2) It seems to list textures that aren't there, or atleast not in that directory.

    Ill show some output for emp_hazardcourse:
    Code:
    89 textures in total
    CONCRETE/CONCRETEWALL001A
    COMMON/TOOLS/TOOLSNODRAW
    IMPERIAL/BUILDINGS_WORLDGEOMETRY/IMP_BUILDINGTEXTURESWALL07
    IMPERIAL/BUILDINGS_WORLDGEOMETRY/IMP_BUILDINGTEXTURESWALL01
    IMPERIAL/BUILDINGS_WORLDGEOMETRY/IMP_BUILDINGTEXTURESWALL08
    IMPERIAL/BUILDINGS_WORLDGEOMETRY/IMP_BUILDINGTEXTURESFLOOR02
    IMPERIAL/BUILDINGS_WORLDGEOMETRY/IMP_BUILDINGTEXTURESFLOOR03
    IMPERIAL/BUILDINGS_WORLDGEOMETRY/IMP_BUILDINGTEXTURESWALL09
    IMPERIAL/BUILDINGS_WORLDGEOMETRY/IMP_BUILDINGTEXTURESFLOOR05
    CONCRETE/CONCRETEWALL004C
    COMMON/CONCRETE/CONCRETEWALL15A
    COMMON/TOOLS/TOOLSSKYBOX
    CONCRETE/CONCRETEWALL063A
    CONCRETE/CONCRETEWALL065B
    CONCRETE/CONCRETEWALL065A
    COMMON/TOOLS/TOOLSBLACK
    CONCRETE/CONCRETEWALL010C
    CONCRETE/CONCRETEWALL010B
    CONCRETE/CONCRETEWALL010A
    IMPERIAL/BUILDINGS_WORLDGEOMETRY/IMP_BUILDINGTEXTURESWALL02
    COMMON/CONCRETE/CONCRETEWALL15
    COMMON/CONCRETE/PAVINGGROUND02A
    CONCRETE/CONCRETEWALL062A
    CONCRETE/CONCRETEWALL004A
    IMPERIAL/BUILDINGS_WORLDGEOMETRY/IMP_BUILDINGTEXTURESWALL18A
    DECALS/DECALMETALGRATE016A
    METAL/METALHULL005A
    COMMON/TOOLS/TOOLSTRIGGER
    COMMON/TOOLS/TOOLSCLIP
    IMPERIAL/BUILDINGS_WORLDGEOMETRY/IMP_BUILDINGTEXTURESWALL18
    METAL/METALCOMBINE002
    METAL/METALPIPE001A
    WOOD/WOODBEAM002A
    WOOD/WOODBEAM001A
    NATURE/ROCKFLOOR006A
    IMPERIAL/BUILDINGS_WORLDGEOMETRY/IMP_BUILDINGTEXTURESWALL06
    METAL/CITADEL_METALWALL074A
    METAL/METALGRATE013B
    IMPERIAL/BUILDINGS_WORLDGEOMETRY/IMP_BUILDINGTEXTURESWALL17
    METAL/METALSTAIR001A
    METAL/CITADEL_METALWALL060A
    METAL/METALFLOOR005A
    METAL/METALWALL102A
    METAL/METALWALL030A
    METAL/METALHULL002A
    METAL/METALWALL070A_CHEAP
    COMMON/TOOLS/TOOLSINVISIBLE
    maps/emp_hazardcourse_a4/metal/citadel_metalwall072c_1856_3072_385
    maps/emp_hazardcourse_a4/metal/citadel_metalwall072c_2240_3072_385
    maps/emp_hazardcourse_a4/common/concrete/pavingground03a_1856_3072_385
    maps/emp_hazardcourse_a4/common/concrete/pavingground03a_2240_3072_385
    maps/emp_hazardcourse_a4/common/concrete/concretewall15c_1280_1536_73
    maps/emp_hazardcourse_a4/common/concrete/concretewall15c_2816_1536_73
    maps/emp_hazardcourse_a4/nature/rockwall015a_2240_3072_385
    maps/emp_hazardcourse_a4/nature/rockwall015a_2816_1536_73
    maps/emp_hazardcourse_a4/nature/rockwall015a_1856_3072_385
    maps/emp_hazardcourse_a4/nature/toxicslime002a_1280_1536_73
    maps/emp_hazardcourse_a4/nature/toxicslime002a_2816_1536_73
    maps/emp_hazardcourse_a4/nature/toxicslime002a_2240_3072_385
    maps/emp_hazardcourse_a4/nature/toxicslime002a_1856_3072_385
    maps/emp_hazardcourse_a4/common/metal/buildingtextures_bluesheet01a_1856_3072_385
    maps/emp_hazardcourse_a4/metal/citadel_metalwall091a_1280_1536_73
    maps/emp_hazardcourse_a4/metal/citadel_metalwall091a_1856_3072_385
    maps/emp_hazardcourse_a4/metal/citadel_metalwall091a_2816_1536_73
    maps/emp_hazardcourse_a4/metal/citadel_metalwall091a_2240_3072_385
    maps/emp_hazardcourse_a4/metal/citadel_metalwall063a_2240_3072_385
    maps/emp_hazardcourse_a4/metal/citadel_metalwall072b_2240_3072_385
    maps/emp_hazardcourse_a4/metal/citadel_metalwall072b_1856_3072_385
    maps/emp_hazardcourse_a4/metal/citadel_metalwall063a_1856_3072_385
    maps/emp_hazardcourse_a4/nature/rockwall015a_1280_1536_73
    maps/emp_hazardcourse_a4/glass/combineglass001a_1280_1536_73
    maps/emp_hazardcourse_a4/glass/combineglass001a_2816_1536_73
    maps/emp_hazardcourse_a4/glass/combineglass001a_1856_3072_385
    maps/emp_hazardcourse_a4/glass/combineglass001a_2240_3072_385
    maps/emp_hazardcourse_a4/common/emp_snow/glasspanel01_lightmap_1280_1536_73
    maps/emp_hazardcourse_a4/common/emp_snow/glasspanel01_lightmap_1856_3072_385
    maps/emp_hazardcourse_a4/common/emp_snow/glasspanel01_lightmap_2240_3072_385
    maps/emp_hazardcourse_a4/common/emp_snow/glasspanel01_lightmap_2816_1536_73
    maps/emp_hazardcourse_a4/metal/citadel_metalwall072b_2816_1536_73
    maps/emp_hazardcourse_a4/metal/citadel_metalwall072b_1280_1536_73
    maps/emp_hazardcourse_a4/metal/metalpipe003a_2240_3072_385
    maps/emp_hazardcourse_a4/metal/metalpipe003a_2816_1536_73
    maps/emp_hazardcourse_a4/metal/metalpipe003a_1856_3072_385
    maps/emp_hazardcourse_a4/metal/metalpipe003a_1280_1536_73
    maps/emp_hazardcourse_a4/metal/citadel_metalwall076a_1856_3072_385
    maps/emp_hazardcourse_a4/metal/citadel_metalwall076a_2240_3072_385
    maps/emp_hazardcourse_a4/vehicle/rubbertrainfloor001a_2240_3072_385
    maps/emp_hazardcourse/hazardcourse_hints_1_nf
    maps/emp_hazardcourse/hazardcourse_hints_1_be
    The first uppercase textures seem fine, the lowercase ones seem wrong except for the last 2. There are numbers behind some of them and I don't know what they mean.

    Anyone any ideas?
     
  11. Demented

    Demented Member

    Messages:
    2,337
    Likes Received:
    0
    Trophy Points:
    0
    The lowercase with numbers should be cubemaps. You don't need to worry about those. (The numbers are the coords of the cubemap.) Though, it occurs to me that I've never looked closely enough at them to know why they share the name of a specific material...
     
  12. Brutos

    Brutos Administrator Staff Member Moderator

    Messages:
    3,385
    Likes Received:
    0
    Trophy Points:
    0
    Noes java, recon has done a KV parser for .Net and there also is the default cpp kv parser. Those would have made your life probably easier.
     
  13. Blight

    Blight Member

    Messages:
    167
    Likes Received:
    0
    Trophy Points:
    0
    Well it wouldn't be any fun if others did the work for me :)

    I could check the Strings for lowercase chars and cubemap data at the end. But if a custom texture ended with a digit, it might be counted as a cubemap entry...

    Maybe I should look up the cubemaps and compare their coordinates with the digits on the end of the Strings?
     
    Last edited: Apr 10, 2011
  14. Trickster

    Trickster Retired Developer

    Messages:
    16,576
    Likes Received:
    46
    Trophy Points:
    0
    Best thing you can do imo is just give the program a static list of default Empires files, and have it auto-remove them from the list. Have it toggle-able, "hide default Empires files" or something.
     
  15. Blight

    Blight Member

    Messages:
    167
    Likes Received:
    0
    Trophy Points:
    0
    A static list isn't very flexible, I really want the process automated. I'm trying to read the cubemap coordinate data now, not having much luck.

    This is how cubemaps are stored:
    Code:
    struct dcubemapsample_t
    {
    	int		origin[3];	// position of light snapped to the nearest integer
    	int	        size;		// resolution of cubemap, 0 - default
    };
    When I try to read the first 12 bytes as 3 integers I get as a result:
    Code:
    [0_0_10688364, 0_0_10692668, 0_0_10693024, 0_0_12113672]
    Those are the x,y,z coordinates of the 4 cubemaps present.

    Im not sure if there is any padding or if Im reading from the wrong offset...
     
  16. Blight

    Blight Member

    Messages:
    167
    Likes Received:
    0
    Trophy Points:
    0
    Okay I managed to get the correct data from the cubemap lump, turns out I first looked up the offset of the cubemap lump which changed the pointer in the bytebuffer. So when I tried to look up the actual data the pointer was not on the correct position.

    I also might have found a way to retrieve the custom textures by looking at the first character to see if it's capitalized and also looking at the end and comparing it with the cubemap data.

    **EDIT**
    Okay nevermind, Ive found a map with CUSTOMS/SCHILD2 as a texture
    Also decals seem to pass as custom textures

    **EDIT 2**
    Maybe those CUSTOMS/* textures are in the PAK lump, in which case I think we can ignore them

    **EDIT 3**
    Okay turns out it gets more complicated
    I think all capitalized names are not custom textures and can be ignored
    Some of the textures with the cubemap data appended ARE custom
    Some of the lowercase textures without cubemap data are NOT custom
     
    Last edited: Apr 10, 2011
  17. Blight

    Blight Member

    Messages:
    167
    Likes Received:
    0
    Trophy Points:
    0
    Ive managed to condense the textures to a list which at least contains all custom textures, but also non custom ones:

    The textures that ARE custom are shown in bold
    maps/emp_hazardcourse_a4/glass/combineglass001a
    maps/emp_hazardcourse_a4/common/emp_snow/glasspanel01_lightmap
    maps/emp_hazardcourse_a4/nature/toxicslime002a
    maps/emp_hazardcourse/hazardcourse_hints_1_be
    maps/emp_hazardcourse_a4/common/concrete/concretewall15c
    maps/emp_hazardcourse_a4/common/metal/buildingtextures_bluesheet01a
    maps/emp_hazardcourse/hazardcourse_hints_1_nf
    maps/emp_hazardcourse_a4/metal/citadel_metalwall076a
    maps/emp_hazardcourse_a4/metal/metalpipe003a
    maps/emp_hazardcourse_a4/metal/citadel_metalwall072b
    maps/emp_hazardcourse_a4/metal/citadel_metalwall072c
    maps/emp_hazardcourse_a4/metal/citadel_metalwall091a
    maps/emp_hazardcourse_a4/nature/rockwall015a
    maps/emp_hazardcourse_a4/common/concrete/pavingground03a
    maps/emp_hazardcourse_a4/vehicle/rubbertrainfloor001a
    maps/emp_hazardcourse_a4/metal/citadel_metalwall063a

    Anyone got ideas on how to differentiate them?
     
  18. blizzerd

    blizzerd Member

    Messages:
    10,552
    Likes Received:
    60
    Trophy Points:
    0
    all textures mentioned in the bsp
    subtract all textures in it that are on a list of stock textures pulled from a page on the wiki
     
  19. Metal Smith

    Metal Smith Member

    Messages:
    4,520
    Likes Received:
    3
    Trophy Points:
    0
    Can you read the gcf / pull a gcf for the program to compile a list of the default textures?

    Then run that list against the one you come up with with this tool and whatever discrepencies need to be in the resource file.
     
  20. blizzerd

    blizzerd Member

    Messages:
    10,552
    Likes Received:
    60
    Trophy Points:
    0
    now thats an idea
     

Share This Page