Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (534)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Java topics needed to learn game dev  (Read 4308 times)
0 Members and 1 Guest are viewing this topic.
Offline luke71933

Senior Newbie





« Posted 2014-04-04 15:35:32 »

Hi, 
    What is the java knowledge required to learn java game development using a game api like libgdx or slick2d along with box2d physics. I would like to start 2D, I already have some java knowledge and was going to get this book:http://www.amazon.co.uk/Learning-Libgdx-Development-Andreas-Oehlke/dp/1782166041
Offline hwinwuzhere
« Reply #1 - Posted 2014-04-04 15:38:45 »

I don't have a lot experience using libraries. But learning object oriented programming is a good start. Knowing how to make and use your objects makes game programming so much simpler, learning how to use libraries after that makes it more powerfull (I guess powerfull is the right term here? Cheesy)

What did the boolean say to the integer? You can't handle the truth.
Offline luke71933

Senior Newbie





« Reply #2 - Posted 2014-04-04 15:45:26 »

I know how to create objects and use them and even constructor methods and methods but I cant get what is happening in inheritance, is it all jsut for you can use variables and methods from the clss your implementing, ex public class game extends player implements car   . What does it mean?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Longarmx
« Reply #3 - Posted 2014-04-04 16:52:43 »

It sounds like you need to learn java. Don't get too excited and jump into making games or else you will just give up. There are many tutorials and I think that we have a thread on this site for java tutorials (just use the search bar). You can go check out thenewboston on YouTube for java tutorials also.

Again, just to repeat myself, DONT jump straight into games. Learn java first.

Offline hwinwuzhere
« Reply #4 - Posted 2014-04-04 17:41:25 »

If you want some good books on OO programming, check out Object Oriented Programming books from O'reilly. Also check out their book about Design Patterns.  It may be quite some effort you need to put into learning OO programming, but it makes programming much easier and understandable.

If you want to be a good programmer, make sure you know how to use Object Oriented programming and how to apply Design Patterns.

What did the boolean say to the integer? You can't handle the truth.
Offline luke71933

Senior Newbie





« Reply #5 - Posted 2014-04-04 18:16:58 »

Dont get me wrong I know switch statements,loops,constructor,variables,conditionals,arrays,parameters,arguments,Object oriented, methods, constructor and today I learned inheritance. What is something that is crucial like a topic or function so i can learn it, i had a school project for java which I had been learning for a year. I got 14/15.
Offline opiop65

JGO Kernel


Medals: 153
Projects: 7
Exp: 3 years


JumpButton Studios


« Reply #6 - Posted 2014-04-04 18:24:49 »

Grades mean nothing. I could fail a math test and still know what I'm doing, I just may not have decided to try on the test or misunderstood instructions, wasn't prepared etc...

Like other people have said, you need to know Java first and the basic concepts of OO. Its not very good that you just learned inheritance, that tells me you really haven't ventured far into the language yet.

There's also no set amount of knowledge you need to know to make games. Just know Java, that's it. After that point its up to you to utilize what you have learned. You don't need to know everything, but knowing the basics is really recommended. Just study more Java first and then come back to game dev.

Offline ctomni231

JGO Wizard


Medals: 98
Projects: 1
Exp: 7 years


Not a glitch. Just have a lil' pixelexia...


« Reply #7 - Posted 2014-04-04 21:12:51 »

As much as I'm happy for the excitement you have trying to "jump" into something like Slick2D and LibGDX, these people are correct. If you do not "feel" the language (being able to write code with your eyes closed), you are going to have a rough time understanding how to work these engines. The reasoning is that with school, you are only scratching the surface. They teach you the variables, functions, and syntax. However, learning when and how to use this syntax is a whole different beast. There are a lot of different design patterns once you've breached the surface of learning the basics.

How do I get past this defense...

Tutorials. Literally it is the difference between trying to jump across an open chasm or taking a convenient bridge. If you look for the tutorials or grab books on the subject you are trying to learn, you have a much better chance of not "falling to your death" trying to understand concepts. You'll probably learn a lot more as well, since, game development takes a lot more than simple programming knowledge.

Game development is only difficult for those who didn't take time to fortify. Everyone always thinks that coming in with a shaky sand castle will guarantee you'll survive the waves. However, those who read the tutorials already had the knowledge to build up a wall. Always brace yourself for impact by learning the tutorials, so when the "big wave" of problems come... you'll be ready.

Offline luke71933

Senior Newbie





« Reply #8 - Posted 2014-04-04 22:44:36 »

I can code well in java without any tutorial or copying any code, Give me a sort of small project which I need to complete before stepping in to games.
Offline ctomni231

JGO Wizard


Medals: 98
Projects: 1
Exp: 7 years


Not a glitch. Just have a lil' pixelexia...


« Reply #9 - Posted 2014-04-04 22:45:37 »

Pong.  Wink Then go upwards from there Smiley

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline LiquidNitrogen
« Reply #10 - Posted 2014-04-05 00:55:51 »

People often say learn the language before you start making games, this is good advice for any real game, but there's a lot to be learned from making mini games.

step 1: draw a square or an image on the screen and get it to move with the arrow keys.
step 2: add some things that the square has to run over to collect points.
step 3: add some things which move around semi-randomly and kill the player if they touch them.

You can do all this without knowing much about programming, but you will learn things about both programming in general and making games, by making little game-like programs. Each time you complete something simple you will come up with new ideas to try out based on the experience you are building up.
Offline luke71933

Senior Newbie





« Reply #11 - Posted 2014-04-05 01:02:54 »

Thankyou  Grin
Offline Drenius
« Reply #12 - Posted 2014-04-05 01:17:29 »

Quote
Java topics needed to learn game dev
Did they? Really?  Wink
Offline luke71933

Senior Newbie





« Reply #13 - Posted 2014-04-05 18:42:02 »

Just created a program with some help from the net  which draws a rectangle , and lets you move it with the arrow keys. How Can I improve the code design and improve the overall program to work better.




Here is the code:


import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.event.*;

import javax.swing.JFrame;
import javax.swing.JTextField;

public class Main extends JFrame implements KeyListener{
   
   
   
   
   int rectX = 50;
   int rectY = 250;
   
   //constructor
   public Main(){
      this.setTitle("Draw Rectangle Project");
        this.setSize(800,480);
       this.setVisible(true);
       this.setResizable(false);
      this.setDefaultCloseOperation(EXIT_ON_CLOSE);
      addKeyListener(this);
            
   }
   

   @Override
   public void keyPressed(KeyEvent e) {
      if(e.getKeyCode() == KeyEvent.VK_LEFT) {
         rectX = rectX -20;
          repaint();
      }
      if(e.getKeyCode() == KeyEvent.VK_RIGHT) {
         rectX = rectX + 20;
         repaint();
      }
      
      if(e.getKeyCode() == KeyEvent.VK_UP) {
         rectY = rectY - 20;
         repaint();
      }
      
      if(e.getKeyCode() == KeyEvent.VK_DOWN) {
         rectY = rectY + 20;
         repaint();
      }
   }

   @Override
   public void keyReleased(KeyEvent e) {
      // TODO Auto-generated method stub
      
   }

   @Override
   public void keyTyped(KeyEvent e) {
      // TODO Auto-generated method stub
      
   }
   
   public void paint(Graphics g){
      
      g.setColor(Color.RED);
      g.drawRect(rectX, rectY, 20, 20);
      g.setColor(Color.black);
      g.setFont(new Font("TimesRoman", Font.PLAIN, 20));
      g.drawString("Use arrow keys to move the rectangle",230,40);
            
   }
   
   public static void main(String[] args){
      Main object = new Main();
      
   }

   
   
   
}

Offline BurntPizza
« Reply #14 - Posted 2014-04-05 18:56:40 »

That's fine for what it does, you could go crazy and implement various OOP ways of handling any number of rectangles, or make them change color, etc, but for moving 1 rectangle, that it fine.

One little logical nitpick:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
@Override
   public void keyPressed(KeyEvent e) {
      if(e.getKeyCode() == KeyEvent.VK_LEFT) {
         rectX = rectX -20;
          repaint();
      }
      if(e.getKeyCode() == KeyEvent.VK_RIGHT) {
         rectX = rectX + 20;
         repaint();
      }
     
      if(e.getKeyCode() == KeyEvent.VK_UP) {
         rectY = rectY - 20;
         repaint();
      }
     
      if(e.getKeyCode() == KeyEvent.VK_DOWN) {
         rectY = rectY + 20;
         repaint();
      }
   }


Can be reduced (simplified) to:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
@Override
   public void keyPressed(KeyEvent e) {
      if(e.getKeyCode() == KeyEvent.VK_LEFT) {
         rectX = rectX -20;
      }
      if(e.getKeyCode() == KeyEvent.VK_RIGHT) {
         rectX = rectX + 20;
      }
     
      if(e.getKeyCode() == KeyEvent.VK_UP) {
         rectY = rectY - 20;
      }
     
      if(e.getKeyCode() == KeyEvent.VK_DOWN) {
         rectY = rectY + 20;
      }
      repaint(); //this happens in any of the if-branches, so just hoist it out. Reduces code duplication.
  }


Also, to format code like that, put it in [code][/code] tags, or click the button with the pound sign ('#').
Offline Hermasetas

Senior Member


Medals: 6
Projects: 2
Exp: 3 years


I do gamez, yes!


« Reply #15 - Posted 2014-04-05 18:59:09 »

You should learn about gameloops since they are the backbone to every game Smiley
Offline BurntPizza
« Reply #16 - Posted 2014-04-05 19:23:09 »

You should learn about gameloops since they are the backbone to every game Smiley

Agreed, there is a good introduction in the Articles and Tutorials board, but one should also recognize that his app does have a game loop, albeit a non-continuous one, which is actually just fine for the purpose of the app.
Offline luke71933

Senior Newbie





« Reply #17 - Posted 2014-04-05 19:27:47 »

I was going to try to search for a book which could explain everything for me for example why do you always have to sue KeyEvent in the parameters of keyPressed and keyReleased and keyTyped.

And walk me through game development step by step and at last maybe I could develop a 2d paltformer without copying or searching for any code.

I looked at some code on stackoverflow and other websites to do this program.

What is the difference between these 3 : inheritance vs polymorphism vs implementation
Offline saucymeatman
« Reply #18 - Posted 2014-04-06 02:37:39 »

I'm going to try to help you understand those things the best I can.

First to understand what the point of all this "inheritance" or "polymorphism" is, you must understand that the programmer (you) must try to never write the same code over and over again.

Quick example. We have 3 classes called "Apple", "Orange", and "Banana". These three classes will have some similar properties, for instance, they share these methods : "public void eat()" and "public void throw()".

However only Orange and Banana have the "public void peel()" method.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
class Apple {
   public void takeOutAppleSeeds() {
       for (Seed aSeed : AppleSeeds) {
           remove(aSeed);
       }
   }
   
   public void eat() {
      bite();
      chew();
      swallow();
   }
   public void throw() {
      if (someoneIsNearMe()) {
         tossAt(personNearMe());
      } else {
         //do nothing
     }
   }
}


1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
class Orange{
   public void eat() {
      bite();
      chew();
      swallow();
   }
   public void throw() {
      if (someoneIsNearMe()) {
         tossAt(personNearMe());
      } else {
         //do nothing
     }
   }
   
   public void peel() {
      removeSkin();
   }
}


1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
class Banana {
   public void eat() {
      bite();
      chew();
      swallow();
   }
   public void throw() {
      if (someoneIsNearMe()) {
         tossAt(personNearMe());
      } else {
         //do nothing
     }
   }
   
   public void peel() {
      removeSkin();
   }
}


Now you can see how these classes are very similar (because they share common fields) but also different (some have methods that others do not, they are not identical).

So see how the code is repeating itself? These 3 classes are all fruit, except they extend what a fruit is. These fruit should use code from a parent class.

We know every extension of what a fruit is must be able to be eaten, and thrown. And for all the fruits listed above, they are all eaten and thrown in the same way. This is the fruit class :

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
class Fruit {
   public void eat() {
      bite();
      chew();
      swallow();
   }
   public void throw() {
      if (someoneIsNearMe()) {
         tossAt(personNearMe());
      } else {
         //do nothing
     }
   }
}


Now we can build off of that fruit class, extend it, because all of the following fruit need the methods in the Fruit class anyway.

1  
2  
3  
4  
5  
6  
7  
class Apple extends Fruit {
      public void takeOutAppleSeeds() {
       for (Seed aSeed : AppleSeeds) {
           remove(aSeed);
       }
   }
}


Now if we create a new apple with :
1  
Apple saucysApple = new Apple();


We can use the methods that it INHERITED from its parent class Fruit!
(Get it? Thats why its called inheritance!)
1  
2  
3  
saucysApple.takeOutAppleSeeds();
saucysApple.eat();
saucysApple.throw();


Cool right? I really hope your getting it by now. Cause i'm getting tired of typing.
Offline luke71933

Senior Newbie





« Reply #19 - Posted 2014-04-06 13:12:55 »

where do you create the sauceyapple object in the apple class or fruit class?
also what is the difference than creating an instance(object of the class) than inehritance.
ex
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
public class fruit {
       public static void main(String[] args]{
       
        Apple sauceyApple = new Apple();
        sauceyApple.eat();
        sauceyApple.throw();
         etc etc etc


       }

}


public class Apple{

    public void eat(){
    //instructions here
   }
    public void throw(){
     //instructions here
   }

}
Offline saucymeatman
« Reply #20 - Posted 2014-04-06 15:31:28 »

You can create a new instance of an object anywhere in any class.
Too tired to do a whole nother example, sorry. Maybe someone else will help ya.
Online Gibbo3771
« Reply #21 - Posted 2014-04-06 15:43:27 »

Ehhhhhhh....

I know we are a Java based community but are we a Java based community that is focused on Game Development or teaching Java itself?

It seems like a lot of the things being explained here can be learned by reading one of the many books and thousands of stack overflow questions. Inheritance and Polymorphism is a huge concept in its own right and something you can simply not learn by reading a few posts on a thread. Sure you will get an idea but it will just leave open a ton of questions, eventually throwing the thread into the chitchat monster as it has no real value.

I suggest the OP takes a step back and figures out what he/she needs to know.

I will suggest some Java skills that are mandatory (imo) for game development:

  • Have a grasp of basic Java syntax, such as how to instantiate objects, declare fields, assign/compare values, methods, return methods etc
  • A firm understanding of arrays/collections, without knowing how to use basic arrays you will find it almost impossible to create anything
  • Understand the basic principle of OOP, you don't have to be good at it but you better damn understand how it works, if not you will spend 80% of your time replicating already written code
  • Less Java related but understanding of algebra and basic arithmetic, then worry about Trig and such

There is probably a lot more but looking at my code, those are pretty much the most common things I see.

"This code works flawlessly first time and exactly how I wanted it"
Said no programmer ever
Offline opiop65

JGO Kernel


Medals: 153
Projects: 7
Exp: 3 years


JumpButton Studios


« Reply #22 - Posted 2014-04-06 15:45:46 »

Objects and inheritance have almost nothing in common, other than they are both grouped under Object Oriented Programming (OOP). I don't have a straight up definition for what an object is, but I do like to use this example:

Think about a box. A box can hold "stuff". Boxes can come in many shapes or sizes and can be used for many different tasks. The same applies to objects in programming. An object can hold "stuff" (variables), and they can be used for many many different tasks. You could also go as far as to say boxes can inherit other box's characteristics (size, color, shape etc...), which is how inheritance works in programming.

With inheritance you can create a hierarchy of classes. One being the "super class", and the other classes being the "child class or sub classes etc...". These child classes will take on the characteristics of it's super class, but can also have its own characteristics.

Inheritance is almost like having a child. The child will retain some of it's parents genes, but will also have it's own modifications (mutations actually). Child classes can have their own methods and variables independent of their super class, but will still "act and look" like their super class.

Hope I helped!

Offline luke71933

Senior Newbie





« Reply #23 - Posted 2014-04-06 22:45:37 »

Thank you you helped . Can anyone recommend any good books which will teach the inheritance and those things but I would not like to see variables,loops, if's etc in the book

Thankyou
Offline BurntPizza
« Reply #24 - Posted 2014-04-06 22:56:27 »

but I would not like to see variables,loops, if's etc in the book

Why not? You can just skip past it if you really want to, and there still might be something that you could learn.

That being said, this google search is a good place to start with finding books. Modify the query as you see fit.
I saw Java, A Beginner's Guide, and I know Herbert Schildt is good, and you can preview the book free online to see if you like the style.
I've heard Head First Java is good.

Really what it sounds like you want is just an OOP book, not a Java book, but most Java books will cover the OOP basics, and do so in a context you already know about (Java), so there is a benefit.

I have Code Complete, 2nd Edition, and it is quite good, it's all about software 'construction' and design. Definitely consider.

EDIT: nice OOP book SO page: http://stackoverflow.com/questions/9210929/best-book-about-oop-principles-and-design
Offline luke71933

Senior Newbie





« Reply #25 - Posted 2014-04-06 23:10:13 »

will the beginners book cover inheritance? because here in my country, inheritance is learnt at university level. I dont know whats considered beginner, I have some java oop basics I would like to learn about key listeners mouse listeners and inehritance etc
Offline BurntPizza
« Reply #26 - Posted 2014-04-06 23:12:01 »

Inheritance is pretty much chapter 1 of every Java book I have seen.
Pages: [1]
  ignore  |  Print  
 
 

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

pw (35 views)
2014-07-24 01:59:36

Riven (34 views)
2014-07-23 21:16:32

Riven (22 views)
2014-07-23 21:07:15

Riven (25 views)
2014-07-23 20:56:16

ctomni231 (56 views)
2014-07-18 06:55:21

Zero Volt (48 views)
2014-07-17 23:47:54

danieldean (39 views)
2014-07-17 23:41:23

MustardPeter (43 views)
2014-07-16 23:30:00

Cero (59 views)
2014-07-16 00:42:17

Riven (56 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!