Closed l0b0 closed 13 years ago
Just and idea for this... in the last version we tried to read one chunk per time, so the memory usage was constant. This has the problem of being really slower than everything-in-memory method. Now, with region files, we can read them one by one. This can be a solution with the best of both methods. What do you think?
I think this makes sense, and that's what I'm trying to do ATM. I should probably just upload the current (broken) implementation so you can get an idea of what's cooking, and someone with more binary-fu can tell me exactly why my "solution" isn't getting anywhere :)
hahah... my binary-fu isn't as big as you think :P... but I can try to help if you upload it :)
I'll do it ASAP. In the meantime, what do you think of instead of going for a full-fledged parser like NBT, we do something like this: for file in .mcr: offsets, sector_counts = split_and_convert_to_int(file.read(4096)) for index in range(len(offsets)): if sector_counts[index] == 0: break chunk_length = struct.unpack('>L', file.read(4)) # I assume they are unsigned longs compression = file.read(1) chunk_raw = file.read(int(sector_counts[index] \ 4096)) chunk = inflate(chunk_raw) blocks = to_int_list(chunk) for block_hex, count in enumerate(block_counts): block_counts[block_hex] += count(block_hex, blocks) ? I'll try to develop + test this on the way to the machine with the more experimental code.
It looks ok to me. Which one is going to be faster? We can test both, NBT and this, and then choose.
Alright, it's up: 05e69ff8806429921a37019abe270010c76c87fb
Giving a try and coding a bit, I don't expect results now, though.
Well... it's working now. I've done some copy&paste job from the old mian, but works now. Almost all the job was done!
I've just pushed the working commit to my branch of beta-format, and I'm going to make a pull request, but I want to try to improve the looking of the code, so expect more commits (maybe not now, but tomorrow).
Awesome! Eagerly awaiting the code here. You could run it through make python-check
for some low-hanging code prettifying fruit.
The code is in the pull request!
Just pushed another commit to the same pull request with some corrections according to make python-check
.
Finished - Thanks Fenixin! Note that future versions will only support the Beta format (or newer formats) since it's much less work and it's converted automatically by the Beta client.
ASAP ZULU SAMBA