I was thinking about it this morning (as I was trying to get my daughter back to sleep) that instead of actually running byte-per-byte comparisons on AI scripts that have the same lengths, I can just generate CRCs per script as they load! That way I can compare the CRCs with the lengths to determine if two scripts are identical The possibility of two different scripts with the same length and the same CRC is so close to 0 that logic states it's impossible. As a result, that will turn an "n log n" function into a "< 3n" function! With over a thousand unique scripts that's a vast improvement!
EDIT:
Success! Let me give you an idea of what this does now. In the following list, each listed actor is unique. The entries below the actor's name indicate that there is an AI script present in that section and the number next to that section is a unique script ID assigned as it is read in order:
Mystery Ninja
0: 127
1: 128
3: 129
15: 130
Mystery Ninja
0: 127
1: 128
3: 131
15: 130
Mystery Ninja
0: 127
1: 132
3: 133
15: 130
Mystery Ninja
0: 127
1: 132
3: 134
15: 130
Mystery Ninja
0: 127
1: 132
3: 135
15: 130
Mystery Ninja
0: 127
1: 132
3: 136
15: 130
So with those six actors and 24 active script blocks, there are only 10 unique scripts between them! The init and custom event 8 blocks are all identical and most of the main scripts are the same. The only thing that uniquely identifies them is the "death counter" which will set the level that Yuffie joins the party at. This is just the kind of thing I'm trying to solve. Instead of wasting space copying three identical scripts twice. This way we can create more intricate behaviors and counters while maintaining synchronicity between all six (or a set of six) without having to modify all six.
Slick, right? :)
Wednesday, November 16, 2011
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment