Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (498)
Games in Android Showcase (116)
games submitted by our members
Games in WIP (563)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1] 2
1  Discussions / General Discussions / Re: Looking for a good and detailed lwjgl tutorial on: 2014-08-16 09:28:48
There is also the List of Learning Resources here on JGO!
You can find some good tutorials there Wink
2  Game Development / Newbie & Debugging Questions / Re: Levels rendered sideways? on: 2014-07-27 09:42:25
That's because OpenGL has its origin in the lower left corner.
Like trollwarrior1 said already you could flip the y Coordinate with
screenHeight - y;
or else you could just initalize OpenGL with
glOrtho(0, screenWidth, screenHeight, 0, -1, 1);
, then you have your origin in the top left.
There's nothing wrong with changing the orthographic projection Wink
3  Discussions / General Discussions / Re: New feature: Embedded PDFs on: 2014-07-19 16:48:02
Sadly this feature don't work on Opera - even though it is using the same engine as Chrome. After clicking "click this page to load the PDF" download is initalized, but nothing appears.
I'm using Opera 12.17 (64-bit) and it works fine for me Smiley
Don't know if there's a different engine with other versions.
4  Game Development / Newbie & Debugging Questions / Re: LWJGL BufferedImage white image on: 2014-07-13 11:37:32
Hmmm, still not working...
Just saw that you do
glLoadIdentity()
between
glBegin(...)
and
glEnd()
.

You'll get an OpenGL Error when doing this:
GL_INVALID_OPERATION is generated if glLoadIdentity is executed between the execution of glBegin and the corresponding execution of glEnd.

So does it work if you delete that
glLoadIdentity()
? Smiley
5  Game Development / Newbie & Debugging Questions / Re: LWJGL BufferedImage white image on: 2014-07-13 10:49:52
You haven't set your texture scaling parameters.
Try calling this between
GL11.glBindTexture(...)
and
GL11.glTexImage2D(...)
:

1  
2  
3  
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
// Alternatively you could use GL11.GL_LINEAR instead of GL11.GL_NEAREST

After that you should see your texture Wink

Also you should do
GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureID)
before drawing your image.
Hope that helped Smiley
6  Game Development / Newbie & Debugging Questions / Re: Rectangles not drawn after Texture is initialized on: 2014-06-12 23:23:06
Ha. But I didn't actually draw the texture yet. When I do it gets rid of the rectangle. That's the problem.
Do you bind your texture? Roll Eyes
And instead of
glRectf(x1, y1, x2, y2)
you could try this:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
// Note: This method assumes that x1 < x2 and y1 < y2, and also that the texture origin is bottom left.
public void drawRect(float x1, float y1, float x2, float y2) {
    glBegin(GL_QUADS);
        glTexCoord2f(0f, 0f);
        glVertex2f(x1, y1);
        glTexCoord2f(1f, 0f);
        glVertex2f(x2, y1);
        glTexCoord2f(1f, 1f);
        glVertex2f(x2, y2);
        glTexCoord2f(0f, 1f);
        glVertex2f(x1, y2);
    glEnd();
}

Before calling
drawRect(x1, x2, y1, y2)
you should do
glBindTexture(GL_TEXTURE_2D, textureId)
.
Does that solve your problem? Smiley
7  Game Development / Newbie & Debugging Questions / Re: Should I use Java Observer? on: 2014-06-11 14:10:09
Well the benefit from using the Java Observer is, that you don't have to write it yourself Roll Eyes

The only things you would have to do:
  • Create your Entity class (extends java.util.Observable)
  • Create an EntityObserver class (implements java.util.Observer)
  • When creating a entity do
    entity.addObserver(observer)
  • When a change in your entity happens do
    setChanged()
    and
    notifyObservers()

I wouldn't bother writing your own Observer pattern Wink
8  Discussions / General Discussions / Re: [Swing] Can swing look sexy? on: 2014-05-28 17:24:06
JavaFX is supposedly the future, but so far it's a *tumbleweed* - who's making anything beyond trivial demos with it?
I'm making a WM 2014 Live Ticker for a lecture project... then again, it is a trivial application... Roll Eyes
It probably won't even be completed because my teammates are rather lazy... I neither have the will nor the time to program their parts too Emo

In the end I still prefer Swing over JavaFX.
9  Games Center / Featured Games / Re: [Slick2d] Retro-Pixels Castle Survival - Top Down Survival Mayhem! on: 2014-05-25 10:04:12
There was a good tutorial that I found (though I can't find it again) that explained how to use powers of two.

The first tutorial that comes to my mind is this one.
Is that the tutorial you had in mind? Smiley
10  Game Development / Shared Code / Re: json on: 2014-05-23 14:59:52
Now that you have a JSON Parser you could expand it to a YAML (v1.2) Parser Grin

And +1 for the recursive descent parser Smiley
11  Discussions / General Discussions / Re: [Swing] Can swing look sexy? on: 2014-05-07 17:52:27
Instead of Swing you could also use JavaFX, there you could even do some 3D Graphics an such.
And you can style your GUI like you want with Cascading Style Sheets. Wink
A easy start would be this tutorial Pointing

I actually think that Oracle wants JavaFX to replace Swing someday... in every Swing-Tutorial there's something about learning JavaFX.
12  Discussions / General Discussions / Re: [Web Games] What is the best second language? on: 2014-05-01 09:44:09
Well you could also use HTML for making games Roll Eyes
13  Game Development / Newbie & Debugging Questions / Re: Opening an inventory Screen on: 2014-04-10 21:37:57
Hey I'm trying to put in your StateStack right now and the issue I have is on line 8 where it reads " pushState(states.get("MainGame")); "
I get an error that reads
"The method pushState(String) in the type StateStack is not applicable for the arguments (State)"

however if I make it so that
the pushState Method in line 22 takes a state instead than it compiles, I cant really test it yet cause I dont have my inventory and all set up yet, but any idea on whats going on with that?

Oh... that's my bad Lips Sealed
Of course it should be like this:
1  
2  
3  
4  
5  
public StateStack() {
   addState("MainGame", new MainGameState());
   addState("InventoryState", new InventoryState());
   pushState("MainGame");
}

I messed it up when I copy&pasted the StateMachine and changed it to the StateStack Roll Eyes
Maybe I should change it in the StackMachine as well so it looks similar persecutioncomplex
I'll fix it in the code above! Thanks Wink
14  Game Development / Newbie & Debugging Questions / Re: Opening an inventory Screen on: 2014-04-10 16:28:45
Thats pretty sweet, I actually might use it!

Well in that case you might consider using a state stack instead of a state machine, it could be somewhat more flexible:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
public class StateStack{
   private Map<String, State> states = new HashMap<String, State>();
// private Stack<State> stack = new Stack<State>();
// But Stack<E> extends Vector<E>, so you should probably use Deque<E> instead:
  private Deque<State> stack = new ArrayDeque<State>();

   public StateStack() {
      addState("MainGame", new MainGameState());
      addState("InventoryState", new InventoryState());
      pushState("MainGame");
   }

   public void update() {
      State currentState = stack.peek();
      currentState.update();
   }

   public void render() {
      State currentState = stack.peek();
      currentState.render();
   }

   /** Enter new State */
   public void pushState(String stateName) {
      State newState = states.get(stateName);
      stack.push(newState);
   }

   /** Exit current State and return to the State before */
   public void popState() {
      stack.pop();
   }

   public void addState(String stateName, State state) {
      states.put(stateName, state);
   }
}


With that approach you don't have to remember which State was before the current State Wink
But with a few States (like about two) the state machine is entirely sufficient.
Glad if it helps Smiley
15  Game Development / Newbie & Debugging Questions / Re: Opening an inventory Screen on: 2014-04-10 15:19:04
Another way to do this could be that you make a State System.
With that approach you could easily add more States like a game menu or battle menu, etc.
Could look like this pseudo code snippets:

1  
2  
3  
4  
public interface State {
   public void update();
   public void render();
}

1  
2  
3  
4  
5  
6  
7  
8  
9  
public class InventoryState implements State {
   public void update() {
      // insert update code here
  }

   public void render() {
      // insert render code here
  }
}

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
public class Game {
   private StateMachine stateMachine = new StateMachine();
   private boolean running;

   public void gameLoop() {
      // initialize etc.

      while(running) {
         // getting delta time and so on

         stateMachine.update();
         stateMachine.render();

         // some fps mechanism like Thread.sleep()
     }
   }
}


And for changing the State you could use a state machine:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
public class StateMachine {
   private Map<String, State> states = new HashMap<String, State>();
   private State currentState;

   public StateMachine() {
      addState("MainGame", new MainGameState());
      addState("InventoryState", new InventoryState());
      changeState("MainGame");
   }

   public void update() {
      currentState.update();
   }

   public void render() {
      currentState.render();
   }

   public void changeState(String stateName) {
      currentState = states.get(stateName);
   }

   public void addState(String stateName, State state) {
      states.put(stateName, state);
   }
}


Free to use for anyone Smiley
16  Game Development / Networking & Multiplayer / Re: Game Networking Framework on: 2014-04-07 19:12:58
Well when I worked with a Client-Server-System the Server send messages in some pseudo XML, something like this:
1  
2  
3  
4  
5  
6  
7  
8  
begin:foobar
begin:intlist
0
1
2
end:intlist
length: 3
end:foobar


So let's assume you have a Player class with an ID, x, y, hp and mp. Your server messages could look like this:
1  
2  
3  
4  
5  
6  
7  
begin:player
id:1234
x:5
y:8
hp:321
mp:234
end:player

After that you could parse that messages, possibly with a recursive descent parser.
You could also send a message "Player(1234,5,8,321,234)", you just have to know how to parse your message for the constructor.

Does that help? Smiley
17  Game Development / Articles & tutorials / Re: Tutorial: stutter-free texture streaming with LWJGL on: 2014-03-24 16:59:23
That's interesting to read!
Thanks for that tutorial Smiley
18  Java Game APIs & Engines / OpenGL Development / Re: LWJGL library path for Eclipse on: 2014-03-23 17:32:07
One slight change is that you have to set a string parameter as the property:

1  
      System.setProperty( "org.lwjgl.librarypath", new File( "target/natives" ).getAbsolutePath() );


i.e. the absolute path at the end.

Oh... you're right, I overlooked that! Thanks Wink
Fixed it Smiley
19  Game Development / Newbie & Debugging Questions / Re: What to use for config files? on: 2014-03-11 21:15:05
If you wan to use the standard library, Properties is a (somewhat old, but usable) way to save key-value pairs in files. You use it as a hashmap, and can store it to a file via a stream, or read a hashmap in from a stream. It also supports xml. Properties is good for using as a simple config file.

Edit: Also Preferences is probably even better than properties, check it out.

+1 for Properties, that's the way I learned to do setting files in lecture. Really easy to use!  Smiley
That Preferences thing looks also quite interesting. Wink
20  Game Development / Newbie & Debugging Questions / Re: Compile and Debug Java on: 2014-03-11 19:52:04
Fighting over this is like fighting over which engine/graphic api is the best Roll Eyes

Oh well we had that too Wink

Yeah and not only once Cheesy

Though i wanted to try oracle IDE, forgot the name...

You mean Oracle JDeveloper?
21  Game Development / Newbie & Debugging Questions / Re: Compile and Debug Java on: 2014-03-11 19:46:12
Why fighting over which IDE is the best?
I switched from Eclipse to NetBeans some time ago, so what?
Fighting over this is like fighting over which engine/graphic api is the best Roll Eyes

In the end it is you who decides what you do with it or how you use it Smiley
22  Game Development / Newbie & Debugging Questions / Re: LWJGL and LibGDX - Little comprehension problem (What is low level?) on: 2014-03-11 16:45:08
Well it's pretty easy:
LWJGL is just a wrapper to OpenGL , OpenCL and OpenAL for Java.
LibGDX uses LWJGL underneath and do some of the boilerplate code for you.

If you going to start and want to learn pure OpenGL/OpenCL/OpenAL use LWJGL, if you want to make games faster then use LibGDX Wink
23  Discussions / General Discussions / Re: Making everything by yourself. And loving it! on: 2014-03-10 09:37:26
Good to see, that I am not the only one with this opinion Smiley

On the one hand reinventing the wheel could be a waste of time, but on the other hand you'll learn a lot of things through reinventing the wheel!
I don't think it would be a waste of time, and if you learned how to build that wheel you still can take some high level api if you want to.

Now I've got to go, lecture is waiting Smiley
24  Discussions / General Discussions / Re: What are your brainstorming techniques? on: 2014-03-05 22:02:00
Usually I first decide what kind of game it should be, e.g. a RTS game.
Next I think about the setting, first the basic like let's say medieval setting, from that point I write down everything what comes to my mind.
After that I think about mechanics and the story, if there will be one.
And of course if it will be a bigger project I start to write a Game Design Document which grows over the period of time Roll Eyes
25  Java Game APIs & Engines / OpenGL Development / Re: LWJGL library path for Eclipse on: 2014-03-03 22:11:31
I'm not sure if it is that what you ask, but you can set the directory with @BeforeClass (I assumed that you use JUnit for the Tests):

1  
2  
3  
4  
@BeforeClass
public void setLwjglDirectory() {
    System.setProperty("org.lwjgl.librarypath", new File("path/to/natives").getAbsolutePath());
}

Alternatively you could also set the property as the first call in your main method.
Or were you looking for something like this?
I hope that helped Smiley
26  Game Development / Newbie & Debugging Questions / Re: How do you guys name builds, betas, etc. on: 2014-02-28 07:12:19
At the moment I usually do it like this:
1  
@version Major.Minor[.Build] (Day.Month.Year)

So I have the version and the build time. Smiley

You could also get more information about Versioning here. Interesting to read Cheesy

By the way in Visual Studio Versioning is like this:
1  
Major.Minor.Build.Revision
27  Games Center / Android Showcase / Re: Voyage to Farland (Win/Linux/Mac/Android) on: 2014-02-19 11:35:16
Looks interesting, it reminds me of The Legend of Zelda and Dragon Warrior Smiley
I think I'll try it out when I'm home.
28  Discussions / General Discussions / Re: Hello JGO! on: 2014-02-17 18:32:26
Hello SilverTiger. Good luck with ... uh ... the other API...  Clueless

Don't worry, JogAmp is also a good api, but I came across LWJGL first Wink
And thanks to everytone so far Smiley
29  Game Development / Artificial Intelligence / Re: Simple but efficient pathfinding AI on: 2014-02-17 18:23:19
In my C# Client I used a simple Pathfinding algorithm, maybe it'll help you!
First I have to say that I had an Array which contained the Tiles.
I went through that map array and made a boolean array where tile(x,y) = true if it was walkable, else it was false.
After that I made an array which contained the distances from the end point to the other tiles, I used that array then to form a path.

It isn't the ideal pathfinding, but it is rather simple to implement.
Now there we go:
http://pastebin.java-gaming.org/fb985144580

How does it work? Here is a simple example:
S is the start point and E of course the end point, x is not walkable.
1  
2  
3  
4  
[ ] [S] [ ] [ ]
[x] [ ] [x] [x]
[ ] [ ] [x] [ ]
[ ] [ ] [ ] [E]

Now that's our start, now we look starting at the end point how much steps we need to any other tile:
1  
2  
3  
4  
[6] [5] [7] [8]
[x] [4] [x] [x]
[4] [3] [x] [1]
[3] [2] [1] [0]

Then we just take the shortest Path in descending order: 5/S -> 4 -> 3 -> 2 -> 1 -> 0/E
1  
2  
3  
4  
[6] [S] [7] [8]
[x] [▼] [x] [x]
[4] [▼] [x] [1]
[3] [►] [►] [E]


I hope I didn't forget something or mixed it up... Glad if it'll help you a little with that pathfinding Smiley
30  Discussions / General Discussions / Re: Hello JGO! on: 2014-02-16 08:26:39
You say that you're learning LWJGL, but this is (relatively) the first time you've done actual graphics programming in Java? If you understand it fine because of your previous programming experience, that's good please ignore this, but if it seems a bit over your head consider learning Java2D (built in java graphics library) first before going on to more advanced APIs. Java2D is a good introduction to Java graphics programming whereas LWJGL has a somewhat strange structure to new people.

I think I used Java2D when learning building GUIs (was fun to do everything by hand).
And yeah... it is unusual to make everything static, if it is that what you mean by strange structure, but I think that's great because you don't have to reference an OpenGL binding or something! I know it can be difficult to start with LWJGL but fact is I'll soon have an OpenGL lecture Wink.
Pages: [1] 2
 

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

The first screenshot will be displayed as a thumbnail.

radar3301 (12 views)
2014-09-21 23:33:17

BurntPizza (30 views)
2014-09-21 02:42:18

BurntPizza (22 views)
2014-09-21 01:30:30

moogie (20 views)
2014-09-21 00:26:15

UprightPath (28 views)
2014-09-20 20:14:06

BurntPizza (32 views)
2014-09-19 03:14:18

Dwinin (48 views)
2014-09-12 09:08:26

Norakomi (74 views)
2014-09-10 13:57:51

TehJavaDev (102 views)
2014-09-10 06:39:09

Tekkerue (50 views)
2014-09-09 02:24:56
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!