Jump to content

Recommended Posts

Posted

I apologize for spamming 'research topics'. I wanted to hijack an existing research thread for this file, but I didn't find a dedicated thread for it.

The format of circles.bin is straight forward:

Spoiler

Circles.bin

Associates a radius with a square depicting a circular region.
The game has a limit of 8 entries (from 0-cell up to 7-cell radius)
Used for sight range for uncovering shroud.
(FF disable shroud reveal for that cell)
(00 enables shroud reveal for that cell)
(other values may have interesting results)

Allocations:
    
    Size(h)    Size(d)    Offset(h)        Section                                Comment
    0x0001    1        000000            Cells for 0-radius circle            1x1 grid
    0x0009    9        000001            Cells for 1-radius circle            3x3 grid
    0x0019    25        00000A            Cells for 2-radius circle            5x5 grid
    0x0031    49        000023            Cells for 3-radius circle            7x7 grid
    0x0051    81        000054            Cells for 4-radius circle            9x9 grid
    0x0079    121        0000A5            Cells for 5-radius circle            11x11 grid
    0x00a9    169        00011E            Cells for 6-radius circle            13x13 grid
    0x00e1    225        0001C7            Cells for 7-radius circle            15x15 grid    
    END                0002A8

    
The data:

00 

FF 00 FF 
00 00 00 
FF 00 FF 

FF 00 00 00 FF 
00 00 00 00 00 
00 00 00 00 00 
00 00 00 00 00 
FF 00 00 00 FF 

FF FF 00 00 00 FF FF 
FF 00 00 00 00 00 FF 
00 00 00 00 00 00 00 
00 00 00 00 00 00 00 
00 00 00 00 00 00 00 
FF 00 00 00 00 00 FF 
FF FF 00 00 00 FF FF 

FF FF FF 00 00 00 FF FF FF 
FF 00 00 00 00 00 00 00 FF 
FF 00 00 00 00 00 00 00 FF 
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 
FF 00 00 00 00 00 00 00 FF 
FF 00 00 00 00 00 00 00 FF 
FF FF FF 00 00 00 FF FF FF 

FF FF FF 00 00 00 00 00 FF FF FF 
FF FF 00 00 00 00 00 00 00 FF FF 
FF 00 00 00 00 00 00 00 00 00 FF 
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 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 00 00 00 
FF 00 00 00 00 00 00 00 00 00 FF 
FF FF 00 00 00 00 00 00 00 FF FF 
FF FF FF 00 00 00 00 00 FF FF FF 

FF FF FF FF 00 00 00 00 00 FF FF FF FF 
FF FF 00 00 00 00 00 00 00 00 00 FF FF 
FF 00 00 00 00 00 00 00 00 00 00 00 FF 
FF 00 00 00 00 00 00 00 00 00 00 00 FF 
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 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 
FF 00 00 00 00 00 00 00 00 00 00 00 FF 
FF 00 00 00 00 00 00 00 00 00 00 00 FF 
FF FF 00 00 00 00 00 00 00 00 00 FF FF 
FF FF FF FF 00 00 00 00 00 FF FF FF FF 

FF FF FF FF FF 00 00 00 00 00 FF FF FF FF FF 
FF FF FF 00 00 00 00 00 00 00 00 00 FF FF FF 
FF FF 00 00 00 00 00 00 00 00 00 00 00 FF FF 
FF 00 00 00 00 00 00 00 00 00 00 00 00 00 FF 
FF 00 00 00 00 00 00 00 00 00 00 00 00 00 FF 
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 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 00 
FF 00 00 00 00 00 00 00 00 00 00 00 00 00 FF 
FF 00 00 00 00 00 00 00 00 00 00 00 00 00 FF 
FF FF 00 00 00 00 00 00 00 00 00 00 00 FF FF 
FF FF FF 00 00 00 00 00 00 00 00 00 FF FF FF 
FF FF FF FF FF 00 00 00 00 00 FF FF FF FF FF
 

 

A visual of the data

Spoiler

Value 00 = White = Reveal this tile

Value FF = Grey = Don't reveal this tile

r8j2BjQ.png

 

There is a check that the game makes at address 0x0044e3ba to determine if the map reveal range is more than 7. If so, the game crashes with the message "Shroud circles only defined up to size 7."

 

This much is probably already known. When loading a map, the game loads this file in these exact segments, storing them in these memory locations:

                    Reference pointers to starting from 0x00547ff0
                    
                    Location of data:
                        0 = 0x00548044    (1 byte data) (referenced by 0x00547ff0)
                        1 = 0x00548038    (9 byte data) (referenced by 0x00547ff4)
                        2 = 0x00548018    (25 byte data) (referenced by 0x00547ff8)
                        3 = 0x00517b60    (46 byte data) (referenced by 0x00547ffc)
                        4 = 0x00517b08    (81 byte data) (referenced by 0x00548000)
                        5 = 0x00517a88    (121 byte data) (referenced by 0x00548004)
                        6 = 0x005179d8    (169 byte data) (referenced by 0x00548008)
                        7 = 0x00517d00    (225 byte data) (referenced by 0x0054800c)

With these locations, it may be possible to perform some modifications on the game executable to extend the maximum range of a reveal (either by Unit Sight or by Reveal Tile event). We will need:

  • Modify the address of the reference pointers to support the same number of pointers as the desired range.
  • Prepare memory locations for additional data.
  • Have the game assign the reference pointers to the memory locations of additional data.
  • Modify the function loading the file so it loads the required number of bytes to support the desired range. 
  • Supply the game with a large enough Circles.bin file to support the desired range. For a range up to 32 cells, 7690 bytes of data is needed. For the full range of 255, that would be 516130 bytes, too costly and impractical for a simple function. This is probably a case of trading space for processor efficiency by loading what is essentially a lookup table for each tile reveal instead of doing time-expensive math.

 

This is a hypothesis, which has to be attempted and tested.

 

 

 

Posted

Reveal the ENTIRE MAP!!! ...Without glitching!

If you set a reveal map event to 0, it reveals the entire map but breaks the minimap unless you save and reload. Would it be much trouble to reveal a 128x128 map? :D

Posted (edited)

There is a oddly behaviour that I realize when revealing the map and saving-loading, not just the reveal map 0 that Fey it's talking about, but even on the vanilla ones. For some reason, the mini-radar varies if you reveal multiple areas with a reveal map of 7 (for example), save your map and reload. It slighly change. Could be that the map itself shows the X*X tile but the mini radar only shows the actual "circle" revealed withouth counting those grey areas? so saving/loading update the radar to add those gray portions into the mini radar as well (as how reveal map 0 reveal all the area but the radar does nothing)

I don't know if turns into a usefull information for you or not.

Edited by Cm_blast
Posted (edited)

For the reveal map 0 not updating the minimap, I found that the game updates the battlefield map and the shroud / minimap separately. For performance saving measures, the shroud and minimap is updated only within an NxN square centered around the reveal point (either a unit or a map location). For range 0, the square size is effectively 0x0 (or 1x1), meaning that effectively nothing is updated on the minimap.

A quick fix would be to replace this logic with another that supplies the whole map dimensions. This fix may reduce performance, so I'll try to think of something to help branch this logic conditionally on range = 0.

omym36Q.png

The results is sampled here, check the minimap:

NYtdeFE.png

 

 

As for the minimap itself, this is interesting, but I have no in-depth knowledge of how saves recreate the minimap.

Here is what I observed:

vIVktv4.png

Before save.

(I am Ordos. Ordos structures to the north, Ordos units to the south. Map reveal triggers reveal Harkonnen base.)

 

CkmXOeZ.png

After loading

 

Bj1iKy7.png

Change map (dark grey is revealed before save, and shrouded after load)

The battlefield itself follows the one after load. So the minimap is actually being revealed one tile beyond sight range into the shroud. Hmm...

 

 

Edit: Added image for proof of concept

 

Edited by lovalmidas
  • Upvote 1
Posted
On 7/13/2020 at 8:15 PM, lovalmidas said:

I apologize for spamming 'research topics'. I wanted to hijack an existing research thread for this file, but I didn't find a dedicated thread for it.

The format of circles.bin is straight forward:

Thanks for another good research! And by the way, I think it's definitely good practice to create a separate thread for individual file research, as this is much better organized than mixing up many different things in a single thread.

I actually had an idea about purpose of this file, but did not bother about examining it deeply, as I felt it had quite low importance in terms of modding. But as discussed, having possibility to have circles with bigger radius and fixing the problem with radar minimap reveal is nice thing.

On 7/13/2020 at 8:15 PM, lovalmidas said:

(other values may have interesting results)

Did you experiment with this? Anything interesting happens?

Posted
On 7/19/2020 at 4:59 AM, Klofkac said:

Did you experiment with this? Anything interesting happens?

I only tried hex value 0x11. And it only reveals the tile if there is an unrevealed tile in some of its 8 directions (which ones is not yet certain). In effect, a unit moving towards a blob of shroud to its west will not reveal them. It doesn't depend on the direction the unit is moving (although that does the impact the visuals as the map is only updated in a limited NxN square region around the unit), it seems to check the surrounding tiles to determine if it should uncover this tile. 

At some time I could generate some screenshot or video to illustrate this.

Posted
On 7/22/2020 at 12:06 AM, lovalmidas said:

I only tried hex value 0x11. And it only reveals the tile if there is an unrevealed tile in some of its 8 directions (which ones is not yet certain). In effect, a unit moving towards a blob of shroud to its west will not reveal them. It doesn't depend on the direction the unit is moving (although that does the impact the visuals as the map is only updated in a limited NxN square region around the unit), it seems to check the surrounding tiles to determine if it should uncover this tile. 

At some time I could generate some screenshot or video to illustrate this.

Ok, I tried myself with various values, and the behavior is interesting, but I could not find the exact behavior mechanics. It also looks like the value is rather a bit field than a numeric value. For example using value 0xF0 behaved same as 0x00, only bits in the lower nibble had an special effect. Maybe you could take a look into code, how the game evaluates the value, if it performs any logical bit operations etc. Probably the other values than 0x00 and 0xFF was an unused feature.

But anyway, I wonder if this is even anyhow useful and has any modding potential.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.