DarkBlizz

Game On => Land of AI => STARCRAFT II: WINGS OF LIBERTY => AI Development => Topic started by: Blackcode on February 28, 2010, 06:49:28 AM

Title: Map Disassembling + tutorial
Post by: Blackcode 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.

Title: Re: Map Disassembling
Post by: sYk0 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.
// sYk0.
Title: Re: Map Disassembling
Post by: Blackcode 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


Title: Re: Map Disassembling
Post by: adonys 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?
Title: Re: Map Disassembling
Post by: sYk0 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).

(http://i48.tinypic.com/15ehj5.png)

(http://i45.tinypic.com/210hxfc.png)

(http://i49.tinypic.com/t5hjtf.png)
Title: Re: Map Disassembling
Post by: Blackcode 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

--------------------------------------------------------------------
Title: Re: Map Disassembling
Post by: Blackcode 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,
Title: Re: Map Disassembling
Post by: sYk0 on March 01, 2010, 01:47:52 AM
Nice find Blackcode ;) that'll come in very handy...
Title: Re: Map Disassembling
Post by: Blackcode 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....
Title: Re: Map Disassembling
Post by: kblood 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:
<?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.
Title: Re: Map Disassembling
Post by: Blackcode 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
Title: Re: Map Disassembling
Post by: sYk0 on March 05, 2010, 05:41:50 AM
again, nice work Blackcode, i'll investigate your findings a little later when I get home...
Title: Re: Map Disassembling
Post by: asdfghgghjdhg 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
}
Title: Re: Map Disassembling
Post by: bassMD 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 (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.
Title: Re: Map Disassembling
Post by: Yuna_Q 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
Title: Re: Map Disassembling
Post by: Kernel64 on March 05, 2010, 09:44:52 AM
Quote from: Yuna_Q 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

Seconded.
Title: Re: Map Disassembling
Post by: bassMD on March 05, 2010, 10:50:26 AM
Making an observer map is easy, I can provide a Lost Temple observer map when I come home from work (I guess Blackcode has better things to do, as he seems quite advanced in his research on hacking the game).

What I didn't figure out yet is how to load two different AIs in order to compare them. The only way I see is including them in the map, which seems quite uncomfortable as you would need to repackage the map after every change to the AI. But maybe that's the best we get, seeing that the map files also include things like player color that change every game...although I feel that the feature of including AIs in the maps seems more suited to custom maps like DOTA.
Title: Re: Map Disassembling
Post by: kblood on March 05, 2010, 11:13:15 AM
Quote from: Yuna_Q 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
I beat you other pplz to it  ;D
http://dionysus.dk/SC2/ (http://dionysus.dk/SC2/)
I just took the 2 player map from the AI map pack, and used Blackcode's info to make it an observer map. I will be uploading several maps to this folder. So far I put a (2) Lost Temple (Observer) map there. I already tested it. I will add a few more.
Title: Re: Map Disassembling
Post by: kblood on March 05, 2010, 11:21:22 AM
Quote from: bassMD on March 05, 2010, 10:50:26 AM
Making an observer map is easy, I can provide a Lost Temple observer map when I come home from work (I guess Blackcode has better things to do, as he seems quite advanced in his research on hacking the game).

What I didn't figure out yet is how to load two different AIs in order to compare them. The only way I see is including them in the map, which seems quite uncomfortable as you would need to repackage the map after every change to the AI. But maybe that's the best we get, seeing that the map files also include things like player color that change every game...although I feel that the feature of including AIs in the maps seems more suited to custom maps like DOTA.
You cannot test two AIs for the same race, you can however take one race from one AI and mix it with another. So far anyway, because as AIs begins getting more advanced, I guess more than just the race AI files will be edited. If that happens it will take more than a bit of editing to match these AIs against each other. Try have a look at the IAI Protoss 0.3 AI in the AI scripts section. That AI can be put in a TriggerLibs folder in the SC2 Beta folder, and it will be that protoss AI that will be used with whatever other AI you have installed. Even if the AI is put into a map file. So if it is just to test an AI, then no reason to put it directly into the map. Unless that for some reason makes more sense to you. Having a TriggerLibs folder in the SC2 Beta folder can give problems though, because if you try using another AI you need to either delete the folder or overwrite all the files in it with the new AI.
Title: Re: Map Disassembling
Post by: kblood on March 05, 2010, 12:41:06 PM
Quote from: Kernel64 on March 05, 2010, 09:44:52 AM
Quote from: Yuna_Q 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

Seconded.
Hmmm, just added StarCraft II Launcher 2.0.2 to my site: http://dionysus.dk/SC2/ (http://dionysus.dk/SC2/)
Seems rather relevant since it can somehow take any map and choose the number of players it should be launched with. No need to make maps with 2 or 4 players when using this. I removed the lazylaunch2.exe in the zip though, so you have to put your own file in that folder. Since it is my domain I guess they might detect the file as a Trojan. I doubt it, but I just rather not host cracks.
Credits and info:
Quote© Zoxc 2010

This is a simple tool that let's you import files to a map on-the-fly.
You can place maps in a folder named 'Maps' in the directory of the
executable. You can also group sets of files (called mods) in folders
in the folder 'Mods'. It will also include every file in the directory
'Base'.

This makes changes files in maps alot easier, you can also use it to
test an AI without modifing your StarCraft II installation.

Thanks to:
- ShadowFlare for SFmpq
- Team Lazytown for their launcher
- Team StarCrack for the included AI
- Blizzard for StarCraft II

Enjoy, sure seems a more permanent solution than me making 5 different maps of each map. Now player race and color just needs to be found and the launcher can setup just about everything :) I also really like how it can choose launcher options.
Title: Re: Map Disassembling
Post by: Kernel64 on March 05, 2010, 02:16:23 PM
I get system error: code 2

The system cannot find the file specified.

my sc2 directory is not within the default install location. Could this be the reason?
Title: Re: Map Disassembling
Post by: sYk0 on March 05, 2010, 03:36:23 PM
Quote from: Kernel64 on March 05, 2010, 02:16:23 PM
I get system error: code 2

The system cannot find the file specified.

my sc2 directory is not within the default install location. Could this be the reason?

it's because kblood removed "lazylaunch2.exe" from the archive, i suggest you go to the original thread to download the loader (http://darkblizz.org/Forum2/sc2-tools/starcraft-ii-launcher/ (http://darkblizz.org/Forum2/sc2-tools/starcraft-ii-launcher/))
Title: Re: Map Disassembling
Post by: Kernel64 on March 05, 2010, 04:00:31 PM
Oh, thanks. The launcher should also be placed within the \files directory.

My mod includes a modification to GameData\abildata.xml, does the launcher support other folders besides \TriggerLibs?

edit: Also, maps with these configuration would be nice:

observer maps for:
ZvZ comps
ZvP comps
ZvT comps
TvP comps
TvT comps
PvP comps

1v1 Player vs AI

ZvZ Player vs. comp
ZvP Player vs. comp
ZvT Player vs. comp
TvP Player vs. comp
TvT Player vs. comp
PvP Player vs. comp

One map, like Lost Temple with all the above items preset would be nice. Would make things easier. If not, is there somewhere I can find a simple tutorial to edit maps and make the above myself?
Title: Re: Map Disassembling
Post by: Blackcode on March 05, 2010, 04:47:06 PM
Kernel the race selection is what we are trying to do on this forum and with some of the guys from the starcrack team... we do not have a working race selection for now... i hope soon i'll get a solution with basttmp and usmc23
Title: Re: Map Disassembling
Post by: kblood on March 05, 2010, 05:18:06 PM
Quote from: sYk0 on March 05, 2010, 03:36:23 PM
Quote from: Kernel64 on March 05, 2010, 02:16:23 PM
I get system error: code 2

The system cannot find the file specified.

my sc2 directory is not within the default install location. Could this be the reason?

it's because kblood removed "lazylaunch2.exe" from the archive, i suggest you go to the original thread to download the loader (http://darkblizz.org/Forum2/sc2-tools/starcraft-ii-launcher/ (http://darkblizz.org/Forum2/sc2-tools/starcraft-ii-launcher/))
true, sorry about that. I did try to explain it and was going to add this link as well. I am having a look at your maps. Well done making a 6 player map. So far I only understood how you made the mapinfo file include more players. Where these extra players are placed on the map is still a mystery to me.
I remember there was a user made MAP editor for Warcraft 3. I expect it was only possible because they had the actual map editor to back engineer it from. Would be nice if we could decode the basic map makeup though, although quite a few things are still both simpler to do and more needed, like race selection.
I am trying to make the gamemode melee instead of FFA, but I am not sure if that is possible. Did it not start out being melee maps? Melee being a all AI vs player map? Well, I will look around some more.
Title: Re: Map Disassembling
Post by: kblood on March 05, 2010, 07:13:02 PM
Quote from: Kernel64 on March 05, 2010, 04:00:31 PM
Oh, thanks. The launcher should also be placed within the \files directory.

My mod includes a modification to GameData\abildata.xml, does the launcher support other folders besides \TriggerLibs?
Several ways to do this. If it is a mod you are making, which takes place in one certain map, you can just add the file to the map. Other than that, I think the launcher can do the same as any map with its mod folder.
I just tested the launcher way, and making a GameData folder in the mod folder of this launcher might make everything produce double units. I think it is because the XML files somehow "stack" their code. Not sure though, because a few other things should be double as well then I guess.
Title: Re: Map Disassembling
Post by: bassMD on March 05, 2010, 09:09:01 PM
Update on the player colors:

The decimal values for the colors (taken from replay files) are:

255,180,20,30   (red),
255,0,66,255    (dark blue)
255,28,167,234  (teal)
255,84,0,129    (purple)

Translating these into hex values and putting them into the map file unfortunately did not change the player colors at all (standard colors were the outcome). I also tried reversing the hex blocks, but no success either. White remains the only color I can set apart from the standard ones.
Title: Re: Map Disassembling
Post by: kblood on March 05, 2010, 09:10:20 PM
I have been experimenting some more with the attributes file. Could it be that, partly since it is an XML file, that it is mostly cosmetic? Giving the settings for the Interface to set up the map? Ie. no value to us since the launcher we use choose those settings.
At least that is how I see it. Is it not Lazylaunch1 or 2 that somehow chooses default gamemode or some set gamemode? Which makes me wonder why GameType 3 seems to be the default one in the attributes file.
[/code]    <Variant>
        <Id Value="2"/>
        <Genre Value="1"/>
        <GameType Value="3"/>
        <MaxTeamSize Value="2"/>
        <Name Value="Variant002/Name"/>
        <Description Value="Variant002/Desc"/>
        <IsDefault/>
        <Attribute Id="3010">
            <Locked/>
            <Default>
                <Slot Id="Global"/>
                <Value Id="7955827"/>
            </Default>
        </Attribute>
Title: Re: Map Disassembling
Post by: DFA on March 05, 2010, 09:17:50 PM
I am not sure exactly how to go about this, but will i be able to do this opening the map file as binary, and modifying it on the byte level?
Title: Re: Map Disassembling
Post by: bassMD on March 05, 2010, 09:20:47 PM
Sure, it could be that these things in the Attributes file are only for the UI, but XML files are for example also used by the AI, so it would be foolish to think that XML = cosmetical.

I actually have no idea what the different game types mean, maybe you can enlighten me.


@ DFA: the map files for Blizzard games are actually MPQ archives. In the Starcraft II ones, there is a file called MapInfo that is the main concern of this thread, and opening it in a hex editor and modifying it on the byte level is exactly the way we work with it.
Title: Re: Map Disassembling
Post by: DFA on March 05, 2010, 09:41:27 PM
i am new to this stuff and learning, thanks for the help.  its usually hard for me to get started on something but once i do, i can make some pretty good progress
Title: Re: Map Disassembling
Post by: DFA on March 05, 2010, 09:59:04 PM
Quote from: asdfghgghjdhg 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
}

i understand what this is suppose to be, but i don't understand like u32, and a few other things.  do you think you can explain this more for me
Title: Re: Map Disassembling
Post by: bassMD on March 05, 2010, 10:03:24 PM
u32 means unsigned 32 bits = 4 bytes, where 1 byte is representable by two hex digits (16 ^ 2 = 256 = 2 ^ 8 ).

But this kind of discussion should not be in this thread, I think you should open another thread for understanding the basics.

EDIT: of course it is 4 bytes, not 8...was late yesterday ;)
Title: Re: Map Disassembling
Post by: DFA on March 05, 2010, 11:52:37 PM
no need

thanks for explaining it, that was enough to let me figure out exactly whats going on =)
i was like OMG its so clear to me now ><
Title: Re: Map Disassembling
Post by: siman on March 06, 2010, 04:19:14 AM
is it possible to lock the race in AIdev map?
Title: Re: Map Disassembling
Post by: bassMD on March 06, 2010, 06:28:26 AM
Do you mean a map that only includes AI players?

It is currently possible to lock AI players' races to Terran only. That should work in every map.
Title: Re: Map Disassembling
Post by: siman on March 06, 2010, 08:24:47 AM
Quote from: bassMD on March 06, 2010, 06:28:26 AM
Do you mean a map that only includes AI players?

It is currently possible to lock AI players' races to Terran only. That should work in every map.


That's good enough for me. In fact I m just going to lock Terran, after I m done with the Terran AI I will go for Protoss. Please tell me how to do that.
Title: Re: Map Disassembling
Post by: bassMD on March 06, 2010, 08:33:55 AM
Look at this thread for locking Terran AIs:

http://darkblizz.org/Forum2/general-discussion/select-your-race (http://darkblizz.org/Forum2/general-discussion/select-your-race)!/
Title: Re: Map Disassembling
Post by: siman on March 06, 2010, 09:11:51 AM
OK I m done, got 5 Terran AI in a row, so I guess it is really working


that would save me a lot of time


PS. the link is broken, plus it does not give better information than this thread, I re-read this thread and found valuable information in reply #10  :D
Title: Re: Map Disassembling
Post by: Blackcode on March 06, 2010, 03:43:37 PM
OK race/color selection done...

StarCrack team LAUNCHER AVAILABLE soon.

ty all for support
Title: Re: Map Disassembling
Post by: Kernel64 on March 06, 2010, 03:59:59 PM
Horray! ???
Title: Re: Map Disassembling
Post by: bassMD on March 06, 2010, 07:26:48 PM
Great news :)

I would really appreciate if you let us know what settings you changed in order to achieve that.
Title: Re: Map Disassembling
Post by: kblood on March 06, 2010, 08:54:58 PM
Nice :D That just leaves the handicap settings  ;) I found them somewhere, but do not think it is that simple to just change the setting in the XML file in the map. Seems you guys found a better way to do it.
I would wish the actual how would be shared more. You seem like the only one who shared some real how to stuff when it comes to changes that require hex editing or anything other than .galaxy files. Then again I am usually not focused and patient enough to really learn it anyway  :-[
Title: Re: Map Disassembling
Post by: Vernam7 on March 06, 2010, 11:51:41 PM
Quote from: Blackcode on March 06, 2010, 03:43:37 PM
OK race/color selection done...

StarCrack team LAUNCHER AVAILABLE soon.

ty all for support


can you make it work with command lines like lazytowns, so we can use it simplier in our .net tools?



Title: Re: Map Disassembling
Post by: Blackcode on March 07, 2010, 04:47:04 AM
ok seeing that we already published our launcher we will update this on wiki too
Title: Re: Map Disassembling
Post by: Blackcode on March 07, 2010, 05:16:08 AM
Quote from: bassMD on March 06, 2010, 07:26:48 PM
Great news :)

I would really appreciate if you let us know what settings you changed in order to achieve that.

I've put the tutorial in the top...
Title: Re: Map Disassembling
Post by: kblood on March 07, 2010, 05:44:20 AM
I got an idea, although it probably wont be easy. I am trying to make replays work even though you use a launcher such as the one the Starcrack team just made. They will probably come up with a simpler and better way, but would it be possible to make a new MapInit? In theory at least it should be possible to make some in game dialogue boxes or whatever they are called in SC2, where you can choose race and maybe even color of every player.
Problem would be setting the rest of the scripts on hold until that is chosen, figuring out all the dialogue scripts codes which might not even have been added yet, and probably a bunch of other stuff. Well, just and idea.
Btw. Blackcode, thx alot for the Hex info about how to make maps race specific :D I will try making a few race specific maps later  8)
Title: Re: Map Disassembling
Post by: Kernel64 on March 07, 2010, 06:13:14 AM
Oh, thank god. Kblood, that would help much. Where will you be posting them, so I can spam f5 on that thread?
Title: Re: Map Disassembling
Post by: Blackcode on March 07, 2010, 06:44:16 PM
updated info on first post until i can upload on wiki
Title: Re: Map Disassembling + tutorial
Post by: Vernam7 on March 08, 2010, 06:17:24 AM
guys SOS:


can you spot anything wrong in this HEX and tell me why this (no modefied map) will start and gets me straign to Victory NO AI enebled!??? its driving me crazy last night was working then i change the colors a little bit and no it doesnt! i cant find my mistake so plz anyone with exp in maps help out just a little bit! ::)




49 70 61 4d 15 00 00 00 a0 00 00 00 a8 00 00 00 01 00 00 00 00 00 00 00 44 61 72 6b 00 58 69 6c 00 0a 00 00 00 08 00 00 00 96 00 00 00 94 00 00 00 00 80 00 00 00 00 00 00 41 73 73 65 74 73 5c 54 65 78 74 75 72 65 73 5c 6c 6f 61 64 69 6e 67 2d 78 69 6c 2e 64 64 73 00 01 00 00 00 ff ff ff ff 00 00 00 00 00 00 00 00 20 03 00 00 58 02 00 00 00 00 00 00 00 00 00 00 03 00 00 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 01 00 00 00 02 00 00 00 50 72 6f 74 00 00 00 00 00 00 00 00 00 00 02 02 00 00 00 01 00 00 00 5a 65 72 67 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00




protoss Human / Zerg AI. protoss starts normally as protos with selected color, the damn Zerg its nowhere to be found! game goes to Vistory why? i tryed with AI modified maps Nothing the same result!!!

Title: Re: Map Disassembling + tutorial
Post by: Vernam7 on March 08, 2010, 07:12:50 AM
forget it i found the missing bytes  ::)
Title: Re: Map Disassembling
Post by: kblood on March 08, 2010, 12:03:03 PM
Quote from: Kernel64 on March 07, 2010, 06:13:14 AM
Oh, thank god. Kblood, that would help much. Where will you be posting them, so I can spam f5 on that thread?

I was busy testing some of all the other stuff that was being released for this game :)

But I uploaded Starlauncher to my server:

http://dionysus.dk/SC2/ (http://dionysus.dk/SC2/)

It has changing position (and color at the same time), how many AI players, and teams although that is rather useless without an AI to handle teamplay. You just need to install the AI you use directly, and remember to use some maps that you have backups off, then it should work.
Title: Re: Map Disassembling + tutorial
Post by: Kernel64 on March 08, 2010, 03:55:27 PM
Any way I can change the game speed manually?

I'm having trouble using that launcher, and I've had some serious errors with past launchers. I'm going manual hexing on making match specific maps.

Where's the Hex for game speed?
Title: Re: Map Disassembling + tutorial
Post by: Blackcode on March 08, 2010, 05:07:28 PM
Quote from: Kernel64 on March 08, 2010, 03:55:27 PM
Any way I can change the game speed manually?

I'm having trouble using that launcher, and I've had some serious errors with past launchers. I'm going manual hexing on making match specific maps.

Where's the Hex for game speed?

did not find it yet till now.... use + - keys for seting speed ingame instead...
Title: Re: Map Disassembling + tutorial
Post by: Vernam7 on March 09, 2010, 03:12:10 AM
what about the teams bytes? the starcrack launcer has it working stable any idea on that?
Title: Re: Map Disassembling + tutorial
Post by: siman on March 09, 2010, 04:05:59 AM
The spawn position is not working for me, I tried it on an AI player slot with the race selected.
Title: Re: Map Disassembling + tutorial
Post by: Valkirie on March 09, 2010, 09:38:13 AM
Quote from: Vernam7 on March 09, 2010, 03:12:10 AM
what about the teams bytes? the starcrack launcer has it working stable any idea on that?
It's not contained into MapInfo, starcrack launcher is reading/writing memory.
Title: Re: Map Disassembling + tutorial
Post by: Vernam7 on March 09, 2010, 09:42:26 AM
Quote from: Valkirie on March 09, 2010, 09:38:13 AM
Quote from: Vernam7 on March 09, 2010, 03:12:10 AM
what about the teams bytes? the starcrack launcer has it working stable any idea on that?
It's not contained into MapInfo, starcrack launcher is reading/writing memory.


thank you for the answer,
if thats true i am not sure if we should go there, there has to be into some other file too .....hmmmmm well i guess it will have to wait for now, before they couldnt even play-login the main menu and now, they have race selection, points, and many feature and they can PLAY, team will have to wait  :P
they should be happy with what they have so far  8)
Title: Re: Map Disassembling + tutorial
Post by: kblood on March 09, 2010, 01:06:56 PM
Quote from: Valkirie on March 09, 2010, 09:38:13 AM
Quote from: Vernam7 on March 09, 2010, 03:12:10 AM
what about the teams bytes? the starcrack launcer has it working stable any idea on that?
It's not contained into MapInfo, starcrack launcher is reading/writing memory.

Oh, that is nice to know and very impressive :D Perfect way to do it, and explains why replays work very well with that loader. Guess the last thing needed is making a script that fixes the team settings in the AI, which the Starlauncher 0.41 fixed somehow.
Title: Re: Map Disassembling + tutorial
Post by: Vernam7 on March 14, 2010, 05:04:39 AM
hello friends


why the spaw position although is written perfectly, works only SOmetimes, in all maps and ALWAYS correct in Shakuras Plateu???


this is happening to all launchers btw
Title: Re: Map Disassembling + tutorial
Post by: Blackcode on March 14, 2010, 05:42:49 AM
Quote from: Vernam7 on March 14, 2010, 05:04:39 AM
hello friends


why the spaw position although is written perfectly, works only SOmetimes, in all maps and ALWAYS correct in Shakuras Plateu???


this is happening to all launchers btw


i will investigate on this... till now i had no problems
Title: Re: Map Disassembling + tutorial
Post by: Valkirie on March 14, 2010, 11:49:26 AM
Quote from: Blackcode on March 14, 2010, 05:42:49 AM
Quote from: Vernam7 on March 14, 2010, 05:04:39 AM
hello friends


why the spaw position although is written perfectly, works only SOmetimes, in all maps and ALWAYS correct in Shakuras Plateu???


this is happening to all launchers btw
Mine too ? Because our launcher is generating a new file from nothing, not patching the actual one. Then if yes, you should investigate.


i will investigate on this... till now i had no problems
Title: Re: Map Disassembling + tutorial
Post by: Vernam7 on March 14, 2010, 02:30:23 PM
Quote from: Valkirie on March 14, 2010, 11:49:26 AM

Mine too ? Because our launcher is generating a new file from nothing, not patching the actual one. Then if yes, you should investigate.



Valkirie what are you talking about?, your latest launcher doesn't even have start locations how can it be even broken, yet?

and so far your tool also patches the maps and lives them patched and not playable from other tools!
but start locations i couldnt tested on yours. so now that you are making start locations make sure you also do so serious tests, cause i though it was working too, but it doesnt always work, actually most of the times its totally random, besides the Shakuras Platue map.


its a general question not specified to one person, or launcher.

i hope its just a map issue, but i tested with sYk0's latest map pack official blizzard maps, nothing all give the same results! ::)


its indeed strange.
if there was something wrong in the implemention process it would work not even for 1 map!
i have triple check the proccess is exactly how our beloved BlackCode told us in his tutorial.

Title: Re: Map Disassembling + tutorial
Post by: Valkirie on March 15, 2010, 02:15:14 PM
Quoteits a general question not specified to one person, or launcher.
The map is patched but not the MapInfo, which is entirely generate by the tool. I didn't made any serious test about start location. Anyway, so far i didn't used BlackCode tutorial, I should probably take a look at it. Hope my three years of Warhammer Online reverse engineering will help me discovering some hidden things.
Title: Re: Map Disassembling + tutorial
Post by: Vernam7 on March 16, 2010, 08:42:46 AM
pffff


well a friend and i have found the answer to the problem i need to verified again and if it goes well i will make it publically available to everyone ;-)  8)


i also PM BlackCode to the issue and solution. after verification the tutorial will be updated i hope. :thumbsup:
Title: Re: Map Disassembling + tutorial
Post by: Blackcode on March 20, 2010, 08:40:33 AM
Quote from: Vernam7 on March 16, 2010, 08:42:46 AM
pffff


well a friend and i have found the answer to the problem i need to verified again and if it goes well i will make it publically available to everyone ;-)  8)


i also PM BlackCode to the issue and solution. after verification the tutorial will be updated i hope. :thumbsup:

ok man... tnx and waiting for it
Title: Re: Map Disassembling + tutorial
Post by: Vernam7 on March 21, 2010, 07:59:51 PM
hi BlackCode


the solution to the Start Locations is this:


i am going to use your tutorial to make the compairing more esy.


now you said
Spaw Position

01
01000000FFFFFFFF50726F740000000000000000000000000000

00 Bytes - can take values 01 - 04 (this case 4 player map 4 spawn points. 00 is random base)
what i delete is the problem, we should NOT put values from 1 to what ever player may have lets say 1 to 6.

BUT what we should really do is open the file Objects from the .s2ma
this is a very tipical XML file.
at the bottom of it search for  tags like those (its a demo from the lost temple)


    <Point id="97" position="98.5,133.5,0" scale="1,1,1" type="StartLoc" name="
Start Location 003" color="0,0,0,0"/>
    <Point id="115" position="132.5,102.5,0" scale="1,1,1" type="StartLoc" name="Start Location 004" color="0,0,0,0"/>
    <Point id="116" position="62.5,26.5,0" scale="1,1,1" type="StartLoc" name="Start Location 001" color="0,0,0,0"/>
    <Point id="117" position="27.5,63.5,0" scale="1,1,1" type="StartLoc" name="Start Location 002" color="0,0,0,0"/>


you notice the node name="Star Location 00x?" in the begging of the line its an ID="xxx" this ID 2 or 3 digits IS your TRUE start location!


WAIT you may found your ID BUT in order to modify correctly the MapInfo file you have to read it as HEX and as you correctly said locate the 6th pair of -00- but instead of just writing values 1 to 4etc you must get the ID values and CONVERT them to hecidecimal that will give you a pair of bytes -xx- now this is ready to apply in MapInfo start location.


here is an easy VB.net Demo Conversion



Dim myID As Integer = SL2 ' the ID value from objects file
Dim myHEX As String = Convert.ToString(myID, 16) '<-----convert it to hexadecimal first
Location = hex '<----this is what you should put in the 6th pair in MapInfo!  ;)


the location 4 is the ID = 115 after conversion should be -73- so REPLACE the -00- with -73- to start always in this 4th location!
final result should look like this
0101000000FFFFFFFF50726F740000000000730000000000000000

your example was working because you got "lucky" (no offence) in one map startlocation had ids 1,2,3,4 so was working because the id was allready corerct. :thumbsup:

sorry for late replay i was busy with my launcher!

hope its clear, Blackode take this and update your tutorial as you may wish. ;-)






special tnx goes also to et2010 for helping on this finding.






Update if StartLocation ID is bigger than 255 and return a 3 or 4 digit value you will have to reverse the last pair with the first, and feelin 0 "zeros" to the missing numbers in hex

for example start location 385 = hex 181 becomes 81-01!

last update here:
weeks ago i found out what the rest of the 00000 are for but since this topic is dead there is no point start write an other small tutorial.