FAQ
Hi there gophers,

*Little aside*
I'm developing a server for Minecraft in Go, it's gonna be hard and long, I
know, but I really want to do it.

*The problem*
Right now I'm working with RCON support, which *Minecraft has support for*<http://wiki.vg/Rcon>,
through some kind of *(bad)* "fork" of *Valve's RCON protocol*<http://developer.valvesoftware.com/wiki/Source_RCON_Protocol>
.

I'm using these two structs:
http://play.golang.org/p/yyasReW60K

Header can be used with binary.Read like:

- binary.Read(conn, binary.LittleEndian, &resp.Header)
- binary.Write(conn, binary.LittleEndian, &resp.Header)

Packet can't because of Payload being a byte slice ([]byte).

I got the login part working, but I can't send commands because some kind
of weird decoding of the three int32 fields on Header.

Ex: *Header{13893632, 0, 0}*



*(this was the response I got after trying to send "help" as command)*


That number is *" 1101 0100 0000 0000 0000 0000 "* in binary, which is 24
bits long, which probably got messed up by binary.Read.
If we read it in reverse in LE order it's actually 23, a more credible
value.

If any gopher wants to help me and needs test this on a real environment,
only a Minecraft server <http://minecraft.net/download> is required (you
can also try it with CraftBukkit<http://wiki.bukkit.org/Setting_up_a_server>,
whatever you like).

Here's the original code: http://play.golang.org/p/L4YwUlouNn

Thanks,
Carlos

--

Search Discussions

  • Dustin Fechner at Dec 7, 2012 at 10:14 pm

    On 12/07/2012 10:38 PM, Carlos Cobo wrote:
    I'm developing a server for Minecraft in Go
    Sorry for going offtopic, but are you even legally allowed to release
    your self-coded Minecraft server? I'm just asking out of curiosity.

    --
  • Carlos Cobo at Dec 7, 2012 at 10:24 pm
    That's a good question! I don't know but right now isn't working, also it's
    not for commercial purposes so.. Anyway, I better ask Jeb.

    I thought a server API would be a good thing for Go and for Minecraft
    (competence is good).
    On Friday, December 7, 2012 11:10:25 PM UTC+1, Dustin Fechner wrote:
    On 12/07/2012 10:38 PM, Carlos Cobo wrote:
    I'm developing a server for Minecraft in Go
    Sorry for going offtopic, but are you even legally allowed to release
    your self-coded Minecraft server? I'm just asking out of curiosity.
    --
  • Dustin Sallings at Dec 7, 2012 at 11:14 pm

    Carlos Cobo writes:

    Little aside
    I'm developing a server for Minecraft in Go, it's gonna be hard and
    long, I know, but I really want to do it.

    The problem
    Right now I'm working with RCON support, which Minecraft has support
    for, through some kind of (bad) "fork" of Valve's RCON protocol.

    I'm using these two structs:
    http://play.golang.org/p/yyasReW60K
    I think it'd be really easy to help if you posted the struct you want
    and the desired output (and why). I tend to do these sorts of things
    with table-driven {struct, expected result} pairs.

    --
    dustin

    --
  • Carlos Cobo at Dec 8, 2012 at 12:48 am
    Here it is.

    Summary: http://play.golang.org/p/abI5RK0dPX

    The struct I want with the desired output:
    http://play.golang.org/p/Tz1vQzOSik
    On Saturday, December 8, 2012 12:14:09 AM UTC+1, Dustin wrote:

    Carlos Cobo <toqu...@gmail.com <javascript:>> writes:
    Little aside
    I'm developing a server for Minecraft in Go, it's gonna be hard and
    long, I know, but I really want to do it.

    The problem
    Right now I'm working with RCON support, which Minecraft has support
    for, through some kind of (bad) "fork" of Valve's RCON protocol.

    I'm using these two structs:
    http://play.golang.org/p/yyasReW60K
    I think it'd be really easy to help if you posted the struct you want
    and the desired output (and why). I tend to do these sorts of things
    with table-driven {struct, expected result} pairs.

    --
    dustin
    --
  • Carlos Cobo at Dec 8, 2012 at 1:47 am
    Yay! I solved it, it's 2:42 AM so tomorrow I'll update the thread with
    working code.

    *ERRORS*


    1. Using *fmt.Scanln* to read from *os.Stdin* instead of *bufio.NewReader
    *.

    I didn't paid attention to Scanln docs so it was splitting my commands
    on each space.

    2. Then I forgot to read pad bytes from each response packet. That
    messed around with the next packet's header and so on...


    Damn it, damn it, damn it... :/

    I already asked Jeb if the project is legal, the RCON client shouldn't be
    illegal so I can continue. I'll wait his response.
    As I said, tomorrow I'll post everything.


    *Thanks Dustin!*
    On Saturday, December 8, 2012 1:40:35 AM UTC+1, Carlos Cobo wrote:

    Here it is.

    Summary: http://play.golang.org/p/abI5RK0dPX

    The struct I want with the desired output:
    http://play.golang.org/p/Tz1vQzOSik
    On Saturday, December 8, 2012 12:14:09 AM UTC+1, Dustin wrote:

    Carlos Cobo <toqu...@gmail.com> writes:
    Little aside
    I'm developing a server for Minecraft in Go, it's gonna be hard and
    long, I know, but I really want to do it.

    The problem
    Right now I'm working with RCON support, which Minecraft has support
    for, through some kind of (bad) "fork" of Valve's RCON protocol.

    I'm using these two structs:
    http://play.golang.org/p/yyasReW60K
    I think it'd be really easy to help if you posted the struct you want
    and the desired output (and why). I tend to do these sorts of things
    with table-driven {struct, expected result} pairs.

    --
    dustin
    --
  • John Beisley at Dec 8, 2012 at 6:58 pm
    If it helps, I used to work on a fork of a Go Minecraft server:
    https://github.com/huin/chunkymonkey

    I've run out of free time to work on big projects like that, and time
    investment is very much needed to keep up with Mojang. The server I was
    working on only supported something around the 1.8 beta client, but it may
    contain useful bits to your own efforts. I made some bad design choices
    along the way (was learning Go at the time), so I wouldn't use its design
    as a good example.

    On 8 December 2012 01:47, Carlos Cobo wrote:

    Yay! I solved it, it's 2:42 AM so tomorrow I'll update the thread with
    working code.

    *ERRORS*


    1. Using *fmt.Scanln* to read from *os.Stdin* instead of *
    bufio.NewReader*.

    I didn't paid attention to Scanln docs so it was splitting my commands
    on each space.

    2. Then I forgot to read pad bytes from each response packet. That
    messed around with the next packet's header and so on...


    Damn it, damn it, damn it... :/

    I already asked Jeb if the project is legal, the RCON client shouldn't be
    illegal so I can continue. I'll wait his response.
    As I said, tomorrow I'll post everything.


    *Thanks Dustin!*

    On Saturday, December 8, 2012 1:40:35 AM UTC+1, Carlos Cobo wrote:

    Here it is.

    Summary: http://play.golang.**org/p/abI5RK0dPX<http://play.golang.org/p/abI5RK0dPX>

    The struct I want with the desired output: http://play.golang.**
    org/p/Tz1vQzOSik <http://play.golang.org/p/Tz1vQzOSik>
    On Saturday, December 8, 2012 12:14:09 AM UTC+1, Dustin wrote:

    Carlos Cobo <toqu...@gmail.com> writes:
    Little aside
    I'm developing a server for Minecraft in Go, it's gonna be hard and
    long, I know, but I really want to do it.

    The problem
    Right now I'm working with RCON support, which Minecraft has support
    for, through some kind of (bad) "fork" of Valve's RCON protocol.

    I'm using these two structs:
    http://play.golang.org/p/**yyasReW60K<http://play.golang.org/p/yyasReW60K>
    I think it'd be really easy to help if you posted the struct you want
    and the desired output (and why). I tend to do these sorts of things
    with table-driven {struct, expected result} pairs.

    --
    dustin

    --
    --
  • Carlos Cobo at Dec 8, 2012 at 8:09 pm
    Oh! Hi there John! It's a pleasure to see you here, no, really.

    I followed your project but wasn't confident enough about my skills on
    Minecraft internals to help you, I'm sorry.

    It's sad you couldn't keep going, but I understand it. Minecraft moves
    forward *"quite fast"* since Notch left it to Jeb.


    I have lots of spare time now, like 2 years, almost, so I joined forces
    with a couple of friends which are making a gaming community for hispanics,
    right now it's pretty Minecraft oriented; I started making website
    integration with Minecraft servers and also a couple of private plugins.

    The APIs are hatable. I miss Go's interfaces on Java, too many casts. ( ex:
    *Player p = (Player) whatever.getEntity();* ).
    Async tasks among other things are also a pain.


    I'm not expecting to make the best server around, just a decent one, enough
    to convince some groups of the modding community to use Go. The more the
    better.
    It seems like a nice boost for the language, at least on my head. We'll see.

    On Saturday, December 8, 2012 7:58:31 PM UTC+1, John Beisley wrote:

    If it helps, I used to work on a fork of a Go Minecraft server:
    https://github.com/huin/chunkymonkey

    I've run out of free time to work on big projects like that, and time
    investment is very much needed to keep up with Mojang. The server I was
    working on only supported something around the 1.8 beta client, but it may
    contain useful bits to your own efforts. I made some bad design choices
    along the way (was learning Go at the time), so I wouldn't use its design
    as a good example.


    On 8 December 2012 01:47, Carlos Cobo <toqu...@gmail.com <javascript:>>wrote:
    Yay! I solved it, it's 2:42 AM so tomorrow I'll update the thread with
    working code.

    *ERRORS*


    1. Using *fmt.Scanln* to read from *os.Stdin* instead of *
    bufio.NewReader*.

    I didn't paid attention to Scanln docs so it was splitting my
    commands on each space.

    2. Then I forgot to read pad bytes from each response packet. That
    messed around with the next packet's header and so on...


    Damn it, damn it, damn it... :/

    I already asked Jeb if the project is legal, the RCON client shouldn't be
    illegal so I can continue. I'll wait his response.
    As I said, tomorrow I'll post everything.


    *Thanks Dustin!*

    On Saturday, December 8, 2012 1:40:35 AM UTC+1, Carlos Cobo wrote:

    Here it is.

    Summary: http://play.golang.**org/p/abI5RK0dPX<http://play.golang.org/p/abI5RK0dPX>

    The struct I want with the desired output: http://play.golang.**
    org/p/Tz1vQzOSik <http://play.golang.org/p/Tz1vQzOSik>
    On Saturday, December 8, 2012 12:14:09 AM UTC+1, Dustin wrote:

    Carlos Cobo <toqu...@gmail.com> writes:
    Little aside
    I'm developing a server for Minecraft in Go, it's gonna be hard and
    long, I know, but I really want to do it.

    The problem
    Right now I'm working with RCON support, which Minecraft has support
    for, through some kind of (bad) "fork" of Valve's RCON protocol.

    I'm using these two structs:
    http://play.golang.org/p/**yyasReW60K<http://play.golang.org/p/yyasReW60K>
    I think it'd be really easy to help if you posted the struct you want
    and the desired output (and why). I tend to do these sorts of things
    with table-driven {struct, expected result} pairs.

    --
    dustin

    --
    --
  • Carlos Cobo at Dec 8, 2012 at 8:12 pm
    Here it is the code working, I'll probably post to the forums soon:
    http://play.golang.org/p/o_nMvLetJL

    The *fmt.Scanln mistake* was a.. well, a mistake.
    I always use the *bufio.NewReader(os.Stdin) approach* but I wanted to test
    out new things from the std library.
    On Friday, December 7, 2012 10:38:22 PM UTC+1, Carlos Cobo wrote:

    Hi there gophers,

    *Little aside*
    I'm developing a server for Minecraft in Go, it's gonna be hard and long,
    I know, but I really want to do it.

    *The problem*
    Right now I'm working with RCON support, which *Minecraft has support for*<http://wiki.vg/Rcon>,
    through some kind of *(bad)* "fork" of *Valve's RCON protocol*<http://developer.valvesoftware.com/wiki/Source_RCON_Protocol>
    .

    I'm using these two structs:
    http://play.golang.org/p/yyasReW60K

    Header can be used with binary.Read like:

    - binary.Read(conn, binary.LittleEndian, &resp.Header)
    - binary.Write(conn, binary.LittleEndian, &resp.Header)

    Packet can't because of Payload being a byte slice ([]byte).

    I got the login part working, but I can't send commands because some kind
    of weird decoding of the three int32 fields on Header.

    Ex: *Header{13893632, 0, 0}*



    *(this was the response I got after trying to send "help" as command)*


    That number is *" 1101 0100 0000 0000 0000 0000 "* in binary, which is 24
    bits long, which probably got messed up by binary.Read.
    If we read it in reverse in LE order it's actually 23, a more credible
    value.

    If any gopher wants to help me and needs test this on a real environment,
    only a Minecraft server <http://minecraft.net/download> is required (you
    can also try it with CraftBukkit<http://wiki.bukkit.org/Setting_up_a_server>,
    whatever you like).

    Here's the original code: http://play.golang.org/p/L4YwUlouNn

    Thanks,
    Carlos
    --

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedDec 7, '12 at 9:45p
activeDec 8, '12 at 8:12p
posts9
users4
websitegolang.org

People

Translate

site design / logo © 2021 Grokbase