Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (121)
games submitted by our members
Games in WIP (577)
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  Game Development / Performance Tuning / floating performance,  Take II on: 2005-03-23 10:21:00
hello.
opend a new one as old thread drifted away and grown to long..

about the float/double benchmarks:
most benchs ive seen do the same  "calculate something with three numbers" thing. this is wrong bench'ing as i guess, because no one has to "calculate" over the same number millions of times (except fractal iterations maybe)

with three numbers, all this values then fit to vm-registers /real cpu-registers rather then real memory.  that makes about big advandtage for the double, which is the "native cpu format". the fact that it is twice the data has no much impact, as all cpu-actions are 80bit at intel as someone wrote.

i just redoing some those tests now, but it seems at the moment just beginning that float is nearly twice as fast on my old machine (Athlon 1.generation, 750mhz) than double.

why this "strange" / "incompatible" results? i think is it just because i use some thousand floats, e.g. in arrays...
and maybe some real program (ok maybe very rarely) uses more than three numbers...
this may seem strange for some people, but for my part, my programs, game programs in fact :-) do so.
thats why i extended my ram from the old 1k to now 256mb...  Tongue

exact results will follow
& greets
Paul

2  Java Game APIs & Engines / OpenGL Development / Re: specular lightning broken? on: 2005-03-19 07:08:49
now got it working too
the reason was that i misunderstood "projection" and placed my camera postion on GL_PROJECTION stack. this is wrong, projection should do only last phase of prejection, the world-to-view transform is therefore splited to cam.positional treansform which i now placed in GL_MODELVIEW stack, and the real clean perspective projection which resides in GL_PROJECTION, all now working fine.
3  Java Game APIs & Engines / OpenGL Development / Re: strange crash on: 2005-03-16 17:05:27
on my system: start -> screen: switch to demo resoulution -> screen: switch back *

thats all

no output on screen, nor on cosole. last echo is the java.exe command itself.

WinXP, Athlon, Geforce2, SoundBlaster PCI
4  Java Game APIs & Engines / OpenGL Development / Re: NIO Buffers in JOGL and LWJGL on: 2005-03-16 11:21:59
Hey, WOW!!
I think you just explained my strange bug of older topic
http://www.java-gaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=LWJGL;action=display;num=1110649575
:-)

For textures, this things would mean that it is NOT allowed, to loose the reference to the pixel-buffer which makes up a texture...
-maybe its loaded to gfx-card.. than all is fine
-maybe it doesnt fit to gx-card mem so its dumped and reloaded later from main memory.. and if buffer is gc-collected and overwritten than .. BANG.

i will check this out in detail.

thanks for this clue :-)

5  Java Game APIs & Engines / OpenGL Development / Re: Textures failing with Threads on: 2005-03-13 15:28:40
hello
bug gone...
but don't know why.  "cleaning" my code i changed some details, maybe execution order or something else, mostly in unposted code... and don't encountered the bug again.
i checked it for a while for "maybe relevant" changes but found none to my honest opinion.

the only thread-interaction to my view is the "other thread fills buffer" thing, which is still there unchanged.

sorry for the inconvinience

if it reappears or i got any clue i'll post again.

sorry & thanks
Paul
6  Java Game APIs & Engines / OpenGL Development / Textures failing with Threads on: 2005-03-12 14:46:15
Hello.
I encountered a strange bug, reason seems "deep inside".

on my system, LWJGL works fine..

...except until i try texturing with multithreading.
I am aware of the fact that OpenGL is a state machine, so ALL LWJGL commands are used in-order by just one thread.
The only thing i do in fact "multithreaded" is writing the  byte buffer for texturing.
As result, textures vanish entirely as if glBindTextture / glTexImage would never been called.

anyone any idea? seems to be inside java native code for the buffer or lwjgl native :-(

snippets of the code:

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  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
/*
 * Created on 06.03.2005
 *
 */

package org.dronus.concept.gl;

import java.nio.*;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;

import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL11;

/**
 * @author Paul
 *
 */

public class Texture implements Renderer{
       
    final int       level=0, internalformat=3, border=0,
                      format=GL11.GL_RGBA, type=GL11.GL_UNSIGNED_BYTE;
//    final int MAXSIZE=1024;
   
      protected int width,height,size;
      public ByteBuffer pixels;
    int texid;
   
    boolean ready=false;
     
    public Texture(){
        IntBuffer idbuf = BufferUtils.createIntBuffer(1);
        GL11.glGenTextures(idbuf);
        texid = idbuf.get(0);
      }
   
      public void setSize(int s){
                        height=width=s;
            size=width*height*4;
            if (pixels==null){
                  if (size<=0) throw new RuntimeException("setSize() first!");
                  pixels = ByteBuffer.allocateDirect(size);
              pixels.order(ByteOrder.nativeOrder());
            }            
      }
      public void putPixels(byte[] bytes){
            pixels.put(bytes);
      }
      public void putPixel(int r, int g, int b, int a){                        
            pixels.put((byte)r);pixels.put((byte)g); pixels.put((byte)b); pixels.put((byte)a);
      }
      public ByteBuffer getBuffer(){return pixels;}
      public void update() {                        
            if (pixels!=null) {
                  pixels.flip();
                  GL11.glBindTexture(GL11.GL_TEXTURE_2D,texid);
              GL11.glPixelStorei(GL11.GL_UNPACK_ALIGNMENT, 1);
              GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
              GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);                  
                  GL11.glTexImage2D(GL11.GL_TEXTURE_2D,level,internalformat,width,height,border,format,type,pixels);
                  pixels=null;
            }else throw new RuntimeException("nothing to update!");
            ready=true;
      }

      public void render() {
            if (ready) GL11.glBindTexture(GL11.GL_TEXTURE_2D,texid);
      };
}


and

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  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
/*
 * Created on 07.03.2005
 *
 */

package org.dronus.concept.gl;

import org.dronus.concept.RandomEngine;
import org.dronus.gloom.space.renderers.Detail;

/**
 * @author Paul
 *
 */

abstract public class GeneratedTexture extends Texture implements Runnable{
      RandomEngine seed;
      double time; Detail detail;
      boolean needsupdate;
      static boolean generating;
//      static GeneratedTexture generating;
     
      public GeneratedTexture(RandomEngine seed) {
            this.seed=seed;            
      }
      /* (non-Javadoc)
       * @see org.dronus.concept.gl.Texture#render(double)
       */

      public void update(double time, Detail detail) {
            if (needsupdate ) {
                  update();
                  needsupdate=false;
                  generating=false;
            }
           
            if(width<detail.getTextureSize() && !generating) {                  
                  needsupdate=false;
                  generating=true;
                  this.time=time;
                  this.detail=new Detail(detail);                                                      
                  Thread updater=new Thread(this);
                  updater.start();
                  //updater.run();
            }
      }
      boolean running;
      public void run(){
           
                  setSize(this.detail.getTextureSize());
                  genTex(seed, time, detail);
                  //      System.out.println("Size now "+width);
                  needsupdate=true;
      }
     
      abstract public void genTex(RandomEngine seed, double t,  Detail d);
}



the buffer is written inside genTex.

by replacing updater.start(); with updater.run(); it runs reliable. also it runs sometimes, if started "fresh", eg. opengl not used for longer times, but mostly not.
it also works more often if amount or size of textures is heavily increased.

strange, eh?

i would be grateful for eny idea
Paul


7  Java Game APIs & Engines / OpenGL Development / specular lightning broken? on: 2005-03-08 22:04:18
hi
got some probs, dont know wether they are due to lwjgl, opengl or stupidness  Tongue :

specular highlights don't move on objetcs if i just move the viewer.  but they should.
moving lightsources produces moving lights.
i just state the circumstances which maybe affect this:

i set the projection stack every frame with glLoadIdent, glFrustrum and gluLookAt.

i enabled local lightning as stated in docs via
GL11.glLightModeli(GL11.GL_LIGHT_MODEL_LOCAL_VIEWER, GL11.GL_TRUE);

i only draw via compiled display-lists

is there anything i forgotten?

thanks for help
Paul





8  Java Game APIs & Engines / OpenGL Development / Re: Diplaylists & GLU primitives on: 2005-02-28 11:09:03
Got a clue
The other parts of the list are drawn, but black.  with lighting disabled, all geometry reappear.
This not only apply to display list, but also to instant rendering.
This is strange, AFAIK GLU only renders geometry not bothering about light/material attributes. but they seemed to mess up when a GLU primitive is included.
any idea?
9  Java Game APIs & Engines / OpenGL Development / Diplaylists & GLU primitives on: 2005-02-28 10:08:28
Hello.
I thought a gl list could consist every rendering-related gl command. But when i use org.lwjgl.opengl.glu.Quadric for exaple, the quadric seems to "delete" all other content of my list. so is only one glBegin / glEnd  block allowed inside the display list? or is GLU doing some other nasty things that destroys the other display list content?
I tried out that order is no reason, there is no difference if i draw the GLU-quadric before or after the other contents of the display list, which will vanish at any case.

thanks for help
10  Java Game APIs & Engines / Java 2D / Re: ImageIO / Java Web Start bug: Workaround on: 2005-02-20 12:28:07
Simple workaround:

Store images uncompressed
gif /png are already compressed and will get euqal or maybe even bigger in size if zip'ped.
So I JARed my application without gfx, and used a zip packer to add the gfx with compression factor = zero. this worked well for all my apps.
(and its no "dirty" fix as JAR gets smaller most times...)
11  Game Development / Shared Code / Re: isometric tiles in Java2D w/ scrolling on: 2005-02-20 07:28:57
I suggest performance by balancing:

two things you have to weight up against each other:

-time to convert data
-time to copy data

when you draw more surface than actually seen (and you do,  as rectified tiles overlap here) maybe a backbuffer-and-copy strategy would be better. i experienced that in my game. the reason is that your images (paletted gifs for example) need to be converted to screen mode which is 24/32bpp mostly and can have several different alignments of data (bitmap type; eg INT_RGB, BYTE etc..)

so there are three different ways to use:

-draw directly to a flip-buffer (as you do, if it is available)
pro: less to draw
con: every tile, and so more then actually visible surface is converted every time drawn

-draw to a backbuffer that exactly matches image-bitmap-mode (eg. paletted mode with global palette for gifs)
pro: conversion is only done once for exact the whole visible surface
con: whole surface will be converted even if less is drawn (eg. no scrolling but moving sprites), for gif's a global palette is needed

-convert all images first
pro: no conversion at runtime at all
con: heavy memory footprint


for me the last worked best
in fact i copy every loaded image to a same-sized bitmap with the exact properties of the output-screen, and use this new duplicates for drawing. if all works, no conversen is done then.
this even accelarates alpha-channel blits i used a lot, but these are allways many times slower than direct blit.

hopes that helps
Paul












12  Games Center / Archived Projects / Re: XAP - maniac experience on: 2005-02-17 17:07:59
seems cas is everywhere it smells of games  Grin


 
..."One day people will make remakes of my games  Grin"..

i HAD to do so... i remember somewhere back in the 90's as i see cas's xap first it was a real impact.. i still own my amiga computer, and as i tested it one year ago... after years of disuse.. well, i plugged it and it worked.. and one of the first things i tried was to bring xap back to life. it was one relic of the good'ol times...

shortly after that i glued myself to my comp and 2 weeks later released xap!..  after some time of disinterest, i got some visitors to it, and as i tracked their referer: it was an board thread of cas, just found my remake. i greatly admire he took it with pleasure, as in fact he tried to sell alienfluxx at that time...  but no, he had no problem doing some very effective promotion for my remake  :-) thx, cas.
i hope you sell some copys of it, as i remember you stated xap orignial was not selled effectivly, the highscore on puppygames seemes that its now better.  (the interest in xap! today is very poor...but tats no economic question for gods sake. in fact the whole highscore is made of friends of mine who for some reason seemed more glued to the game..)

thx for response & greetz
Paul
P.S. game is finished now except details, so control won't change, as this would be some inpact on gameplay i guess.



13  Games Center / Archived Projects / XAP - maniac experience on: 2005-02-15 12:30:28
XAP!
This is a creative manic arcade game, a not-so-stupid, maybe quite smart shooting game. 250kb achieve quite nice graphics & sound. It runs as browser applet, can also be downloaded and started as application, but then online highscore logging is disabled.

http://hirnsohle.de/xapentry.htm

would be very pleased to see some comments of yours about here.

thx & greets
Paul
Pages: [1]
 

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

The first screenshot will be displayed as a thumbnail.

theagentd (16 views)
2014-10-25 15:46:29

Longarmx (52 views)
2014-10-17 03:59:02

Norakomi (45 views)
2014-10-16 15:22:06

Norakomi (34 views)
2014-10-16 15:20:20

lcass (39 views)
2014-10-15 16:18:58

TehJavaDev (68 views)
2014-10-14 00:39:48

TehJavaDev (68 views)
2014-10-14 00:35:47

TehJavaDev (60 views)
2014-10-14 00:32:37

BurntPizza (74 views)
2014-10-11 23:24:42

BurntPizza (45 views)
2014-10-11 23:10:45
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

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
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!