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: