Monday, 31 October 2016

From Survival to Creative - Five Years in Making

Earlier today I came across something that really captivated me for a moment. It was a gallery of a huge build that according to the title took 5 years to build. The link to the gallery was originally published on reddit, but has quickly gained quite a lot of popularity in only one day, over 300 thousand views and 14 thousand points. Let's take a look at what could have possibly made the imgur community push a Minecraft creation to go viral.

A 2D top-down view of the map.

The creator tells us a short story of how he started and what motivated him. Before he started the build he was playing exclusively in survival mode, but deep inside always knew that great things await him and that he was destined for something more then just trying to survive one more night in just another randomly generated world. One day he decided to take a break from survival and started building a simple castle with some tunnels underneath. After a couple of months of effort a great tragedy took place, his computer crashed during an electrical storm followed by a save file corruption. Like anyone else in his situation, he stepped back and allowed himself some rest from Minecraft. However that did not stop his restless hearth from searching to create something great, something cool. One morning he awoke with a clear vision of what he had to do. Five years later, we get a glimpse of his dream, in form of a few screenshots that certainly don't do this build justice.

The city, viewed from sky.

The build is a huge city that sprawls around a carefully designed castle. The design of the castle took inspiration from Gothic architecture and the Lord of The Rings fantasy franchise, as did the rest of the city. The city itself is divided into three sections: the fortress, the residential wing and the royal township. Each section or wing was designed with complexity and elegance in mind:

This slice of the central castle gives an idea of the level of internal complexity. This kind of detail is pretty consistent throughout the build. One of the things I really wanted to achieve was a depth to everything, such that you only ever saw the tip of the iceberg in terms of what was there. Almost every structure is somehow connected underneath with subterranean passageways, if you're lucky enough to be able to find your way there.

Notice that there is no direct pattern to how elements are designed and placed.

Another interesting feature here is the underground section of the city built underneath the caste that would appear to contain a sea of lava, and we all know you can't go wrong with lava. Not only does this creation look massive and detailed on the 'outside', but there seems to be more 'inside', or to be more precise - underground. This section is riddled with caves, passageways and structures that, in author's words: "eventually become lost in Minecraft's natural caves and abandoned shafts".

The city is literally swimming in lava, I love it!

Special attention has been placed on the 'look and feel' of things. This is unfortunately not the case with many generic builds the community stencils out these days. What matter to most, is how big, impressive or cool something is. Even though these things indeed are important to a certain degree, what is inevitably lost in the process is that spark of originality, the touch of finesse coming directly from the artists heart.

The author explains his artistic direction:
Because of my roots playing Survival, I wanted the whole thing to feel like Minecraft, as if you could be exploring the biomes and the structure just appears above the trees as you walk along. I love the way the game has its own natural environment, so I wanted that to wrap around the things I built as if it was just the algorithm regenerating around it. I'm not sure if I captured that or not, but that was the aim.

The castle blends nicely with the environment around it.

On top of everything, this map contains a custom resource pack specifically created by the author to fit the needs and wishes of his creation. With the combined power of image editing and creativity, mossy stones became columns, paintings became steely castle decorations, cakes became boxes of provisions and vanilla glass became cool. The fact that textures are as important as shapes has been proven over and over again, what is the point in building some- thing awesome if it looks like a pile of rotting manure. Minecraft textures are not very impressive in my opinion, but they do tend to be adequate enough to give you the general idea of Minecraft's artistic direction. After that it's up to you choose the right resource pack for you and paint the world as you see fit.

Now, I know what you're thinking: where do I download this thing? Unfortunately the map is not available for download yet. This could change in the future though, as the author has received many requests to make the map public. It's very likely that he's just overwhelmed with the amount of positive responses he received in just one day, that he's probably just taking the time to come to his senses. Along with many in the comment section of the gallery, I too would like to throw an epic survival session on a multiplayer server with fellow 'soarvivors', but for now all we can do is hope. And of course leave a positive comment on the original imgur post, letting the author know how awesome he is. Be sure to mention that you're counting on him to publish that map.

Hope you've enjoyed reading this article, make sure to leave a comment and share if you did. Until next time, keep on rocking those builds and have fun playing Minecraft!

Thursday, 6 October 2016

Learning to GitHub: For Minecraft Modders

If you've been following the Minecraft modding community for some time you should have noticed that when some developers release their mods, alongside the download link to the release build; they also publish a link to an open-source repository for their mod. A large majority of these link will lead you to a website called GitHub, and at this point most of you with no prior experience in these matters will just rush the back button in your browser, thinking this might be too technical for you. Well it really isn't all that difficult to understand or even do, and with a bit of patience and an open mind, you too can learn how to GitHub. Let's get started whenever you're ready.

Before we talk about what GitHub can do for you, it's advantages and disadvantages and why you should use it when developing Minecraft mods, we first need to ask the question - what is GitHub? In order to answer this question we will take a look at the word "GitHub" and break it apart.

If at any time you get confused, jump down to the section called "List of terms used on GitHub" to help you get a better starting grasp on what's being discussed.

Table of Contents

About Git and Version Control

The first word is Git. In a nutshell Git is a version control system that is used for software development. Your following question might be - what exactly is version control? Version control is a system that records changes to a file or set of files over time so that you can recall specific versions later. This means that every revision (change) your project has ever undergone will be recorded and ready to be used at any moment. Information about these revisions as well as the ability to revert your project to an earlier state of development is available to you.

Git stores your project in something called a repository, which in this instance is just a large storage of information. Most operations in Git only need local files and resources to operate – generally no information is needed from another computer on your network. This means that after you've set up your repository, you do not need to be connected to the internet to browse project history or make changes. In most cases you will want your repository hosted online. This is where a repository hosting service such as GitHub comes in. Hosting your repository online will make it available for other people to interact with. Other developers can clone or fork your repo, essentially making copies they themselves can work on.

In addition to making collaboration easier it also helps you back up your project as it is now stored on a server, so if you for some reason suffer an accidental systems crash that causes you to lose parts (if not all) of your project, you can feel better knowing that a copy of your project is safe and sound online. It works the other way around as well. Because Git is a"distributed" or "decentralized" version control system, every repository clone is really a full backup of all the data. Thus if any server dies, and these systems were collaborating via it, any of the client repositories can be copied back up to the server to restore it. You can read more about version control here.

To understand Git, it's important to understand how it handles data. Once you've made some changes to your project you want to save them. To do that in Git, you need to commit them. Committing is the process of adding your changes to the history of your repository and assigning a commit name to it. Before you make a commit you have to choose which changes you want to include in it. Ideally each commit should reflect an accomplished task, so you should choose to include only those changes that are relevant to that task, followed by a fitting description. The way I understand it, every commit is a pointer to a snapshot which is a read-only copy of the data set frozen at a point in time. Each snapshot is a locked point in time we can observe or choose to return to. This section of the Git documentation explains it in more detail. You will see how Git uses the benefits of snapshots in the following section.

Another powerful feature of Git is called branching - a process of diverging from the main line of development and continuing to do work without messing with that main line of development. You can visualise this concept as a flowing river (main branch) that splits into smaller rivers without changing it's direction or intensity. These new smaller rivers now contain all the contents of the water before branching as well as new elements inherited from their own beds. The main purpose of branching is code isolation that aims to isolate a development effort such as a bug fix, new feature or something else. They are also useful for staging branches (preparations for new project releases) and private branches (small tasks and work in progress code). Read more about branches here. If you want to know when to use them, read this.

What exactly is GitHub?

In addition to what I've mentioned earlier about GitHub being a web-based Git repository hosting service, it's essentially a code sharing and publishing service, as well as a social networking site for programmers. It includes collaboration features such as bug tracking, feature requests, task management, and wikis for every project. GitHub is mostly used for code but can be used for any other project type that can benefit from revision control and online collaboration.

One of the most interesting features of GitHub is forking. If you want to contribute to an existing project to which you don’t have write access (unable to push commits directly), you can “fork” the project. What this means is that GitHub will make a copy of the project that is entirely yours; it lives in your user’s namespace, and you can push to it. There are two reasons you might decide to fork a project: you want to contribute to the original project, but lack the write privileges to do so, or you wish to develop the project in your own vision. Once you've forked the project you can start making changes to it. If the reason you forked the project is collaboration then you will at some point in time want to tell others about the changes you've made, and possibly even see your changes accepted and merged with the original project. We can do this with a feature called pull request. Read more about them here.

As mentioned above, GitHub is a social networking site as much as it is a repository hosting service. It's a social network that has completely changed the way we work. Having started as a developer’s collaborative platform, GitHub is now the largest online storage space of collaborative works that exists in the world. I will use the words of  How-To Geek to better explain the importance of this aspect:

The social networking aspect of GitHub is probably its most powerful feature, and is what allows projects to grow more than anything else. Each user on GitHub has their own profile, which can act like a resume of sorts, showing your past work and contributions to other projects via pull requests.

Project revisions are able to be discussed publicly, so a mass of experts can contribute knowledge and collaborate to advance a project forward. Before the advent of GitHub, developers interested in contributing to a project would usually need to find some means of contacting the authors, probably by email, and then have to convince them that their contribution is legit and they can be trusted.

It's important to note that you are in no way forced to use GitHub if you want to collaborate on a project over the internet using version control system. You are free to choose other services, the most prominent being BitBucket that allows unlimited public and private repositories, a service that GitHub unfortunately does not provide. The most important reason why you should choose GitHub for hosting your open-source Minecraft mod project is the ability to easily network with other Minecraft mod developers. There is also the full compatibility with Git and numerous other reasons, but the former one remains most important.

List of terms used on GitHub

Here is a quick list of words you will frequently see on GitHub,  followed by an explanation. This list was taken from a great user-friendly tutorial I found online called GitHub For Beginners: Don't Get Scared, Get Started.

Command Line: The computer program we use to input Git commands. On a Mac, it’s called Terminal. On a PC, it’s a non-native program that you download when you download Git for the first time (we’ll do that in the next section). In both cases, you type text-based commands, known as prompts, into the screen, instead of using a mouse.

Repository: A directory or storage space where your projects can live. Sometimes GitHub users shorten this to “repo.” It can be local to a folder on your computer, or it can be a storage space on GitHub or another online host. You can keep code files, text files, image files, you name it, inside a repository.

Version Control: Basically, the purpose Git was designed to serve. When you have a Microsoft Word file, you either overwrite every saved file with a new save, or you save multiple versions. With Git, you don’t have to. It keeps “snapshots” of every point in time in the project’s history, so you can never lose or overwrite it.

Commit: This is the command that gives Git its power. When you commit, you are taking a “snapshot” of your repository at that point in time, giving you a checkpoint to which you can re-evaluate or restore your project to any previous state.

Branch: How do multiple people work on a project at the same time without Git getting them confused? Usually, they “branch off” of the main project with their own versions full of changes they themselves have made. After they’re done, it’s time to “merge” that branch back with the “master,” the main directory of the project.

Use this list as simplified references to what these terms mean. They are not meant to complement your lack of knowledge or understanding, but help ease your learning curve.

Setting up Git

Now that you are introduced to the basics of what's what, it's time to actually set things up. GitHub has a very simple article on how to do this here. I will try to condense and focus what is written there to the best of my abilities. I will also assume that you have no prior experience with Git and currently feel a bit uncomfortable using the command line, so we will use GitHub's official desktop client

You should download and install the client now (note that the client will automatically install Git and keep it up-to-date for you, so no need to worry about that). After the client is installed we will proceed with setting it up. If you still do not have a GitHub account, you should head to GitHub's website and create a free account, you will need that to authenticate. The process is very straightforward; we only need to register our name and email so we get proper credits for our commits, and authenticate our client to GitHub so we are not asked for our username and password every time we try to push or pull our changes. 

Open your client, find and click the cog symbol in the upper-right corner of the app. Choose "Options" From the available context options that have appeared. Enter your name and email under Configure git.

Configuring Git from the GitHub Desktop client

it doesn't matter if the name is your real name, your nickname or something else, Git only wants to know who to credit for the commits pushed from this client

Next up, we should authenticate to GitHub. In the client options find Accounts and choose Add account. Now simply enter your GitHub username and password in the appropriate fields. Don't worry, your information should be safe, unless the information is somehow sniffed out by a world class hacker, in that case you're screwed.

Authenticating to GitHub from the GitHub Desktop client.


Congratulations, you've successfully set up Git and GitHub! You should take a moment to pat yourself on the back and take a few minutes to relax. What's up next? That's entirely up to you. If you already have a mod project you're working on, you should create a new repo, clone it and dump your mod files there. If you are interested in contributing to other mods WIP mods out there, take a look at this list on MinecraftForum. Once you've found an open source mod in development you like that has a repository on GitHub, fork the repo and start contributing. And last but not least, if you have no idea what to do, I suggest reading a tutorial I wrote about Getting Started With Minecraft Modding.

Thank you for taking the time to read this. I hope it helps you out on becoming the best modder you can be. If you have the time, be sure to leave a comment and say a few words. As always, don't feel shy to share this article with people you think might benefit from it, and keep in mind that more articles are on their way. In the meantime, happy modding everyone!

Sunday, 28 August 2016

Getting Started with Minecraft Modding

Greetings, fellow Minecraft players! So you've finally decided to try your hand at some mod dev stuff? Great, you will not regret it, I promise. Modding is difficult, takes a lot of time and energy, but is definitely worth it.

Welcome to modding minecraft! We modders have a lot of control over Minecraft, but there's a lot of code and beginning can be overwhelming. But still, creating your own blocks and adding your own functionality to Minecraft is quite a liberating experience! If you don't like a facet of the game, change it! If you want more content, you can add it!"

This article is a guide or tutorial of some sort that is intent on showing you how to get started developing your first very own Minecraft mod. Once you're done reading this article you should be able to set up your development environment, install Forge, interact with Git repositories, import your mod in Eclipse as an independent project and run your mod directly from Eclipse with relative ease.

This article was written for version 1.10, however I believe that you will have no problem applying it to other recent versions including 1.8 and 1.9. Also, many of the concepts you'll learn here will be very useful to you for modding in general.

Table of Contents

This guide is divided into the following sections:

Use the links to easily navigate through the article and bookmark individual sections.


Okay, let's get started. Before we can go into writing the actual code you will have to download and install some software. Here is a list of prerequisites with descriptions and download links:

  • Java SE Development Kit (JDK) - Includes the Java Run Environment, plus tools for developing, debugging, and monitoring Java applications.
  • Eclipse IDE (for Java Developers) - The development environment we will be using in this tutorial. If you're using another IDE, you might have to configure things differently.
  • Minecraft Forge MDK - Minecraft modding API that is used to interact with Minecraft code, develop and package our mod. Always choose the recommended version.

First off, you should create a new folder where all your mod development files will be located, you can call it something descriptive like "MinecraftModDev". Inside that folder create a subfolder called  "Installation Files" and move all the files you've downloaded (JDK, Eclipse and Forge) here. The reason we are creating this subfolder is to have an offline backup of these files in case you need to repeat this whole process from scratch.

Now, onto the first point of the list, installing the JDK which should be a fairly simple job (remember to write down the installation path). After the installation is complete we need to set the JAVA_HOME variable to the installation path of our JDK. This will let Forge (and other applications) know where our Java is located. This is a short and simple how-to on how to accomplish this task.

Note: you might need to restart your computer to finalize this step.

Second step is to locate the Eclipse package you downloaded (make sure you downloaded an offline installation package for Java Developers). From the link I provided you the package should be a zip file containing the full program without the need for installation. Just extract the zip file and move the extracted folder wherever you see fit. Since the program is not installed in Windows registry, a useful thing to do would be to create a shortcut of the program and maybe even pin it to Start Menu for ease of access, however you don't have to do this.

Setting up Forge

Now that we have our IDE it's time to set up Forge, so first and foremost it's important to understand what Forge really is. Minecraft Forge is a modding API (Application Programming Interface), which makes it easier to create mods, and also make sure mods are compatible with each other. You can imagine it as a bridge between us and Minecraft's source code, it helps us interact with it. Now we can set it up, and the best place to find out how to do that is the official Forge documentation. Here is the link to the instructions on their website. The instructions are fairly simple and you should be looking at your Forge project in Eclipse in less then few minutes. Once Forge is done installing move it's folder into the root development folder we created earlier.

One of the steps in Forge's documentations tells you to “open up a command prompt in the folder you created”. To do that with ease, right-click that folder while holding shift and select the open command window here context entry.

About GitHub

What is GitHub? GitHub is a web-based public hosting service for Git repositories. Now what is Git you might be asking yourselves. Git is the most popular version control system used for software development. Version control System (VCS) is most simply put, management of changes to documents. They are commonly used by word processors (e.g Microsoft Word) and spreadsheet software (e.g. Microsoft Excel) as well as most bigger collaborative projects today.

Every time you make any changes (however small they might be) to your project, you are given an option to create a new version of your project, a version that contains those new changes. That version is stored in your repository both offline and online so all members of your development team always have a secure backup of the whole project. In addition to this, you are able to view the changes made in each revision in detail as well as revert your active code to an earlier project version. Not to mention such features as branching, stashing, forking and pull requests which are immensely useful. If you've been an active developer for some time and have never heard about this concept then this will change they way you look at code forever. Here are some good reasons why you should use version control system in your development environment.

For more information about GitHub, what it can do for you, and how to use it, read a dedicated article I wrote about this: Learning to GitHub: For Minecraft Modders.

Although it's not strictly necessary to set up your project in an online repository on GitHub, I would strongly recommend it. It's a great way to make your development effort more organized and efficient, and I've already mentioned the collaborative element in all this. It might be important to add that most other Minecraft mod developers use GitHub as well, which makes working there that more interesting for us.

To set up your project in a repository, visit GitHub and create a free your account. Next thing you have to do is download and install a Git GUI client. The most simple one I know of is GitHub Desktop (for Windows 7 or later) so I would recommend going with that. If you're interested in something more advanced you can take a look at this list.

For the purpose of this guide I've decided to create a new generic mod (the name was borrowed from Havvy's generic mod) and hosted it in a repository on GitHub. You can find the repository here.  What I want you to do now is visit that repository and clone (create a local copy) it to your computer using GitHub Desktop you installed earlier. I usually keep all my repositories in Documents\GitHub, but you can store yours wherever you want. If you are not sure exactly how to do, that don't worry, you can watch the instructional GIFs linked in the end of the article.

External Project Dependencies

One more thing we need to do before we can import the generic mod project in our Eclipse workspace. The following steps will explain how to do an independent mod setup. For this setup we only need Forge for it's two meta files, after that we can freely delete it. There are three files that we need to move to your mod root folder. The first file is called .classpath. Eclipse uses this "meta"file to locate all project external dependencies, which are basically all Minecraft and Forge classes you are going to be interacting with. Without them your mod is completely blind. The second file is called .project, which is used by Eclipse as a project description file that describes that project. The third and last file is called build.gradle, which is essentially a set of instructions for building a gradle project. Now, go to your Forge root folder, copy the those three files and paste them in your mod root file. Now open the build.gradle file with your favourite text editor (I use Notepad++ because it's just awesome) and edit the following lines to look like this:

version = "1.0.0"
group = "user.genericmod"
archivesBaseName = "genericmod"

Now we're all set to import the mod with Eclipse. Fire up your Eclipse IDE and import a new gradle project File → Import → Gradle - Gradle Project, then click Next. Enter your project root directory as the root directory of your mod (where your mod project is located on your hard drive), click through Next until the end, then click Finish. Eclipse will then start synchronizing our gradle build with workspace and ask you if you want to "Overwrite existing Eclipse project descriptors", always choose overwrite here. In case your JRE System Library is not set to the latest version of Java SE you're using (that would be "JavaSE-1.8" in my case), make sure to edit your Java build path by right-clicking on your project in package explorer and navigate to Build Path → Configure Build Path and edit the execution environment of the mentioned system library under "Libraries" tab. Congratulations, you've just successfully set up your first mod with Forge! If you had problems completing this step you can watch the instructional GIFs linked in the end of the article.

The reason I did not go into explaining what Gradle is and how to fully use it, is because I lack the knowledge to do so. I searched a long time before I could find some relevant information on how pull this setup off. This is the 'how-to' article I used to accomplish this.

Run Configurations

There are two amazing things I didn't know when I just started modding Minecraft. Amazing thing #1: with the use of Gradle we're able to run an instance of a Minecraft client and server directly from Eclipse with both Forge and our mod loaded inside. Amazing thing #2: is that we can actually run Minecraft interactively while watching the source code and the variables during the execution. This allows us to write our code 'on the fly' when trying to correct problems. Without debugging, mod development would be a long and tedious process that only few would have the patience and dedication of doing. Code debugging is unfortunately out of the scope of this article, so feel free to read more about Java debugging with Eclipse here. Meanwhile we should concentrate on trying to figure out how to set up run configurations.

In order to run our mod from Eclipse, we need to create a new run configuration. To do that, right-click your project in the package explorer and navigate to Run As → Run Configurations..., then select "Java Application". Right-click the category and choose New. Name the new configuration something like "Client_Launcher" (make sure it's not "Launch_Client" as Forge uses that name) and enter GradleStart in the Main class field. Click Apply, and after that Run. Eclipse should start booting up the new Minecraft instance and you should be seeing the console log start to fill up.

If you get an error, please let me know in the comment section and I will try to help to the best of my abilities. Again, if you had problems completing this step or you are more of a visual learner, you can watch the instructional GIFs linked in the end of the article.

Pro Tip
After running build.gradle and the Java application from Eclipse you will end up with a lot of files in your root mod directory that are cluttering our package explorer window. To remove these files from view left-click the small arrow (pointing down) located in the upper right corner of your package explorer, select "Filters..." option and check the "Non-Java elements" checkbox.

The Conclusion

If you followed this article properly you should now be left with a fairly good understanding of how to set up your Minecraft development environment from scratch.

One last suggestion; join your fellow developers on the official Minecraft Forge forum and take a look around, there is much to learn from there and the community is very helpful and kind... most of the times.

Keep in mind that I am not an expert of any kind on this topic, so suggestions and corrections are most welcome. If this article helped you in any way please leave me a comment with your impression, it helps keep me motivated when I see my writing is actually helping people out there. Also don't feel shy to share this article with people you think might benefit from it.

Here is the album of instructional GIF's as I promised, although I apologise for the GIF sizes. To increase their size so that the instructions will be more visible, right-click the GIF and select "view video".

Friday, 26 August 2016

Hello World of Minecraft!

Greetings, dear visitors and welcome to a new blog of mine that will talk about the vast and amazing world Minecraft. The idea first started with only having mod development in mind, but I can already think of a few other idea to write about. From the modding aspect of this blog, I hope that with time it will hopefully turn into a quality repository of development news, tutorials, guides and how-to's. So if you're just starting out (or are thinking about starting) exploring the wonderful world of Minecraft mod development, you're in the right place! For all the end users out there, don't worry guys, there will be plenty of other stuff as well (survival gameplay, world building, challenges and more).

I've been a semi-active Minecraft developer for the last year or so which makes me a slightly experienced newbie, and even though I've spent countless hours navigating Forge classes and reading various tutorials online, I still get confused about a lot of stuff. Let's not forget about needing to bookmark all those websites containing information essential to developing a functional mod, because if you decide to take a longer break from coding you know you probably aren't gonna remember a thing about setting up your mod's framework. New and aspiring Minecraft developers sometimes get overwhelmed with the amount of information they have to sift through to be able to properly set things up to get simple things working. For all of the reasons above I've decided to start writing articles intended to help you truly make Minecraft your world. Note that I am by no means a master in this area of expertise, but as I've said, just an experienced newbie. So even though I put considerable amount of time into research and testing you should take all technical information I provide with a grain of salt. I would also really appreciate any advices, corrections and tips from more advance developers.

The Minecraft player side of me has been around since the 1.6 update, and I've mostly played survival since. I've tried building stuff here and there and I love to be able to be creative in that way. The only thing that bothered me was the overall ease of the whole process. Infinite resources, super fast mobility and no danger at all. This is the main reason I like to be creative in survival mode. Building a huge castle, creating new wonderful caves or even something more daunting like a floating island of treasure; accomplishing all these things feels much more enjoyable to me when there is a dose of challenge involved. This means that you will mostly get to see creative content done the hard way. I say 'mostly' because my friend Ada loves to be fully creative in Minecraft, (without the restraints of survival) so her small creations are sure to end up here.

That's about all I can think of writing for now. Thank you for taking the time to read this and I hope I you decide to stick around. I can't promise future content will be something you'll enjoy, but it's definitely going to be interesting, and most importantly, it will be unique.