• Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

Java Two small Java games by Markus "Notch" Persson

HadASpook

King Coder
Hello there, CF!

As I was scouting the web the other day for some interesting Java projects to contribute to, I came across two that not could I contribute to, but rather, mod and analyse. I present to you, two of Markus "Notch" Persson's(creator of Minecraft) previous projects: "Breaking The Tower" and "Minicraft".

Both games were written in Java by Notch, for two Ludum Dare competitions(Ludum Dare is a game jam where you have between 48-72 hours to build a game from scratch, by yourself or as a team). The first one, "Breaking The Tower", is simple: accumulate an army of warriors to destroy a tower - note that the game has no tutorial or instructions, so you need to figure out how to play it yourself. The second one, "Minicraft", is more well known as it is pretty much 2D Minecraft, with mobs, crafting/building, and an end.

There are some things to note about these games though:
  • Both games, in their original states, have no comments, therefore, you'll need to analyse the code yourself and figure out how everything fits together.
  • Minicraft can be found in two separate copies: one by Notch himself, left in its original state; and a version maintained by fans(this version contains comments in its source code).
  • Both are built from scratch, using the standard graphics libraries supplied by Java(Swing and AWT).
  • Do not redistribute the games and claim them as your own. Specifically for "Breaking The Tower", Notch does plead that you do not redistribute the game in an altered state. Really, to avoid any trouble, just don't redistribute the games.
  • You will need a copy of the JRE(Java-Runtime-Environment) to run these games. Make sure that the JRE you have is at the latest version too, as to avoid compatibility and (future) security problems.

So far, I have only taken a proper look through the "Breaking The Tower" code and it isn't too bad in terms of difficulty. As I said, you will need to piece everything together though, as no comments or documentation has been supplied.

Do have a play through the games first though before diving in so that you can get an understanding of the mechanics(be warned, they're addictive).

Have fun!(links to the GitHub repositories are below)

 
Last edited:

HadASpook

King Coder
Thanks for this, Breaking The Tower seems like quite a fun game.
You're welcome!

I played Breaking The Tower before diving into its code: got addicted to it. So far, I've only made minor tweaks to the code(changed the text colour, bigger window size, and reduced resource and population count to make the game even harder), but now I'm thinking about adding new stuff to make it more interesting. Don't know what I'll add though.
 

HadASpook

King Coder
Hello all,

I have updated the original post to include a notice for those who go to test the original Minicraft made by Notch himself: my experience with it was that the game would not run due to errors which unfortunately, I wasn't able to find a fix for. Error came after error. As a result of that, I suggest those who want to play Minicraft and mod it, play the community-maintained version; otherwise, feel free to try and fix the original and see if you can get it to work(I'll try my best in the meantime to get a fix if possible).

Update: I have found the solution minutes after posting this. I had been comparing the source files between the original Minicraft(Notch) and the community-maintained version - the only difference I could find in the files themselves were the addition of comments. Upon examining the file structure, however, I found one important difference: the original Minicraft has a folder labeled "res" whereas the community-maintained version does not and instead has all of the resources inside the source folder.

Taking advantage of this, there are now two solutions to this problem in the original version:
  1. Move all of the resources alongside into the source folder(the solution that the community-maintained version has done).
  2. Or update lines 118-119 of the original code to be:
Java:
...
    screen = new Screen(WIDTH, HEIGHT, new SpriteSheet(ImageIO.read(Game.class.getResourceAsStream("res/../icons.png"))));
    lightScreen = new Screen(WIDTH, HEIGHT, new SpriteSheet(ImageIO.read(Game.class.getResourceAsStream("res/../icons.png"))));
...
(Notice that instead of "/icons.png", it has changed to "res/.../icons.png" so that it properly points to the resources folder).

I hope this offers a solution to those who wish to use the original version but can't due to this simple error. Please let me know if there are any further problems.

Thanks.
 
Last edited:

Top