• Post Reply Bookmark Topic Watch Topic
  • New Topic

A beginner trying to learn Java for creating games, where should i start though?  RSS feed

 
Natalie Bäckström
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to learn Java so i can later on learn how to make 2D games but the questions is, 1 Where should i start and how should i start it. 2 How much should i know and have learned before i try to "program" a game? 3 What sorts of programs should i learn (if Java isn't enough for making games) and then i would love to know how long you guys waited before you started code your first game and how long it took you to be good enough where you can write and understand what you do (unless it's to hard to understand everything if the Java language is really big), i don't really mind taking a long time but i don't know what to start with and how long should i wait before i try coding things with images, let's say a background where a character can move, how long did you wait before doing that?, i don't want to jump right into making a game without knowing anything but my goal is to make a game (for PC and maybe mac) that i could earn money from, even if it's only 1€ for each copy. I'm aiming to be a indie developer ^-^ and in 1-2 years i will probably go to university for programming within games so i want to learn as much as i can and MAYBE if i'm a quick learner been able to make a game, no matter how short it is, and be proud of it ^-^
 
Ganish Patil
Ranch Hand
Posts: 529
19
Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Netbeans IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Natalie Bäckström Welcome to CodeRanch , experts will definitely guide you soon.
 
sal jefferson
Greenhorn
Posts: 17
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A great place to learn and have fun with Java in a "game like setting" is this resource:
http://www.learningwithrobots.com/textbook/PDFs.html

And another resource is the Alice project:
http://www.alice.org/index.php
 
Matt Cartwright
Ranch Hand
Posts: 152
Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
welcome to the ranch

what about writing the classic "hello world!" program, then write a class HelloWorld and instantiate it from another one (your controller)?
Then write a class HelloNatalie that inherits HelloWorld, have a look at shadowing and overloading...
Write an interface Animal and classes like Cat and Dog, create collections of animals (lists, arrays etc) of animals, give them attributes like 'likes milk', use iterators in loops to make them all meow and bark, select only those that like milk etc.

Have a closer look at Java AWT and Swing graphic APIs and create a new window (JFrame) with some area to host your game, the board (JPanel or Canvas).
Draw a circle on that board. Have look at the APIs default passive rendering (paintComponent()) and learn a bit about active rendering.
Introduce a timer and have that circle moving from left to right. When you can do that, make it bounce back from the left and right (boundary detection).
Then introduce angles and have that circle bounce back from top and bottom of your board, make it disappear when going over left and right boundaries...
Have a closer look at KeyListener and/or KeyAdapter and draw two rectangles, one left one right on your board.
Control them with your keyboard (up and down with boundary detection at top and bottom) and make the circle bounce back from the rectangles (collision detection).

Enjoy playing Pong!

Don't start with making it look nice until it does what you think it should be doing. Once it works, learn how to load images etc. Introduce a high score list, store that in a text file or embedded database.... Make your game configurable.
Then have a great idea, get the basic shapes moving (circles and rectangles), make boundary checking and collisions work, make it look nice and earn a lot of money
HTH
Matt
 
Les Morgan
Rancher
Posts: 768
19
C++ Java MySQL Database Netbeans IDE Oracle Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Natalie,
I started Java by making a game, but Java was literally about my 30th language to work with. This is Oracle's tutorial: Really Big Index for Java. I would suggest you go though the intro to it, and then start on the learning paths. Once you start to know what is going on, then think of a very small game--maybe like bouncing a ball, then make the ball move, make the ball bounce all over the screen like it is in a box, add more balls, when they collide make them explode. Once you get to this point you are ready for starting on a lot of the 2D game scenarios.

One thing you should be familiar with is that learning Java is not learning to program. You should catch onto that right off. Programming is a problem solving approach that is applied to developing computer programs. Learn to program, the basics are in the tutorials, and understand what is happening. Write out, map, what you want to do in an outline in a word processor or on paper and then set about solving the problem that is making the program.

Have fun, but also really learn the basics, they will determine how far you can go with your game programming. BTW: How are you at trig, algebra, and geometry? You're going to need skills.

Les

Natalie Bäckström wrote:I want to learn Java so i can later on learn how to make 2D games but the questions is, 1 Where should i start and how should i start it. 2 How much should i know and have learned before i try to "program" a game? 3 What sorts of programs should i learn (if Java isn't enough for making games) and then i would love to know how long you guys waited before you started code your first game and how long it took you to be good enough where you can write and understand what you do (unless it's to hard to understand everything if the Java language is really big), i don't really mind taking a long time but i don't know what to start with and how long should i wait before i try coding things with images, let's say a background where a character can move, how long did you wait before doing that?, i don't want to jump right into making a game without knowing anything but my goal is to make a game (for PC and maybe mac) that i could earn money from, even if it's only 1€ for each copy. I'm aiming to be a indie developer ^-^ and in 1-2 years i will probably go to university for programming within games so i want to learn as much as i can and MAYBE if i'm a quick learner been able to make a game, no matter how short it is, and be proud of it ^-^
 
Steven Arthur
Greenhorn
Posts: 12
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A good first game would be a text-based game. You can always do the graphical "action" stuff later, and its wise to cover the fundamentals first; loading and saving files, gathering text input from the user, displaying text on screen...thats enough for one's first Rodeo or two.

Best of luck and god speed.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!