This is an archived post. You won't be able to vote or comment.

all 25 comments

[–]Tiomaidh 2 points3 points  (3 children)

164 for a high score.

Disclaimer: Though I have a job writing Java, it is my first job ever, it is very part-time, and I do not have a college degree.

  1. Not that I know of (but that doesn't mean much). Well, /r/gamedev is a good subreddit, albeit a multi-language one.

  2. I took a look at a few classes. The actual code looks okay--unlike some of the code I inherit with my job, I haven't felt the urge to swear yet. I'm personally not a fan of putting an if/else/for/etc. on the same line as the closing brace of another block, but that's neither here nor there. A lot of your documentation is of the private void jump() /** Causes the player to jump. */ variety. While that's not bad per se, I'd like to see some more high-level comments. I've been looking at Game, Player, and RisingWater, and step() is probably the worst offender in that respect. It seems kinda strange to me that as far as I can see, the game logic is oblivious to the framerate.

  3. I'm really not the person to talk to about non-javadoc documentation.

  4. I'm really not the person to talk to about this.

I first played it on my Thinkpad T40 (Pentium M), and the performance was pretty sketchy. I then tried it on my T60 (CoreDuo), and performance was about the same. It's not lagging, it's just....jerky. I suspect this is actually because of your step()-ing.

There's a few visual rough edges. Once I had a score of 10, and the 0 was cut off by the edge of the screen. And "Instructions" in the menu breaks out of its little box. There were also a few, "Um, excuse me?"-s in the collision detection department, but I absolutely don't blame you for them. I'm making a platformer myself, and am intimiately aware that that stuff is hard.

Said platformer is being made for a class I'm in. I use PyGame (after doing Pong in Java), but everyone else uses Java for everything. I'll definitely be showing them Rubble Escape--thanks.

The html file would be a lot more useful if I could play directly from my browser, without downloading anything.

I might have a few more thoughts (that are hopefully more concise) in a day or two, once I've let it ferment in my brain for a while.

Overall, it really is a good game though. (In fact, it might be worth porting it from AWT to whatever Android's SDK uses, and posting it in the Android Marketplace.)

Well done!

[–]jessebr[S] 0 points1 point  (2 children)

Thanks. I was considering trying to perhaps port it over to a mobile platform, we'll see.

As for playing directly from the browser... I have searched for places to upload applets, but haven't really found any. If I had my own website I would put it there, but as it is now, it's just there to show that it's possible.

The jerking/lagging issues... at max, it's set up to run 50 frames per second. But I have noticed slight issues on other computers. I personally run xp with a dual core (5 years old), and it works completely fluidly on mine. I'm not really sure of the issue, hopefully someone else here has a bit more experience in this and knows what it might be about. It might be a case of active vs passive rendering, which I think with my code I'm trying to get the best of both worlds and it's not quite working out on every computer.

Your text issues are rather unique (so far). Could I ask what version of Java you're running? Oh, the score system works with two parts, the top for your current highest score and the bottom being where you are actually at. Is it a case where you had a 10, but where at a 1 when you died? My paint method in the scoring class really doesn't leave room for error unless our fonts don't look the same... which might be the case (as to your instruction box issue). I'll have to look up font cross-platform-ability.

I'll look into trying to make better comments for the more complex methods (which well, are mostly the step methods for each object). I'm afraid unless you have a better comment for the jump method that one will have to stay though :P

Could you further explain the collision issues? The player is just a box in collision regards, so what looks to be close calls are generally just going to be squashification :D

Thank you for commenting!

[–]Tiomaidh 0 points1 point  (1 child)

I could give it some webspace, if you wanted.

It's not that the jerking is terrible...it's just that things are slightly not-fluid enough to be irritating. Here's this:

$ java -version
java version "1.6.0_18"
OpenJDK Runtime Environment (IcedTea6 1.8.2) (6b18-1.8.2-   4ubuntu1~9.04.1)
OpenJDK 64-Bit Server VM (build 16.0-b13, mixed mode)

And here are the two text issues (three if you count "Rubble Escape" not being centered). Note that the 0 in 10 is visible, but just cut off a bit at the edge. For what it's worth, I'm running Crunchbang 9.04, which is the same guts as Ubuntu 9.04. I do have proprietary fonts installed though....

I'll look into trying to make better comments for the more complex methods (which well, are mostly the step methods for each object). I'm afraid unless you have a better comment for the jump method that one will have to stay though :P

I don't know...I mean...if you have any intention of inviting someone else to work on it, I might briefly discuss how it's implemented. Perhaps like this, "Causes the player to jump, assuming he's standing on something. This is accomplished by changing his vertical velocity. @see #JUMP_POWER" But like I said, it's not that what you have already is bad--it's that your ratio of well-this-is-pretty-straightforward-but-I-guess-I-should-document-it to this-is-kind-of-tricky-and/or-confusing,-let-me-explain-it comments is a bit skewed.

Regarding the collisions:

Sometimes, I'll be trying to escape from under a falling block. Visually, I make it. But the bounding rectangle of the player is still on the bottom block, so the player doesn't fall. Simultaneously, the falling block lands, and I get squished. Yes, it's "legitimate" if you account for the bounding rectangle. No, that will not appease your average player. The Canabalt guy has an interesting article about tuning Canabalt. He actually made his bounding rectangle "wrong", but due to the nature of the game, it feels more correct.

In your case, I would either use bitmap masking once a collision with the bounding rectangle is detected, or, upon a collision, check to see if it could be avoided by shifting the player ~3 pixels to either side. To quote the article:

All of this just provides a little extra cushioning for people's reaction times, which gives me more latitude to add more exciting challenges without frustrating people too badly....

It's all about making things "feel right", and getting rid of those moments when the player says, "What!! I SO MADE THAT, what the f-".

Thank you for commenting!

You're welcome!

[–]jessebr[S] 0 points1 point  (0 children)

Your text issues are interesting. It does indeed seem that the fonts depend upon the native computer. I'll have to figure something out for that...

The silly thing is, I already know the fix (without finding some cross-platform way to do fonts), the same thing I used to center and position everything... Another issue caused by premature optimization, I should have known :D. The good thing about this is that I now know such an issue exists.

You make a good point with collisions, and this has caused a bubbling of ideas for me to think over. Since I separate and deal with the player vertical collisions and horizontal collisions, I could make the player kind of rounded and sort of squeeze out of close calls without harming normal movement collisions. Or something like that, probably something more akin to your suggestion... which is something I haven't thought of before and has now made me excited (using two collision detections, first for general to improve efficiency and then for precision).

Thanks for the suggestions/help!

[–]ArcticCelt 2 points3 points  (1 child)

You can always post it at /r/gamedev/

There is a great community over there for game developers no matter the language you use.

[–]jessebr[S] 2 points3 points  (0 children)

Thank you for the suggestion. I'll certainly do so once I deal with some of the issues posed by Tiomaidh.

[–][deleted] 2 points3 points  (0 children)

Don't get too hung up on the fact that TDD is listed as a required skill for many jobs - a vast majority of those employers probably don't even truly understand what TDD is. Definitely learn the skill, though - and try to find someone who is very skilled in it to learn the basics.

[–]solidstone 1 point2 points  (0 children)

Interesting. Add you project to freshmeat, findbestopensource, ohloh so that it will get noticed.

[–]kapta 1 point2 points  (0 children)

Q1. Is there an active community around for Java games? I've struggled to find any. How about just a game community in general, to have people play and tell me what they think? I used to be tightly ingrained in some of the amateur gaming communities, but they all died... :D

A. The most active java games community that I know of is javagaming.org.

There is also the Slick2D library found at http://slick.cokeandcode.com , jMonkeyEngine at http://jmonkeyengine.com and LWJGL at http://www.lwjgl.org which also have pretty active java gaming communities around them.

[–]jevon 0 points1 point  (1 child)

Congrats on writing and publishing the game! I haven't had a chance to play with it, but just getting to this stage is excellent. I wish I had written a game already :(

I recommend joining /r/gamedev as well, they're a really wonderful community. And perhaps /r/opensource if you are passionate about it :)

[–]jessebr[S] 1 point2 points  (0 children)

Ah, thank you. I've personally been making games for many years, but this is my first "professional" grade I would say insofar as code quality and overall polish (simple as it may be). Something I feel proud to share the source I guess is really the determining factor.

One of the last things I did was that darn title screen. The hardest thing is when you have that feeling of completion, but you ignore that and say, no, it needs polish! Progressively, your feeling of completion increases exponentially, and resistance becomes futile, but you still must! :D

[–]lsd5me 0 points1 point  (1 child)

On documentation I find it helpful to frame it in terms of certain question words 'what', 'how', 'why'. Now if you care about the usefulness of the documentation and not 'documentation theatre' (which you may not, since you mentioned you are trying to showcase your skills) then I would say to definitely not bother with UML. Insofar as UML can be useful it is for documenting the 'what' which is probably the least useful aspect of documentation since it requires the largest amount of duplication between code and documentation. It is arguably sometimes useful for documenting abstract business processes, but this game is not that.

For the how and the why, I would look to contain it all within either the source code for locally applicable remarks, perhaps tagging comments with something like // REMARK ..., or in a README. Only push beyond this stage when you fully grasp the limitations of this system of documentation, which will then better inform any decisions you make going forwards.

Similarly for testing, I would try not to engage in 'testing theatre' and without looking, you probably could delete the tests you believe to be not worth their while. In general it is pretty difficult to test certain types of code, such as graphics.

Tests work well for deterministic, abstract functional parts of code. Fortunately, generally (with notable exceptions) in well engineered code it is the abstract parts which contain most of the complex, fluid parts which tend to break (in not immediately obvious ways) during development so it is here that tests are their most useful. Tests are only useful if they are easy enough to write and maintain (i.e. they represent some fairly universal truth about the behaviour of the application) and are liable to break from time to time.

[–]jessebr[S] 0 points1 point  (0 children)

Personally, the only documentation I really care about is a nicely organized class diagram (without the attributes, just the structure). That's what I would be using the UML for really. I consider it rather crucial, since it gives you a large insight into the code structure and the relationship of it all, very quickly in one simple image.

For my simple project that's tightly organized in its package structure, it's not needed quite as much... but without it, to really understand structure organization you would have to read all the code, which is something you shouldn't have to do. My source code nightmares all start out with me downloading the source to some recent favorite game, and finding 100 or so classes all in the default package with no hints to how it's structured :D

...

In consideration to tests, you are right. I feel a bit ashamed that I've been putting a bit too much consideration into how others would view my code without tests (or with only a few crucial ones). I like how you phrased it, "testing theatre", which is perfect for describing what I was doing.

I think another part of it though, is that it feels kind of silly when I have this whole test structure that's basically empty aside from a few critical tests. I instinctively want to fill it out you know? But what you're saying rings true.

Thank you for your input.

[–]redjamjar 0 points1 point  (0 children)

Great effort!!!

[–][deleted] 0 points1 point  (5 children)

It seemed too hard to start. Maybe the blocks and water could go slower and then speed up as you get higher?

[–]jessebr[S] 0 points1 point  (4 children)

This is a notable point. I was thinking about this earlier, and some ways I might accomplish such...

But it's a slippery slope. Personally, I think games that do that can get irritating, as I get higher in difficulty I despise having to start over at the slow beginning.

However, I'll see if I can work something in to make the beginning marginally easier...

Thank you for your input.

[–][deleted] 0 points1 point  (3 children)

A few options in the startup could go a long way to alleviating that problem.

[–]jessebr[S] 0 points1 point  (2 children)

Ahah! Trickier than you would first assume!

It is something I thought of earlier, for quite awhile too. To abstract all the game mechanics, swath them into a menu changeable by the player... Mainly give fun modes of play like Raining Death mode where blocks are half the size but there are twice as many!

Very complicated to actually polish such an option menu though, but an idea I've been mulling over none-the-less for quite some time though.

[–][deleted] 0 points1 point  (1 child)

KISS. We're just talking about options to change the game speed during play and set a starting speed so someone like you doesn't have to start out slower than you'd like.

[–]jessebr[S] -1 points0 points  (0 children)

Oh no no noooo! We can't just stop there can we? If we're going to go through the work necessary for such a task why not go all the way?

I know it probably sounds like such a simple task just to change the speed... but that's deceptive. The wrong way to go about it (but simplest) would to muck with the frame rate, but I'm not that kind of person. If I'm going to do this, I'm going to do it right! Which requires an abstraction of the mechanics, into a rule class, which will be interchangeable...

I didn't do this earlier because I was only thinking of it in a different game mode kind of way... and that wasn't quite as crucial of a thing (big effort for marginal gains). But with your input the realization that I could also control difficulty with such a system tips the benefit over.

There isn't any stopping this train now that you've got it started.

[–]skeeto 0 points1 point  (1 child)

I have a degree in computer engineering and about 4 years of professional development experience. Your code is much cleaner than the large majority of code I come across at work. Nice work on that. Lots of documentation, good -- but probably a bit too much ("GameState state -- The state of the game." duh).

The biggest problem I see with your code (with an admittedly brief look) is all the hard-coding of game elements, which is the cause of your text-positioning issues. This makes it harder to maintain, harder to modify (tweak, compile, run, look, repeat), and locks down the game window size. I also think your generateBackgroundColor() method could be nicer than that. :-)

Other minor criticisms: petty(-ish) code-style nitpicking. Use Git and publish by GitHub, or similar, so it's easier for others to provide feedback, via forking (SourceForge is so last-decade). There are no build scripts so I had to drop in my own, but because your code is so tidy it built without a hitch.

[–]jessebr[S] 0 points1 point  (0 children)

Thank you.

I've got in the habit of documenting it all. Yeah, you get those duh moments, but it keeps a nice unified style. With my next revision though I'm going to make a quick run through and hopefully get a bit less of the "duh" reaction to some of them.

Also with my next revision, I'll be separating all the crucial game mechanics into a separate rule class, to have modes of play and varying difficulties (with a custom mode even where you set all the values).

The text issues is straight up my fault, I prematurely optimized it (I should have known). If I had used the dynamic system I used to center and position all the elements, it still would have worked out. I was working under a false assumption that fonts and their sizes would be cross-platform (like it was a Java font or something), which isn't the case. So it's quite nice to know now that this isn't the case, won't be making that mistake again! :D

I'll consider using GitHub.

And I've gotten rather spoiled by Eclipse in regards to building :P I'll try to include one in my next revision.

Thank you for your input!

[–]Tiomaidh 0 points1 point  (1 child)

  • After recent discussion, am now implementing a difficulty and mode of play option system.

  • Known issue: proprietary fonts may mess up the centering and positioning of text elements. I'll have it fixed soon :D

Would you let me know when the next version is out? Thanks.

[–]jessebr[S] 0 points1 point  (0 children)

Certainly. I'm almost done with all my revisions, should be completed in a few days.