Java2D - Space Invaders

Hi i just wanted to post my tutorials on creating Space Invaders but trying to create it with pre-refactored (most of it aleast) code.

My main reasons for doing this is to hopefully let beginners/intermediate programmers be able to come in and easily understand
and change code when they want to.

Still need a lot of practice with commentary and confidence but i am sure that will come in time, and also sorry about the microphone i
need to get a new one.

This is just a hobby just now but if they acutely help some programmers then i will make a schedule but for
just now am kind of just posting them whenever. but they should be a video about 1-4 every 2 weeks depending
on the circumstances.

But if you give it a chance i hope you enjoy and get something out of it,
Cheers :slight_smile:

Have you read the rules of this board? You’re supposed to include code and not just advertising your videos.

I don’t know about anyone else, but I would NOT use java2d. It is slow, and takes longer to code, compared to lwjgl, which is easier to learn, faster to make, and over all just looks a lot better. If I were to make this tutorial, I would mention lwjgl, and how you should move on from java2d to it when you need better looking graphics. But hey, that is just my opinion. I await the coming ‘you’re so ignorant!’

“lwjgl easier to learn than java2d”
I lol’d.

Anyways yeah, either request deletion or copy+paste the actual tutorial here.

Are you suggesting that newbies should jump straight into lwjgl? Really? If you remember, you most likely started out with java2D. Lwjgl doesn’t handle anything for you. You have to make everything, like spritesheets, buffer objects and whatever else low level stuff you need. If you don’t want someone to say you’re ignorant, don’t say ignorant things. Nobody starts out with lwjgl. Almost everyone I know started out with java2d because its noon friendly. Do they use it anymore? No. But that’s just because yes, it is slow and clunky. But at least you don’t have to write everything yourself.

Sorry. I sort of jumped behind myself there. I really meant that he should mention that once you are good with java2d, you should move into lwjgl. That does not mean ‘newbies should jump straight into lwjgl[.]’ It could mean that you use libGDX, slick2D, or something. You could even use slick-util for all the buffering and loading stuffs. Lwjgl isn’t that hard to learn… Takes time though (for me, anyways).

BTW: I did start with java2d, and almost quit game programming because of the hierarchy. It just did not make sense to me… Then my hobby was saved when I found lwjgl. It all just flows so nicely (to me, anyways)! Just set up a display in a few lines, and start loading textures and drawing. I will never go back :).

Stop calling libraries you don’t use properly slow because you don’t use them properly.

lwjgl in terms of basic 2D graphics is minimally more difficult than Java2D due to the loss of abstraction. To argue though that it makes interfacing with graphics in general more or less complex is absurd. Any properly written game or engine will have abstracted the rendering procedure enough anyways to plug either one in. You should use what is best for your project.

If you can get away with Java2D there is absolutely NO reason to use a native dependency like lwjgl AT ALL outside of sheer preference (preference vs portable code… hmm.)

If your code needs to perform more complex rendering algorithms that Java2D makes very difficult (lacking any direct access to hardware etc) and any alternatives perform too poorly than you can consider the very easy transition to lwjgl (easy assuming code was structured properly.)

You throw away a huge advantage offered by Java by using complex native dependencies (that go all the way down to kernel drivers) when you don’t need them.

I don’t find java2D slow at all really. Running a mostly complete 2D engine with a particle engine, hundreds of mobs and lighting and I get over 1000 fps on my decent machine. Just because you can’t use it correctly doesn’t mean no one else can.

Hell, my honors high school computer science class used java3D to create a fully functional Mario kart clone that actually runs on the crappy single core Intel CPUs that the school computers use. If you can’t manage to structure your projects correctly so that your game runs faster than our school project, then you seriously need to learn some basic Java. Stop bashing on Java2D and realize its a decent tool to use, when its the correct time to use it.

Exactly what’s wrong with Java2D hierarchy? The complaints with Java2D are never associated with hierarchy. Also, how is lwjgl going to be better - lwjgl ‘hierarchy’ is just your own written code, which in terms of object-oriented development is probably worse than the guys at Oracle.

I did not say that Java2d is horrible. I’m sure it is great if used correctly. I am saying that I work better with opengl. It suites me.

Sorry to say, but I just don’t like using java2d. That is just my preference. It just clicks more naturally with me. I am not saying that lwjgl is easier to learn. I am saying that I had a better experience with lwjgl. Also, why would you need to make graphics abstract? All the engines do that, but I have no clue why.

“NO reason to use a native dependency like lwjgl AT ALL outside of sheer preference (preference vs portable code… hmm.)”
Are you saying that lwjgl isn’t portable (as in port to all OS?)?If so, look at far sky! It ports to Windows, Mac, And Linux! And it was written in lwjgl!

I don’t see any disadvantages with its capabilities. It runs off of hardware. What is wrong with using native libs? And by the way, I hated the hierarchy in java2d, just because it did not feel like I was making a game. It felt like I was hacking into a window making program, and making a game. I mean, paint(), JFrame, JPanel, all of it just sounded like tools to making a window, not rendering anything other than some buttons and images.

And above all:
This is all my opinion!
I have not had any issues with lwjgl, its lack of abstraction, or how it is a native library! Thus, I use it! I just don’t want to use java2d because it does not suite me. Granted, a lot of things will not ‘suite’ me in coding, but when I find out that there is an alternative to it, I want to use it!

And what are the issues with using lwjgl over java2d?

yeah i realized my mistakes after i posted :clue:, shouldn’t have done it so late.
Sorry for the mistake i have sent a message endolf so should be sorted soon.

And the reason am using Java2D is just because of its simplicity you can just jump right into
it and not have to worry about versions or libs etc. I wanted to make it
simple and not difficult to follow, its more for people who know java but are not yet confidant enough
to code there own things yet.

No, don’t feel bad for using java2D. It was the right choice because yes, newbies would have a hard time with anything else. I’ll check out your tutorials later and tell you if I like them! :slight_smile:

Yeah. Don’t worry. It wasn’t a bad thing to use java2d. I was saying that I have had better experience with lwjgl. For a simple game like this, you did a good job explaining and guiding! I am just saying that you should at least mention at some point that there are other libraries than java2d, if they don’t like java2d.

Oh, and I looked more in depth into the tutorials, and thought that you did an excellent job!

As advice for your video series, you ought to put the tutorials in a playlist, so you don’t have scroll down from 16 to 1 to watch the first tutorial.
Also, is there a specific reason you’re using AWT not Swing?

Great tutorial for newbies like me ;D. thankx