Help on an old Notch game (Herp Fortress)
Hello!
Around a decade ago, Markus Persson (Notch), the creator of Minecraft, began working on a demake of Team Fortress 2 called Herp Fortress. He developed it as a personal Java project and even live-streamed the process on his Twitch account. The streams were later archived.
After a few months, Notch canceled the project but shared the source code on Twitter.
I run a YouTube channel and was interested in potentially making a video on the game, so I decided to download the source code with hopes of compiling or running it. However, I’m not familiar with Java (my experience is in C#), so this is all quite new to me.
The first thing I did was follow YouTube tutorials on how Eclipse works (the IDE used for development). After setting it up, I tried running Herp Fortress, but it only opened a blank window. I even tried compiling it into a .jar file, but got the same result. The console output showed the following message:
From what I gather, it seems to be an issue related to loading an image file, but I’m unsure how to resolve it.
I’d appreciate any guidance or tips from anyone experienced with Java or who has worked with this source code (if there are any). Any help would be greatly appreciated!
Hike's Archive
YouTube
Notch Coding Herp Fortress [PART 1/5]
Originally streamed on February 24th 2012 on twitch.tv/notch
notch (@notch) on X
Since I totally failed to do any 0x10c stuff today, here's the entire source code for Herp Fortress: http://t.co/ok7HqcqT
Twitter
20 Replies
⌛
This post has been reserved for your question.
Hey @Realest Billy! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
the error seems to be originating from loading a nonexistent image in linr 26 of
com.mojang.herpfortress.Art
see also lines 14 and 11The thing is, the images exist, they are in the resources folder
no, it doesn't work like that
dam
Class#getResourceAsStream
loads a resource located next to the class
so if you do Art.class.getResourceAsStream("abc.png")
, it loads it from res/com/mojang/herpfortress/abc.png
if res
is registered as a resource folder
Art.class.getResourceAsStream("/abc.png")
would load it from res/abc.png
(again, if res
is a resource folder)
And that code doesn't seem like it ever workedYeah but there's footage of it online working so I don't know what's up
Did you modify the
Art
file?No
ok
so first mark
res
as a resource folder
and then remove the res
from the strings so you have things like loadAndCut("data/red.png")
alright
right click on res > build path > use as source folder
Done
Now i removed the res from the loadAndCut strings
So what now, doesn't look like anythings changed
Can you show the code and project structure again?
This is the Art.java code
oh I forgot to say that
you still need a slash at the beginning
public Bitmap[][] red = loadAndCut("/chars/red.png", 16, 16);
it works
Thanks for your help
If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
Post Closed
This post has been closed by <@1313557097564344391>.