Hi !
Featured games (85)
games approved by the League of Dukes
Games in Showcase (636)
Games in Android Showcase (178)
games submitted by our members
Games in WIP (688)
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]
1  Discussions / General Discussions / Re: Does Internet cost matter to you? on: 2015-04-06 23:09:31
I could even believe in you, OP, but when you said you were going to use Java, I lost all my faith.

And I'm not saying this because I hate Java; instead, it is because I have a very large experience with Java (3 years and a half), and I KNOW that this is impossible. Just, impossible.

And, even if you used a low-level language or JNI, I'm still pretty sure this is impossible. You are probably just a kid saying things you'll never do to gain attention.
2  Game Development / Newbie & Debugging Questions / Confusion with VAO/glDrawArrays and Frustum Culling on: 2015-03-31 17:02:49
Hey there.

Just to give you all my context: I know that there is A LOT of good engines and libraries out there, like libGDX, JMonkeyEngine, etc. But I'm developing a small personal "engine", for learning OpenGL.

Now, to the point: Currently, I have a world with ~1050 blocks, and I use a >ImmediateArrayBatcher< class (which extends >Batcher> class with some useful but not important methods) for drawing them, also using a >VertexObject> class behind the scenes.


Then, EVERY frame, I'm re-populating the VertexObject buffers and re-calling glDrawArrays() and the other methods on ImmediateArrayBatcher._flush().

I have read a bit about immediate mode, VAOs and VBOs, but I still can't pull this out to code.

I tested the performance with this ImmediateArrayBatcher and a ImmediateBatcher, which uses the deprecated immediate mode (glBegin, glEnd...), and the FPS was the same (~1050 blocks, ~140 FPS on my machine), even with Frustum Culling.

Then, I came into another problem: I could use display lists, but... what about the Frustum Culling? When in a frame some blocks would not be render, they will not be anymore rendered since they were not rendered on the display list when it was created. Or, even more, I think that only populating the VertexObject buffers one time, and then only calling glDrawArrays() after would cause the same thing.

Also, my blocks are not necessarily 1x1x1: then, I cannot create something like "chunks" for separating display lists for each one.

So, my questions are:

1 - Should I use glDrawArrays() or glDrawElements()? And, if I use the second one, how should I populate my VertexObject class?
2 - As I said before, since I'm using Frustum Culling, I cannot use display lists, and I don't know how to properly populate the VertexObject buffers and calling glDrawArrays() after. Then, would VAO and/or VBO help me there?

3  Game Development / Game Mechanics / Re: How to handle collision detection when an entity movement speed is high? on: 2014-05-10 20:04:58
I think I've explained it bad, so here I go again.

I AM checking for collision and not intersection. It's something like:

  • player wants to move from 126,126 to 126,127
  • creates a new Box for that position { x = 126, y = 127, width = 32, height = 32 } (width and height are playerWidth and playerHeight, respectively).
  • check if this box collides with any object (entity/block/etc) on the map. if yes, the movement does not happen. if no, the movement goes normally.

BUT, the problem is: in the example above, the player moved +1 y (his movement speed is 1). but, what if his movement speed is 2?

So, here we go again:

  • player wants to move from 126,126 to 126,128
  • creates a new Box for that position { x = 126, y = 128, width = 32, height = 32 }
  • the new Box endX and endY are 158 and 160, respectively.
  • there is a block located at y = 160.
  • so, the player can't move, since it would collide with the block. BUT, the player could have moved to y = 127 (endY = 159), with 1 movement speed.

So, moving the player with 1 movement speed is alright. The problem is when moving with higher and/or fractional movement speeds (like 2.5, 3.25, etc).
4  Game Development / Game Mechanics / Re: Organizing classes on: 2014-05-10 19:52:29
Is it best to load all of my 3D models at the very beginning of my game, or should I load them for each level and dispose them as levels change?

Is it the loading and storing that slows down the program, or is it the rendering?

This is for mobile devices.

It depends on what is "slows down the program". Loading will increase CPU usage, storing will increase RAM allocated.
5  Game Development / Game Mechanics / How to handle collision detection when an entity movement speed is high? on: 2014-05-10 18:30:24

So, basically, my collision detection code is something like this:

public Boolean canMove() {
  Position pos = positionEntityWannaMoveTo;

  for (WorldObject : All Objects In Map) {
    if (WorldObject.intersects(pos)) {
      return false;

  return true;

Ok, obviously, my code isn't like this because it would use too much CPU considering the map has a high number of entities/tiles, but the "base" of the detection is something like that.

Suppose, my player is at Y 126.0, and his height is 32.0. So, his feet Y is 158.0, and there is a solid block at Y 159.0. So, if my player movement speed is 1.0, it will move correctly. But, what if the movement speed is 2.0, then the final move feet Y would be 160.0, being blocked by the block.

Then I tried to divide the movement speed in parts, so it would detect and move each 1.0 of movement speed. But, what if the movement speed is partial, like, 3.5? Then I should move each 0.5 of movement speed? And if it is 3.85?

So, there is a proper way to handle the movements with partial movement speed?
6  Game Development / Game Mechanics / Better way to move the map according to player position? on: 2014-05-08 04:56:27

I'm developing a 2D game with tiled-based maps. So, when my player moves any point after/before screenWidth / 2 or screenHeight / 2, it'll .glTranslate the map and everything drawn on it. To calculate when it should translate or not, untranslate or not, and how much translate, I'm not using anything like matrixes: I'm just using pure math code.

My question is: is there a way to do it better? This way, right now, isn't affecting performance or anything related, but I'm just wondering if I could get the same result using transformation or projection matrixes? (Since I don't know how those works.)

7  Discussions / General Discussions / Re: JEP for making Unsafe a public API on: 2014-05-05 01:40:56
Oops, sorry, didn't noticed that!

Well, I know that you are not talking about accesibility... but in case anyone want it, you can easily access the Unsafe class...

Field field = Unsafe.class.getDeclaredField("theUnsafe");


return (Unsafe) field.get(null); // Return the Unsafe instance
8  Discussions / General Discussions / Re: JEP for making Unsafe a public API on: 2014-05-05 01:36:05
I don't get it... I can access Unsafe normally, it's a public class. I can normally use 'Unsafe.getInstance()'. So, of what are you talking about?
9  Java Game APIs & Engines / OpenGL Development / Re: How can I improve my rendering? (VAO/VBO) on: 2014-05-04 23:52:28
Well, there's 3 things you need to do:

1. Pack all your sprites into texture atlases. Plenty of information around about how to do this.
2. Sort your sprites according to rendering state needed, eg. blend mode, texture binding
3. Batch all your sprites up into groups with the same rendering state, writing indices out to an index array, and use glDrawElements to draw, say, 100 sprites in one go, rather than 100 calls to glDrawArrays.

Stop using that tesselator thing.

Cas Smiley

Hello, and thanks for answering me, I know how boring this can be.

Well, I'll follow your tips ^^. Just wondering, when you say writing indices out to an index array, it's something like the method 'addVertex' here If yes, is it possible to configure more vertex properties, like brightness and etc using this array? (As I've seen, Minecraft have block brightness, and they are set on the arrays sent to glDrawArrays too.)
10  Java Game APIs & Engines / OpenGL Development / Re: How can I improve my rendering? (VAO/VBO) on: 2014-05-03 14:46:05
Erm... hm... well... yeah, I'm drawing each sprite separately :// I'm very newbie on OpenGL, started learning like 1 month. I don't know how to name it correctly, but the Tessellator class is something like "vertex array immediate mode", isn't it?

Btw, the detectTerrainIntersection was my fault, I was calling it for each entity, each tick. Now I've made some 'cached collisions' workaround and it's working great, not even getting 4% on profilling.

So yeah, the problem is my stupid Tessellator class with immediate mode for every block and every entity on world, since I still am not that experienced to do something like Sprite Batching.

@Edit: Oh, and glBindTexture is taking 8%... another problem from immediate mode.
11  Java Game APIs & Engines / OpenGL Development / Re: How can I improve my rendering? (VAO/VBO) on: 2014-05-03 03:33:07
New log (around 4 minutes of execution):
12  Java Game APIs & Engines / OpenGL Development / Re: How can I improve my rendering? (VAO/VBO) on: 2014-05-02 19:31:20
Hey there,
Just saying, probably tomorrow I'll post it, because I upgraded from Win7 -> Win 8 and Intel haven't published the drivers for my graphics board, so yea it'll take some time 'til I be able to re-open my game.
13  Java Game APIs & Engines / OpenGL Development / Re: How can I improve my rendering? (VAO/VBO) on: 2014-05-02 14:04:17
Yes I've already seen the display lists, but the problem is: I have some animated tiles. But I'll try it, like rendering all static tiles via display lists and after, draw animated tiles separated, but I still think that the problem isn't the tiles itself, but yes the entities, and the entities are always in movement and changing sprites so display lists won't work :/ Anyway, thanks.

Hey there, my -Xprof log result:

As you can see, my is taking 15% of the time, but I still don't think this is the main issue (yeah, today I'll try to modify some things on it). GL.drawArrays is using 24%, and (wtf?) is using 13%.
14  Java Game APIs & Engines / OpenGL Development / How can I improve my rendering? (VAO/VBO) on: 2014-05-01 16:40:00
(First, sorry for my bad english, I'm brazilian :/)

Good afternoon,

Well, I'm learning OpenGL/LWJGL right now, and I'm developing a little 2d game:

My problem is, even it's a 2D game, with 12 entities on my map, I'm having only 30 FPS. Yes, it's a crappy 2009' notebook with Intel on-board graphics and a simple dual-core CPU, but the same way, 30 FPS is sooo little for a 2D game.

So I've been reading some tutorials, articles, topics and etc about Sprite Batching, VBOs and VAOs, but I couldn't get it well. My rendering class right now is an edited Tessellator-class taken from Minecraft, used for testing and learning purposes only.

The class "Tessellator" right now:

Aand the "VertexObject" class used in Tessellator:

(Methods like hasColor(), getColor(), hasTexture(), getTextureUV(), etc, are all from sub-class Tessellator, but I'm sure they doesn't matter here.)

So, how can this be improved? I know there's a better solution for glXPointer, but even reading a lot I can't put it on practice.

Thanks in advance.
15  Game Development / Newbie & Debugging Questions / Re: Run another program inside my program applet/canvas? on: 2012-12-13 18:11:44
Ook, thank you!
16  Game Development / Newbie & Debugging Questions / Run another program inside my program applet/canvas? on: 2012-12-13 17:50:00

I was thinking... in Java, is there a way to run another java program, and display this program INSIDE my program, via Canvas or something?

Pages: [1]
Dwinin (75 views)
2015-11-07 13:29:08

Rems19 (81 views)
2015-10-31 01:36:56

Rems19 (81 views)
2015-10-31 01:32:37

williamwoles (107 views)
2015-10-23 10:42:59

williamwoles (93 views)
2015-10-23 10:42:45

Jervac_ (112 views)
2015-10-18 23:29:12

DarkCart (137 views)
2015-10-16 00:58:11

KaiHH (118 views)
2015-10-11 14:10:14

KaiHH (159 views)
2015-10-11 13:26:18

BurntPizza (173 views)
2015-10-08 03:11:46
Rendering resources
by Roquen
2015-11-13 14:37:59

Rendering resources
by Roquen
2015-11-13 14:36:58

Math: Resources
by Roquen
2015-10-22 07:46:10

Networking Resources
by Roquen
2015-10-16 07:12:30

Rendering resources
by Roquen
2015-10-15 07:40:48

Math: Inequality properties
by Roquen
2015-10-01 13:30:46

Math: Inequality properties
by Roquen
2015-09-30 16:06:05

HotSpot Options
by Roquen
2015-08-29 11:33:11 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‑
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!