Catacomb Snatch design questions

Hello,

I’m starting the development of games under Java and I essentially come from the Business Java (Java EE, Spring, etc.).

I have have average knowledge in AWT/Swing.

I wanted to take a look at the source code of Catacomb Snatch (for which I proudly donated previous week-end) to help me start coding games and I have a few questions about it. I guess everything is related to performance or something like that. On top of that, they had only 60 hours, but I’m quite intrigued by half of their design choices.

  • Why doesn’t Mojang use the standard tools of AWT such as BufferedImage but uses a kind of buffer (with their class Bitmap) without going through the AWT paint/update methods? Where can I find more information about this?
  • Why did they rewrite half of AWT for this game (Keys are handled differently, for instance)?
  • Why is there no kind of Manager?
  • Why are nearly all fields public? (and broader: why is nearly none of the “good practices” ever used?)
  • Why is every art loaded at start rather than lazily?

There is probably something that explains all this, but I just couldn’t find anything about it. If such resource exists, could you point me to it?

It’s ok if not all questions find answers, I’ll try to do it myself then.

Thanks a lot in advance :slight_smile:

I wouldn’t recommend it as place to start learning since the game is pretty complex for a first game and its coded in a rush and they’ve probably had to cut several corners to get it done in time. Try something like the tutorials here.

AWT isn’t really designed for writing games (although its very possible to do so), there are several libraries out there that IMO are a better place to start (like Slick2D). AWT occasionally requires various hacks and tweaks to get working properly for games and proper fast enough rendering (especially for a fast paced game like the above).

I’d guess the above choices are mostly taken due to the time limitation and there not being enough time to clean up the code, refactor it & limit the scopes on variable and to optimise it properly (such as the loading).

Seems to be a business practice that was original started by Notch. If you go back and read his Blog, you’ll see several instances where he states that he does this on purpose because he considers accessors/mutators to be useless boiler plate. At least when your code is being used internally. If it’s going to be in an outside project/accessed by others, he can see a purpose.

Even if you look at his other code, including Minecraft (Which you can view if you’re attempting to mod it), there are several instances where “Bad coding practices” are used, because a lot of them actually work, even if they’re not good.

Because classes named ‘manager’ are incredibly bad and a sign of a poorly thought out app. http://c2.com/cgi/wiki?DontNameClassesObjectManagerHandlerOrData

Because you don’t want arbitrary pauses during the game while resources load. A jerky framerate is not fun.

Note: this was written before Orangy Tang’s answer

Thanks for the answers! But I don’t find them very useful, unfortunately.

I understand you saying me “start by doing small stuff”, but I already did that. My English is not the best and I should have chosen other words than “start coding games”. Indeed my experience in game programming is small as I’m starting but it’s not zero as well. I’m coding my game for six months now (purely casually, hence the long process), and I’ve been writing simulation renderers for another 5 years (in AWT).

I understand the factor “limited time” to develop it and I thank you for the indication of Notch’s philosophy about accessors: I read his blog and found out what he meant.

Regarding the engine, I’ll stick with AWT for the moment, not that Slick (which I also tested) is bad: I just want to start with what I know best.

In that context, I hope my questions make more sense and may actually find answers about how Mojang designed their Catacomb Snatch. :slight_smile:

I was watching this game being created and it made me want to get into game design too(Also donated for the games). From having no knowledge of game design yesterday(Although a few years of java knowledge), I now have a game loop that renders a map with a character I can control. Also noticed that Notch is a (still active?) member of this site! So thats cool too :slight_smile: Best of luck with your games!

Especially since the game has no sense of a “Loading” state. In several games, especially ones that use lazy-loading, or semi-lazy loading, there is some transition between the different game modes. Like, say in an RPG, you have loading between regions, often loading between going between “Movement” and “Battle” states. I haven’t played Catacomb Snatch, but I would assume that’s it’s game loop is sort of like Minecraft and the stuff to have come from Notch, which is mostly transition free gaming.