We're opening up some of the game's code! Making games isn't easy. Sure, it's not rocket science, or brain surgery (those things are probably waaaaay easier), but it's still incredibly difficult to…
Article word count: 1065
HN Discussion: https://news.ycombinator.com/item?id=18156929
Posted by aw1621107
(karma: 571)Post stats: Points: 166 - Comments: 32 - 2018-10-06T19:52:20Z
Weʼre opening up some of the gameʼs code!
Making games isnʼt easy. Sure, itʼs not rocket science, or brain surgery (those things are probably waaaaay easier), but itʼs still incredibly difficult to learn to code, program and sheer-blind-luck your way into making a videogame. If only you had access to more resources…
Well, the lovely folks on Stockholmʼs Minecraft Java team are giving you just that, by opening some of Minecraftʼs code as libraries so they can be used however you like! Want to use them to improve your Minecraft mods? Great idea! Want to use them for your own projects? Go for it, just donʼt forget to credit us! Want to use them to help improve pieces of the Minecraft Java engine? Thanks, we really appreciate it!
Hang on, what even is a game ʼlibraryʼ?
“Libraries are little parts of the game engine,” explains Java developer, Nathan Adams (also known as Dinnerbone). “Weʼre making some of the self-contained libraries that Minecraft uses open source. Anyone can pick them up and use them in their own game.”
Hey, itʼs the Minecraft we all know and love. But hang on, whatʼs with that colourful command text? Heresy!
The plan is to open up different libraries gradually. These libraries are open source and MIT licensed, which means that “basically, anyone can go in there and they can contribute and they can help improve our game engine,” Nathan explains.
“Or, if theyʼre making their own game, they donʼt have to rewrite these little parts. They can just use ours, which have been tried and tested because weʼre a very popular game, apparently!”
“I’m so proud of that name!” Nathan says. “Brigadier is the name of the command engine that Minecraft uses.” Brigadier is also the first library weʼve opened up!
“So in the game you can type something like /give Dinnerbone sticks and then that goes internally into Brigadier and breaks it down into pieces. Figures out what are you trying to do with this random piece of text.”
Minecraft tells Brigadier: “These are the things that players can do. Tell me once the player’s trying to do this.” So when a user types /give Dinnerbone sticks in chat, that goes through Brigadier. Brigadier splits it up, it error checks it, it tries to be as helpful as it can. You’ve also got this lovely pop-up window when you’re typing that can suggest what the next bit might be.”
Hopefully all this makes the process a lot more user friendly!
[1/3] - Start entering a command by pressing the ʼ/ʼ key and Brigadier will start making suggestions. Handy!
[2/3] - The different parts of the command are colour coded. So the actual command (ʼgiveʼ) is in grey, the player (ʼDinnerboneʼ) is in blue and the item being given ʼMinecraft: stickʼ) is in sunny yellow!
Nathan hopes that giving the Minecraft community access to Brigadier can make it “extremely user friendly one day.” After all, commands are still not commonly used by a lot of Minecraft players. “Some people donʼt really look at commands because they’re a bit intimidating and I totally understand why,” says Nathan. “This is supposed to help a lot with that.”
Brigadier takes the random strings of text you enter into Minecraft and turns into an actual function that the game will perform (so youʼve got Brigadier to thank for all those sticks). “A lot of people think this is a really easy function,” says Nathan. “But the reality is actually extremely complicated.
“We thought this would be an amazing first test of the system. It’s a great thing that people can just pick up and use in any kind of project. It doesn’t even have to be a game – I’ve seen some people trying to use it on telegram chat bots, so you can just message it and it’ll do what you’re asking it to do.” Neat!
Brigadier has only been available for just over a week, and already weʼve seen people trying to improve the code, and even make Nathanʼs handy readme doc a bit prettier and more user-friendly! Wait, you lot are writing stuff for Nathan for free? Are you trying to put me out of a job?
DATA FIXER UPPER
“The name is so stupid that we had to keep it,” explains Nathan, unapologetically. DataFixerUpper does exactly what it sounds like, and itʼs one of the most important parts of the Minecraft game engine. Itʼs also the second library weʼre opening up!
“The problem that we have in Minecraft, that I’m pretty sure every game has, is that data changes over time,” says Nathan. “we add a thing into Minecraft and then we kind of have to change how we store level data, how we store all the save files and stuff to accommodate it.
“When we load up any world in Minecraft right now, you can have some data that has not been touched for six years, because that chunk was last played six years ago. So we need to know: ʼOK, this level actually looks really old. Now we’ve got to turn that old data into what it should look like now – in a way that the game can currently read.ʼ
“We have one little unit which uses DataFixerUpper that just says to Minecraft: ʼthis is how to turn anything into the data format that the game is going to use.ʼ And so the game is now only saying ʼThis is how the data looks, so this is how I’m going to read it.ʼ
"Basically, before Minecraft actually loads the chunks, it goes through DataFixerUpper and that turns it into what it should currently be now.”
Confused? Thatʼs fair – DataFixerUpper is a lot less user-friendly than Brigadier – but thatʼs also one of the reasons why weʼre making it available to everyone!
Yeah, this is all getting way too technical for a simpleton like me. Good luck!
The Java team will be opening up more libraries soon and weʼll update this article when they do. One library under consideration is Blaze3D - a complete rewrite of the render engine that weʼre aiming to implement for 1.14. For now, why not use your programming expertise with our existing libraries? Donʼt forget to leave feedback on the GitHub page or reach out to Nathan on Twitter!
DOWNLOAD DATA FIXER UPPER
HackerNewsBot debug: Calculated post rank: 121 - Loop: 52 - Rank min: 100 - Author rank: 86