overdate Posted April 3, 2016 Share Posted April 3, 2016 Hi, everybody! Some time ago i has idea to create map generator for red alert 1. It simple to do size, start waypoint, trees, mines, units and other objects. Some bugs was but it can be fixed. But i have trouble with landscape objects like water, mountains, ore. I dont know how place them I use default: "" [MapPack] 1=CQAAIIH//v4f/4H/gAkAACCB//7+H/+B/4AJAAAggf/+/h//gf+ACQAAIIH//v4f/4H/gA 2=kAACCBAP7+HwCBAIAJAAAggQD+/h8AgQCA [OverlayPack] 1=CQAAIIH//v4f/4H/gAkAACCB//7+H/+B/4A= "" It work but landscape look monotonously(examples: testmap, testmap2). I can fix this manually, of cource! But i want to do full automatical generator. Heed for your ideas P.S. I know english bad, sorry for mistakes. testmap.mpr testmap2.mpr Link to comment Share on other sites More sharing options...
Messiah Posted April 4, 2016 Share Posted April 4, 2016 For the buildings, use [structures] instead of [base]! Base is used for computer-controlled construction by the AI in single-player, not for pre-placed structures. Link to comment Share on other sites More sharing options...
Nyerguds Posted April 4, 2016 Share Posted April 4, 2016 I'm guessing you're going to have to decode it from Base64 first... Link to comment Share on other sites More sharing options...
Blade Posted April 4, 2016 Share Posted April 4, 2016 MapPack and Overlay pack have multiple levels of encoding, you need to strip the ini key from each line (1=, 2= etc...) and concatenate them into a single string, then base64 decode them, then decode them as an LCW stream. The LCW stream format is chunks of LCW compressed data preceded by a small 4 byte header. The header is an unsigned int16 indicating the compressed size of the chunk and and unsigned int16 indicating the uncompressed size. You may see LCW referred to as Format80, but LCW is the correct name. For the MapPack, once you have decoded it you have the RA equivalent of the C&C bin file data. For NewINIFormat=3 maps, it has 16384 int16 entries that indicate which tile set each cells "icon" (internal name for cell image data) comes from and then 16384 int8 entries that indicate which "icon" within the tile set each cell uses. All maps are 128x128 internally so one entry per cell starting in the top left. For OverlayPack there are just 16384 int8 entries that indicate the overlay used. 0xFF (or -1) indicates no overlay for that cell. Link to comment Share on other sites More sharing options...
Nyerguds Posted April 4, 2016 Share Posted April 4, 2016 Wow. Nice info. So RA is limited to 255 overlay types, then? you need to strip the ini key from each line (1=, 2= etc...) and concatenate them into a single string Stripping off the keys is normally an automatic part of "reading the ini" though XD Link to comment Share on other sites More sharing options...
Blade Posted April 4, 2016 Share Posted April 4, 2016 I think its likely to be 128 actually as it looks like its treated as a signed byte, if we treat it as unsigned in RA++ we could go up to 255 though without messing with the map format. Also, both 0x00FF and 0xFFFF for the tileset are treated as being the clear tile which has very odd implications for the internal theatre in that one of its tile sets is unuseable (Its one of the arrow tiles). Looks like they initially developed maps with the same max number of tile sets as C&C but expanded it somewhere later in development and existing maps weren't converted properly to the new system. Interestingly, NewINIFormat=1 or 2 makes the MapPack section be read as though it was laid out the same as the C&C bin files after its decoded, int16 for the tileset immediately followed by int8 for the icon number. No idea why it was changed, maybe it improves load times through some cache locality optimisation or something. Link to comment Share on other sites More sharing options...
overdate Posted April 4, 2016 Author Share Posted April 4, 2016 Thank you I understand ideas. Not so easy, but perspective. Can you tell me more about LCW format? Google give nothing. I ask senior colleagues - any clear ideas too. And what about quantity of TERRAIN`s objects? There is a limit? On maps more then 100X100 bottom is trees-less. Link to comment Share on other sites More sharing options...
Nyerguds Posted April 4, 2016 Share Posted April 4, 2016 A Google search for "LCW compression" actually links back to the forum: https://forums.cncnet.org/index.php?topic=4403.0 Link to comment Share on other sites More sharing options...
Blade Posted April 5, 2016 Share Posted April 5, 2016 Thank you I understand ideas. Not so easy, but perspective. Can you tell me more about LCW format? Google give nothing. I ask senior colleagues - any clear ideas too. And what about quantity of TERRAIN`s objects? There is a limit? On maps more then 100X100 bottom is trees-less. Terrain object count limits are controlled in rules.ini under [Maximums], specifically the entry Terrain=500. You can only set this from rules.ini, not from within a map. Link to comment Share on other sites More sharing options...
Messiah Posted April 5, 2016 Share Posted April 5, 2016 Interestingly, NewINIFormat=1 or 2 makes the MapPack section be read as though it was laid out the same as the C&C bin files after its decoded, int16 for the tileset immediately followed by int8 for the icon number. No idea why it was changed, maybe it improves load times through some cache locality optimisation or something. That means - if you set NewIniFormat=1 RA will read C&C .bin files? :O Also, both 0x00FF and 0xFFFF for the tileset are treated as being the clear tile which has very odd implications for the internal theatre in that one of its tile sets is unuseable (Its one of the arrow tiles). Looks like they initially developed maps with the same max number of tile sets as C&C but expanded it somewhere later in development and existing maps weren't converted properly to the new system.no, that arrow tile isn't usable too in new naps too. Is that arrow tile fixable? Link to comment Share on other sites More sharing options...
Blade Posted April 5, 2016 Share Posted April 5, 2016 That means - if you set NewIniFormat=1 RA will read C&C .bin files? :O No, it just means that the data encoded in the MapPack section is laid out more like a C&C bin file where it goes [tileset, icon, tileset, icon...] instead of [tileset, tileset... icon, icon...] as it does for NewINIFormat=3. Also, both 0x00FF and 0xFFFF for the tileset are treated as being the clear tile which has very odd implications for the internal theatre in that one of its tile sets is unuseable (Its one of the arrow tiles). Looks like they initially developed maps with the same max number of tile sets as C&C but expanded it somewhere later in development and existing maps weren't converted properly to the new system.no, that arrow tile isn't usable too in new naps too. Is that arrow tile fixable? Not easily, the heap would need expanding and the initialisation of that tile would need duplicating at the end of the TerrainTypes initialisation. Then in theory it would be usable as the tile set one higher than the current maximum. It would need the map editor to use the new id for the tile set as well. Link to comment Share on other sites More sharing options...
Nyerguds Posted April 5, 2016 Share Posted April 5, 2016 Interestingly, NewINIFormat=1 or 2 makes the MapPack section be read as though it was laid out the same as the C&C bin files after its decoded, int16 for the tileset immediately followed by int8 for the icon number. No idea why it was changed, maybe it improves load times through some cache locality optimisation or something. That means - if you set NewIniFormat=1 RA will read C&C .bin files? :O No, since C&C map format is [int8, Int8]. RA1 has more tiles, and as he said, its format becomes [int16, Int8] because of that; three bytes per cell rather than C&C1's two. Link to comment Share on other sites More sharing options...
overdate Posted April 6, 2016 Author Share Posted April 6, 2016 Thanks everybody for useful information Link to comment Share on other sites More sharing options...
Messiah Posted July 23, 2016 Share Posted July 23, 2016 actually it might be possible, to auto-generate the mappack too. I just had some wine and an idea how a possible logic for proper placement of tiles might look alike and wrote it down. first, you have to define all tiles in your tile set, e.g. cliff, river etc. then you have to define the edges of your tiles too, actually you define what can be added next to the tiles. e.g. S03 can have any clear/miscellanous tile in the north and in the south, but on the west and the east there MUST be another cliff tile. I guess your algorithm writes the mappack from the topleft, row after row, every cell. so probably on the left and the top there might be other tiles, so your program randonmly will choose a tile fitting at the next position. make sure there is a "plan B" for the case there is no fitting tile in your tileset (just use clear then or whatever). make a user input interface, where the user defines the amount of cliffs, rivers, roads, water, beaches, water-cliffs and miscellanous tiles in his map. user might define how long cliff chains are - when you weight the cliff end pieces, cliffs will be shorter of course. user also might define how windy cliffs might be by weighting the windy cliff tiles (S29-S38). same with rivers and all other tiles. I'm no programmer and I don't know how actually to program something like that, and I also don't give any guarantee that this will work or look good and balanced, but I had the idea the logic above could work - the result might be interesting in any case! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now