Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (495)
Games in Android Showcase (114)
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  Java Game APIs & Engines / Java 2D / Re: Real-time manipulation of tiles/pixels on: 2003-04-25 00:20:43
Its a hard problem, i havn't seen any java2D games using real lighting.  you might want to try lwjgl, which will get you hardware lighting with openGL.

The only thing i can see is to do all your lighting on one pixel buffer.  Having one back buffer image, and one pixel buffer for the screen.  Storing your tile images as int[] so you can do System.arrayCopy(tile,0,pixels,tilePos,tileSize) for each visible tile.  Then do lighting on one pixel buffer, and update one image with the new pixels.  

Or if it doesn't need to be per pixel, just try images filled with black, with varying alpha.  Basic but most 2D games dont need to much Cheesy
2  Java Game APIs & Engines / Java 2D / Re: Dragging an object from one panel to another on: 2003-04-23 23:06:16
Mabye in the drawing panel you've got a list of shapes.  When you click the new button you'd create a temp shape, and move its position with the cursor using mouse motion listener.  When the mouse button is presses to place the shape, add it to the shape list and stop moving its position.
3  Java Game APIs & Engines / Java 2D / Re: Real-time manipulation of tiles/pixels on: 2003-04-23 22:53:47
There a few different ways to do per pixel stuff.  My fav is  creating your own ImageProducer.  Check out the java version of - http://www.gaffer.org/tinyptc/  it will explain how its done.

You can also get the DataBufferInt from  BufferedImage.getRaster().getDataBuffer()

You might want to try a different method to light your map.  Doing per pixel lighting will probally be slow Smiley
4  Java Game APIs & Engines / OpenGL Development / Re: Why is one color affecting whats already draw on: 2003-04-09 22:32:55
Hey thanks for your help!! Smiley

Just needed gl.texEnvf(gl.TEXTURE_ENV, gl.TEXTURE_ENV_MODE, gl.DECAL);
before drawing the texture. Simple Smiley

Also how do you reset the color?
its not gl.color4f(0, 0, 0, 0)?

Thanks princec! Cheesy
5  Java Game APIs & Engines / OpenGL Development / Re: Why is one color affecting whats already draw on: 2003-04-09 05:08:24
Hey i know i had the wrong blend modes in places, but in the 2 things that are being rendered it was as you said.

ive tryed to simplify it down to see the problem.  so everything is in one render method.

this just draws one colored quad overlapping and area of another and works find.
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
    public void render()
    {
        gl.clear(GL.COLOR_BUFFER_BIT);
       
            gl.disable(GL.TEXTURE_2D);
        gl.blendFunc(GL.ONE, GL.ZERO);        
        gl.color3f(0, 1, 0);
        Tools.fillQuad2i(gl, 100, 100, 200, 200);
 
        gl.blendFunc(GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA);
        gl.color4f(1, 0, 0, 0.1f);
        gl.disable(GL.TEXTURE_2D);
        Tools.fillQuad2i(gl, 150, 150, 400, 400);
       
        gl.swapBuffers();
    }


Then if i change it to draw a textured quad, then a colored quad, it doesn't work.  The textured quad is fully colored, when it should only be partly colored in the overlapping area.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
    public void render()
    {
        gl.clear(GL.COLOR_BUFFER_BIT);
       
            gl.enable(GL.TEXTURE_2D);
        gl.blendFunc(GL.ONE, GL.ZERO);        
        gl.bindTexture(GL.TEXTURE_2D,tileTextures[0]);
        Tools.fillQuad2i(gl, 100, 100, 200, 200);
 
        gl.blendFunc(GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA);
        gl.color4f(1, 0, 0, 0.1f);
        gl.disable(GL.TEXTURE_2D);
        Tools.fillQuad2i(gl, 150, 150, 400, 400);
       
        gl.swapBuffers();
    }


The init code is the same as before, super simple.  I just don't see where the problem is.  Im using the correct blend modes.
Managed to keep my sanity, but it won't stay for long. Tongue

Thanks for any suggestions! Smiley


6  Java Game APIs & Engines / Java 3D / Re: Using glu.lookAt messes up my code on: 2003-04-08 03:12:28
Hey i noticed one problem. your calling lookAt after loadIdentity, which is the wrong way round.  loadIdentity reverses any changes from lookAt.

Also the parameters in lookAt might be wrong.

glu.lookAt(0.0f, 0.0f,  camZ, 0.0f, 0.0f, camZ, 0.0f, 1.0f, 0.0f);

which changes the position and view vectors to the same depth, and sets the up vector to the normal settings.

That should help Smiley
7  Java Game APIs & Engines / OpenGL Development / Re: Why is one color affecting whats already draw on: 2003-04-08 02:51:10
Hey thanks for the reply, but the blending modes did not change the effect.  :-/

Its strange because i had the same thing working in perspective mode.  I was drawing the tiles and sprites in perspective, then switching into ortho mode for the cursor.  And it worked.  Same rendering code, now in all ortho mode, and it doesn't work.

Its for the josrts project.  Ive just refactored and cleand up the interfaces.  If you have some time, id really appreciate if you could check out the design and code.  Smiley

We are pretty close to having something here.  I can create a level in the editor, and see it run in gl.  Only problem is damn color blending! Cheesy

http://www.froggy.com.au/harleyrana/java/JOSRTS_0025.zip
8  Java Game APIs & Engines / OpenGL Development / Why is one color affecting whats already draw on: 2003-04-07 04:16:28
The basic problem is, im drawing some tiles ( with no color ), then draw the cursor using an outline and fill color, then the last outline color used fills the tiles.  

I don't understand why the tiles are being affected after there drawn.  Tryed all the different blendFunc modes, nothing has worked.
Thanks for any help clearing up this annoying problem! Smiley


Basic init code for ortho mode.  all there is.
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
    gl.matrixMode(GL.PROJECTION);
        gl.loadIdentity();
        gl.ortho(0.0f, Display.getWidth(), Display.getHeight(), 0.0f, -100.0f, 100.0f);
        gl.matrixMode(GL.MODELVIEW);
        gl.loadIdentity();

        gl.shadeModel(GL.SMOOTH);
        gl.clearColor(0.0f, 0.0f, 0.0f, 0.0f);
        gl.enable(GL.POLYGON_SMOOTH);
        gl.enable(GL.BLEND);


Main render method (simplifyed)
1  
2  
3  
4  
5  
6  
        gl.enable(GL.TEXTURE_2D);
        gl.blendFunc(GL.ONE, GL.ONE);
        gl.bindTexture(GL.TEXTURE_2D, 1);
        Tools.fillQuad2i(gl, 100, 100, 200, 200);
               
        cursor.render(gl);



The cursor render method
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
   /***********  Draw the Mouse Cursor  ****************/
        gl.color3f(0, 1, 0);
        gl.translatef(mouseX, mouseY, 0);
        Tools.fillPolygon(gl, poly);
        gl.color3f(1, 0, 0);
        Tools.drawPolygon(gl, poly);

        /***********  Draw Selection Rectangle  ****************/
        gl.translatef(-mouseX, -mouseY, 0);
        gl.blendFunc(GL.SRC_ALPHA, GL.DST_ALPHA);
        gl.disable(GL.TEXTURE_2D);
        gl.color4f(1, 1, 0, 0.2f);
        Tools.fillQuad2i(gl, dragX, dragY, dragX + dragWidth, dragY + dragHeight);
        gl.color3f(1, 0, 0);
        Tools.drawQuad2i(gl, dragX, dragY, dragX + dragWidth, dragY + dragHeight);    

9  Discussions / Miscellaneous Topics / Re: Array fetish? on: 2003-04-07 03:39:34
Hey Shawn, could you explain where the performance problems are in Collections api.  For those of us to cheap to buy a profiler. Smiley

The only direct comparison can be between arrays and ArrayList, which my code is full of.  On array list when you don't use iterators is there much difference between pure arrays?

What are the big performance suckers?

Thanks heaps! Smiley  

10  Java Game APIs & Engines / Java 2D / Re: ImageIO - uses and information regarding... on: 2003-04-06 02:48:01
Hey JBanes im not sure you are correct about not being hardware accelerated.  

From what ive read, i understood that its only when you call getData() or raster, that the image loses its hardware acceleration.
Also ImageIO will become the standard way to load images soon.

I might be way off the mark here, its just what ive seen.  Its always confusing when you want to know excactly what the vm is doing.  We need some clarification.

If it matters i always use ImageIO these days. Really like the ability to skip pixels when loading, makes it possible to load thumbnails that actually take up less memory.  Life saving feature for my image viewer  Smiley
11  Discussions / Miscellaneous Topics / Re: Array fetish? on: 2003-04-06 01:55:50
Hey totally understand people falling in love with Collections, i to have formed a more than intimate bond with HashMap.  
Sometimes i feel dirty when trying to put collections in collections, like ArrayList.add(ArrayList).  Whereas making multilevel int[][][][][] is guilt free.

Being a fellow array lover, im sure you would appreciate their excessive use in this game.
http://www.froggy.com.au/harleyrana/4K-entry.html

Im probally preaching to the converted here, as collection aficionados im sure you know about http://trove4j.sourceforge.net/
Kick arse HashMap implementation, and primitive collections.

To bug you some more with stuff you've already seen, a benchmark comparison. http://www.onjava.com/pub/a/onjava/2002/06/12/trove.html

Tongue  Smiley
12  Discussions / Miscellaneous Topics / Re: Favourite name for vectors? on: 2003-04-04 00:30:05
While we are talking formating, what is style comments do you like? Smiley

Im thinking more for personal readability than java doc compliance.
13  Discussions / Miscellaneous Topics / Re: Favourite name for vectors? on: 2003-04-04 00:25:12
Ive beeing learning and looking at more c++ lately, and the styles have really rubed off on me.  Like next line braces, and more use of abbrivated variable/class names.  But still havn't picked up hungarian notation, which is so common.

I think using abbrivations can be overused, but there are some cases where it works.  Like when the meaning is clear, and its used all over the place, like vectors. Smiley

Regularly i thank the kind souls that gave us eclipes, and its code formater.  I never would have been able to make an inner listener with out them.  Cheesy
14  Java Game APIs & Engines / OpenGL Development / Re: screen dimensions in Open GL units? on: 2003-04-03 02:40:01
http://www.markmorley.com/opengl/frustumculling.html
Explains the situtation really well. Smiley
15  Discussions / Miscellaneous Topics / Re: Favourite name for vectors? on: 2003-04-03 00:59:40
Quote
horrible feeling you're being serious...

well, half serious, half tounge firmly in place. Cheesy

Hey cfmdobbie this is what happends when you ask a question, you find out more than you wanted to know. Smiley

Hungarian notation was created to solve scope problems in C, so theres not much need for it now.  Except hordes of people still love it.  Smiley  Seems to be really popular with C++ coders.  Its just what your used to and like i guess.

Im growing fonder of float3.  The same naming as the CG language.  You won't find any cleaner! Smiley
I know im breaking the sacred java rules, but i'll live.
16  Discussions / Miscellaneous Topics / Favourite name for vectors? on: 2003-04-02 04:56:55
Hey guys, its a personal question, close to the heart of all game programmers.  How do you name vectors?

We got a list to choose from :  vec3,vect3,Vec3,Vect3,Vector3,Vector3f,float3,and many more.

What do you like?


17  Java Game APIs & Engines / Java 2D / Re: performance question on: 2003-04-01 22:58:51
http://www.gamedev.net/community/forums/topic.asp?topic_id=65858

Its a reply from the same author, about smooth scrolling.
different code from the article.  This cleared it up perfectly for me.  Now working sweet ! Smiley
18  Java Game APIs & Engines / Java 2D / Re: performance question on: 2003-04-01 22:54:32
Hey darcone is right, using one large image for the background is never going to be fast.  
Try to break up the image into tiles.  Its much quicker to render the visible set of tiles.

Check out http://www.gamedev.net/reference/articles/article743.asp
explains how to do smooth scrolling over the tiles.
19  Java Game APIs & Engines / OpenGL Development / Re: Racing games on: 2003-04-01 01:15:11
Hey i don't think theres going to be anything simple about a 3D racing game! Cheesy
Would be a very cool project though! Smiley
20  Java Game APIs & Engines / OpenGL Development / Re: Ambigious methods on: 2003-04-01 00:10:33
Would there be any speed advantage replacing some of the math methods with native versions.  Or is the benifit outweighed by crossing over jni?

Could we replace this in org.lwjgl.Math?

public static float sin(float theta) {
     return (float) java.lang.Math.sin(java.lang.Math.toRadians(theta));
}
21  Java Game APIs & Engines / OpenGL Development / Re: Distributing games on: 2003-03-30 03:08:34
Hey princec out of curiosity, what was the performace difference between jet optimized, and standard java for you?

22  Java Game APIs & Engines / Java 2D / Re: Why Java? on: 2003-03-30 02:39:08
Hi erikd, i don't see how you can argue that c++ isn't the fastest game proggraming language.  Check out http://osl.iu.edu/~tveldhui/papers/DrDobbs2/drdobbs2.html

Talks about the improvements in compilers that have now let c++ bet fotran at its own game, in linear algebra and others.  The improvements also mean that c to c++ difference is only in style.

Theres also more info in a ddj tech net cast from Mr Stroustrup.

Princec has has shown how much we can get out of lwjgl and java, to make real games that are close to their c++ counterparts.  It will be interesting to see if any commercial game companies will start using java, with its huge productivity improvments.  
There was a recent game that used python to control the whole game, using c++ for rendering functions and math.
Don't have a link, but i think it was on orielynet.
There is a strong possibility of java being used similarly, as the control language, with platform specifc stuff were performace is critical.
23  Java Game APIs & Engines / Java 2D / Re: Solicitation for Opinion on: 2003-03-27 23:15:48
Hey look up tables make a big difference for trig functions.

There are heaps of things that could be added to the api, i just gave a brief example.

The point is a util library, with functions that you'll use all the time in lots of different types of games.

Probally a bit off topic for Jbanes initial question, buts what i want. Smiley
24  Java Game APIs & Engines / Java 2D / Re: Why Java? on: 2003-03-27 22:37:57
In pure rendering speed there is not much difference using openGL through lwjgl, and native c++.  You should be able to pump as many triangles per frame in java.  Smiley

It just depends on the type of game your making.  As to how much perfomace hit you'll take using java.  In alot of situations, the hit will be very low.

C++ is the fastest language around for making games.
Its complexity makes it a pain to use, but pros know how to get every last bit of performace out of it.  Like the ability to go into asm blocks for those tight loops.  

LWJGL is a blessing to the java community.  It is perfect for alot of groups and individuals, that will benifit from using java.  But pros have the tools and experience using c++, and can't afford any performace hit.

As a java lover im really hoping sun can pull of the theoretical  advantages of a runtime evnironment, to leave c++ behind with runtime optimizations.  
But it hasn't happend yet, and i doubt it will in the next few years if ever.
25  Java Game APIs & Engines / Java 2D / Re: Why Java? on: 2003-03-26 23:14:22
The only thing i can say is, pick the language for the job!
There is no perfect language, you just need to pick the best one for the job.  Smiley

We wont see a commercial FPS built in java.  But we will probally see game tools being built out of java.  Tools are perfect for java, because they benifit from all the productivity benifts of java, and don't need fast graphics.

Now java can use openGL through lwjgl, we can get cool 3D graphics in java fairly fast.  Its never going to as fast as c/c++ but for simple projects the benifits of java will out weight the speed loss.


26  Java Game APIs & Engines / Java 2D / Re: Solicitation for Opinion on: 2003-03-26 22:14:30
Hi the with java you really have two options for making games.
Use Java2D for basic platformers and shooters, or LWJGL for everything more complex.
With straight java2D you don't have the hi res times etc, but for the types of games you'd make with it its not a problem.
If you want faster graphics, hi res timers, better sound just use LWJGL!!  Cheesy

I think we should generaly use lwjgl for graphics unless it needs to be an applet or somthing similar.

Its possible to abstract the rendering to allow DirectX or OpenGL, but foget about abstracting between openGL and java2D.  There to different.

The kind of game api id like would contain lots of small simple functions, that don't tie you into using the whole system.
Allergo is a good example, even though its in C, its i nice clean design, with simple functions that do one thing well.

Im thinking the basic util functions every game needs, math functions, interp, curves, fonts, images.  Nothing to do with rendering API's.
http://www.froggy.com.au/harleyrana/java/API.java

Its simplicity lets you use it in any type of game.  Obviously you'd add a bit more to it, but you get the idea. Smiley

Harley.


27  Java Game APIs & Engines / OpenGL Development / Couple of questions on Texturing 2D terrain. on: 2003-03-24 23:48:30
Hey another terrain question!  This ones for the 2D rts josrts.org.
Theres a bunch of questions i need to clear up on texturing. Smiley

The general question is what is the best way to texture the large flat landscape?   The two main ways are basic tiled approch, or one large texture with a detail texture.

More specific question regarding display lists and multitextuing.
Is there any benifit using multi texturing if your compiling into a display list?
Trying to create tiles of the landscape, drawing a section with multitexturing into display lists.  But when i call the lists, there a weird pattern in the tiles, some are out of order, or stetched.
http://www.froggy.com.au/harleyrana/java/TerrainRender.java
(only offending parts) Smiley

When im drawing in interpreted mode, it looks cool if you don't mind the repeating detail texture.  To make it more interesting i could draw rock and grass patterns.   How should i draw the extra detail in the terrain?  TEXTURE2_ARB ,or go back to TEXTURE0_ARB ?

On gljournal's extension data base multitexturing has support for some old chips, and it was incororated into gl 1.2.1.  So can i assume that its going to work on most cards?  What is the normal number of texture units available / should i use?

Still just playing around with the multitextured terrain, to see the difference between tiles.
If i do use tiles im thinking of having a base texture, detail texture for transitions or just extra details like grass spots, and color index for each point in the terrain grid.  Does that sound right?

If your still here, thanks for your patience Cheesy
Obviously these are basic questions, but where better to learn!   Thanks for any help or suggestions.  Smiley
Harley.
28  Java Game APIs & Engines / OpenGL Development / Re: What is going on? ┬áIt used to work now it does on: 2003-03-09 23:05:30
Not sure if it helps. In eclipes i add lwjgl.jar to java build path > libraries.  and put lwjgl.jar + lwjgl.dll in the root directory of the project.

lwjgl.jar needs to be in the class path, and lwjgl.dll in the project directory.

29  Java Game APIs & Engines / OpenGL Development / Re: Multitexturing for terrain quads? on: 2003-03-07 23:58:43
on a structure point.  do you think its worth using a quad tree lod?  ( im already using a quad tree for objects, and leaf nodes are terrain )

from what ive read recently, its faster to use brute force, and just have one high quality terrain for each sector.

would you aggree?

the game in mind is pretty much top down view, rotated abit on z axis.  so the field of view is pretty small.

what about just using one large terrain texture, with a detail texture?  i've seen a detail texture make a big difference on terrain.

thanks.


30  Java Game APIs & Engines / OpenGL Development / Re: Getting vars out of Gl, like frustrum[]? on: 2003-03-07 03:03:42
Sorry guys, im a dork. Tongue
Should have seen 'View Frustum Culling for LWJGL and GL4Java" post.
Answers my question perfect! Smiley
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.

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

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

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

Tekkerue (38 views)
2014-09-09 02:24:56

mitcheeb (57 views)
2014-09-08 06:06:29

BurntPizza (45 views)
2014-09-07 01:13:42

Longarmx (28 views)
2014-09-07 01:12:14

Longarmx (34 views)
2014-09-07 01:11:22

Longarmx (35 views)
2014-09-07 01:10:19

mitcheeb (40 views)
2014-09-04 23:08:59
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!