User Name
Password
AppleNova Forums » GamingNova »

MC: Mojang teams with Bukkit devs to improve modding support


Register Members List Calendar Search FAQ Posting Guidelines
MC: Mojang teams with Bukkit devs to improve modding support
Thread Tools
SpecMode
Wait what
 
Join Date: Feb 2005
Location: El Dorado County, California
 
2012-02-28, 12:03

Like the title says, the Bukkit devs are working with Mojang on a new server API to support modding, which will then somehow be extended to the client. In the shorter term, though, Mojang will be working with the team to make sure Bukkit is compatible with 1.2 so we shouldn't have the usual long wait for mod support after the new version is released.
  quote
Brad
Selfish Heathen
 
Join Date: May 2004
Location: Zone of Pain
 
2012-02-28, 13:41

ABOUT TIME.

More details, skipping the history and gushing and just getting to the meat of it:

http://www.mojang.com/
Quote:
The plan is to build a fresh server API, and then extend it to support client-side modding (in one way or another). We will try to make it easy for bukkit users to convert if they wish to do so, but backwards compatibility is not guaranteed. We will, however, help bukkit to be compatible with 1.2, to avoid having a long gap while you wait for the official Minecraft server to catch up.
http://forums.bukkit.org/threads/buk...chapter.62489/
Quote:
When discussing the possibility of a modding API publicly, Mojang was concerned that they would be unable to provide the community with a suitable and powerful enough solution and we honestly feel that our experience building Bukkit will help them do so. Thanks to our work with Bukkit, we have a years worth of experience, failures and lessons to help us develop a proper modding API and intend to do whatever it takes to produce one that satisfies the needs of the community. Now that we have an opportunity to design the official Minecraft API, we intend to make it a suitable replacement for Bukkit, if not a significantly better one, while bukkit.org will remain a community for modders for the foreseeable future.
I've thought for a while that the solution should be to simply replace/merge MC server proper with Bukkit server, and then have a single server code base going forward. It's immediately apparent to anyone who looks at the code that it would take ages for Mojang to catch up and add all the hooks that Bukkit currently supports.

I wonder how much of the new API will actually be cherry-picking bits from Bukkit versus creating whole new APIs. At the very least, writing new APIs should be SIGNIFICANTLY easier without dealing with the obfuscated code. Though, I wonder if this means the server will be going closed-source and reobfuscated…

The quality of this board depends on the quality of the posts. The only way to guarantee thoughtful, informative discussion is to write thoughtful, informative posts. AppleNova is not a real-time chat forum. You have time to compose messages and edit them before and after posting.
  quote
709
¡Damned!
 
Join Date: May 2004
Location: Purgatory
 
2012-02-28, 17:24

Even though I'm a code dummy (unlike Robo) I'm happy to see the Bukkit devs getting some recognition (and hopefully some decent pay now they're a part of Mojang). That we put off moving to new worlds until they'd finished their secret voodoo speaks volumes.

That said, I really don't understand what Bukkit is other than allowing us to /tl and /tp.

Maybe, if you get in a mood, Brad, you could give us the tl;dr version of what Bukkit does and why it's such a big deal?

So it goes.
  quote
turtle
Lord of the Rant.
Formerly turtle2472
 
Join Date: Mar 2005
Location: Upstate South Carolina
 
2012-02-28, 22:50

I'm looking forward to this new support. Things will/should be less buggy with mod support.
  quote
Brad
Selfish Heathen
 
Join Date: May 2004
Location: Zone of Pain
 
2012-02-29, 00:29

Quote:
Originally Posted by 709 View Post
Maybe, if you get in a mood, Brad, you could give us ... what Bukkit does and why it's such a big deal?
Gladly!

edit: I went a little overboard. You were looking for a tl;dr version. Here it is.

TLDR:

Bukkit allows you to add plugins that can completely change the behavior of many parts of the game. Without Bukkit, Minecraft server is virtually no different from single-player Minecraft aside from the multiplayer aspect.

That said, let the rambling commence.



Minecraft multi-player server is little more than the standard single-player game that you can play alone. On a server, you really only get two additional features: chat and "op" privileged status. Op (short for operator) is a very rudimentary administrative role. The op can ban players, pardon banned players, give resources (by opaque numeric IDs), give XP, change the time and weather, teleport players, change player modes between creative and survival, and shut down the server. That's it. No más.

Bukkit aims to greatly expand that functionality. Bukkit is a fork of the Minecraft server that adds APIs to the server. The Bukkit developers took the source code for Minecraft server (I'll explain how later), modified ("forked" or "branched") key parts of the code, and repackaged it into a new executable program. "API" is short for "Application Programming Interface" and (in this context) is just fancy talk for places in the server where a plugin can attach new code while the server is running.

What kind of APIs are there? Bukkit provides two types basically. One is the "command" API that lets a developer write whole new commands (like "/wwarp world_bp"), and the other is the "event listener" API that lets a developer's plugin "listen" for something to happen (such as a player going to sleep in a bed) and then cause something new to happen (such as restoring the sleeping player's health).

The APIs that Bukkit added to Minecraft server allow a plugin to do lots and lots of things that wouldn't be possible in the regular game. There are "economy" plugins that enforce fair trade and buying/selling among the players. There's the popular "lightning-shooting" plugin. There's many-world teleportation support ala my SimpleWorldWarp. There are plugins that can alter the terrain shape or change the types of trees that grow. There are plugins that change what blocks drop, how much damage mobs can cause, and effectiveness of your tools. Etc etc.

Here's a list of events a plugin can "listen" for... just in the "Player" category:

Quote:
PlayerAnimationEvent, PlayerBedEnterEvent, PlayerBedLeaveEvent, PlayerBucketEvent, PlayerChangedWorldEvent, PlayerChatEvent, PlayerDropItemEvent, PlayerEggThrowEvent, PlayerExpChangeEvent, PlayerFishEvent, PlayerGameModeChangeEvent, PlayerInteractEntityEvent, PlayerInteractEvent, PlayerInventoryEvent, PlayerItemHeldEvent, PlayerJoinEvent, PlayerKickEvent, PlayerLevelChangeEvent, PlayerLoginEvent, PlayerMoveEvent, PlayerPickupItemEvent, PlayerQuitEvent, PlayerRespawnEvent, PlayerShearEntityEvent, PlayerToggleSneakEvent, PlayerToggleSprintEvent, PlayerVelocityEvent
None of this is normally possible in Minecraft. Bukkit makes all of this possible.

...

Some extra nerdy bits… how does Bukkit make this happen?

Minecraft is a Java app, and similarly the server is also a Java app. Tools exist that developers can use to "decompile" Java apps into editable source code. Mojang (and other closed-source developers) realized this, and they run their source code through an "obfuscator" before compiling it into an executable Java app. Obfuscated code can be decompiled, but it's a nightmare to read as a human and figure out what it means.

For instance, here's an actual obfuscated method from the Minecraft server:
Code:
public fs a(int paramInt1, int paramInt2) { if (this.c[paramInt1] != null) { if (this.c[paramInt1].a <= paramInt2) { localfs = this.c[paramInt1]; this.c[paramInt1] = null; i(); return localfs; } fs localfs = this.c[paramInt1].a(paramInt2); if (this.c[paramInt1].a == 0) this.c[paramInt1] = null; i(); return localfs; } return null; }
I have no idea what that does! All of the variable and class names are short jibberish names that are almost impossible to decipher.

Almost.

In software engineering, there are common idioms and design patterns that virtually every developer will use. There are best practices for programming games, like how to implement gravity physics, how to determine 3D line-of-sight, etc. A trained eye can pick out a few of these patterns in the code, rename a few of the obfuscated names, and suddenly you're a small fraction closer to having an understandable pile of code.

Through lots of investigating and debugging and sheer trial and error, the Bukkit devs have un-obfuscated some key parts of the server code to actually be legible. Once they have legible code that they understand, then they start modifying it, adding small bits of code called "hooks" that create the API that allow plugins to inject new code.

Why does Bukkit's official relationship with Mojang matter?

Until now, every time a new version of Minecraft server is released, the Bukkit devs have to scramble to catch up. Each new version is re-obfuscated in a different way. So, a method previously called "xfdf" might now be called "affa". This means the Bukkit devs have to mix and match new and old code to get a working product again. That can be a painstaking process, and bugs can arise as a result from imperfect merges.

Also, only a small fraction of the server has been successfully unobfuscated. There are large swaths of Minecraft/Bukkit code that still look like that snippet above. This means that there are lots of areas of the code that don't yet have API hooks that could have them. The EntityCreeper.java, for instance, has no API for adjusting the "fuse" for the creeper. I'd love be able to adjust the fuse since it seems so much shorter in SMP than SSP. Not possible without a lot more work.

Having access to the full unobfuscated codebase means the Bukkit devs don't have to scramble with each new version, and they get a clearer understanding of where and how they can add new APIs. It also means they can clean up some of the less-optimal bits that they had to commit in order to work around weird behaviors in the server they couldn't figure out or change.

tl;dr? Scroll up.

The quality of this board depends on the quality of the posts. The only way to guarantee thoughtful, informative discussion is to write thoughtful, informative posts. AppleNova is not a real-time chat forum. You have time to compose messages and edit them before and after posting.
  quote
Posting Rules Navigation
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Post Reply

Forum Jump
Thread Tools
Similar Threads
Thread Thread Starter Forum Replies Last Post
iPhone 3.1 beta 2 released to devs Justin Apple Products 2 2009-07-14 19:40
iPhone 3.0 beta 4 released to devs Justin Apple Products 2 2009-04-29 13:41
iPod Extreme Modding. I WANT. Hassan i Sabbah Apple Products 6 2007-03-20 22:50
Modding PB keyboard into an external USB one. Satchmo Apple Products 5 2006-12-30 10:53


« Previous Thread | Next Thread »

All times are GMT -5. The time now is 17:14.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004 - 2024, AppleNova