I first tried Java many years ago and have tried it on and off since then but never liked it much. I have just started again with Java 5 and this time I like it. The idea of generics and auto-boxing were huge improvements. Now I spend my days in Java for my job, so I’m very familiar with it at this point. My decent sized projects are below, at least the ones I can post (can’t post work stuff, obviously).
Gravitoids
A simulation of gravity and AI/Evolution. For more, see the Gravitoids page.
Pond Game
Pond Game is a simple game made in the classic ’80s style. It should be easy to pick up. My idea was to try to make a game like you’d find at PopCap. The game has the same simplicity, and I’m hoping it will have some good depth, but the polish is missing. Other than that, the game is finished. I don’t intend to update it more. Took me a week to make.
So here is the idea so far. You are a frog on a bunch of lily pads. You hop from pad to pad eating each fly. After you jump off a pad, it disappears. There are sick/wilted lily pads (they have yellow spots for now) that won’t hold your weight. If you jump on them (or in the water) you are dead. We’ll say the pond’s turtle ate you. But you get your revenge because the turtle hides under the wilted pads, but will support your weight if you happen to jump onto him. He’ll go hide under a new pad after you jump off.
That’s it. Relatively simple. For pure eye-candy reasons, there are four fish in the bottom of the pond swimming around. They serve no purpose other than to amuse me. You move with the arrow keys, and can quit with Escape or Q. The mouse does nothing right now.
If you’d like to try the game, you are free to download the JAR file and run it. Requirements aren’t very high at all, but you must have Java 5. Once you’ve got that, you can just run it. You should be able to double click the game (JAR file) to run it. If you are on OS X like me, you have to go to a command line, give the path to the Java 5 VM and the correct options to run the file (”/path/to/java5/java -jar pondgame.jar”), but the game works fine.
Development log (in reverse order, courtesy of BZR):
- All sliding related bugs are now fixed. We should be just about done at this point.
- Added a ‘Game Paused’ message when paused.
- Slowed the pads down a tad. We have problems killing the wrong pad during sliding, and problems with pads spawning under a slide. Those seem to be the major issues.
- The frog now slides too, but there are bugs in the code causing lily pads to get stuck part way, and the frog to be able to/not able to jump when he shouldn’t/should.
- That last update dropped CPU usage by about 20% on this Mac, and raised my frame rate by 6 or 7 FPS. What WAS THAT WATER CODE DOING???? Oh well. The frog slides now, but jumping during a slide doesn’t seem to work right.
- Changed the water to just fill a rectangle. Will have to change back (it’s still there, just not used right now) if we want to go back. It does things under 1ms most of the time instead of 30.
- The sliding code works right, but the frog doesn’t slide. Just have to add that and things will be almost done.
- Code to test if the pad would slide works correctly.
- Accidentally commented out the drawing of the fly. Oops.
- Did tons of testing. Found out it was taking WAY too long to render the water. By removing pointless calculations in the loop (which Java should have optimized out anyway) I boosted my frame rate almost 10 FPS, and cut CPU usage at the same time.
- Wrote an unused quick draw function for the lily pads. We don’t use it because it is actually 1/2 FPS SLOWER than the non-quick version. Too bad we have to deal with threading, otherwise it would be faster.
- Improved the fish code to reduce the number of Sin and Cos calculations. Improved the framerate a tiny bit.
- Updated the fly code to save a tiny bit of computation, I’ll be looking at the fish code next.
- Made the frog jump smoothly between pads, but it doesn’t look that good. Might look better with an extra frame (frog with legs out) or with a higher framerate. For now, the frog’s speed is set to 32 so it looks just like it did before I implemented all of this.
- Updated the lily pad code so that they should be able to slide. The lily pad manager is ignorant of all of this. Next up I intend to make the frog’s movements smooth and the give him the requisite sliding code. After that, implement the slide.
- Fly now flies into the scene correctly. Stupid trig. Took a while. Seems to work just fine now. Might want to adjust it later so the fly can’t spawn right next to where he is going.
- Fixed all turtle problems, and made it so the player can no longer move when dead.
- Fixed the freezing bugs. It was caused by being stuck in a while loop where we never changed the variable we were checking (oops).
- Added some debugging messages. The turtle problem has been found, but I need to identify a way around it.
- Added Fly.java. Apparently I forgot to do that earlier. Oops.
- The turtle is working mostly now as a lucky safe spot, but if you jump from turtle to turtle, you die.
- The turtle is working mostly now as a lucky safe spot, but if you jump from turtle to turtle, you die.
- Added the turtle (bill) who randomly hides under wilted lily pads.
- Tweaked things, like making sure the fly doesn’t spawn under the frog.
- Fly moves around and only lands on good lily pads. The frog always starts on a good lily pad. Still need that tweaking of the growing logic. Also made a new turtle graphic (but I don’t know what the turtle is for yet). Of course, the graphics aren’t in this system so you can’t see it.
- Added the fly (named joe in the code), but he doesn’t get actually used, just drawn.
- Made the frog start in the middle of the play field. That’s it.
- Lilly pads grow back now, but it could probably use some adjustment to the frequencies and such to make sure a minimum number is maintained and we don’t grow more if we are over some maximum number.
- Added scoring code. Need to add the fly and make the lily pads grow back.
- Fixed an error in the makefile.
- Wrote the Frog class and edited the makefile to be able to make a jar file for us.
- Frog moves correctly and is drawn correct, lily pads are killed correctly, and the frog dies when he lands somewhere he shouldn’t.
- Fixed frog class drawing behavior.
- Added the frog class. But drawing him east doesn’t work, and I expect that drawing him west doesn’t work either.
- Made LillyPadManger work, it’s added to the PondPanel. I suppose the frog is next.
- Wrote LillyPadManager, updated makefile. Still haven’t tested this stuff.
- Added LillyPad class and modified the MakeFile, haven’t tested it yet though.
- Added a make file so I don’t have to keep using those long command lines to Java5.
- Made the fish share one image, and changed the frame rate to 30fps to cut down on CPU usage.
- Initial import, right now little fish swim around.
Scheduler
Scheduler is a simple little program to make my life easier. I’ve always hated trying to figure out a schedule for a semester. My school doesn’t offer any help, just the list of classes. This left it up to me to draw diagrams to try to see what would conflict with what else and it took a long time.
Around the start of the year, I figured out that I could use transparencies to make things easier, but that is still a hassle. The solution was obvious: use a computer. It took me until around now to do it. So in the last two weeks, I have been making Scheduler. Since the first “version” has been finished, I thought I’d put some information about it up here.
The program (at this point) simply reads a list of classes and sections. You click the courses that you want, click the calculate button and it shows you the schedule possibilities. The problem is that right now it only shows you things with ALL those courses, so you must know exactly what you want. That’s something to fix in the next version.
This is the first program I’ve ever done with a GUI in Java and I must say for all I’ve heard Swing is pretty nice. I’ve seen worse. If you are interested in trying it, you can download the JAR file and give it a try. You will also need a datafile (test file here) in the same directory. If things aren’t perfect, the program will bail. You’ve been warned.
Enjoy for now.
–Update–
This update is actually a bit old as I post this, but I basically rewrote this program for my Senior Project. Instead of being a hack using a simple flat text file, the re-write had no bugs, used a database accessed over the internet, and I think it is actually being used to help students at the school I graduated from.
