Quote from: infuzedbeatz on October 09, 2008, 03:29:13 PM
So how would I use ghost C++ to detect the map and output a file .cfg? Is there a command I can use after I launch Ghost to make a map, look at the information and output that to a .cfg?
A step by step would gladly appreciate it so I can learn myself help others as well and not have to bother you guys as much. I'm not totally computer illiterate so just do how you would normally do it and I think I can follow on. Thanks in advanced.
You can't make GHost++ output a config file directly but you can very easily make a stripped down config file that only works if GHost++ has access to the map itself. The following config file works just fine for DotA 6.55b as long as GHost++ can access the map file because GHost++ automatically calculates everything else. You can edit this config file to work for any other map just by changing map_path and map_localpath (and you can delete map_type if you don't want GHost++ to try to collect DotA statistics - e.g. if it's not a DotA map).
map_path = Maps\Download\DotA Allstars v6.55b.w3x
map_speed = 3
map_visibility = 4
map_observers = 1
map_flags = 3
map_gametype = 1
map_type = dota
map_localpath = DotA Allstars v6.55b.w3x
Here's what all of that means:
# the map path tells Warcraft III clients where to find the map on their system
# map speed
# 1 = slow
# 2 = normal
# 3 = fast
# map visibility
# 1 = hide terrain
# 2 = explored
# 3 = always visible
# 4 = default
# map observers
# 1 = none
# 2 = on defeat
# 3 = allowed
# 4 = referees
# map flags
# - you can combine these flags by adding together all the options you want to use
# - for example to have teams together and fixed teams you would use "3"
# 1 = teams together
# 2 = fixed teams
# 4 = unit share
# 8 = random hero
# 16 = random races
# map game type
# 1 = custom
# 9 = blizzard
# map type
# "dota" = try to collect DotA statistics
# map local path
# GHost++ will search [bot_mappath + map_localpath] for the map file (bot_mappath is set in the main config file)
If you want to create a map config file that works even when GHost++ doesn't have access to the map, you can use the above config file with a GHost++ that *does* have access to the map file first. Then GHost++ will output something like this to the console (these values are from DotA 6.54b actually):
[MAP] calculated map_size = 193 236 49 0
[MAP] calculated map_info = 114 75 121 60
[MAP] calculated map_crc = 120 227 167 121
[MAP] calculated map_width = 116 0
[MAP] calculated map_height = 116 0
[MAP] calculated map_numplayers = 10
[MAP] calculated map_numteams = 2
Then you can manually copy those values into the config file and you'd only be missing the slot structure. Note that some map files are protected in such a way that StormLib can't read them so you're not actually guaranteed that the calculated values will be correct. Anyway, you can try and figure the slot structure out yourself or you can edit the source code to GHost++ and look for the following lines in map.cpp:
Code:
/* for( vector<CGameSlot> :: iterator i = Slots.begin( ); i != Slots.end( ); i++ )
DEBUG_Print( (*i).GetByteArray( ) ); */
They're commented out (that's what the "/*" and "*/" means) because I didn't want to dump the entire slot structure to the console every time you loaded a map. If you uncomment them and recompile GHost++ will print the automatically calculated slot structure to the console and you can use it to create your slot structure. Note that it will actually print the structure in hexadecimal so you'll have to do the conversion from hexadecimal to decimal yourself. It'll look something like this (this slot structure is from the Uther Party map):
{ 0 ff 0 0 0 0 1 1 64 }
{ 0 ff 0 0 0 1 1 1 64 }
{ 0 ff 0 0 0 2 1 1 64 }
{ 0 ff 0 0 0 3 1 1 64 }
{ 0 ff 0 0 0 4 1 1 64 }
{ 0 ff 0 0 0 5 1 1 64 }
{ 0 ff 0 0 0 6 1 1 64 }
{ 0 ff 0 0 0 7 1 1 64 }
{ 0 ff 2 1 1 b 1 1 64 }
Which you would rewrite as:
map_slot1 = 0 255 0 0 0 0 1 1 100
map_slot2 = 0 255 0 0 0 1 1 1 100
map_slot3 = 0 255 0 0 0 2 1 1 100
map_slot4 = 0 255 0 0 0 3 1 1 100
map_slot5 = 0 255 0 0 0 4 1 1 100
map_slot6 = 0 255 0 0 0 5 1 1 100
map_slot7 = 0 255 0 0 0 6 1 1 100
map_slot8 = 0 255 0 0 0 7 1 1 100
map_slot9 = 0 255 2 1 1 11 1 1 100
If you don't want to go through all that you can use LainNoc's map generator to create a map XML file which has all the above information. You can then open that XML file and copy it into a config file and you're ready to go. The advantage to doing this is that LainNoc always generates the correct values because it doesn't actually read the map itself, it uses Warcraft 3 to calculate the values by connecting to another Warcraft 3 game and sniffing the values from the network. Of course this means you have to get someone to host the map with Warcraft 3 so you can connect to them with LainNoc.
I think that about covers it.
So write something like the text mentioned above in a text file and save it as <mapname>.cfg inside the cfg directory under your ghost folder.
If you are confused I took that information from
forum.codelain.com/index.php?topic=611.0