Playing With Java
Posted by Chris Spurlock on September 20, 2011 – 11:07 pm

In preparation for another Java certification test, a friend and I have embarked on the long journey of developing a game. It’s not for profit, or even open-source, but rather just to learn some things along the way. Coming from writing MVC or three-tier (yes “or”, they’re different) business applications, this should be interesting. As far as I know games don’t follow any patterns I’m used to dealing with. But, that is a good thing. It should broaden my skills, force me to think outside of the norm, etc.

Not being game designers, we opted to emulate other games. After all, the purpose isn’t technically to create anything ground breaking or to be creative. Minecraft was the perfect candidate. The graphics are simple enough. Once the game “engine” is to the point of having a reliable terrain generator, collision detection, simple AI, and combat, there’s really no limit on what can be done with it.

I’ll include a snippet of the code here, only because it makes me giggle every time I call the method. If you ask “why does that make you giggle?” you need to watch the T.M.I. episode of South Park.

public static double getYawToObject(Player player,
WorldObject o2, int o2ChunkX, int o2ChunkZ) {

return 180f - player.getYaw() - Math.atan2(-player.getPosition().getX()
- (o2.getPosition().getX()+o2ChunkX*16), -player.getPosition().getZ()
- (o2.getPosition().getZ()+o2ChunkZ*16)) * 180/Math.PI;
}

Currently there is rudamentary terrain generation, primitive collision detection, and some basic physics.

See the following screenshots for a current state of the project:

scarypaversbedrock

One Comment »

  • Hi Christopher,

    I came across your profile on linkedin, which in turn led my to your website. We currently have a position open in the Herndon/Reston area, which I think you would be a great fit for! Our client is looking for a Jr/Mid Level Java Developer who islooking to take that next step in there career. In addition, they are looking for individuals who are passionate about what they do, which is clear by your site.

    If you would like to hear more about this spot feel free to reach out to me when get a chance. jlipp@kforce.com or 703-464-6645.

    Thanks in advance for you time.

    Jarid Lipp

Leave a Comment

© Copyright 2007-2012 Chris Spurlock
This site is XHTML 1.0 and CSS3 valid.