Tag Archives: Java

Really, another Minecraft article?

Here at RTR HQ we like to consider ourselves trailing edge, covering all the stories that have already been slashdotted and boingboinged, not to mention Penny Arcaded. My last post included the simulated 6502 project. The madness/brilliance of this ALU simulator boggles my mind. Yes, Minecraft is awesome, and for the low low price of $13.30 it’s had me in its terrible grasp for the past week, e.g. this.

I wanted to run through a few graphical bits about it. First, the voxel display engine is surprisingly fast for something that runs in the browser. Minecraft uses the Lightweight Java Game Library to drive OpenGL. Max McGuire figures that the program tracks the visible faces, i.e. all those between air and non-air, and then brute-force displays all these faces (using backface culling) within a given distance. The file format keeps track of 16x16x128 (high) chunks, so just the nearby chunks need display. I don’t know if the program’s using frustum culling on the chunks (I’d hope so!). Looks like no occlusion culling is done currently. The lighting model is interesting and nicely done, we haven’t quite figured it out; the game’s author, “Notch” (Markus Persson), notes that it was one of the trickier elements to make work efficiently.

Me, I’ve been looking at voxelization programs out there, to see if there’s a good one for turning models into voxel building plans (it’s a sickness, seriously). Patrick Min’s binvox (paired with his viewvox viewer) looks promising, since Patrick’s a good programmer (e.g., his CalcuDoku app), the program’s been around 6 years, and it’s open-source. Binvox uses the GPU to generate the voxel views, so it’s quite fast. It supports both parity counting and “carving”, and can also remove fully-interior voxels after processing. Parity count is for “watertight” models (closed and manifold, i.e. the polygon mesh correctly defines a solid object without gaps or self-intersections, etc.). Carving is taking 6 views and recording the closest occupied voxel from each direction. It won’t give you holes or crevices you can’t see from the 6 directions, but is otherwise good for polygonal models that are just surfaces, i.e., that don’t properly represent solids. See his page for references to all techniques he uses. I found a bug in Patrick’s OBJ reader yesterday and he fixed it overnight (fast service!), so I’m game to give it another go tonight.

C++, Baby

I was catching up on the Communications of the ACM, and noticed this article, Computer Science in the Conceptual Age. The “catch your eye” text on one page was: “Programming interns/job seekers from our program Spring 2009 (35 interviewed in the game industry) found no companies administering programming tests in Java.”

There are other chewy bits, such as: “The USC experience is that 100% of its students interviewed for programming positions are given three-to-four-hour-long programming tests, with almost all companies administering the tests in C++.”

Also, this: “The game industry will also tell you that it wants the first four programming classes in C++, not Java, according to M.M. McGill and my own private communications with directors of human resources in major game-development companies.”

One final morsel: “Many game companies say they will not interview or hire someone whose first programming language is Java.”

Wow, that last one’s harsh, especially since my experience with two teenage sons (one in high school, the other a freshman computer science major) is that Java is the norm for the first “real” language taught (I don’t count Scheme as a real, “you’ll get paid programming in it” type of language). I don’t think I’d rule someone out for knowing Java first, though having gone from C++ to Java and then back, the transition from Java to C++ is like being thrown out of the promised land: you suddenly again spend half your time messing with memory in one form or another. C# and Java are darn productive in that way. And, no, for me at least, those auto-pointer classes in C++ never quite seem to work—they need a different sort of discipline I don’t appear to have. I also love that my first Java program, from 1997, still works on the web; some of my C++ programs from back then won’t run on Vista or Windows 7 because the WinG DLLs are not a part of those operating systems (thanks, Microsoft).

Nonetheless, the article’s right: at Autodesk we’ve dabbled with Java and C#, I’ve seen Python used for UI control around the fringes of a program, but the heart of client-side graphical programs is almost always C++ (or isn’t, with regrets and cancellation often soon following—been there myself, though Java was only a little bit to blame, to be fair). Also, XNA, which uses C#, does not have a 64 bit version. In addition, Microsoft’s managed code support usually lags behind the “real” DirectX, i.e., the one for C++.

Looking around, I did find an open-source project, SlimDX, that does support 64-bit assemblies for interfacing with DirectX. Interestingly, they claim one AAA game title shipped using SlimDX, but no mention of which. So I asked. They’re keeping the information confidential, which is fine, but the other comment sounds about right: “The large majority of professional commercial PC/console games are still developed in C++ because of the sheer amount of legacy code the studios developing those games have that is already in C++ (and because of the generally poor support from major console vendors for languages other than C or C++, which contributes to lock-in).”

Long and short: it’s C++, baby.