Live data from Hacker News

Writing a Minecraft server from scratch in Bash (2022)

sdomi.pl

51–56 of 56 posts

Re: Writing a Minecraft server from scratch in Bash (2022)

#51

Earlier quoted context omitted.

This is because in addition to being the most sold video game of all time, minecraft is effectively open source. It's not literally open source, but you can decompile java bytecode with standard tooling, and symbols are available, either community-reversed, or official.

Frustrating how game studios can see Minecraft's success here and not change a thing about their development practices.

I think Minecraft's position today has as much to do with the content of the game itself as it has to do with its architecture/Mojang's engineering choices.

The nearly-infinite expandability and modularity of Minecraft is partially due to the simplicity of the art, core game mechanics, and lack of storyline. Good mods are harder to make when the world they must integrate into is more complex.

I think this means a lot of games wouldn't see the kind of sustained success Minecraft has seen, even with more "open" development practices.

I hypothesize that the "open world" craze of years past was an attempt to capture Minecraft magic, but those games lacked the thematic open-endedness that really facilitates Minecraft's longevity.

Re: Writing a Minecraft server from scratch in Bash (2022)

#52
post #17

Just wondering, but is writing custom servers for commercial games still a thing?

Not just servers but for some games clients too https://runelite.net/

Although writing game servers for commercial games is already "difficult", isn't writing game clients for commercial games a huge issue copyright wise?

Re: Writing a Minecraft server from scratch in Bash (2022)

#53
post #45

Earlier quoted context omitted.

I don't understand how this would help the author. Since the bash doesn't support floating point numbers anyway

This. Also, gawk has netwoki support, so you can write an mc server with just gawk.

I had the same thought. bc would have been a lighter choice.

And tryauuum, I think the author only needed powers of two to emulate floating point in the first place. So they could just divide said number by 2 a number of times.

Re: Writing a Minecraft server from scratch in Bash (2022)

#55
post #10

They should have used my (dumb?) library, ctypes.sh: https://github.com/taviso/ctypes.sh Then they can access libm, poll(), select() and so on from bash :)

would love to see how poll() and select() etc work this way

Here are some examples!

https://github.com/taviso/ctypes.sh/blob/master/test/select.... https://github.com/taviso/ctypes.sh/blob/master/test/poll.sh

Yes, it is crazy :)

Re: Writing a Minecraft server from scratch in Bash (2022)

#56

bash is one of my favorite, as favorite as vim and lua. a single binary that is less than 2M bytes, universal, way more capable than many people think. with shellcheck and good habits, bash can be readable and safe as well. if you want something extra, you can always use C/C++ to add those utilities without using more involved FFI etc, and without pip/npm/etc to load who knows how many dependencies.

> with shellcheck and good habits, bash can be readable and safe as well. My favorite thing to do with shellcheck: add it to CI. Developers hate this one trick! A lot of times CI and Dockerfiles have inline bash scripts. My next favorite thing to do is to move all of that inlined bash to their own script files. Now that CI has shellcheck: all that stuff gets checked too! Developers seem to hate this though because it…

To skip the "move your scripts to standalone files" step some devs don't like, consider something like https://github.com/hadolint/hadolint which runs Shellcheck over inline scripts within Containerfiles.
Post reply on HN