This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Basic Game Programming Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Basic Game Programming" Watch "Basic Game Programming" New topic
Author

Basic Game Programming

Matthew Margolis
Ranch Hand

Joined: Sep 29, 2001
Posts: 32
I have reached a point in my Java education that I feel I am comfortable with all the basics and many of the more advanced topics. I have been experiementing with graphics lately and want to get into game programming. Simple stuff at first like tetris would be good I think. Now all I need is a resource to learn from. I don't really know all that much about the code behind games like tetris or asteroids, anywhere where I can get a formal education in the production of game code?
I really like to learn out of books but I can't seem to find any that are both about Game Design and use Java. The only book I was able to find that seemed of any merit was The Black Art of Java Game Programming. It is very old and seems like it would be really obsolete. Are there any better books out there? If not are there atleast some websites that could get me started?
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
I haven't read the book you've mentioned (I actually do have an old copy of it), but somewhere (a while back) I read an article comparing and contrasting that book and a couple of others (one of which was Teach Yourself Java Game Programming in 21 Days). I think the article was on Gamelan.com - but I wouldn't put any money on it.
JavaBoutique offers a short Java Game Programming Tutorial - I haven't read it.
Now, if you really want to do something cool, what about putting together a few online resources to reference (such as JavaBoutique's tutorial) and we could do a short series here going through the process of creating a relatively simple game (such as Tetris or Pacman)? We beginners could steer the ship while we constantly seek advice from the many advanced programmers here at JavaRanch. Just an idea.
Good Luck.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Matthew Margolis
Ranch Hand

Joined: Sep 29, 2001
Posts: 32
Great idea! I have a short list of good resources that I will post later(have to get ready for school now).
Thanks for the link.
Matthew Margolis
Ranch Hand

Joined: Sep 29, 2001
Posts: 32
Had a bit of spare time so here they are. The following links all handle atleast some aspect of game design with Java.
Java Gaming.org
A tetris clone with source
I am sure that I have some more written down somewhere but those will have to wait, I have to go.
[ April 25, 2002: Message edited by: Dirk Schreckmann ]
Steve Deadsea
Ranch Hand

Joined: Dec 03, 2001
Posts: 125
A lot of concepts in Java game programming are similar to concepts used elsewhere. I suggest reading about double buffering. You'll need to know what it is, how it is used in Java, and how to use the built in double buffering in Swing. It is also helpful to know how to do it yourself. If you don't already know about double buffering, search google.
You probably also want to look into some of the new 1.4 APIs. The fullscreen mode for Java looks promising and I think they have tried to put in a mode where you are drawing directly to video memory. If you don't know why you would want these features, it would be worth your while to research that before you start.
Java isn't the best language for writing games but its getting better with some of these new features. I might suggest that you try game programming using some good game programming libraries (in C) such as SDL:
http://dmoz.org/Computers/Programming/Games/Libraries/SDL/
But if you are doing this to learn Java, then by all means. Games use much more of the Java libraries than many other applications. You will soon become familiar with Threading, IO, and Swing.
My attempts at game programming in Java can be found here:
http://ostermiller.org/ladder/
Its open source and it a ton of fun to play.
Matthew Margolis
Ranch Hand

Joined: Sep 29, 2001
Posts: 32
Steve: I am currently taking a java class and want a good way to apply all that I know and maybe learn a little more along the way. I enjoy playing computer games and have always wanted to develope them and I figure I might as well do it in the language I am currently working with. I do have some C/C++ experience but I am much more fluent with java's exclusive features than C++'s.
Double buffering is a topic I have heard of, sounds like it will be an extreamly valuable asset when it comes to screen flashing.
I will be sure to check out your ladder game, gotta love the Donkey Kong Day's.
Elouise Kivineva
Ranch Hand

Joined: Feb 07, 2002
Posts: 154
The basic worm/snake game (worm moves constantly - must not touch walls [death], food pellets appear occasionally & worm lengthens when it eats) is a good OOP exercise and is relatively easy to plan & program. It also lends itself well to later embellishment. Start with a single difficulty level and a square field for movement. Once it works you can expand it with multiple difficulties (speed), food pellets that vanish if not eaten quickly, food that moves around (escapes), or obstacles in the playing field.
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Elouise's idea sounds quite good to me. Anybody feel like walking this path?
Matthew Margolis
Ranch Hand

Joined: Sep 29, 2001
Posts: 32
Ooooh, I like it. Snake was always one of my favorites. Sounds like it might be a little simpler than tetris to plan out and definitly has more roof for expansion, great idea Elouise.
Rob Ross
Bartender

Joined: Jan 07, 2002
Posts: 2205
Originally posted by Matthew Margolis:

I really like to learn out of books but I can't seem to find any that are both about Game Design and use Java. The only book I was able to find that seemed of any merit was The Black Art of Java Game Programming. It is very old and seems like it would be really obsolete.

This is actually still a very good, relevant book and does a good job of teaching you some fundamentals. It's true it's a little out-of-date, but it's not that hard to adapt.The low-level drawing routines are based on java 1.1,so they're still supported, even though you could probably enhance what you can do by using 1.2 and the Graphics2 environment.
The biggest change is they use some deprecated methods. There's nothing preventing you from running the examples as-is; you'll just get a bunch of deprecation warning when you compile. But, when you start writing your own game frameworks based on the sample code, you'll want to re-write them to use non-deprecated methods.
Other than these few gotchas, I still recommend this book.


Rob
SCJP 1.4
Matthew Margolis
Ranch Hand

Joined: Sep 29, 2001
Posts: 32
Thanks Rob, I think I found a place where I can get the book pretty cheap so I am going to check it out. Learning outdated information isnt a bad thing at all now that I think about it, I can compare the methods the book uses to modern day concepts and see how the ideas evolved over time.
Matthew Margolis
Ranch Hand

Joined: Sep 29, 2001
Posts: 32
Is the book worth getting if it doesn't come with a cd? As the book is out of print it is hard to find a new copy and most of the used copies are missing Cds..
Gerry Giese
Ranch Hand

Joined: Aug 02, 2001
Posts: 247
Check Amazon for "Java 2 Game Programming". It's quite recent and while I have my problems with it, overall it's good, especially for the beginner who is learning Java at the same time.
Matthew Margolis
Ranch Hand

Joined: Sep 29, 2001
Posts: 32
Hmmm just checked out the reviews and it looks like its really not what I am looking for. I have heard nothing but great things about Lamothe but this particular book does not seem to follow in his legendary footsteps. So I guess for now my best option is the Black Art book. Now if only I could find it somewhere with the cd...
Gerry Giese
Ranch Hand

Joined: Aug 02, 2001
Posts: 247
You might want to go ahead and look for the Java 2 Game Programming book at the bookstore and look through it anyway. It wasn't really what I was looking for, but I still learned a few things from it. If you really are looking at a 'basic' level book, this one might fit the bill. So much has changed since the Black Art book that you may be better off starting without it.
Matthew Margolis
Ranch Hand

Joined: Sep 29, 2001
Posts: 32
Well I just won the black art book on ebay (with CD Yay!) for a little over 13 dollers and it came with another book on general windows game programming. Thats a pretty good deal and I still have some spare cash left so I might just pick up the book you reccomended anyway Gerry and go through it simultaneously to pick up on any major changes/better concepts it has to offer.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Basic Game Programming
 
Similar Threads
Need help with granting read/write permission
Game Idea
BAG: Best way for a beginner to realize an idea for an Android game?
To create Java Puzzle game -Tetris
Why isn't there a Response scope?