Suggest a project to the new guy!

Hey guys I’m new to these forums, as well as being relatively new to games programming with Java. I’ve done a introductory course at University on Java and I’m super keen to get neck deep in some serious games coding! So far I’ve just been doing tutorials on-line based around clones of old arcade games like pong, pacman, tetris, etc. They have been fun but the challenge is kind of lost seeing as all the code for the games are provided for you! Although I have learned a lot within the Java 2D library and have become fairly confident in OOP design and implementation.

Here is what I propose to anyone with any spare time and an interest in helping a new enthusiastic coder.

I need a problem to work on, that is relatively basic yet still challenging. The idea being I will post all my progress in this thread and everyone can offer suggestions or give ‘hints’ to the problems that I may face. The problem doesn’t have to be huge, maybe even something as simple as move a sprite with the keyboard and shoot at a target, that sort of thing.

I may be going out on a limb here, but I know there are some seriously talented programmers on these forums! I see this as a awesome learning experience.

Thanks for your time! ( please excuse my enthusiasm! ) ;D

Welcome to JGO, Eyesackery!

I love your enthusiasm for making games! Keep it up and you will go far in life, but don’t get bogged down by the ‘boring’ parts :wink:

Based on your experience, I say you should start learning OpenGL to be able to grasp the full power of the graphics card to make some visually attractive games.

Good luck! ;D

Thank you for your suggestion ra4king :slight_smile:

Eep! OpenGL and 3D programming seems a little daunting to me but I’m up for the challenge!

Can you suggest any good material on-line to get me started?

You’re in luck! These tutorials are the best around. However, the code is in C++ but you can find the LWJGL ports over here.

However, if you are confident enough that you don’t need someone’s else code, you can very easily “port” the C++ code yourself. Since LWJGL copies almost all functions exactly, it is safe to assume all functions you see that start with ‘gl’ are almost exactly the same as in LWJGL. Only one exception, function calls starting with ‘glut’ is just the windowing API. In LWJGL, that’s simply your Display class.

What about these tutorials? They’re also pretty great.

I heard those articles are really old and outdated. If they have been updated, I’m not aware of it.

The tutorial I linked to is an excellent tutorial on modern OpenGL.

You might want to make something in java2d before OpenGL.
As for the actual project, how about:
-a scrolling shooter
-street fighter style game
-tower defense

You can make pretty simple games of the above type.

[quote=“Eyesackery,post:1,topic:39215”]
Write an early entry for next year’s Java4k contest. Plenty of material in the relevant subforum.

Thanks a lot for the awesome replies guys! Very much appreciated! :smiley:

@ra4king - That book looks great! Definitely going to set aside some study time for those! Thank you!

@Sickan - That website looks awesome too, lots of information on beginning games programming in OpenGL, thanks!

@Jimmt - Thanks for the suggestions man! I’ve been kind of working on a little project I’ll talk more about it below :slight_smile:

@pjt33 - That sounds like a very good plan, why didn’t I think of that!? haha, thanks man. :slight_smile:

So I jumped the gun a little and have been working on a bit of a project for the last few days, based of a few tutorials laying around online. However I’m stuck!

I’m trying to implement a “point and shoot at mouse”, type of function, and so far I have been able to get the angle and position of the mouse on mouse clicks. The ship is at the bottom of the screen shooting upwards, so I only use 180 degrees in the equation.

But I’m stumped as to how to fire at that position?

This is how I’m calculating the angle and position of the mouse currently.


double anglePi = Math.atan2(mouseY - ship.y, mouseX - ship.x) * 60;
int angle = (int) Math.abs(anglePi);

Math.atan2 returns an angle in radians, not degrees so leave it as a double :wink:
Multiplying an angle by 60 (or anything) makes no sense really :stuck_out_tongue:
Also, negative degrees/radians is definitely not the same as positive degrees/radians.

:-\ Essshh, looks like I need to brush up on a few of my maths skills!

I knew I should have been listening during high school! :stuck_out_tongue:

So I found a pretty helpful post in a action scripting forum that helped to solve my problem :slight_smile:

http://www.actionscript.org/forums/showthread.php3?t=251651

[quote=“ra4king,post:10,topic:39215”]
That’s not true. Multiplying by 60 and then truncating is an effective way to quantise, which is necessary if you use prerendered graphics in N rotations or convenient if you use lookup tables for trig.

[quote=“pjt33,post:12,topic:39215”]

Hey there’s that swooshing sound over my head again! ;D

So I’ve been cruising through the space invaders 101 tutorial on coke and code (http://www.cokeandcode.com/index.html?page=tutorials/spaceinvaders101), and have been trying to do some of the challenges after the tutorials.

I’m having trouble with getting the aliens to fire back.

To me this looks like it should be working, but unfortunately it does not.

Any help or hints would be very much appreciated, this has been so frustrating :’(.


			for (int i = 0; i < entities.size(); i++){
				
				Entity entity = (Entity) entities.get(i);
				
				if (entity.equals(alien)) {
				
				    randomAlien =  rand.nextInt(entities.size());
					Entity alienShooting = (Entity) entities.get(randomAlien);
					alienShot = new AlienShotEntity(this,"sprites/shot.gif",alienShooting.getX() + 13,alienShooting.getY(), angle);
					entities.add(alienShot);
					break;
				}
			}
				
		

What’s the “alien” variable? If you have many aliens, why are you only checking against 1?

I’m trying to check for every ‘alien’ in the array list. I’m not very confident with array lists :slight_smile:

“entity.equals(alien)” <== that checks against only 1 instance of alien. If you want to check if an Entity is an instance of Alien, you would want: “if(entity instanceof Alien)” or whatever your Alien class is called.

Ra4king! I think I love you!! Haha. :slight_smile: that solved my problem, thank you! I have been pulling my
Hair out for hours over that one! Cheers!

Haha glad to help :slight_smile:

Hi guys, still been working away at my little Java 2D project and have had a million ideas for a more in depth game. I can finally see how it’s possible to build games from my own imagination now, which is exciting! ;D

Like you guys suggested I’m going to start becoming familiar with OpenGL and the JLWGL.

I’m under the impression that the only way to use the JLWGL is through Slick2D?

I’m a little confused, are JLWGL and Slick2D just 2 different libraries? How do they work together?

If I wanted to user the JLWGL and Slick2D for my next project, where should I start? ( where/how to learn ).

Here’s a little screen of what I’ve been working on.

http://img835.imageshack.us/img835/2117/gamexk.jpg