Tuesday, November 8, 2011

Will the Minecraft Forge API help resolve the current modding mess?

I thought of a small useful mod I want to implement, so I've been investigating current best practices when modding Minecraft.

Boy, what a mess.

The modding situation in Minecraft is quite chaotic at the moment.

In a January, 2011 interview with Gamasutra, Notch said:
High up on priority is a proper modding API that lets people who make mods plug into the game in a way that doesn't break when we update the game.
That never happened. Instead, in a series of three blog posts (post 1, post 2, post3) in April, Notch renounced the idea of an API, instead opting to someday require people to pay to become licensed Minecraft mod developers and download the full source code. In the meantime, Mojang would do nothing.

Due to a storm of protests, Notch quickly backed down on charging fees for mod development. But as promised, Mojang has announced nothing since then about modding. Thus the chaos.

The Wiki page on data values shows just one of the problems: block IDs are restricted to being 255 or below. That's right, it's 2011, RAM hasn't been an issue for years and yet something as important as the Block ID is restricted to a single byte!

Mods that implement new block types have to find an unused ID in this tiny space and hope that another mod or the next update of Minecraft doesn't claim it too. Indeed, the wiki's own pages provide an example of the problem; Minecraft block IDs end at 121 (End Stone), but IDs used by mods start at 98, probably because the wiki page is out of date and doesn't reflect the changed mod block IDs.

There are other IDs for items and sprites that can clash as well. But IDs are just the tip of the iceberg: in order to function, mods need to modify Minecraft's code, and these changes to the java classes can clash with other mods or Minecraft itself due to an update.

Providing an API to allow mods to hook into Minecraft game functions to prevent these clashes is the task that Notch and Mojang walked away from, and the proposed solution of allowing full source access to developers doesn't resolve it. Even with full source access it will still be possible for mods to step on each other's changes.

Full source access may even make the problem worse!

Currently, modders must process Minecraft's .jar file using something called Minecraft Coder Pack. MCP decompiles the java and replaces obfuscated class and variable names with sensible ones chosen by MCP staff members who reverse engineered the meaning of the code. But despite the heroic efforts of the MCP crew, source code that's been reconstituted through decompilation and deobfuscation is never as clear as the original.

Once Mojang allows access to the full source code, mod development will become easier since the actual source code is clearer and easier to work with, plus the tricky steps to invoke MCP's wizardry won't be needed. With this barrier to entry removed, the number of Minecraft mod developers should increase, and as it does the issue of them stepping on each other's toes will get worse.

Members of the Minecraft mod community have attempted to solve this problem themselves by writing their own APIs, but the efforts have been uncoordinated and several competing APIs exist.

In the midst of trying to figure out which community-sourced API had the most support and complete implementation, I came across an audio interview with FlowerChild of the impressive Better Than Wolves mod. I don't usually go for audio presentations such as lectures or podcasts due to the low rate of information transfer, but FlowerChild is a compelling speaker.

The interview is available both as a single long audio file and split up into several YouTube videos. While they all should be listened to by anyone interested in Minecraft modding, his explanation of the need for and merits of the open source Minecraft Forge API project directly answered my questions about the community-based APIs:

I must say that this is the best minecraft related interview I've seen for a long time. As a person who tracks minecraft moding community for a while, that was damn interesting. -miki537, commenting on the YouTube video.

I'm extremely grateful to FlowerChild for taking the time away from other things to be interviewed. He provides valuable insight into Minecraft modding—not just how to do it, but why things work that way. The metadata, as it were.

I had a chuckle when just after listening to FlowerChild's explanation of the monetary motives of some of the competing API developers to profit from downloads or donation buttons, I came across an API whose developer explained its existence by saying that it provided hooks unavailable when using Minecraft Forge. Rather than contribute to the Minecraft Forge project, this developer chose to remain solo. Sure enough, a donation button appears prominently on his download page, and he invokes his API in his plea for monetary support.

As FlowerChild said during the interview, each additional API to download increases the burden on users of Minecraft mods, as well as complicating the support issues for mod developers. Since naive users of mods have trouble installing mod files, the less they need to do it the better. By keeping his functionality out of Minecraft Forge, this API developer seeks to profit by increasing the burden on everyone else.

Back to the main topic: anyone modding Minecraft should use and contribute to Minecraft Forge. It represents the way forward to a future of Minecraft modding that best serves both users and mod developers. Nondevelopers can help too—mod users can preferentially choose mods that use Minecraft Forge, and request Forge support by mods that don't.

My hope is that Minecraft Forge can achieve the same level of success that the developer community for the WowAce library has done with addons for WoW.

3 comments:

  1. There is flaw supporting the logic of donating and obtaining Minecraft Forge. If modding API was proposed to be free, why should I spend more money trying to use mod's in a game Markus walked away from all-together? It's bad enough that I'm stuck with this half-baked game, but why can't you fan's just get in Notch's case about Modding API? The guy is lazy, but he isn't tone def.

    Convenience the lazy @#$% Swedish guy who walked away with 22 million of our dollars to make official free modding API and be done with this cataclysm of disagreement this lousy community has been having since the start.

    ReplyDelete
  2. You do realize that Forge is just another one of these competing so-called APIs, nothing more and nothing less.

    A true, proper API for Minecraft modding does not exist at this time, though there has been some early discussion about it among a few of the modders who have made great contributions to the modding community in the past(e.g. ModLoader, MCP).

    A proper API will be created after Minecraft's full release. There's no doubt about that. (But it sure won't be Forge or ModLoader.)

    On a related note, the Spout project looks very promising. I look forward to see how that evolves in the future.

    ReplyDelete
  3. Forge is currently THE Minecraft API to use, there is not another API as powerful and featured as it out there. The biggest APIs that exist apart from Forge all only do things that Forge doesn't yet.

    Spout is basically the same type of thing Forge is, an add-on to a base product (in this case, [Craft]Bukkit), so I'm not sure how you don't have the same objections to it.

    ReplyDelete