New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is the 256 key limit only for efficiency? #2
Comments
It's a requirement of the db storage format. Each cell in the grid is You could change the algorithm to be 16 bits per tile if you wanted On Sun, Jun 26, 2011 at 11:12 AM, dylanevl
|
I commented and deleted this before because I thought I was wrong, but after reviewing the code some more, I think i could be right. There were kudos for the Adventure code in there in case github didn't automatically send it to you. I've enjoyed picking it apart, it's been a nice introduction to node. Back to increasing the number of keys-- is it just a matter of changing the file encoding to 'base64' and then adjusting the tileSize variable? Right now it's set to 1024 or (2^8)_4, so I assume I'd need to change it to (2^16)_4 for 16-bit keys? |
There shouldn't be any encoding (utf8 or otherwise) since it's not a string, but a buffer. What I meant was to double the size of the buffer and then every time the buffer is accessed you'd need to first double the memory offset and split the number into it's higher and lower 8 bits and set both bytes manually. Then to read out of the buffer, you'd double the offset and read the two halves and add them together. This is untested code, but it should give you an idea of how to read and write 16 bit numbers out of a buffer. I don't remember the exact function to map x and y to the buffer. Also you'll still need to convert between the index and the actual value.
|
Looking at the code, I can't see any reasons why the 256 key limit is needed.
Am I missing something or is it simply there to improve the overall performance of the pseudo-database?
The text was updated successfully, but these errors were encountered: