Willing to help a totally newbie?!

Hi everyone! I’m a junior in high school and I’m currently taking my first year of Java. I took Comp.Sci last year and had a great time learning C++. Now I’m in AP Comp.Sci 2 and they changed the language from C++ to Java, so now I have to learn it. We have to make a game with Java as our end-of-the-year project. It doesn’t have to be so glorious like the games professional programmers make, but honestly speaking, I’m totally clueless. I know that I have to learn a lot more about Java codes and stuff. So, is there anything you would recommmend that I study?! Something that could get me started?! I’d really appreciate it. Thanks in advance! ;D

Hmm.

(1) Where are you in learnign java? Thre are plenty of good books that will give you Java Syntax and thats a great palce to start,

(2) What kind of game are you thinking of? Simple turn-based games can be done pretty well using the AWT/Swing APIs. For anything more real-time you really want to learn about active rendering (for 2D games) OR JOGL (for 3D games.)

That was fast… uhm… we aren’t really learning anything new right now. We’re kinda reviewing for the AP Test this Spring. I can’t really tell how much I know of Java… probably not that much yet. Some of my classmates already took Java last year, not sure how that happened 'coz last year Comp.Sci was taught using C++. Anyways, I might just go with a simple game. 3d would be cool, but I don’t have much knowledge to take the risk. Not at this point.

Okay.

Yes I’d recommend you stay away fom 3D. It requires some advanced math to really understand and work with that I don’t think you are likely to have studied yet.
(Its stuff I didn’t do til college.)

So lookign at 2D action games there are a number of different kinds. The easiest are like the first video-games (pac man, asteroids, etc). These have a fixed backgrounds and a fairly small muber of things moving at one time. I would suggest you look at some of these “retro” games .

There are lots of web sites that have versions of them. Some of the pulbishers like Atari and Williams have re-released packaged collections youccan play on your desktop. (There’s also MAME, but that requries ROM images and, as they are illegal I can’t tell you where to get them. Maybe you have a friend who already knows…)

Playing some of those aught to give you some good ideas of what you might want to do.

The next sep is learnign how to do that sort of input and animation in Java. There are a number of good examples that folks around here have written.
(As I recall there’s a real nice pac man clone for instance.) I’d ask the folks here to give you pointers to where you can download some of their examples.

Finally, there are some good resources that you may want to look at as you are studying that code. There are two articles in particular that I know of that explain some details of 2D active rendering better then the API docs do.

I wrote one called “Understanding AWT Image Types”. It used to be posted here but when we changed the site over it was a casualty of the move. There are copies around on the web, I’lll try to find a copy for you.

The other, on the direct rendering process, was writen by Mike Martak and can be found on the Swing Connection here:

http://java.sun.com/docs/books/tutorial/extra/fullscreen/

If you havent already downloaded them you want to go to java.sun.com and download the J2SE API docs as thats the fundemental reference for all Java programmers.

To start your game first learn how to display objects on the screen by doing some of the applet/application exercises found in any textbook. Doing a google search for java game tutorials will yield (old) tutorials on how to get the basics down (animation, movement, collision). After that learn by searching, asking, and using the java.sun.com website about making your application go into “full screen exclusive mode”, page flipping, and the bufferStrategy approach to displaying your app to the screen. Then search this fortum about hi a resolution timer (like GAGE2D) that is needed in order to have a fast “proffesional feeling” game. Ask questions if you get stuck but always try to find a solution by your self first.

Thanks so much! We won’t start our projects until late April, although some of my classmates are just too excited to wait that they’re almost finished with theirs. We’re working in groups. I’m kinda busy with other school stuff, but I’ll try my best to check out everything you told me to check out. Hope you can find that something you wrote. I very much appreciate it. Gotta go now… err, still have some homework to do. Thanks again! ;D

So the game has to be with graphics? I know of many text-based games, or is that not allowed?

Good point. Something like a text adventure is a lot easier to write, but I’ve found most kids these days don’t even know the concept of a text based game and want to make pictures move :slight_smile:

Hi! Thanks for all the replies. Sorry for the long post. I kinda got busy with other stuff… Anyways, as I’ve mentioned before, we’re working in groups. My group decided to make a slot machine. One of my teammates already got the logic set up (with codes and stuff), so I decided to just work on the graphics. I already have the program with graphics, but now we have to figure out how to add a KeyListener or maybe a MouseListener, doesn’t really matter which one we use. We’re using the paint() of the GfxApp class, and we have no clue of how to add a listener. Other than that, I think we’re ok. Anyways, thanks again for the replies! :slight_smile:

Btw, what is a “text-based” game?

Ah grasshopper.

Back in the days when real computers took up entire buildings and “home computers” were low powered curisoities most computers didnt have graphics displays.
You talked to them either through a teletype (a typewriter which you typed into and the the computer coudl type abck at you on) or a CRT which was basically a teletype with a screen instead of paper.

And people wrote games for these machines. They were typing based games because thats al lthe hwardware coudl do. You typed somethign in, and the computer typed something back at you.

Among the top games of the day were Star Trek and Hunt the Wumpus. But the biggest of all were two programs called “adventure” and the more advanced 9and later) one called Dungeon. They pit out pargaraphs describing where you were and what you saw. You would type command in (eg “take rope”, “climb cliff” etc) and it woudl tell you what happened next.

They were eventually releaed on microcomputers unde the names ADVENTURE and ZORK and where the fathers of the Adventure games of today.

Here endeth the lesson.