It appears you have not registered with our community. To register please click here ...

May 18, 2012, 05:16:54 AM

Author Topic: Map Disassembling + tutorial  (Read 8067 times)

Blackcode

  • DarkBlizz Contributor
  • Sr. Member
  • *****
  • Posts: 126
    • View Profile
Map Disassembling + tutorial
« on: February 28, 2010, 06:49:28 AM »
This is the dump of my shakuras MapInfo file.
 
Bytes:
 
4970614D15000000B00000009800000001000000000000004461726B005368616B7572617300
0A00000008000000A60000008800000000800000000000004173736574735C54657874757265
735C6C6F6164696E672D7368616B757261732E6464730002000000FFFFFFFF00000000000000
0020030000580200000000000000000000050000000003000000000000000000000000000000
0000000000000102000000FFFFFFFF5465727200000000000100000000000000000202000000
FFFFFFFF50726F7400000000000200000000000000000302000000FFFFFFFF50726F74000000
00000300000000000000000402000000FFFFFFFF50726F740000000000040000000000000000
0400000000000000000000000300000004000000040000000A0000002D000400000001000000
0200000003000000040000000600000001000000020000000400000008000000030000000C00
000006000000150000001E4000
 
 
String:
 
IpaM....................Dark.Shakuras.........................Assets\Textures\loading-shakuras.dds................. ...X...............................................Terr.......................Prot.......................Prot.......................Prot....
 
 
 
 Adding players or Change state:

1. Open .s2ma file with your MPQ editor.
 
2. Find MapInfo file inside and open it in Hexeditor.
 
3. Find the bytes that look like this. (My example is from a 4 player map)

0003000000000000000000000000000000000000000000
0101000000FFFFFFFF0000000000000000000000000000
0202000000FFFFFFFF0000000000000000000000000000
0300000000FFFFFFFF0000000000000000000000000000
0400000000FFFFFFFF0000000000000000000000000000
 
in MapInfo... the add AddPlayer bytes are (03,01,02,00,00 in this example)
 
00 - Disabled
01 - Human
02 - AI
03 - Observer Player
 
If all bytes are 02 except the one for player 00 (witch must remain 03) u get in observer mode.
 
Color
 
The color bytes are FF FF FF FF
 
It can takes values like 00 00 00 00, 01 00 00 00, 02 00 00 00 ...... 0F 00 00 00
 
Race - after the color bytes (FF FF FF FF) insert String Zerg, Prot, Terr
 
*beware not to write over old bytes but insert new ones.
 
Zerg in Hex is5A 65 72 67
Prot in Hex is 50 72 6F 74
Terr in Hex is 54 65 72 72
 
0101000000FFFFFFFF0000000000000000000000000000

becames
 
0101000000FFFFFFFF50726F740000000000000000000000000000
 
Spaw Position
 
0101000000FFFFFFFF50726F740000000000000000000000000000
 
00 Bytes - can take values 01 - 04 (this case 4 player map 4 spawn points. 00 is random base)

Loading map Image

 
IpaM....................Dark.Shakuras.........................Assets\Textures\loading-shakuras.dds.................
 
 
1. Create inside s2ma file (mpq archive)
 
a folder Assets inside this folder make another called Textures
 
take "loading-shakuras.dds" from "C:\Program Files\StarCraft II Beta\Mods\Liberty.SC2Mod\base.SC2Assets" mpq archive and place it in your Texture created folder.
 
Load image Widescreen mode:

find
 
735C6C6F6164696E672D7368616B757261732E6464730002000000FFFFFFFF00000000000000
 
the 02 is loader image in widescreen  or stretch.
 
values can take: 00 - none, 01 - stretch, 02 - widescreen.

 
« Last Edit: March 07, 2010, 06:46:47 PM by Blackcode »

DarkBlizz - Making Battle.net Magic -

Map Disassembling + tutorial
« on: February 28, 2010, 06:49:28 AM »

sYk0

  • DarkBlizz Contributor
  • Member
  • *****
  • Posts: 52
    • View Profile
Re: Map Disassembling
« Reply #1 on: February 28, 2010, 08:00:07 AM »
Hey Blackcode, I figured this one out too. :D

I'm currently busy making a utility so users can edit their own map settings.
  • Change the number of AI opponents on the map (4 player maps).
  • You can specify that you want AI only (User will be a spectator), this will be good for AI devs to monitor how the AI plays.
  • You can have custom AI settings for a specific map.
  • More features to come... stay tuned.
// sYk0.

Blackcode

  • DarkBlizz Contributor
  • Sr. Member
  • *****
  • Posts: 126
    • View Profile
Re: Map Disassembling
« Reply #2 on: February 28, 2010, 08:31:09 AM »
1. Open .s2ma file with your MPQ editor.
 
2. Find MapInfo file inside and open it in Hexeditor.
 
3. Find the bytes that look like this. (My example is from a 4 player map)

0003000000000000000000000000000000000000000000
0101000000FFFFFFFF0000000000000000000000000000
0202000000FFFFFFFF0000000000000000000000000000
0300000000FFFFFFFF0000000000000000000000000000
0400000000FFFFFFFF0000000000000000000000000000
 
in MapInfo... the add AddPlayer bytes are (03,01,02,00,00 in this example)
 
00 - Disabled
01 - Human
02 - AI
03 - Observer Player
 
If all bytes are 02 except the one for player 00 (witch must remain 03) u get in observer mode.
 
Color
 
The color bytes are FF FF FF FF
 
It can takes values like 01 00 00 00, 02 00 00 00 ...... 0F 00 00 00
 
Race - after the color bytes (FF FF FF FF) insert String Zerg, Prot, Terr
 
*beware not to write over old bytes but insert new ones.
 
Zerg in Hex is5A 65 72 67
Prot in Hex is 50 72 6F 74
Terr in Hex is 54 65 72 72
 
0101000000FFFFFFFF0000000000000000000000000000

becames
 
0101000000FFFFFFFF50726F740000000000000000000000000000
 

 
« Last Edit: March 07, 2010, 05:12:13 AM by Blackcode »

adonys

  • New Member
  • *
  • Posts: 2
    • View Profile
Re: Map Disassembling
« Reply #3 on: February 28, 2010, 01:01:18 PM »
can you make/do you know how to make team maps? like 1h vs team of 2 Ai, 1h vs team of 3 AI, h+AI team vs team of 2 AI, team of 2 AI vs team of 2 AI, please?

can you make an AI vs Ai obs mode for the small 1x1 maps (Blistering sands), please?
« Last Edit: February 28, 2010, 01:12:09 PM by adonys »

sYk0

  • DarkBlizz Contributor
  • Member
  • *****
  • Posts: 52
    • View Profile
Re: Map Disassembling
« Reply #4 on: February 28, 2010, 03:07:26 PM »
Map modifier on it's way... soon...

Just a sample of what I'm working on (not what it will look like when it's done).






Blackcode

  • DarkBlizz Contributor
  • Sr. Member
  • *****
  • Posts: 126
    • View Profile
Re: Map Disassembling
« Reply #5 on: February 28, 2010, 03:36:09 PM »
nice.... check some stuff i found on internet ....
 
--------------------------------------------------------------------
 
struct  MapInfo
{
  DWORD   magic;  // 'MapI'
  u32     unknown1;   //  0x15
  u32     width;
  u32     height;
  u32     unknown2;   // version?? depth??
  u32     unknown3;   // subversion??
  char    tileset[];
  char    title[];
  u32     boundryLeft;
  u32     boundryBottom;
  u32     boundryRight;
  u32     boundryTop;
  u32     unknown4;
  u32     unknown5;
  char    loaderImagePath[];
  u32     loaderImageFormat;  // enum names are made-up
          {
            stretch_none       = 0x00,
            stretch_fullscreen = 0x01,
            stretch_widescreen = 0x02
          }
  u32     unknown6; // (-1)
  u32     unknown7;
  u32     unknown8;
  u32     unknownWidth;
  u32     unknownHeight;
  u32     unknown9;
  u32     unknown10;
  u8      playerCount;
  struct playerStruct
  {
    u8      isUnused; // ?
    u8      pUnk1;
    u8      pUnk2;
    u8      index;
    u8      owner;
            {
              c_playerTypeNone      = 0,
              c_playerTypeUser      = 1,
              c_playerTypeComputer  = 2,
              c_playerTypeNeutral   = 3,
              c_playerTypeHostile   = 4,
              c_playerTypeReferee   = 5,
              c_playerTypeSpectator = 6
            }
    u8      pUnk3;
    u8      pUnk4;
    u8      pUnk5;
    u32     unknown;  // -1 if no name or default name
    char    playerName[];
    u8      pUnk6;
    u8      pUnk7;
    u8      pUnk8;
    u8      pUnk9;
    u8      pUnk10;
    u8      pUnk11;
    u8      pUnk12;
    u8      pUnk13;
    u8      pUnk14;
    u8      pUnk15;
  } [playerCount];
 
  // unknown
}
// Looking for race, team, color, difficulty
 
--------------------------------------------------------------------

Blackcode

  • DarkBlizz Contributor
  • Sr. Member
  • *****
  • Posts: 126
    • View Profile
Re: Map Disassembling
« Reply #6 on: February 28, 2010, 03:37:07 PM »
 CONTROLLER = 500,
 RULES = 1000,
 IS_PREMADE_GAME = 1001,
 PARTIES_PRIVATE = 2000,
 PARTIES_PREMADE = 2001,
 PARTIES_PREMADE_1V1 = 2002,
 PARTIES_PREMADE_2V2 = 2003,
 PARTIES_PREMADE_3V3 = 2004,
 PARTIES_PREMADE_4V4 = 2005,
 PARTIES_PREMADE_FFA = 2006,
 PARTIES_PREMADE_5V5 = 2007,
 PARTIES_PREMADE_6V6 = 2008,
 PARTIES_PRIVATE_ONE = 2010,
 PARTIES_PRIVATE_TWO = 2011,
 PARTIES_PRIVATE_THREE = 2012,
 PARTIES_PRIVATE_FOUR = 2013,
 PARTIES_PRIVATE_FIVE = 2014,
 PARTIES_PRIVATE_SIX = 2015,
 PARTIES_PRIVATE_SEVEN = 2016,
 PARTIES_PRIVATE_FFA = 2017,
 PARTIES_PRIVATE_CUSTOM = 2018,
 PARTIES_PRIVATE_EIGHT = 2019,
 PARTIES_PRIVATE_NINE = 2020,
 PARTIES_PRIVATE_TEN = 2021,
 PARTIES_PRIVATE_ELEVEN = 2022,
 GAME_SPEED = 3000,
 RACE = 3001,
 PARTY_COLOR = 3002,
 HANDICAP = 3003,
 AI_SKILL = 3004,
 AI_RACE = 3005,
 LOBBY_DELAY = 3006,
 PARTICIPANT_ROLE = 3007,
 WATCHER_TYPE = 3008,
 GAME_MODE = 3009,
 LOCKED_ALLIANCES = 3010,

sYk0

  • DarkBlizz Contributor
  • Member
  • *****
  • Posts: 52
    • View Profile
Re: Map Disassembling
« Reply #7 on: March 01, 2010, 01:47:52 AM »
Nice find Blackcode ;) that'll come in very handy...

Blackcode

  • DarkBlizz Contributor
  • Sr. Member
  • *****
  • Posts: 126
    • View Profile
Re: Map Disassembling
« Reply #8 on: March 01, 2010, 05:04:55 PM »
i have shared everything i knewd about... now it's your turn...
I will not publish any project using infos here.. but I think all we know about we must do it public....

kblood

  • Sr. Member
  • ****
  • Posts: 105
    • View Profile
Re: Map Disassembling
« Reply #9 on: March 02, 2010, 05:41:51 PM »
You have probably already found this, but i got a nifty MPQ package addon for my Total Commander, and started browsing around in SC2 AI and MAP files.
I came across the attributes files in the maps which start out as:
Code: [Select]
<?xml version="1.0" encoding="utf-8"?>
<Attributes>
    <Variant>
        <Id Value="1"/>
        <Genre Value="1"/>
        <GameType Value="2"/>
        <MaxTeamSize Value="1"/>
        <Name Value="Variant001/Name"/>
        <Description Value="Variant001/Desc"/>
        <Attribute Id="3010">
            <Locked/>

Would it be possible to rearrange this file to change the gametype?
I have found that maps usually triggers some melee scripts. If those scripts are added to the map, then the map should be able to change the gametype if nothing else works.
Its just that it would be nice to be able to make 2vs2 maps. Has 1vs3 already been made? That would be nice as well. Making observer possible is cool, and I am wondering how that was found out? Randomly changing hex code? I doubt that :)
Good work so far though. I just began looking through the scripts today.
Another question. If the AI files are unpacked and you just place the files from the package in subfolders, would they over rule the AI files? And would it overrule these files if they are put into maps? I still have not found the priorities of all these scripts. I am just fairly certain just about all scripts can be added to the map files and overrule them all as they are mini mods.

Blackcode

  • DarkBlizz Contributor
  • Sr. Member
  • *****
  • Posts: 126
    • View Profile
Re: Map Disassembling
« Reply #10 on: March 05, 2010, 04:25:39 AM »
already found that but did not had the time to fully investigate....
i'm more focused on the maipnfo file.... aready found a way to lock terran For AI mode and toss for NonAI..
 
0102000000FFFFFFFF00000000000000000000 XX 00 00 00
 
the XX bytes should take value 01

sYk0

  • DarkBlizz Contributor
  • Member
  • *****
  • Posts: 52
    • View Profile
Re: Map Disassembling
« Reply #11 on: March 05, 2010, 05:41:50 AM »
again, nice work Blackcode, i'll investigate your findings a little later when I get home...

asdfghgghjdhg

  • New Member
  • *
  • Posts: 3
    • View Profile
Re: Map Disassembling
« Reply #12 on: March 05, 2010, 06:28:09 AM »
i think this is right:
 
struct  MapInfo
{
  DWORD   magic;  // 'MapI'
  u32     unknown1;   //  0x15
  u32     width;
  u32     height;
  u32     unknown2;   // version?? depth??
  u32     unknown3;   // subversion??
  char    tileset[];
  char    title[];
  u32     boundryLeft;
  u32     boundryBottom;
  u32     boundryRight;
  u32     boundryTop;
  u32     unknown4;
  u32     unknown5;
  char    loaderImagePath[];
  u32     loaderImageFormat;  // enum names are made-up
          {
            stretch_none       = 0x00,
            stretch_fullscreen = 0x01,
            stretch_widescreen = 0x02
          }
  u32     unknown6; // (-1)
  u32     unknown7;
  u32     unknown8;
  u32     unknownWidth;
  u32     unknownHeight;
  u32     unknown9;
  u32     unknown10;
  u32      playerCount;
  struct playerStruct
  {
    u8      index;
    u8      owner;
            {
              c_playerTypeNone      = 0,
              c_playerTypeUser      = 1,
              c_playerTypeComputer  = 2,
              c_playerTypeNeutral   = 3,
              c_playerTypeHostile   = 4,
              c_playerTypeReferee   = 5,
              c_playerTypeSpectator = 6
            }
    u8      pUnk3;
    u8      pUnk4;
    u8      pUnk5;
    u32    color
               {
                  c_Red = 1
                  c_Blue = 2
                  ... and so on as in war3
               }
    char    playerName[] with finishing zero; mb other struct
    u8      pUnk6;
    u8      pUnk7;
    u8      pUnk8;
    u8      pUnk9;
    u8      pUnk10;
    u8      pUnk11;
    u8      pUnk12;
    u8      pUnk13;
    u32      pUnk14; some kind of player race, value grater 0 makes computer play terran, dont work for player
     u8       finishing zero (for what?)
  } [playerCount];
 
  // unknown
}

bassMD

  • New Member
  • *
  • Posts: 10
    • View Profile
Re: Map Disassembling
« Reply #13 on: March 05, 2010, 06:40:15 AM »
I posted my findings about setting the color in another thread (http://darkblizz.org/Forum2/general-discussion/select-your-race!/) - to summarize: I also think that this u32 is the color, but values like 00000001 just give the default color. Setting it to 00000000 results in white. Read my whole post though (#3 in the linked thread) please.

EDIT: I'm not sure if asdf is right about the player count - this was set to 00 in my Kula's Ravine (4 player map) that I use for testing and it works flawlessly.

EDIT 2: I also played a bit with the player name, but nothing I tried changed the ingame name. The map worked though, although I inserted 7 bytes as the name.
« Last Edit: March 05, 2010, 06:45:05 AM by bassMD »

Yuna_Q

  • New Member
  • *
  • Posts: 13
    • View Profile
Re: Map Disassembling
« Reply #14 on: March 05, 2010, 09:13:18 AM »
Blackcode, could u make 1vs1 ai observer map  for ai testers  with losttemple or other map?
it's very useful for test ai.
plz

DarkBlizz - Making Battle.net Magic -

Re: Map Disassembling
« Reply #14 on: March 05, 2010, 09:13:18 AM »