Become a fan of Slashdot on Facebook

 



Forgot your password?
typodupeerror
×
Programming Games News

JavaScript Comes To Minecraft 149

mikejuk writes "JavaScript is the language of the client and it is becoming the language of the server. Now it seems set to be the language of Minecraft. ScriptCraft is a Minecraft mod that can be added to the game to allow the player to use JavaScript commands. Walter Higgins ported the Rhino JVM implementation of JavaScript in a few spare weeks over Xmas. Some additional JavaScript classes allow the construction of blocks making it possible to automate construction. It also provides a 'turtle like' drone class that makes it easier to move in 3D. It makes use of a fluent API to create a domain specific language for movement. As its creator says: 'Ultimately I think the ScriptCraft mod could be used to take building in Minecraft to a whole new level. With a full-blown language at the Player's disposal, it should be possible to create not just castles and forts but entire road networks and cities.' Most importantly of all, it not only pushes the boundary of Minecraft, it also provides a way to get kids who are already hooked on Minecraft to start learning JavaScript."
This discussion has been archived. No new comments can be posted.

JavaScript Comes To Minecraft

Comments Filter:
  • by iluvcapra ( 782887 ) on Monday January 21, 2013 @02:39PM (#42650075)
    I saw the headline and half expected that someone had in fact implemented a Javascript interpreter with MineCraft.
    • Same, I was so excited to see a JavaScript version of MineCraft. Thought it would be HTML5, and wonder how the memory and graphic would support it. However, it is more for automation or command line usage, using script command to create blocks.

      • I think GP was saying he expected to see a Javascript implementation created within Minecraft using redstone circuits (there are folks who have created working CPUs using redstone circuits).
        • by vlm ( 69642 ) on Monday January 21, 2013 @03:30PM (#42650577)

          I'd much rather see a java implementation using lots and lots of redstone. Then you could theoretically run minecraft on minecraft in infinite regression. This could cause the end of the world so I'd be careful.

          • Remind's me of The Onion's World of World of Warcraft. [theonion.com]
          • It's theoretically possible, but you'd have to mod minecraft to allow more than a 21x21 chunk area to be loaded at once, otherwise the computer won't have enough space to have enough memory.
          • I'd much rather see a java implementation using lots and lots of redstone. Then you could theoretically run minecraft on minecraft in infinite regression. This could cause the end of the world so I'd be careful.

            Oh No! Don't Tell the GCC developers! We're all be DOOMED!

          • We'll be fine.

            It'll be so slow, the Sun would envelope the Earth before this would cause the end of the world.

    • by Fallingcow ( 213461 ) on Monday January 21, 2013 @02:51PM (#42650217) Homepage

      Javascript running via a 3D world written in Java would have a Lovecraftian madness-inducing quality. You'd take one look at it and start bleeding from the eyes while producing an inhuman scream, before vomiting up most of your internal organs.

      I mean, either of those things (Javascript, or a 3D world written in Java) are capable of getting you half way there all on their own. Both cannot exist, yet they do. Even thinking of the two being combined is enough to PH'NGLUI MGLW'NAFH CTHULHU R'LYEH WGAH'NAGL FHTAGN **carrier lost**

    • by Minwee ( 522556 )

      No, that kind of thing only works in Dwarf Fortress.

      The problem is that those damn Elephants keep stepping on the infinite strip of tape and ruining my Turing Megaproject.

  • by shaitand ( 626655 ) on Monday January 21, 2013 @02:43PM (#42650129) Journal

    You can already do all this in Java. What is the benefit of exposing players to the wonder of javascript via minecraft vs exposing them to the wonders of java via minecraft? Either one is a POS.

    I wish someone would do a C rewrite. People make excuses about the fully manipulable world and such but the reality is that there is nothing going on in minecraft that would make it tax a Pentium 3 without no gpu offloading had it been authored well in a decent language.

    Don't get me wrong it's a great game and fun to play. The implementation just leaves a lot to be desired. Buggy as hell too but you can't blame that on the language!

    • I don't like Java either, but don't hate on the JavaScript, please. It's running my MSN client on a Pentium II smoothly!

    • by timeOday ( 582209 ) on Monday January 21, 2013 @03:05PM (#42650347)
      I'm delighted that Minecraft is in Java because my son plays it all the time, it's more constructive than other games, and it also happens to be just about the ONLY game that will run on our computer, because it's Linux. (Well, flash web games work too, and Club Penguin had a healthy run at our place... but I doubt Flash is what you are advocating).

      OK, I realize there has been some variety of games over the years which were released for Linux like quake 3. But as for games on Linux that are actually currently popular, and which people playing on different OS can link up and talk to each other, there are extremely few.

      • Re: (Score:3, Informative)

        by CastrTroy ( 595695 )
        There's nothing inherently special about Java that makes it able to run games on Windows/Linux any more than C/C++. If the programmers set out to make a program that will run on both, it will run on both. If they just assume it will work on Linux, or have no intention of it running on Linux, then it doesn't matter if it's written in Java, C or .Net, it won't run on Linux.
        • This. If you decompile the Java bytecode in Minecraft, you will see that it uses lwjgl (LightWeight Java Game Library) which uses JNI (Java Native Interface) to get access to native OpenGL objects. There's no reason why this couldn't have been done in a natively compiled language, except that Notch started Minecraft as a quick project.
        • by Pieroxy ( 222434 ) on Monday January 21, 2013 @03:42PM (#42650695) Homepage

          There's nothing inherently special about Java that makes it able to run games on Windows/Linux any more than C/C++.

          Holy fucking Jesus Christ, you haven't learned much in all that time have you? There is a hell of a lot more in Java. I once saw a (server-side) project of about 100k classes go from Java 1.3 32bit on Windows to Java 1.4 64bit on Solaris without even needing a recompilation. The stuff just worked.

          This is miles and miles away from what it would have meant in C or C++, and you know it. Of course, C and/or C++ done properly can achieve something that is portable, but at least your most common data type doesn't change whenever you change the number of fucking bits in your CPU. Not mentioning the stability of the APIs whenever you want to do anything vaguely more complex than fopen.

          • by mark-t ( 151149 )

            This.

            It's not that it's impossible to write nonportable java, it's just that what's interesting about Java, particularly when you compare it to C or C++, is that you get that portability with practically zero extra effort.

            Java is not unique in this regard... although to the best of my knowledge, most of the other languages that achieve the goal are script-based.

            • Java is script based too. It just saves the script in an intermediate compilation phase to save on loading performance. You can output byte code with the Perl interpreter as well to the same end.

          • I once saw a (server-side) project of about 100k classes go from Java 1.3 32bit on Windows to Java 1.4 64bit on Solaris without even needing a recompilation. The stuff just worked.

            That level of portability and cross-platform compatibility is nothing special; C/C++ is the rare exception because it exposes so many unportable features and is so completely lacking in runtime error checking.

            but at least your most common data type doesn't change whenever you change the number of fucking bits in your CPU.

            C99 has

          • I'm not going to argue with that. Although I don't think there is any excuse for not doing your C/C++ properly so the benefit is mitigated somewhat.

            This is a bit different though. This is a 3D game and performance is at least as important here as portability. A properly done and portable C/C++ is a better choice in this case than an easily portable but poorly performing Java implementation.

            Every tool has its place.

            • by Pieroxy ( 222434 )

              In C/C++ you would have used an implementation of OpenGL which is only vaguely compatible with the Linux one. Of course, everything is supposed to work the same way, but really, it doesn''t. Yes, it is the fault of the shitty drivers on linux, but still, it's at best going to be a hit and miss operation.

              Java3D might not be the cutting edge when it comes to 3D acceleration, but it really works all the same on all platforms where Java runs.

      • Get Play On Linux http://www.playonlinux.com/en/ [playonlinux.com], (your distro might distribute it). It comes with user contributed install scripts for a variety of games (from CD/DVDs, GoG, Steam, etc), which will download the version of wine with the best compatibility / least regressions for a particular title, install needed runtimes, do all the winetricks magic needed and install the games. I've installed a few old GoG games and some newer ones. I'm playing Skyrim through PoL now and it runs (with DLC, high rest t

    • by Anonymous Coward

      The problem is that Notch is an absolutely terrible programmer. It's not Java, it's the actual code, and you can find out as much by analyzing it.

      • I'm sure Notch is but crap C is faster (and more efficient) than crap Java just like good C is faster than good Java, though crap C isn't necessarily faster than good Java (but sometimes is, Java is that bad).

        • by Zmobie ( 2478450 )

          C is also much more prone to fucked up pointer arithmetic and memory leaks. It is honestly probably better that it is written in Java if Notch is a bad programmer because at least you have a managed language so that the game doesn't constantly crash from some memory issue.

          I will agree with you that normal performance yes, C absolutely wrecks Java, but good Java is at least decent considering it is a managed language. Hell, if someone were so inclined they can try to force some mock memory management by fo

          • The clear answer is for someone who isn't as shitty a programmer (maybe a student learning games programming in C or C++) to write a minecraft clone and open source it. Should be a fun project for someone with the time. Replicate the login interface so you still need to own the game to use it. Someone will write a bypass but you can do that already.

          • Comment removed based on user account deletion
            • by Zmobie ( 2478450 )

              Yea, if he has managed to run out of memory in Java, the game would have been UNPLAYABLE if he wrote it in C.

              • Comment removed based on user account deletion
                • by Zmobie ( 2478450 )

                  I haven't honestly seen any of the code for the game so I don't know exactly what you are talking about in regards to his implementation. That said though, an OO implementation can be somewhat replicated in imperative languages like C, though obviously not the exact same since there are fundamental differences in the way things are handled. Hell, technically Java is not a true OO language even since it still heavily uses primitive types.

                  What I am saying is if he didn't even manage memory correctly in Java

    • I wish someone would do a C rewrite. People make excuses about the fully manipulable world and such but the reality is that there is nothing going on in minecraft that would make it tax a Pentium 3 without no gpu offloading had it been authored well in a decent language.

      Even though it looks like just a blocky retro game, remember it's a completely dynamic world. There's a good amount of surfaces to draw and each block's state must be checked and maintained as they can be freely manipulated. Possibly a P3/1000MHz could just cut it though... I completely agree though that a C or, more likely C++ rewrite would be much appreciated.

      • by Bengie ( 1121981 )
        What I don't understand is how my CPU can be nearly idle running a server, while the server gets slow with too many things going on at once.

        If a CPU is idle, the server should not be getting bogged down.
        • That just means the CPU isn't the bottleneck. I don't know the details of how "real" minecraft servers are set up, but in general minecraft writes a lot of stuff to disk (since worlds get so big, and Java needs that memory for other things as well, it more or less has to).

        • by Zmobie ( 2478450 )

          Could be a number of things. Improper threading springs to mind immediately as many applications in the vein of how minecraft was developed do not use multi-thread expansion correctly. Over-use of memory is another considering how vast the spaces in minecraft are there may be some required disk writes server side and even if the implementation uses B-Trees and proper spanning those kinds of operations are extremely costly moving it from disk to active RAM and vice-versa. Without looking at the code or ob

    • They HAVE done a C rewrite. The mobile version definitively, and I think the XBox version as well. Go ahead and join their superiority - and perhaps reflect on the fact that there are tradeoffs to the potential efficiency gains of a rewrite.

    • I think you underestimate the quality of javascript (which is not the worst thing you could use as a scripting language, def better than using java of all things), and overestimate the role of Java in the "slowness" of the game. Just because the graphics look like they're from quake 2 doesn't mean that's all there is to it.

      take Dwarf Fotress and try to play it on a P3. You might think it's running normally because it's hard to gauge speed in a text-based interface but... it's running really slowly. World
    • The again the entire Minecraft modding scene exists because Java cen be decompiled relatively easily. I don't think that we would havs such an expansive modding scene if Minecraft were distributed as a regular binary. In fact it's the only closed-source game I know where people routinely write mods that replace parts of the engine itself.
    • by Kirth ( 183 )

      I wish someone would do a C rewrite too. Just look at what this http://minetest.net/ [minetest.net] does: "limited to +-31000 blocks in all directions" Hell, that's one big difference to 256 blocks...

    • I wish someone would do a C rewrite. People make excuses about the fully manipulable world and such but the reality is that there is nothing going on in minecraft that would make it tax a Pentium 3 without no gpu offloading had it been authored well in a decent language.

      Don't get me wrong it's a great game and fun to play. The implementation just leaves a lot to be desired. Buggy as hell too but you can't blame that on the language!

      It is not a rewrite, as I have added a lot of things like quests, skill points, colored light, infinite up and down, teleporting, torches you can carry and 88 mobs while avoiding many of minecraft features. I did take inspiration from minecraft [blockstory.net] just like Notch took inspiration from Infiniminer. My game runs very fast in older machines (about 10x the framerate) and it even works in android and iphone. I wrote it in C# using Unity, you are more than welcome to try the free demo for each platform and ch

  • Most importantly of all, it not only pushes the boundary of Minecraft it also provides a way to get kids who are already hooked on Minecraft to start learning JavaScript

    No, most importantly for my kid, it has the potential to get a highly JS-capable dad interested in Minecraft (a diversion he has hitherto managed to avoid).

    However, whether this be a good thing or a bad one is a matter that's entirely up for debate. :)

  • Maybe it's just me, but there are so many elegant languages they could have gone with. Maybe a JS engine is easy to implement, but the thought of even using it just makes me shiver. It's a recurring problem though. Unity has JS like language too and people are dead set on using it. Oh well. Better that python i guess.
    • by Elgonn ( 921934 )
      Until every browser supports LUA I'm not sure how you'd get Javascript to go away. There are very few (non-primary/embedded) scriptable engine languages. Besides with all the recent development Javascript is probably the best one.
      • I don't think there's much hope of that considering the huge similarities with python and considerable disparity in library availability and popularity. I'm not sure there's much awareness of it outside the gaming development community.

      • Apropos Lua... this isn't the first pl-in-a-block mod. Lua was first.

        (It also isn't an acronym, and we are past the day when all programming languages were named in ALL CAPS).

    • Why better than Python?
      • by vlm ( 69642 ) on Monday January 21, 2013 @03:10PM (#42650411)

        Does python still use whitespace as part of control flow structures? Ugh. I don't want to be the guy who posts the equivalent of "mysql doesn't have transactions" over and over in 2013, but I can't be bothered to keep up with a language I don't use, either.

        It is however a fact that Python at least USED TO BE in a really bad neighborhood, sandwiched in between COBOL and FORTRAN in the "compiler really cares a lot about whitespace" ghetto, even if they've fixed it since then. I'd rather write a million parenthesis in LISP.

        • by larry bagina ( 561269 ) on Monday January 21, 2013 @03:17PM (#42650477) Journal

          Haven't fixed it, won't fix it.

          >>> from __future__ import braces
          File "", line 1
          SyntaxError: not a chance

          • It's a feature, not a bug.

            I'm sure the parent poster will hate Go as well but I feel this language design decisions ultimately do much more good than harm.

        • by rk ( 6314 )

          Yes, python does still use the "whitespace thing" and no it's not that big a deal, and until I learned Python 12 years ago, I felt as you did. There are good reasons why as programmers we have almost genetic revulsion at syntactically or semantically significant whitespace, but python enforces with whitespace pretty much what as a good programmer you're doing anyway, which is consistently indenting your code. Most people don't even notice it after an hour, your editor will do it for you, and in my case, a

        • by caseih ( 160668 )

          Ha well you can keep lisp then. Python I'm a white space ghetto? To funny.

          I found Eric s Raymond's take on python very interesting. He started out with your attitude but very quickly changed his mind once he actually started using it. Look it up. It's worth a read.

          I've used both lisp and python. There's no comparison. Python is easy nicer. But it has a lot of lisp like features that make it a real pleasure to use. I'd prefer python over JavaScript any day. I was very sad the epiphany browser abandoned pytho

        • If that's the only thing you can find wrong with Python, then I think that speaks much more good about the language than bad. When I first started playing with Python, I got tripped up a few times about inconsistent use of tabs vs spaces, but I have vim configured to take care of that for me now. Even if I want something fast or low-level, I will typically compile a shared object file for some C code, and then wrap it up in Python with Python's ctypes API. This gives me a good trade-off of the performanc
          • If that's the only thing you can find wrong with Python, then I think that speaks much more good about the language than bad.

            Agreed, the whitespace thing is pretty much my only complaint about Python.

            I don't script everyday, but when I do script and I can choose the language, I script in Python.

    • by am 2k ( 217885 )

      Unity has JS like language too and people are dead set on using it.

      In my experience, everyone who's serious about game programming in Unity3D uses C# anyways.

    • by Jaxim ( 858185 )

      Don't worry. You're not alone. I wish JavaScript would either mature or be replaced by another language: i.e. Google's DART.

      The problem is that there is a huge crowd of developers who know JavaScript and like anyone in the human race, they don't like change and would like to see the status quo.

    • by pjt33 ( 739471 )

      It's not just that a JS engine is easy to implement: it's that it comes as standard as part of Java (since Java 6).

  • by vlm ( 69642 ) on Monday January 21, 2013 @03:05PM (#42650361)

    I would imagine this will primarily serve to ostracize the xbox port even further away from mainstream minecrafting.

    • No more than any other mod which is only available for Minecraft on PC (which I assume is all of them, but I've never played the Xbox version).
  • I am amused (Score:5, Interesting)

    by Windwraith ( 932426 ) on Monday January 21, 2013 @03:14PM (#42650465)

    I find it amusing that this is news but what about LuaForge [github.com]? It allows you to do Minecraft stuff in Lua, a language that can't be easier to learn, and is also pretty fast out of the box.

  • kids who are already hooked

    Sounds like the earlier thread about a guy who wanted to get his wife hooked on (a.k.a., addicted to) video games just as he was....

  • I feel sorry for the Minecraft developers. Have fun with a language that doesn't have a class object system like every other modern mature computer language which makes working in a team environment so much easier.

    While we're at it, why don't we introduce PERL to minecraft?

    HTML was upgraded to HTML5 and CSS was upgraded to CSS3. Why can't JavaScript be upgraded so it is more in line with modern languages? If that could happen then Google could give up on developing their new DART language which is designed

  • I don't see how someone reinventing the wheel should get /. coverage. WorldEdit, a very popular plugin, already has javascript integration. Also, check out GroovyBukkit for groovy integration that is incredibly easy to use. I did one-liners in Groovy to, say, lay rail tracks wherever you're standing if you are holding a rail in your hands -- that way you just walk and the tracks follow you. I have a 100-line bot named "David" (named after the Prometheus character) which helps non-op people obtain things
  • provides a way to get kids who are already hooked on Minecraft to start learning JavaScript

    Won't somebody PLEASE think of the children and stop this madness?!

  • Hardly revolutionary (Score:5, Informative)

    by Mercano ( 826132 ) <`mercano' `at' `gmail.com'> on Monday January 21, 2013 @04:32PM (#42651113)
    Not sure how this is a groundbreaking achievement. ComputerCraft [computercraft.info] already provides a LUA interpreter and turtles, and has a lot more documentation. There's also RedPower's [eloraam.com] Control module [wikispaces.com], that gives you an emulated 6502-based 8 bit computer. A FORTH boot disk can be crafted in-game, or you can edit your save files to bring in either an BASIC boot disk or your own assembler code. (Previous /.coverage of the 6502 emulator blocks [slashdot.org])
    • This isn't 1962! We don't write programming languages in all caps just because they're programming languages.

    • Right, and there are also multiple Bukkit plugins which allow scripting in various languages - JRuby & Jython, for example. And WorldEdit already allows a degree of Javascript. I'm sure this particular mod is cool, but it's absolutely nothing new. People have been extending Minecraft with scripting tools for well over a year now.

      Slashdot... 2011's news in 2013!

  • I wish he had chosen Jython. But then again, if he implemented it "the right way" using the Java scripting engine, Jython should be pluggable in no time.

  • Or .. you could be a programmer and use Minecraft's source code that Mojang distributes with every release.
  • So many times some kid has come up to me and said they wanted to learn to make video games. The trouble is that there's this giant gulf between the multimillion dollar games they play, and what they can actually do with newbie knowledge. When I was a teenager, (80's) I could see a game I loved like say... Ultima or Zork... and understand the steps leading up to me making that game. A little harder to find that maker's connection with Halo, Bioshock, Borderlands, etc. So maybe Minecraft can be a good bridg

Life is a whim of several billion cells to be you for a while.

Working...