Skip to content

Some code about Minecraft. Mostly having fun with protocol parsing.

Notifications You must be signed in to change notification settings

JeanSebTr/minecraft

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

minecraft tools & libs written in golang

Here's some code about Minecraft… big WIP

The MasterPlan would be to make a server supporting multiple client's versions on a distributed back-end. Storing terrain chunks in redis or something like that. Or sharding the generated chunks between running instances with custom pubsub ans raft. Because. Fun.

protocol/

WIP reimplementation of netherrack's mc protocol handler without the reflection based parser Make huge use of golang type alias so every packet's field type has a Read/Write method

The rational behind it is that the original implementation :

  • can't support multiple protocol versions at once
  • make heavy use of reflexion to read/write packets
  • did a clever use of struct's tag for buffer's and array's length , but I think it's better solved by type alias which give us ptr deferencing hell and I find it great to reuse those tags at compile time

And the more complete implementation mc-server/MCServer (support 1.8)

  • duplicate the parser methods to handle changes in protocol
  • manually implement every packet's reading/writing
  • is in C++

protocol/generate/

Generate protocol read/write methods from packet's struct definitions using golang AST

run go run protocol/generate/* < protocol/packets.go > protocol/generated.go

server.go

allow to login from an 1.8 client with some patch to netherrack and then login to an other server should add packets proxying to catch broken packet parsing and record session for automated tests mostly experiments residues

Food for thought

  • http://wiki.vg/
  • be more performant and maintainable than MCServer
  • api to control game entities
  • of course a map like that
  • allow unlimited client with virtual entity ids
  • coordinate translation to allow wrapping around the map
  • dispatcher patern + golang chan's sweetness : be aware of blocking channels & slow clients

About

Some code about Minecraft. Mostly having fun with protocol parsing.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages