27

This would depend on the game and the indexing structure used for the chunks. Though, at such a high level, it's not too likely it has much to do with memory or a specific performance enhancement. More than likely it's an arbitrary decision for sizing chunks in a predictable way. It allows for some counting and indexing tricks using bit shifting that wouldn'...


23

Yes, it generates more chunks (or at least more of the village tree) than you think it does. This is what I call "area of interest" in my voxel code. There are two kinds of area of interest: Logical (which is what we're discussing here) Rendering (which is typically be smaller in radius than the logical area) Remember that the only way your renderer can ...


16

What you need to do is separate terrain from live blocks. For example you could store the live blocks in a dictionary that uses a point as key. And then unload the terrain. This way your live blocks stay in memory in a way you see fit, and you can still look them up based on position, but the terrain is stored on disk for later retrieval. This will increase ...


15

First, multiplying by powers of two is much cheaper than multiplying by an arbitrary number, since you can do it by bit shifting. Most of the time the compiler can do this for you, so whenever you write "* 16" in your code, the compiler actually does a shift by four, and you don't need to worry about it - you just need to give the compiler the opportunity by ...


15

Actually, Minecraft will run at whatever resolution you size your window to (348x866): So it's likely that whomever took the screenshot you grabbed, just happened to have their window sized that way. The default screen size when I start the game appears to be 856x482, which is pretty close to 16:9. It doesn't need to use a standard aspect ratio or ...


11

I saw a video from GDC where he said that he used Java because it's what he felt most productive in, at least at the time. It was only a passing comment though and note that this video is post-Minecraft, so his reasoning may not have been the same when he started Minecraft. Source: This video from about 14:45 in answer to the question "What Tools or ...


10

Yes, if you examine Minecraft under the hood you can see that it's just a separate file that will launch the JAR file afterwards. However, you're probably more interested in implementing an update solution for your game yourself. If that's the case, check out Sparkle.


9

The real answer is just this: On a binary computer, powers of two are nice round numbers. When a normal person needs to pick an arbitrary number for some purpose, they typically choose nice round numbers in the number system they're comfortable with, base 10. So they'll pick 10, 100, 1000, etc. Because they're simple and easy and don't require much ...


9

You could look in the game code to find the code for enchanting. Since that takes away experience, it should tell you how, although it may be in levels. Also, you could look in the code for the anvil. In those, you should find variables for experience. You could probably subtract from those variables for every 2 or so blocks that you mine/dig/chop, like the ...


8

This lag-vs-responsiveness issue is the situation with virtually all motion controllers, whether something like the Hydra, the Wii Remote, the Kinect, or the PlayStation Move. The problem is this: When an input stream is coming in, you're making a decision on a frame-by-frame basis about whether or not to trust the input data; whether the trends you're ...


8

I'm going to assume you're using the Forge API, given the parameters you listed. EntityLiving is an abstract type representing living entities like players and mobs. When it is passed into your block break event, it indicates the entity which broke the block. It's not guaranteed to be a player, so you need to try to cast it to the subtype that represents a ...


8

Technical stuff During Minecraft's chunk generation a chunk passes several stages before it is done and can be rendered. These stages, in order, are as follows: EMPTY: Just as indicated, the chunk barely exists and is empty. STRUCTURE_STARTS: Here world generation decides whether a chunk might be the origin of a structure, and if so, it also generates the ...


7

No. Notch said at some point that he plans to release the sources once the game is no longer selling, but that was WAY before it got this big. And yes, it's still selling.


7

There are two ways. Using MCP obfuscation mappings, the first and proper way to do so is with: EntityLiving.attackEntityFrom(DamageSource, damageDealt); You need to specify where the damage came from in the first parameter though, so the simpler one is to simply use: EntityLiving.setEntityHealth(health); Use this with getHealth so you can do stuff like ...


6

I know there's an already accepted answer and it's not quite on the spot - but I also came here via Google and I was looking to learn and thought others might, too. There are other open-source Minecraft clones (and InfiniMiner which is what Minecraft is based off, too). I'd suggest anyone who is looking to study up on it looks at these: TechCraft ...


6

One reason not mentioned in other answers is that if needed, powers of two numbers can always be halved without rounding problems. This is probably not a reason in Minecraft clones, but is in some other cases such as in textures with mipmaps.


6

The bulk of Minecraft's chunk rendering goes through a vertex array. The world is split into 16x16x16-block render-chunks (which currently happen to be the same as storage-chunks, but it wasn't always that way). Each render-chunk is converted to a vertex array, and rendered. It uses OpenGL display lists (one per render-chunk) as an older alternative to VBOs....


5

There are many reasons why a game may be limited to a specific framerate, and only one of them is relative performance of the API version. Let's look at two of the most simple examples. vsync can limit framerate to the refresh rate of your monitor. If you have a 100hz monitor and if vsync is enabled, you'll never run faster than 100fps. The game may have ...


5

Most perlin noise algorithms will allow you to retrieve the noise value at any given location, with something like noise(x,y,z). This makes it fairly trivial to generate noise on a chunk by chunk basis. All you need to do is pass the global position, instead of the chunk position. for(int i = 0; i < CHUNKMAX_X; i++) for(int j = 0; j < CHUNKMAX_Y; ...


5

You can't just open the jar in Eclipse. Even if you have some kind of decompiler-plugin, you will only see obfuscated code. You will need the Minecraft Coder Pack to decompile and deobfuscate the jar (as well as MCP can anyway) so you can work with the code. Additionally, if you want do develop Minecraft-Forge mods you should check out this page. Forge ...


5

First, we need to identify the square consists 4 symmetric sides, each of them of length 2*r. 1 1 1 1 2 4 x x x 2 4 x C x 2 4 x x x 2 4 3 3 3 3 As you can see, the sides are symmetric relative to center, that means we can can take one cell from each side in each iteration, one coordinate always fixed while the other controlled by offset. To make it easier ...


4

The objects in collections in Java are usually indexed starting with zero. Also, the method .size() returns the numbers of elements inside the collection. So, if the size is 1, you can only access the element 0. Not 0 and 1 like you're doing, because the element 1 do not exist. Try this: for(int i = 0; i < staffOnline.size(); i++) { // changed here ...


4

If I understand you correctly... Could you not just load the chunks in a spiral around the player? Each time you check for the next chunk to load you could start whole spiral process again (or come up with a better way to find 'missing' chunks) as this will loads the correct chunks whilst the player moves.


4

You could try to accomplish it by looping through player's inventor and checking if Nth slot in his inventory is empty, if it isn't -- the function returns false. private boolean hasItems(ItemStack item) { for (int i=0; i<=thePlayer.inventory.getSizeInventory()-5; i++) { if (thePlayer.inventory.mainInventory[i].itemId != NULL) { ...


4

The main bottleneck is storing and generating chunks on the server. Around 10 Chunks in each direction are loaded for every player, that means that if a lot of players are in one spot, it's only going to load the chunks once, but if all players spread out, it's going to load these 10 chunks in each direction for every player. It gets even worse if the ...


4

A lot of people hate on Java, but honestly, modern Java is quite good. I mean, sure javac will never be as fast as a C/C++ compiler but if you take an in-depth look on how your Java code gets compiled into what eventually gets read by the JVM, you'll see why it's "slower." Regardless, Java is a powerful and straight-forward language and I could speculate ...


4

Backward compatibility is hard work. It really limits the architecture choices you can make. When you only have your application which doesn't need to interface with anything, and you decide that it's time to make everything different than you used to do it before, it's not a problem at all. But when you need to maintain compatibility with external ...


Only top voted, non community-wiki answers of a minimum length are eligible