Note that there are some explanatory texts on larger screens.

plurals
  1. POOld file fragment understanding - For those up for a challenge
    primarykey
    data
    text
    <p>I am trying to grab PVS (rendering with line of sight) information from an old game format. It has documentation and I have been able to translate everything into C++ code up to this point. This part however confuses the heck out of me. I spent a few hours today trying to understand where to start but alas, I have nothing. Again, this is only for those that might be up for a challenge or can lend some advice or even pseudocode for how I would accomplish this. </p> <p>Thank you</p> <p>Data6 entries (There are Size6 of these):</p> <p>Data6Size1 : WORD Tells the number of entries in the Data6Data field.</p> <p>Data6Data : Either BYTEs or WORDs</p> <p>This is a complicated field. It contains run-length-encoded data that tells the client which regions are “nearby”. The purpose appears to be so that the client can determine which mobs in the zone have to have their Z coordinates checked, so that they will fall to the ground (or until they land on something). Since it’s expensive to do this, it makes sense to only do it for regions that are visible to the player instead of doing it for all mobs in the entire zone (repeatedly).</p> <p>I’ve only encountered data where the stream is a list of BYTEs instead of WORDs. The following discussion describes RLE encoding a BYTE stream.</p> <p>The idea here is to form a sorted list of all region IDs that are within a certain distance, and then write that list as an RLE-encoded stream to save space. The procedure is as follows:</p> <ol> <li><p>Set an initial region ID value to zero.</p></li> <li><p>If this region ID is not present in the (sorted) list, skip forward to the first one that is in the list. Write something to the stream that tells it how many IDs were skipped.</p></li> <li><p>Form a block of consecutive IDs that are in the list and write something to the stream that tells the client that there are this many IDs that are in the list.</p></li> <li><p>If there are more region IDs in the list, go back to step 2.</p></li> </ol> <p>When writing to the stream, either one or three bytes are written:</p> <ul> <li>0x00..0x3E skip forward by this many region IDs</li> <li>0x3F, WORD skip forward by the amount given in the following 16-bit WORD</li> <li>0x40..0x7F skip forward based on bits 3..5, then include the number of IDs based on bits 0..2</li> <li>0x80..0xBF include the number of IDs based on bits 3..5, then skip forward based on bits 0..2</li> <li>0xC0..0xFE subtracting 0xC0, this many region IDs are nearby</li> <li>0xFF, WORD the number of region IDs given by the following WORD are nearby</li> </ul> <p>It should be noted that the values in the range 0x40..0xBF allow skipping and including of no more than seven IDs at a time. Also, they are not necessary to encode a region list: they merely allow better compression.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload