Skip to content
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

Support both 1.8 and 1.9 chunk format #19

Closed
rom1504 opened this issue Feb 29, 2016 · 24 comments
Closed

Support both 1.8 and 1.9 chunk format #19

rom1504 opened this issue Feb 29, 2016 · 24 comments

Comments

@rom1504
Copy link
Member

rom1504 commented Feb 29, 2016

http://wiki.vg/SMP_Map_Format#Format

http://wiki.vg/Pre-release_protocol#Chunk_Section

PrismarineJS/node-minecraft-protocol#231 (comment)

This will help mineflayer and flying-squid update to cross-version (1.8 + 1.9)

@rom1504
Copy link
Member Author

rom1504 commented Mar 8, 2016

@rom1504
Copy link
Member Author

rom1504 commented Mar 14, 2016

@rom1504
Copy link
Member Author

rom1504 commented Apr 7, 2016

@mhsjlw has started working on that at https://github.com/mhsjlw/prismarine-chunk

@louwers
Copy link

louwers commented Jun 9, 2016

Did the chunk format change in 1.10?

@ghost
Copy link

ghost commented Jun 9, 2016

Nope, not yet 😄. I doubt the chunk format will change again for a very, very long time as this is probably the most optimized chunk format we've seen (hence how complicated it is, especially in JavaScript).

@louwers
Copy link

louwers commented Jun 9, 2016

Here is another implementation in C: https://github.com/broese/mcbuild/blob/master/mcp_packet.c#L625

@mhsjlw This kind of stuff looks quite odd in Javascript, but why is it more difficult? Hard to get good performance?

@ghost
Copy link

ghost commented Jun 9, 2016

No, JavaScript doesn't natively support longs which the 1.9 chunk relies on, we've tried ways around it that seem to be successful, but we're not anywhere close.

EDIT: For it to be a proper prismarine-chunk implementation we need to be able to read AND write and load AND dump

@louwers
Copy link

louwers commented Jun 9, 2016

What are still currently problems with your implementation?

@rom1504
Copy link
Member Author

rom1504 commented Jun 24, 2016

@rom1504
Copy link
Member Author

rom1504 commented Jun 24, 2016

@rom1504
Copy link
Member Author

rom1504 commented Jun 24, 2016

WIP there https://gist.github.com/rom1504/2d6451dbea299099b861ac6acef6ef7d

@reverofevil
Copy link

@rom1504 I don't understand the issue with longs at all. It's getting split into variable length bit fields anyway, there's no difference in the underlying datatype except that count always gets multiplied by 4. To circumvent the issues with computing the size, it's handy to create a structure with two u32 fields.

@Gjum
Copy link
Member

Gjum commented Jun 28, 2016

The problem lies in accessing the data on these longs. Each entry is offset by some number of bits and can be split across two longs in a nontrivial way: http://wiki.vg/SMP_Map_Format#Example

@reverofevil
Copy link

reverofevil commented Jun 28, 2016

@Gjum And what is the problem?

http://ideone.com/sf0cAR

@rom1504
Copy link
Member Author

rom1504 commented Jun 29, 2016

@polkovnikov-ph the problem is nobody finished a full implementation for prismarine-chunk 1.9

I you feel like implementing it, go ahead !

@rom1504
Copy link
Member Author

rom1504 commented Oct 31, 2016

last progress on this https://github.com/roblabla/prismarine-chunk/commits/master

This issue is 8 months old, might be time to solve it... (blocking mineflayer and flying-squid for minecraft >=1.9)

@GeorgesOatesLarsen
Copy link
Member

GeorgesOatesLarsen commented Jan 7, 2017

RE: The WIP you did. I had a go at completing it:

https://gist.github.com/Flynnn/035c17f67158154220db7971e34314b2

Seems to work! It converts the new 1.9 raw chunk data back to the format being read by the 1.8 version of prismarine-chunk. Not the most ideal solution, but it appears to work. Histogram reports 76% air, 14% stone, 6% water, 1% bedrock, and less than 1% of dirt, lava, gravel, gold ore, iron ore, coal ore, and redstone ore.

I'm gonna go ahead and integrate this into a fork of prismarine-chunk.

EDIT:
I should note that I did not check the block-order -- I assumed them to be the same. There's a possibility that my code is loading chunks upside down, backwards, or something similar. I'm not really sure how to test this effectively, though. My cursory reading on the protocols seemed to indicate, though, that the orders are the same, so I doubt this is a problem

@ghost
Copy link

ghost commented Jan 7, 2017

👍 Good luck! Keep us updated

@GeorgesOatesLarsen
Copy link
Member

GeorgesOatesLarsen commented Jan 7, 2017

AFAICT this should be good: https://github.com/Flynnn/prismarine-chunk But I'd like to wait until someone is able to really test it before doing a pull request.

Notably, a new argument is required for Chunk.Load -- no way around this, except, perhaps, having the argument packed in with the data. Perhaps that would be preferable?

@reverofevil
Copy link

@Flynnn Great job! I'll try it right now.

@rom1504
Copy link
Member Author

rom1504 commented Jan 12, 2017

finally done thanks to @Flynnn

@rom1504 rom1504 closed this as completed Jan 12, 2017
@GeorgesOatesLarsen
Copy link
Member

GeorgesOatesLarsen commented Jan 12, 2017

Most excellent! Thanks for all of the help, @rom1504, @mhsjlw

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants