Hacker News new | past | comments | ask | show | jobs | submit login
Scripting API now in public beta (minecraft.net)
203 points by 20years on Dec 8, 2018 | hide | past | favorite | 98 comments

This kind of thing changes lives. I used to play a lot of counter strike source. One day I found a server mod called EventScripts, and suddenly I could make all kinds of crazy game modes on Python. I found I picked up this programming thing pretty naturally, and without that mod I doubt I would have even dabbled.

The feedback loop is phenomenal and is something you simply do not get with other forms of learning. I really can't think of a better method and I'm so excited the younger generation will be exposed to this.

Kudos Microsoft, I only wish it was done a bit quicker.

Edit: For anyone interested some tutorials are archived here: https://web.archive.org/web/20140810191103/http://python.eve.... Good times :)

This will show my (lack of age). I organically taught myself digital logic as Minecraft slowly added redstone and its features. When it came time to pick a major computer engineering was an obvious choice and I never looked back! Minecraft will always have a special place in my heart for this reason.

Minecraft is pretty much a technical phenomenon. It's a decade old, it's not fancy, but even now people are still playing it and modding it and taking the game to wherever their imagination will go. It's become part of many people's childhoods and even my closest friends, approaching their 30s, are still heavily invested in building their world in there, using various mods to basically recreate Civ and build out each stage of evolution.

You couldn't create such an inspirational game, or even an accidental ecosystem, by actually planning for it.

And a very good example that people should care foremost in doing a game that others want to play, instead of doing language flame wars about which one is better to write games on.

Absolutely. The easily obvious purpose really means a lot (I want to make this Spleef arena automatically regenerate with Cobblestone [as quickly as possible] when X happens) to me.

Besides Redstone Minecraft also got me into Java (both by writing mods and something [Forge Mod Loader?] requiring recompilation of the jar), Lua through ComputerCraft and Sysadmining with Bukkit and PermissionsEx.

Of course it didn't only lay the foundation for my current, largely useful technical knowledge, but through playing on servers and participating in the administration (at 12) learned a lot of social skills I probably would've taken way longer to acquire otherwise.

Yeah, I like that this game exists.

Way back there used to be Metamod (which IIRC circumvented some limitation of the Half-Life engine regarding how it loaded DLLs into the game), and then AMX Mod layered on top of that, which was later replaced by AMX Mod X. This in turn used a little programming language called "Pawn". You could then write mods in Pawn, compile that to bytecode and dynamically load it into the game server. Later there was Sourcepawn. These enabled a lot of complex mods, and required relatively little knowledge about the messy details of the engines, however it was still relatively involved. First you had to setup the various base mods to get it to work, then you needed to compile your mods, restart the game server for most changes etc.

Fun fact, the creator of pawn / sourcemod was one of the guy working on the JIT compiler of spidermonkey (js engine) @ Mozilla : https://www.bailopan.net

Lots of people that started out in game modding end up doing some really cool stuff in other software fields too. The skill and motivation are transferable, I suppose.

I remember SourcePawn! It was a bit too hardcore for me at the time. If I remember correctly it used a thing called 'sigscanning'[1] to find the address of private functions. I think it would have a list of patterns and then scan the binary w/ pattern matching to find the address.

Hacky as hell but you could do some neat stuff with it like respawning players and adjusting all kinds of 'untouchable' attributes.

1. https://wiki.alliedmods.net/Signature_Scanning

sigscans are how nearly all third-party modding APIs work. It's a lot better to hardcode what behavior you're trying to find than hardcoring binary offsets, and then having to update them manually once the program updates.

Wow what a nostalgia hit.

I remember coding with it, to manage fixtures between teams. I looked it up and found a source on my hard drive, last modified 04/10/2001 apparently.


> The feedback loop is phenomenal and is something you simply do not get with other forms of learning.

Coming off of a BA in the Humanities and studying programming for economic necessity (i.e. getting skills that would help me get a job), this is what hooked me. It felt refreshing to enter a world where my creation worked or didn’t (runtime bugs aside) and I knew it right away.

This isn’t to degrade my Humanities studies. I’ve gotten a lot of value out of them, too.

Funny to see someone linking to one of my tutorials :) I'd completely forgotten I wrote all of those!

Thank you for making them, and your support back then.

I still have my eventscripts release T shirt somewhere :)

Blast from the past. I have a similar story; Eventscripts was how I learned python! was a lot of fun playing with code that you could see take action in game.

I feel the same way. I am so excited about this. I hope it is not too late though. Seems as though a lot of the popular around Minecraft has faded a bit.

I was surprised to learn that it's actually the opposite: Minecraft recently reached a new peak with over 90 million active players.


Wow! Good to know. Thanks for sharing this!

This will get way more young kids interested in programming than all the subsidized school programs combined, by the way

I disagree. This would have been true like 4-6 years ago when Minecraft was still in the spotlight of the mainstream. Kids today have moved onto other games like Roblox and Fortnite

Do you have a source for that?

From another comment: https://www.gamesindustry.biz/articles/2018-10-02-minecraft-...

>Kids today have moved onto other games like Roblox

I find it funny people think Roblox is a new thing when I played it a few years prior to Minecraft coming out.

Roblox seems to have a pretty good Lua mod ecosystem.

Roblox has a very good Lua ecosystem. It's on the scale of an actual featureful game engine now, with free cloud hosting and microtransactions support and developer payouts that attract would-be gamedevs. It's been growing extremely rapidly with players, and makes it very easy for kids to open up the game editor and start slapping blocks around to try and switch from "consumer" to "producer".

I'm 21. I first learned programming through Roblox when I was like 15. I don't play anymore, and haven't for years, but I have a giant friend group that also got introduced to programming through Roblox. A lot of them have gone on to work there now, and they've been making it better and better over the years.

Minecraft is giant, and there are tons of mods for it, but also the barrier to entry for making those mods is extremely high. You have to open a command line, decompile a jar and deobfuscate the bytecode and then use Java, which historically isn't the best first language to pick up for a kid. More kids have probably been introduced to coding through ComputerCraft than have gotten a mod building correctly.

I did both and it was certainly pretty easy to open up the Minecraft jar and change what mobs spawn in which biomes or how far a ghast fires its fire balls.

But I was already on Linux then.

They're more than just mods. Pretty much _every_ game in Roblox is built with LUA scripts. I'd go as far as to say that Roblox is more a game engine than it is a game.

No, they haven't. They really haven't. Minecraft persists.

Hasn't this been possible for ages? Like 6 years ago I tried writing a basic Minecraft mod before I knew programming.

Theres a substantial difference in UX between integrating Java software via decompiling class files and having your community use process of elimination to figure out how everything works vs having an actual public and documented API for it.

I don't understand what drives parents to want their kids to become code monkeys. I would rather my kids be financially savvy and have business skills. It sure doesn't hurt to know how to code, but getting them to program in Python from age 10 does not make them entrepreneurs or creators of business opportunities, it just makes them the labor workers of tomorrow.

That’s kind of like saying, “Teaching them to write just makes them the scribes and court officials of tomorrow,” or, “Teaching them to add and subtract makes them the bookkeepers and tax collectors of tomorrow.”

My issue is not with the act of programming, just as I don't have an issue with the act of writing something on a paper.

The issue is that the parents are doing this in order to set the kids up to a career in programming, which IMO is going to be the blue collar work of their future. There is no glory in being a code monkey 10 years from now... just a decently paid blue collar worker making someone else rich.

Teach them the business skills that will enable them to properly hire and evaluate 20 programmers for their business venture, not simply be one of those 20 programmers.

Different parents may have different reasons. I'm gonna be one soon, I will encourage my kid to learn how to code, and here's why:

- I want them to be confident in interacting with technology. To understand that none of this is magic, and that it can be bent to one's will given enough (usually not much) knowledge.

- I want them to learn that they can, and should, automate their tasks on the fly - whatever those tasks are. I want them to know it doesn't require (though can involve) buying ready-made single-purpose solutions, but a little bit of thinking and (sometimes) skills. This conceptual block is what I see in most of non-computer people around me.

- I want them to acquire the ultimate tool in learning and communication: trying to make a machine to do something. There's no better way to realize what you don't know than trying to model it as a computer program.[0][1]

I don't necessarily want them to be a programmer in the future[2]. I want them to find their own career, but I also want them to go through life confident in their ability to truly understand whatever they're curious about, and to shape the increasingly digital world around them.


[0] - I used to use this approach as a teenager to verify my understanding of physics. The act of trying to write a simulation quickly revealed which parts of the topic I only thought I knew.

[1] - Incidentally, that's the primary source of frustration in job - a lot (often most) of time is spent debugging and fixing lack of understanding of stakeholders. Most people aren't aware how imprecise (and in a way, wishful) their thinking is.

[2] - Honestly, I doubt that in 20 years, this will be a well-paid job, due to sheer scale of mass-manufacturing of "programmers" that universities are now engaged in. I expect the supply to exceed demand in 5-10 years.

Another dad told me the same thing about my middle son 15 years ago. He was guiding his own son to be a psychologist because he felt that off shoring was going to remove all of the IT jobs in the developed world.

As it turns out he was wrong, my son's enjoying a great career as a programmer, his son has left psychology and is doing some kind of creative arts) music/digital career.

I think ultimately no one really knows what the future will hold, but it seems that it can't be a bad thing having a strong familiarity with the modern day building blocks of business, i.e software.

But i totally agree about arming them with business skills as well, so they can step up to whatever the next step is.

My parents pushed me away from programming because they thought there was no future and I’d hate it. I didn’t listen and it turns out they were wrong on both counts. Now I can provide for my family, live comfortably, and I love the work I do.

My Dude… there are so many more roles programmers can play in the world than this little fantasy of yours where you get to be Mr Scrooge McDuck.

Running a Minecraft server is the logical progression to writing Minecraft plugins. At least a few years back, it was fairly easy to monetize Minecraft servers by selling in-game perks and paying YouTubers for advertising. Once you reach a certain player count/level of cashflow, you end up having to hire and evaluate programmers/sysadmins to sustain the business.

This isn't a rare path - just look on sites like SpigotMC and you'll see literally thousands of developers turning to the business side of things. The business skills that your kids would gain from this would be 1000x more valuable than whatever you can teach.

Why do you think all those parents wants their kids to have a programming career? Do you think the same of parents putting their kids in musical instrument classes? Don't you think there will be any joy working with code in 10 years time?

Looking down on being a "decently paid blue collar worker" is not something anyone decent is going to want to teach their kids.

I'm sorry I want more for my kids than them being a car mechanic. Nothing wrong if that ends up happening, but I'm not going to teach them to fix cars at 10 with the intention of them being a mechanic growing up.

What is "more"?

Running their own server and having to make unique custom plugins to compete with other servers for players is also more effective business training than anything a school has to offer.

Teaching someone to code is teaching them how to automate things, which is useful in many different careers. Being financially savvy is useful too, fortunately people can learn both.

> Being financially savvy is useful too, fortunately people can learn both.

Didn't understand why they imply that being a code monkey means you know nothing about anything else... Must not be a code monkey themselves. Working with programmers you see people of all backgrounds who have a wealth of knowledge in all sorts of topics, some even have financial backgrounds, others business and military, and so on.

I've been programming for 20 years... I've come across very few programmers who have decent business/financial skills over this time period.

Name one domain that can't be enhanced by knowing how to code.

I have nothing against knowing how to code, but no 10 year old needs to be doing that, just going to make them even more used to a sedentary lifestyle and away from (real) social interaction.

Agreed. Let's also shut down all the sedentary encouraging education that happens at 10. Math. Literacy. Science. Gym all the way!

You're better off targeting video games and social media, specifically the latter. Then again, kids don't even play video games, they watch someone else play video games.

Oh yeah, Twitch should be considered a health hazard for young impressionable kids. Wasting time and life away watching others play is something I just cannot comprehend.

Some of us think that programming is actually fun.

There's nothing you can do to guarantee they are successful.

What you can do is expose your kid to a lot of things and help them find something they're passionate about. Ideally something they can use to pay their bills too when their business fails. I don't see why some programming/tech exposure can't be one of those things.

I work fewer hours and have more lateral mobility than pretty much all my friends that make as much money as I do. Software engineering is a good field. Nobody is saying you have to force it down anyone's throat, and that's not what a Minecraft scripting API is doing.

What a great creative opportunity though for kids out there to dabble in programming due to a game they love. That doesn't preclude them from being financially savvy in the future. They're kids.

I looked briefly but didn't see it - does Minecraft scripting have a way to save state and reset to that state instantly, how about stepping through code in real time? If not, most programs are just macros - they simply mimic user-actions, and if somewhere along the script something doesn't go as planned, it's just a mess. It's really hard teaching 10 year olds how to do anything more than the basics if every time they run the program, their entire world is messed up, and there's no way to undo the script they just ran, or understand why it went wrong.

This has been true in Minecraft for years now, it'd be great if it were addressed.

They have in-game error messages and log files, or you can attach Visual Studio's debugger.


Oh. Hello Windows lock-in.

Does anyone know of a good guide to the Minecraft versions? My daughter wants to get mods and maybe venture into scripting, but it seems confusing as to what each version is capable of. We have it on Xbox and android but it seems none of this works on those. It seemd java edition is best; except this has now been replaced by win10 edition, but that does not support most mods or so it seems. It's quite confusing so if anyone has a magic decoder ring for versions/platforms/compatability I'd really appreciate the info!

The Java edition is the only one that supports mods. Development is parallel between it and the bedrock edition. The windows 10, android, iOS, Xbox one, PS4 and switch versions all use the bedrock edition.

I would recommend starting with a premade mod pack and a YouTube series that's currently using it. Direwolf20 authors his own packs and creates videos using those packs. The twitch client allows you to install various modpacks for Minecraft, including Direwolf20's

A hearty second on Twitch. It’s very easy to go down the rabbit hole in getting a mod working on your kid’s computer (what 3rd party API are they using, what version, what mods do they build on, what version of Minecraft does it work with, etc.).

The Java version is the most moddable and featureful among the versions. The console/mobile/Win10 versions are collectively called Bedrock Edition. The Bedrock versions allow for (limited) crossplay between one another. The Java and Bedrock versions are incompatible. Bedrock versions have had essentially no moddability, though this announcement seems to be hinting that official Bedrock modding support may be in the works.

In short, Windows 10 Edition has not replaced the Java Edition, and IMO the Java version on PC remains the best way to play, especially if modding or server communities are desired.

Java is the original and I don't think it's fair to say that is has been "replaced" yet. Mods basically only exist for this one.

The Windows 10 one (which as here announced just got scripting beta), the XBox one and Android/iOS versions are all based on the same code base and labeled "Bedrock Edition". There's a bunch of other variants for other consoles etc, but less relevant. The Raspberry Pi one also had a (I think Python?) scripting interface, not sure if they still maintain it.

I was about to comment to say this is the source of the confusion. The Java based one is the original. Microsoft doesn't have the best history with Java, so my best guess is that eventually Bedrock may indeed replace the original in constant development, but it doesn't appear to be too soon. It doesn't hurt to just invest some time into the Java edition of Minecraft until the Windows 10 catches up with the new mod system.

The Raspberry Pi has a minimalist rendition of Minecraft that let's you script it with Python. Just downloading (or getting n00bs) the official Rapsberry Pi distro Raspbian includes Minecraft with it.

As other commenters have stated, java is best for modability both because of it's extensive community support and inertia (already written mods are on java).

However, (this may not be true any more, but I think it is) you get a free version of the win10 store version of minecraft with a java edition purchase. So just buy the java version, and you get both (and the prices are pretty close last I checked)

This promotion stopped in November.

Check out this topic: https://gaming.stackexchange.com/questions/164341/how-exactl...

Look into Minecraft Forge.

Not sure how relevant all of this is now but we got it up and running on an older iMac pretty easily.

This is very cool, and very exciting.

My niece is really into Minecraft and has a huge interest in stuff like robotics and programming, I think in no small part because of Minecraft's influence. But because she's on the Windows 10 version it's difficult for me to help her with anything. Better, more open modding tools for Bedrock means that it's easier for me to show her stuff and pique her interest towards developing more interesting customizations.

Now if only I didn't have to set up a Windows VM to run Bedrock...

There's a GitHub project which uses the Android version of Bedrock and runs it "natively" on Linux/Mac/etc. systems, works pretty well too https://github.com/minecraft-linux/mcpelauncher-manifest/wik...

While the scripting API isn't yet available for Android, I found it much faster personally than running with Parallels and the like

Why not make DevOps part of the fun with setting up their own environment?

In all seriousness, while I'm an adult, when I started learning to code I got a major sense of accomplishment from getting my Ubuntu virtual environment setup.

Very exciting, should put a fresh breath of life into Minecraft for sure.

It looks like it's only available for Bedrock edition currently. What about Java edition? Is this Microsoft making an attempt to make the Java edition obsolete?

> should put a fresh breath of life into Minecraft for sure

If you mean "new options from a different group", then yes.

If you mean "Minecraft has gotten stale and this will pep it up", then no. Minecraft has a very health and active modding community that has really been exploring new directions lately, and the non-modded Minecraft has been continuing to push new options and directions for some time.

> Is this Microsoft making an attempt to make the Java edition obsolete?

I expect they don't have to "attempt" so much as just let it decay because they'll have a lot more non-Java resources. As much as I've trashed MS in the past and as much as I thought the Minecraft buyout would be bad for Minecraft, MS has really been a decently-behaved corp citizen in software of late and developments like this mean that while they might under-support the Java Edition, they'll continue to support Minecraft in some form as we've come to expect.

Java has a massive inertia advantage in modding, which is pretty important in my opinion because modders are the largest playerbase that will stick with your game for a very, very long time. Additionally, modders have been known to stick to old versions of minecraft for a long time, so new features/tooling likely won't sway them. I expect the java edition to remain the most popular version for a very long time.

That whole system is really a mess, and I speak from experience as a modder. All the changes between MC releases makes updating an enormous pain in the butt, so there's still mods stuck at version 1.6.4 and every version in between.

I think most modders would be ecstatic at some kind of official mod support, assuming it offers at least what forge does already.

Fully-fledged DnD session in Minecraft anyone?

Note that release only gives you an API to some UI elements and to entities (animals, monsters). This is not yet a full Bedrock API and the number of things you can do is currently quite limited.

Nice to see a start though!

I got my start in programming basically via Minecraft. Multiplayer servers taught me DNS, ports, & bash... modding on Mac OSX & configuring a server to work with the same mod (Flan's Mod) taught me basic client-server principles... hell, even Buycraft fuelled my interest in Bitcoin and web development. I don't know if I'd even have been a serious developer at all if it wasn't for Minecraft.

And now kids have access to learning JS directly. This is 100x as powerful as learning how to web inspector pages. I look forward to watching my little cousins surpass me.

Are there typescript typings anywhere? Might be a great toy to play with this Christmas and get more experience with TS.

Well, it definitely sounds neat, and although I really wish it weren’t JavaScript, that’s actually a pretty good choice based on popularity. Pity it couldn’t have been TCL, Lisp, or even Scheme or Python.

I can’t wait until the modding community picks this up and figures out how to integrate it. Gonna be fun times ahead, no doubt!

As an aside, this was a bit of a surprise to me:

> you can learn more about how to sign up for that beta by clicking this line of green text

Link. Link. Doesn’t everyone know what a link is, these days?

Yeah sure I saw him with Zelda in this game

I like your list but its missing the one language that I feel is most suited- Lua.

Do we really want kids' first experience with programming to be a language with 1-indexed arrays? That's just going to set them up for failure ;)

The very first mod for this should be someone to convince Mr Crayfish to donate his Furniture Mod to the public domain (if it isnt there already) so that it can be ported to the Bedrock editions!

Oh this is actually really cool, especially because the lightweight nature of JS and the way this is designed means plugin experiences are more plug-and-play when you join a modded server, rather than having to have a plugin pre-installed or having a download time when joining the server.

As soon as I think Minecraft is old news something like this pops up. Seems very interesting.

Kudos to Microsoft. This can also open up new opportunities for AI simulations, especially reinforcement learning. Similar to OpenAI. It should unleash a new playground for progress.

Trying to write mods for Minecraft is what got me into programming as a teenager, this looks really cool!

It would be interesting to see a comparison between this API and what Java mods are capable of doing.

Looks like the JavaScript API is ES5. Wonder if they've any plans to support ES6+?

They're using ChakraCore, with support for ES6+. you can use all your favourite `const` and `let` and `function*` etc.

Glad to hear that!

Oh, just after it was announced obsolete?

Probably won't be long before a minecraft babel plugin exists.

Any existing babel setup will already work, you don't need to wait. That being said, I'd be kind of surprised if this doesn't actually support ES6.

How likely is it that the Minecraft team built their own Javascript interpreter rather than setting up bindings to an existing one?

Might use Rhino or something, since it’s on the JVM

Bedrock edition is in C++, isn't it?

Yes, they ported it to C++ due to game consoles and mobiles support.

Creating a couple of Java AOT compilers from scratch wasn't properly part of their idea how to best make use of resources.

I wonder whether the landscape looks different today, with Oracle's Graal efforts.

Not really.

Java AOT compilers to native code have been available since early 2000's, as long as companies are willing to pay for them.

However there have been very little attempts to support Java on game consoles, apart from ajile's attempt [0].

Targeting game consoles is similar to bare metal programming, even when a thin OS is present and doesn't bound well with a programming model that abstracts what the hardware is capable of.

As for iOS support, there are a couple of options like CodenameOne, GluonVM and RoboVM.

And for UWP only CodenameOne.

So there isn't really an option that would make sense from business point of view.

Hence why porting the game engine into a programming language that is available out of the box in all SDKs was a much more pragmatic option.

[0] https://www.geek.com/games/new-development-kit-brings-java-t...

It uses V8.

far too limited and around 5 years to late


Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact