Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (499)
Games in Android Showcase (118)
games submitted by our members
Games in WIP (567)
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  Java Game APIs & Engines / Java 2D / Re: AWT/Java2d-Pipeline interaction design questio on: 2005-05-31 11:07:50
Quote



How so? I've been doing that for a while as of late. Never had any problems with it.


Well ... Put a big AWT Panel in a JScrollPane and you'll see for yourself.
2  Game Development / Newbie & Debugging Questions / Re: What good is java.nio for? on: 2005-05-04 14:01:43
Cas, the map method of a FileChannel allow you to map only a part of the file so what's the problem with 2GB files ?
3  Discussions / Miscellaneous Topics / Re: Any good Regexp tutorials? on: 2005-05-04 09:18:19
Quote
Thanks guys. Is the regex fast enough to use in a game during runtime?

Currently I'm using it to load maps from plain text files.


Pattern's static factory method "compiles" the regular expression in a state machine. Once compiled, a regular expression is quite fast, taking character as input event and switching from state to state. So you can use a regex in a loop very efficiently, but try to compile it outside of the loop.
4  Java Game APIs & Engines / Java 2D / Re: BufferedImage and animated gifs on: 2005-05-02 09:50:15
javax.imageio.ImageReader handles image files containing multiple frames.
5  Game Development / Newbie & Debugging Questions / Re: opengl questions on: 2005-04-30 07:59:40
OpenGL is a really low level graphic api. There is no such things like "controls" or "buttons". It's more about drawing textured polygons, lines and points. So the short answer is NO. Still, you can create your own widgets ( see http://glow.sourceforge.net/ for an example ), but if you're new to OpenGL, it's probably too much of a challenge.
6  Java Game APIs & Engines / OpenGL Development / Re: Grayscale on: 2005-04-29 07:06:09
Too bad SGI_color_matrix is not part of core opengl...
7  Java Game APIs & Engines / OpenGL Development / Re: Mapping window position to openGL position on: 2005-04-26 06:55:32
So ... converting a 2d point (screen) in a 3d point (opengl space) ? Sounds odd isn't it ? The best you can get is a ray, not a point. search google for "opengl ray picking".
8  Game Development / Game Mechanics / Re: Pixel Collision Optimzation? on: 2005-04-22 07:23:45
Quote

Also, I'm assuming the tree needs to be recalculated for each sprite animation... ?


Each animation frame has its own tree.
9  Game Development / Game Play & Game Design / Re: Tile based map formats for fast display -- on: 2005-04-21 06:41:55
Once again, quadtree comes to mind. Some other people have explained it better than I can, so feel free to ask google for it =). Quadtree is a space partitionning tree for 2d space ( Octrees are for 3d space ). Basicaly, you got a root node covering the entire area of your map. The root contains four sub-nodes dividing the root area in four parts, and so on recursively to a given depth. So, looking for the tiles in a given area is done by traversing the tree, branching to the appropriate sub-nodes until you reach the area you'r interested in.
10  Java Game APIs & Engines / OpenGL Development / Re: Glow effects on: 2005-04-20 05:11:36
Quote

Only, there is not a single card that supports that extension: http://www.delphi3d.net/hardware/extsupport.php?extension=GL_EXT_convolution


Convolutions are part of the imaging subset ( ARB_Imaging ) that is widely supported ... by NVIDIA only Sad

The website you mentioned is quite handy !
11  Java Game APIs & Engines / OpenGL Development / Re: Glow effects on: 2005-04-19 14:26:49
1) Load your sprite in a texture.

2) Create a large bluring kernel ( search goole about convolution kernel or look at the java.awt.image.ConvolveOp class ). It is nothing more than an array of weights applied on source pixels to produce a destination pixel.

3) Load the kernel using glConvolutionFilter2D

4) Configure post convolution scale  to intensify the glow.

4) Enable convolution : glEnable(GL_CONVOLUTION_2D_EXT)

5) "Blit" your sprite

6) Disable convolution

7) "Blit" your sprite again.

I must admit I've never tried it =) I dont even know if it is accelerated on common opengl cards.

12  Game Development / Game Mechanics / Re: Pixel Collision Optimzation? on: 2005-04-19 09:52:23
Hopefully, this can be greatly optimized by the use of quadtrees. A "collision" quadtree for this sprite is a hierarchical structure that allow you to test for collision in a increasing precision way. Each node of this tree cover a part of the sprite and the "oppacity state" of this part ( OPAQUE, TRANSPARENT, MIXED ). If a node is MIXED, it contains four sub-node covering each a quarter of the parent's sprite area. The root node covers the entire area.

Example :

Let's say a sprite is a 100x100 pixel array, the quadtree may looks like this :

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
// (x,y,width,height) STATE
(0,0,100,100) MIXED
|`-- (0,0,50,50 ) OPAQUE
|`-- (50,0,50,50 ) TRANSPARENT
|`-- (0,50,50,50) MIXED
|      |`-- (0,50,25,25) OPAQUE
|      |`-- (25,50,25,25) TRANSPARENT
|      |`-- (0,75,25,25) OPAQUE
|      `-- (25,75,25,25) MIXED
|            ...
 `-- (50,50,50,50) OPAQUE


This structure is built when you load the sprite and stick with it the all sprite's life.

Now, when you need to know if two sprites overlap, apply this algorithm :

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  
public bool collisionTest( Node node1, Node node2 ) {
  if( node1.state == TRANSPARENT || node2.state == TRANSPARENT ) {
    return false;
  } else if( node1.state == OPAQUE || node2.state == OPAQUE ) {
    return true;

  // they're both mixed.
 } else {
    Node node11, node12, node13, node14;
    Node node21, node22, node23, node24;

    return
       collisionTest( node1.subnode1, node2.subnode1 ) ||
       collisionTest( node1.subnode2, node2.subnode2 ) ||
       collisionTest( node1.subnode3, node2.subnode3 ) ||
       collisionTest( node1.subnode4, node2.subnode4 );
  }
}

// test

Sprite sprite1( "sprite1.png" );
Sprite sprite2( "sprite2.png" );

if( collisionTest( sprite1.collisionRoot, sprite2.collisionRoot )) {
  System.out.println("Sprites overlap");
} else {
  System.out.println("Sprites dont overlap");
}


Note: This algorithm only works for sprites having the same dimension and not offseted. More advenced collision detection require quite more code but are easily feasible too.

Hope this helps =)
13  Java Game APIs & Engines / OpenGL Development / Re: Anti-Aliasing Fullscreen, but how?? on: 2005-04-19 06:09:27
You have to deal with PixelFormat here. Take a look at the constructor's parameter labeled "samples".
14  Java Game APIs & Engines / OpenGL Development / Re: FloatBuffers and glGetTexParameter on: 2005-04-19 06:01:52
Quote

Here's a snippit of working code:
1  
2  
3  
4  
5  
6  
            GL11.glEnable(GL11.GL_LIGHTING);
            float[] al = { 0.3f, 0.3f, 0.3f, 0.0f }; // RGBA for ambient light
           ambientLight = BufferUtils.createFloatBuffer(al.length);
            ambientLight.put(al);
            ambientLight.rewind();
            GL11.glLight(GL11.GL_LIGHT0, GL11.GL_AMBIENT, ambientLight);


There is no need for an array here. You can simply do that :

1  
2  
3  
4  
5  
6  
7  
8  
9  
// create a buffer
FloatBuffer ambientLight = BufferUtils.createFloatBuffer(4);

// fill it with RGB for ambient light
ambientLight.put( 0.3f ).put( 0.3f ).put( 0.3f ).put( 0.0f );
ambientLight.rewind();

// That's it !
glLight( GL_LIGHT0, GL_AMBIENT, ambientLight );


To answer NovaC, a direct buffer is simply a buffer created using the static method ByteBuffer.allocateDirect(). See ByteBuffer's javadoc for in deep explanations. I think BufferUtils does nothing more than calling that.
15  Java Game APIs & Engines / OpenGL Development / Re: Glow effects on: 2005-04-19 05:15:02
It's not that complicated. Use imaging extention ( notably glConvolution... ) and a bluring kernel to "grow" your pictures, then apply a sharpening kernel to intensify it.
16  Game Development / Game Play & Game Design / Re: direction inidicating sprites... on: 2005-04-11 06:02:17
What you mean by "This is not working" ? Is the player's viewport a square ? If not, the angle isn't 45.
17  Java Game APIs & Engines / Java 2D / Re: super mario hill-problem.. on: 2005-04-08 09:58:56
Testing for tile transparency is kind of ugly. Instead, I think you should maintain a int[32] companion array for each type of tile that contains height values. This even allow you to do some cool effects like outdoor tiles where mario's feet are slightly hidden behing grass or such things.
18  Java Game APIs & Engines / JOGL Development / Re: JOGL Overlays on: 2005-03-23 11:51:59
About drawing something on the top of your scene, you can call glDepthRange( 1f, 1f ); before drawing and restore it to glDepthRange( 0f, 1f ). I've never tried that but it may work.
19  Java Game APIs & Engines / JOGL Development / Re: JOGL Overlays on: 2005-03-23 11:40:23
There is no 2D in OpenGL, only 3D. glOrtho sets your projection matrix to a special case of perspective projection called "orthographic projection" where parallel lines remain parallel once projected. So your "2d box" is in fact a quad facing the camera in a 3d space. Now if you can think of your "2d box" as a quad, you should understand why rotating it along x or z axis appears to scale it and why translating it along the y axis has no effect.
20  Game Development / Performance Tuning / Re: Escape Analysis on: 2005-03-23 06:13:02
Hi there,

princec, there is maybe a way to implement this functionality without any addition to the java language :

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  
package java.nio;

public abstract class ObjectBuffer extends Buffer {

  public ObjectBuffer( int capacity ) { ... }
  public ObjectBuffer( ByteBuffer buffer ) { ... }

  public ObjectBuffer duplicate();
  public ObjectBuffer slice();
  // ... name it

}


package org.lwjgl....;

@Pack(4)
public VertexBuffer extends ObjectBuffer {

  public VertexBuffer( int capacity ) { ... }
  public VertexBuffer( ByteBuffer buffer ) { ... }

  public @Mapped float x;
  public @Mapped float y;
  public @Mapped float z;
  public @Mapped float nx;
  // ...

  // error, only primitive types can be mapped.
 public @Mapped Object o;


}


the @Mapped fields' values depend on the current ObjectBuffer position.
Does it suits your needs ?
21  Java Game APIs & Engines / OpenGL Development / Re: Zooming around a point on: 2005-03-10 05:55:27
Are you using orthographic projection (glOrtho) or perspective projection (glFrustum) ?
22  Java Game APIs & Engines / OpenGL Development / Re: loading an image with lwjgl devil on: 2005-03-08 05:11:15
ilCopyPixels returns an array of pixels. The ImageIcon constructor wants the bytes of an image file. Why don't you just try that :

1  
ImageIcon ii = new ImageIcon( path );


Hope this helps.
23  Java Game APIs & Engines / OpenGL Development / Re: Keyboard.enableBuffer() not available in 0.95w on: 2005-02-21 11:28:00
Polling is ok for movement keys and such, but for things like typing, you need some kind of buffering.
24  Game Development / Game Mechanics / Re: hovercraft physics, help please.... on: 2005-02-21 09:20:28
There is a full chapter on hovercraft physics in this book:

http://www.oreilly.com/catalog/physicsgame/

If you can get a hand on it...
25  Java Game APIs & Engines / OpenGL Development / Re: LWJGL vs Jogl on: 2005-02-15 05:42:00
Comparison of JOGL and LWJGL seems pretty pointless to me, as their design goals are different. JOGL is supposed to be a generic and object oriented binding of opengl for java, that is, be able to handle every kind of opengl usage : games, CAD/CAO, etc. Thus, opengl context management makes sens in JOGL. On the other hand, LWJGL purpose is to provide a direct, lightweight and game oriented binding of opengl for java. Context management is of no use in games, as for AWT/Swing widget, so, what's the point adding it ?
26  Game Development / Performance Tuning / Re: New VM performance improvements on: 2005-02-04 08:54:37
Quote


Clamp is programming function not math function. If you'd like to add something to the math it could be FFT, mem intensive FFT, DCT, IDCT, matrix operations, and possibly something helpful.



Neither max nor min are actually "math functions" and they can be relpaced by
1  
2  
3  
4  
// max
a > b ? a : b;
// min
a > b ? b : a;


They exist for sake of clarity ( and possible optimization ), as clamp should.
27  Java Game APIs & Engines / OpenGL Development / Re: devIL on: 2005-02-03 13:23:03
Personally, i convert pictures to my own format at design time using a simple tool. My format is quite simple :

- Magic cookie
- image type ( 1d, 2d, 3d, cubemap, ... )
- image flags ( compression flag, byte order flag, ... )
- opengl type ( GL_BYTE, GL_INT, ... )
- opengl format ( GL_RGB, GL_LUMINANCE, ... )
- x size
- y size
- z size
- data

So loading an image is as simple as: read the header, compute data size, load data in a buffer and call gl with type and format.
28  Game Development / Performance Tuning / Re: New VM performance improvements on: 2005-02-03 13:05:37
Operations on streams can be very cool too ( and subject to massive optimizations using MMX, 3DNow, SSE, SSE2, SSE3, etc ).

1  
2  
3  
4  
5  
6  
void add( int value, int[] stream, int offset, int length );
void mul( float factor, float[] stream, int offset, int length );
void xor( short mask, short[] stream, int offset, int length );
void lshift( int amount, int[] stream, int offset, int length );
void clamp( byte lbound, byte ubound, byte[] stream, int offset, int length );
...
29  Game Development / Performance Tuning / Re: New VM performance improvements on: 2005-02-03 10:04:01
What about adding "clamp" methods to Math ?

1  
2  
3  
4  
5  
int clamp( int lower_bound, int value, int upper_bound );

// equivalent to

int max( lower_bound, min( upper_bound, value ));


And the same for byte, short, long, float, double of course.
30  Java Game APIs & Engines / OpenGL Development / LWJGL and modularity on: 2005-01-31 07:20:31
Hi there,

If some of you are Linux users, they probably have dealt with Linux kernel compilation ( or various other software system compilation ). For the others let me explain how it works: First, you edit ( using a dedicated tool or even manually )  a configuration file specifying which "kernel modules" you want to include in the kernel, then you compile it. Modules can have dependencies with each others ( ex. the firewall module require the network module ). So, you can build your very own kernel containing only the modules you need and nothing else. This have numerous aventages. Mainly it leads to potentially ligthweight result, but it also allows a plethora of modules to exists without bloating the kernel.

Maybe lwjgl can works like this? Each extension ( even GL* ), utility ( Bone animation, devil, openal, etc ) can be considered as a module. A module database ( xml files ? ) is used by a tool to produce an ant file, then the whole shebang is compiled and packed in a single tailored jar file.

Thoughts are welcome !
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.

Pippogeek (39 views)
2014-09-24 16:13:29

Pippogeek (30 views)
2014-09-24 16:12:22

Pippogeek (19 views)
2014-09-24 16:12:06

Grunnt (44 views)
2014-09-23 14:38:19

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

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

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

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

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

BurntPizza (54 views)
2014-09-19 03:14:18
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!