I am nearing the end of my summer project. This is a clone of Pacman written in Java. I think I will stop implementing new features. Just clean up the code. Fix some bugs. Package the thing and call it a summer.
Recently I did a bad thing. I deleted all my Java files. I wanted to delete all my class files. That will teach me to try to compile from the command line. Damn. At least I had a backup that was a week or two old. It still irked me.
Some buggy object code had the game crashing when exceptions were thrown. Now we still need to hunt down the root cause of those bugs. However I managed to keep things running by validating parameters passed into my functions. Prevents evil access problems.
Next thing I might try to slip in there is better timing for the action in the game. Right now I just sleep a hard coded number of milliseconds based on how much processing I figured I expended to render a frame. However I really should just poll the clock to figure out how long to sleep.
I read an article that surveyed what technologies Java developers were using. Hey. I want to keep up with the Jones. So I am keeping an eye on the top tech in a number of areas. I write them down here so I don't forget.
JUnit for testing.
Eclipse as your IDE.
MySQL or Oracle for the database.
Hibernate is your ORM.
MongoDB for NoSQL.
Jenkins for CI.
Maven to build.
SonarQube/FindBugs/Checkstyle for code analysis.
Nexus to hold artifacts.
Tomcat app server.
Spring MVC is your web framework.
Scala is your next language.
Java8 is coming up.
Okay. Time to get busy making sure I got these technologies under my belt. You got to work with the best, or at least the most popular. Shout out to the makers of JRebel, who I assume came out with the report ranking the technologies.
This week we are taking our video game to the next level. The prototype works good. I decided to make a number of noteworthy additions, including sounds. I had used sampled clips before in Java. I even knew the libraries I needed to include.
So Pacman chomps on a pellet. The game is supposed to make this wakka-wakka sound. I got an audio file that has the sound. Just got to play it each time Pacman goes over a pellet. The first time I tried it out I heard nothing. I figured this could not be right. I played sounds before for my last game.
Then I looked at my game loop. For now we are settling for choppy animation until we get all the mechanics down tight. To prevent the game from running too fast, I sleep() for a second each iteration through the game loop. Turns out you cannot play a clip and sleep immediately afterwards. Drat.
When I finally implement the full animations, hopefully the sound will play fully. For now I just moved my sound playing earlier up in my game loop, giving it some time to execute before the thread sleeps. Next up my partner has to add more AI to make the ghosts "smarter". Currently Pacman can outsmart them and leave them lost.
My latest project is an Amazon web page scraper. I have almost 5k eBooks in Kindle format. Every time I finish reading a book, I have a hard time choosing the next one to read. I do a lot of searches on Amazon to figure out which of the books I own is the next best.
I figured I should be able to let the computer choose a book for me. To do that, the computer needs to have a lot of stats on the books I own. Time to mine the Amazon web pages for those books to get the data I need.
So I am working on a scraper to grab the data I need from Amazon web pages. Then I plan to store this data in a MySQL database. With all the facts on hand, I am sure I can write a function that ranks the books in order from best to worst.
Writing the scraping portion turned out to be a big pattern matching exercise. Check. Next I need to store the scraped data in the database. I thought I had coded some Java that accessed a MySQL database. Turns out it was Java that accessed a Java DB.
No problem. How hard could it be. Well I kept getting exceptions stating that there was no suitable driver found to access MySQL using JDBC. Err it turns out I need the MySQL Connection J jar file in the classpath. Who knew?
I partnered up with a friend of mine from school to work on some projects together. At first we did some database web apps in PHP. Now we are getting to the real fun. We are writing a Pacman clone.
Now I believe in starting small. Therefore I got Pacman to be drawn to the screen. The guy chomped around a rectangle nicely. My friend took on the task to get a ghost drawn. It drew, but ran off the screen initially. Bugs have since been fixed and the ghost bounces around inside the boundaries.
Next step is to draw a rudimentary maze and have the Pacman and ghost obe the walls of the maze. I think we got this.