Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (476)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (533)
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  Games Center / WIP games, tools & toy projects / Re: Izzy's Revenge on: 2014-04-13 10:38:04
hahaha, maybe you're right.

I have to say that for us hotline miami is one of the funniest indie games eves. We watched yesterday the teaser of hotline miami 2 about 100 times! amazing!
2  Games Center / WIP games, tools & toy projects / Re: Izzy's Revenge on: 2014-04-12 12:57:48
thanks a lot!

we finally have some ingame enemy killing action. For programming a basic AI I used a quite simple algorithm based on the state object pattern. really clean and nice:

<a href="http://www.youtube.com/v/Phov5OJjwiE?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/Phov5OJjwiE?version=3&amp;hl=en_US&amp;start=</a>
3  Games Center / WIP games, tools & toy projects / Re: Izzy's Revenge on: 2014-02-01 09:42:40
Little by little, we keep pushing.

Surprisingly the java2D engine works quite well, better than expected. We can run the game at 60fps in low-end GPUs like the intel HD4000 and geforce 9500.

We started to use textures with java2D texturepaint, it works quite well, with no performance penalty in comparison to direct image drawing. It works even better in some cases.

I'm totally reworking the code in order to follow the "clean code" directives. I feel quite happy with the result.


4  Games Center / WIP games, tools & toy projects / Re: Izzy's Revenge on: 2013-12-25 09:06:26
We programmed for Izzy's revenge a very very basic physics functionality. Some elements like the main character, projectiles or enemies extends from a class named "Physicable". This class provide several characteristics like position, speed, acceleration, friction or air friction as well as some methods for detecting collisions.

Using these features, when Izzy gets harmed, we added some speed in the reverse direction as a knockback. You can see what happens with too high speeds XD:


<a href="http://www.youtube.com/v/zZsJMWMAexM?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/zZsJMWMAexM?version=3&amp;hl=en_US&amp;start=</a>
5  Games Center / WIP games, tools & toy projects / Re: Oh My Goat on: 2013-10-05 06:57:03
Hi yaw! it's nice to see you arround. The game looks awesome TBH.

The game looks great btw, it has a lot of graphic quality. I'm pretty sure you will become famous!! Tongue
6  Games Center / WIP games, tools & toy projects / Re: Realtime Lighting Example in java2D on: 2013-10-05 06:51:56
OMG I'm sorry for the delay!!!

Finally, this saturday morning I have some spare time Tongue

I cast the shadow using some trigonometry. If you know the location of a polygon point and the location of the light source, you can get the expression of the line that connects them. This line is one of the rays casted by the shadow.


I use polygons, not areas. I just add points to that Polygon and then I send the polygon to render. Pretty fast and simple.


I calculate all the shadow polygons in real time, it is not very resource consuming. This is some graphical sample of what I do. lines p3-p4 and p2-p4 are ignored as they are in the back of the object.




I agree with you that

This is part of the code (removed some non important stuff) . It is a mess and it is full of spanish variable names, so it may be quite confusing for you. I will try to fix this some day. Anyways I hope that you will get the general idea.


For any doubt, please ask me!! ;(

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  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
//I call this method n times for each light, where n is the number of objects inside the scene

//ii: object number ii of the scene
//luz_baseX,int luz_base, screen location of the light
//distancia_fuera: distance of shadow trail
//lightScale: scale of the light
//gsombras: volatileimage where I store all the shadows
//dimMaxMedia: size/ of the light


private void AddSombras_to_luz(int ii,int luz_baseX,int luz_baseY,float distancia_fuera,float lightScale,Graphics2D gbsombras,int dimMaxMedia){

   
          //LIGHT POSITION ON SCREEN (X,Y)
         float centroX=(luz_baseX*light_resolution);          
          float centroY=(luz_baseY*light_resolution);      
         
          int quita_baseX,quita_baseY;

           
          //POLYGON THAT STORES THE IMAGE CONTOUR
         Polygon quita;
           
          //GET POLYGON    
         
   
                if (!A_e.get_non_bg_objects(ii).get_cast_shadow()) return;              
                quita      =A_e.get_non_bg_objects(ii).getPolygon(tiempoms);

               
                //LOCATION OF THE UP-LEFT CORNER OF THIS POLYGON ON SCREEN
               quita_baseX=A_e.get_non_bg_objects_x(ii);
                quita_baseY=A_e.get_non_bg_objects_y(ii);
               
               
                       
          //NO POLYGON OR LESS THAN 3 VERTEX
          if (quita== null || quita.npoints<3) return;
           
         
           

           
          boolean anterior_shadow=false;
          int cont=0;
          int pos=0;
         
           //two points of the object polygon
           float pto1_x,pto1_y,pto2_x,pto2_y;
           
            //distance from these points to light source
           float dist1,dist2;
         
            pto2_x=((quita_baseX+quita.xpoints[0]));
            pto2_y=((quita_baseY+quita.ypoints[0]));
            dist2=(float)Math.sqrt( (pto2_y-centroY)*(pto2_y-centroY)+(pto2_x-centroX)*(pto2_x-centroX));
           
           

           
          //for each point of the polygon
         while(cont<quita.npoints){
          boolean actual_shadow=true;    
             
         
          //move point 2 to point 1
         pto1_x=pto2_x;
          pto1_y=pto2_y;
                   
           //read a new point from the polygon
         if (pos<quita.npoints-1) {
            pto2_x=((quita_baseX+quita.xpoints[pos+1]));
            pto2_y=((quita_baseY+quita.ypoints[pos+1]));}
          else {
            pto2_x=((quita_baseX+quita.xpoints[0]));
            pto2_y=((quita_baseY+quita.ypoints[0]));}  
         
         
         //distances to light source
        dist1=dist2;
         dist2=(float)Math.sqrt( (pto2_y-centroY)*(pto2_y-centroY)+(pto2_x-centroX)*(pto2_x-centroX));
       
         
        //optimizations
       
         //this vertex is outside light range, it should not project shadow
       if (dist1>(dimMaxMedia)*lightScale   && dist2>(dimMaxMedia)*lightScale  ) {actual_shadow=false;}
       
       
        else{
       
        //the line between these two points creales a line. is this line in the front side of the object or in the back side
       //if it is in the back side it should not project a light (useless)
       
        //we calculate the bisector and we move us 4 pixels from the middle of the line to the line in the direction of the bisector.
       //is we are inside the polygon we don't project a shadow, othwerwise we project it
           
        float bisectriz_X=(pto1_x+pto2_x)*0.5f;
        float bisectriz_Y=(pto1_y+pto2_y)*0.5f;
        float dist_bis=(float)Math.sqrt( (bisectriz_Y-centroY)*(bisectriz_Y-centroY)+(bisectriz_X-centroX)*(bisectriz_X-centroX));
       
        float bcos_1=(bisectriz_X-centroX)/dist_bis;
        float bsin_1=(bisectriz_Y-centroY)/dist_bis;
        float binIn_X=(bisectriz_X -bcos_1*4);
        float binIn_Y=(bisectriz_Y-bsin_1*4);
 
       
        if (quita.contains((binIn_X*light_resolution_inv-(quita_baseX)),
                           (binIn_Y*light_resolution_inv-(quita_baseY)))) {actual_shadow=false;}}
       
       
       
       
        if (cont==0 && actual_shadow) {if (pos==quita.npoints-1) break; pos++;continue;}
       
       
        //even more optimization!!
       
        //cases    anterior_shadow, actual shadow
       //               false        true                               add pto 3 (shadow ray) y 1
       //               false        false                              no shadow is projected, we ignore these points.
       //               true         true                               add pto 1.
       //               true         false   (||actual=last)            add pto 1, pto 2, pto 4 (shadow ray) and render

       
                      float cos_1 = (pto1_x - centroX) / dist1;
                      float sin_1 = (pto1_y - centroY) / dist1;
                      float cos_2 = (pto2_x - centroX) / dist2;
                      float sin_2 = (pto2_y - centroY) / dist2;
       
              if (actual_shadow == true) {
                  if (anterior_shadow == true) {
                      //add point to the polygons
                     quita2.addPoint(Math.round(pto2_x+ cos_2*2), Math.round(pto2_y+ sin_2*2));
                     

                  } else {
                      float pto3_X = (centroX + cos_1 * distancia_fuera);
                      float pto3_Y = (centroY + sin_1 * distancia_fuera);
                       //add point to the polygons
                     quita2.addPoint(Math.round(pto3_X), Math.round(pto3_Y));
                      quita2.addPoint(Math.round(pto1_x+ cos_1*2), Math.round(pto1_y+ sin_1*2));
                      quita2.addPoint(Math.round(pto2_x+ cos_2*2), Math.round(pto2_y+ sin_2*2));}

                  if (cont == quita.npoints - 1) {

                      float pto4_X = (centroX + cos_2 * distancia_fuera);
                      float pto4_Y = (centroY + sin_2 * distancia_fuera);
                        //add point to the polygons
                       quita2.addPoint(Math.round(pto4_X+ cos_2*2), Math.round(pto4_Y+ sin_2*2));
                       
                     //render the polygon
                    { paintShadow(gbsombras);}
                      quita2.reset();}


              } else {
                  if (anterior_shadow == true) {
                      float pto3_X = (pto1_x + cos_1 * distancia_fuera);
                      float pto3_Y = (pto1_y + sin_1 * distancia_fuera);
                       //add point to the polygons      
                     quita2.addPoint(Math.round(pto3_X+ cos_1*2), Math.round(pto3_Y+ sin_1*2));
                     
                      //render the polygon
                          paintShadow(gbsombras);
                      quita2.reset();
                     
                  }

              }
       
                   anterior_shadow=actual_shadow;
                   cont++;
                   pos++;if (pos==quita.npoints) pos=0;
          }

}
7  Games Center / WIP games, tools & toy projects / Re: Realtime Lighting Example in java2D on: 2013-09-07 08:57:47
Ok,  first what I have is an "Image_container class", which stores both images and polygons:

1  
2  
3  
4  
public class Image_container extends Identificable_element {

 private BufferedImage[] Image;
 private Polygon[] perimeter;


So, each image has its own associated perimeter polygon. I get these polygons with a (quite) improved version of this idea: http://stackoverflow.com/questions/7052422/image-graphic-into-a-shape

Once you have the light source location and the location of the polygon, you can create these fake shadows for each facet of the polygon. I optimized this by just creating a complex polygon which is composed by all the exposed object facets plus the shdow projection. If I have time I will try to clean up some code and post it here Tongue

After some thinking and optimizations you can reach nice performance. Not 300 lights of course, but maybe 5-6 lights with a few tens of objects in screen is feasible (on a mid-end card).  The biggest limitation here is the shadow rendering, (not the calculation, just the "drawpolygon"). If you have to render 10 shadows per light, you will become limited by fillrate, specially on lowend cards like intedl HD3000 (I works sooo bad with java2D).

For the light I use an existing image, as you did in your older posts about this. It works fine.

Also, you can get smoother shadows by doing the following, it is like a "cheap" antialias. It draws a traslucent shadow contour several time before drawing the shadow.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
private void paintShadow(Graphics2D gbsombras){

//"remove" contains the shadow polygon
//"gbsombras" is the target graphics2D    

  if (antiAlias) {
   
     gbsombras.setColor(new Color(0, 0, 0, 0.5f));
     
                       for (int a=-1;a<2;a++){
                       for (int b=-1;b<2;b++){  
                            remove.translate( a, b);
                            gbsombras.drawPolygon(remove.xpoints,remove.ypoints,remove.npoints);
                            remove.translate(-a,-b);
                            }}}
                             

      gbsombras.setColor(Color.BLACK);                
      gbsombras.fillPolygon(remove.xpoints,remove.ypoints,remove.npoints);
}


8  Games Center / WIP games, tools & toy projects / Re: Realtime Lighting Example in java2D on: 2013-09-06 21:42:26
StumpyStrust!

I have to say that one of your previous posts was really helpful for me in order to make a (fake) dynamic lighting system. Thanks a lot!! I owe you a beer.

Using an idea similar to yours I managed to do dynamic shadows. Sorry for the bad video framerate. The performance is quite acceptable.

<a href="http://www.youtube.com/v/crrH_WHF4WQ?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/crrH_WHF4WQ?version=3&amp;hl=en_US&amp;start=</a>



The Idea I chose was to, from the light source and the picture contour, create a polygon in real time and in an intermediate volatileimage, remove the polygon to the light sprite with the AlphaComposite.SRC_OUT. If you are interested in some details just ask me

9  Games Center / WIP games, tools & toy projects / Re: Izzy's Revenge on: 2013-08-29 20:12:23
Hi! the idea is to do a mix between a platformer and a beat'em up. I have already prepared the particles systems for the blood Tongue

In the development area, i've been working the last days trying to make windowed Vsync to work in Java2D. I've also managed split the game in two execution threads, one for game physics and other for screen rendering. I needed to add some synchronization between both threads in order to avoid stuttering. Now the screen sliding and the game is super-smooth Smiley
10  Games Center / WIP games, tools & toy projects / Re: Izzy's Revenge on: 2013-07-22 22:15:18
This is a WIP of Izzy's workshop. You can see some of the machines that Izzy created during the last years. What do you think?




11  Games Center / WIP games, tools & toy projects / Re: Izzy's Revenge on: 2013-07-08 17:59:20
Hello! We're not dead!! Grin

<a href="http://www.youtube.com/v/JT2JzMF168o?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/JT2JzMF168o?version=3&amp;hl=en_US&amp;start=</a>

After several months of silence, we are back! Many things happened during this period. Maria and Néstor moved from the north of Spain to Valencia, so the full team is now together. We just set a small office and we spend a few hours everyday in the project.

The detail of Izzy’s animations has been increased.  Izzy was too small, all the animations have been redone, and a few ones like ladder climbing and sliding have been added. Finally, the graphic engine has been improved with many bugfixes and some new features like a tween engine.

We decided to rework the whole graphic style. The previous house looked too depressing and we wanted a more cartoonish style.









Also, we wanted to show some of the new designs we've been making, not in-game images but you can see all the new background style we are creating!







From now, you will hear very frequently from us as Izzy’s Revenge just became a serious project for us.
Kisses!
12  Games Center / WIP games, tools & toy projects / Re: Izzy's Revenge on: 2013-03-22 18:24:00
Finally, we have some extra artwork!!:

Izzy in a killing spree:



City where Izzy lives:

We are still fighting with the house mapping:

click here for full size image!
https://dl.dropbox.com/u/96150028/blog/update_maraton/img4.png
13  Games Center / WIP games, tools & toy projects / Re: Izzy's Revenge on: 2013-02-27 05:55:23
Yes, I agree with you, but realize that if you try to fake 3D perspective with 2D drawings, you will have that problems allways at some point. We inspired ourselvels in games like treasure adventure world or a boy and its blob. They have that type of "bad perspectives", but the final result is fine enough:

(second 45)

<a href="http://www.youtube.com/v/AOgwi0w7O7w?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/AOgwi0w7O7w?version=3&amp;hl=en_US&amp;start=</a>
14  Games Center / WIP games, tools & toy projects / Re: Izzy's Revenge on: 2013-02-26 06:00:24
Hi!

Thanks! if you have any question anytime please ask me!

I discovered Spine a few days ago and it looks awesome, it a really professional tool. We have been talking a lot about that: should we draw all the frames or use a skeleton system?. Maria thinks that the movement can appeal more natural by drawing all the frames. Also, she is learning a lot about animation Tongue.
15  Games Center / WIP games, tools & toy projects / Re: Izzy's Revenge on: 2013-02-25 05:20:49
Jimmt, you gonna love this update!

We have been working all this month trying to figure out how to use perspective correctly. We wanted to do a modular scheme: create any room size from a few tiles.

The first attempts gone quite bad: everything was too complicated and looked broken:


After a while, we tried to simplify the idea as much as possible:

With this new set we finally managed to get nice results:


Also, we have updated the map builder with several tools that we realized they are very useful like undo/redo, add invisible colliding elements, dragging elements or copy/move big level areas:

<a href="http://www.youtube.com/v/QXSJQjKMnJg?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/QXSJQjKMnJg?version=3&amp;hl=en_US&amp;start=</a>


PS. Maria is still working hard trying to improve Izzy's animation as much as possible. As we are not rich she has to use cheap, not orthodox methods:

16  Java Game APIs & Engines / Java Sound & OpenAL / Re: Need a really simple library for playing sounds and music? Try TinySound. on: 2013-01-26 23:25:59
Ok, my fault, I just tried it again and it works nice. I dunno why I assumed that. Maybe because I just started using music.


About the delay, 50 ms were also fine for removing the crackling. I didn't noticed any lag (core i5 laptop and core i7 desktop, both java 1.7). Maybe just happens with slower computers or other JVM. Why does it happens? because the computer takes a lot of time filling the whole buffer for the first time? Interesting. I will take a look again at the code.

BTW, as I saw in your page, you are doing your PhD, right? good luck!! I wish you to publish a lot of papers Tongue
17  Games Center / WIP games, tools & toy projects / Re: Izzy's Revenge on: 2013-01-26 22:42:58
Hi! we added sound capabilities inside the game thanks to the Tynisound library. It worked great! We added environmental sounds.

<a href="http://www.youtube.com/v/JDQMgKrNmbw?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/JDQMgKrNmbw?version=3&amp;hl=en_US&amp;start=</a>
18  Java Game APIs & Engines / Java Sound & OpenAL / Re: Need a really simple library for playing sounds and music? Try TinySound. on: 2013-01-26 22:17:47
Hi again! yes, that maybe would work too, but inside the kuusisto code, UpdateRunner method doesn't need an accurate loop, just a (more or less) regular loop for filling the buffer, so just increasing the buffer size is enough

Also, I've been working some more with this library. I found  (in my opinion) an important limitation. As I can understand, by now, a sound cannot be played twice simultaneously. You need to load different sounds with the source file (waste of memory).

What I did is just add to the SteamMusic/MemMusic/SteamSound/MemSound a new method called getInstance() This method return a new music/sound that shares the source data. This is a quite small code addition:


1  
2  
3  
4  
           
        public MemMusic getInstance(){return new MemMusic(left,right,mixer,lengthSeconds);}

        public MemSound getInstance(){return new MemSound(left,right,mixer,tinysound.TinySound.getSoundID(),lengthSeconds);}



But was very useful for adding environmental sounds when the same sound comes from several different locations

19  Java Game APIs & Engines / Java Sound & OpenAL / Re: Need a really simple library for playing sounds and music? Try TinySound. on: 2013-01-17 05:19:15
Hi kuusisto, I've to say that you made a great work with this library. It not only gives just what I wanted and nothing more but it is also so clearly written!! I love it.

My congratulations. We definitely will be using it in Izzy's Revenge.

I have just one comment. In my desktop the library worked OK, but in my laptop I noticed some serious crackling, quite annoying.

I have been checking your code. It seems that in UpdateRunner class, you read data with a 25ms buffer. Then you perform a Thread.sleep(1);

It is know that sleep command in several windows machines totally sucks, in my laptop, sometimes Ihave more than 30 ms sleep after calling Thread.sleep(1);

Increasing maxFramesPerUpdate for storing up to 100ms of data per iteration into audioBuffer worked great! No more crackling, the music became smooth and perfect.

So, if there is not any extra problem, maybe is a good idea for futures updates to increase the default buffer size from 25ms to 100 ms or even more.


20  Games Center / WIP games, tools & toy projects / Re: Izzy's Revenge on: 2013-01-08 17:36:36
Thanks all for your comments! The two artist are quite talented, but they don't work as much as I would like Tongue

Jimmt, the problems related with perspective were due the lighting system. I had to remake the shadowing part. Also, I added oval shadows at the bottom of the objects. Also, the builder is still pure 2D and (more or less) tile-based, so we have to fake the perspective.

For example, the floor is divided in two parts, the top part is just part of the background and the bottom part collides with the character:


Anyways, we are just starting to map the levels, I'm sure that new problems will appear!!


About the distortion effect, it is made in a quite easy way. Even java 2D can handle it! Tongue It is just a particle generator (origin at the cyan square). The particles are fragments of the background image, with some shift. With a low alpha value they mix very well with the background:

21  Java Game APIs & Engines / Java 2D / Re: OpenGL VM flag degrade performance on Java2D??? on: 2013-01-08 06:11:05
alesky, I show you a skeleton of a canvas ready for drawing anything you want. I use a VolatileImage as a intermediate buffer. I set the same name you used. If you try it, it would be great some result comparison  Cheesy

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  
public class Zoom_canvas extends Canvas {
   
   
     

    protected BufferStrategy buffer;  //BufferStratrgy
   protected VolatileImage dbImage ; //VolatileImage as intermediate buffer

   

    public Zoom_canvas() {   //constructor
       this.setIgnoreRepaint(true); //we repaint manually
       this.setFocusable(false);

        GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
        GraphicsConfiguration gc = ge.getDefaultScreenDevice().getDefaultConfiguration();
        dbImage = gc.createCompatibleVolatileImage(this.getWidth, this.getHeight, Transparency.TRANSLUCENT); //initialize the VolatileImage
   }

    public void dispose() {
        buffer.dispose();
    }

    public void Init() { //call this before starting game loop, it initializes the bufferStrategy
       createBufferStrategy(2);  //double buffering
       buffer = getBufferStrategy();
    }

    public void PerformDraw() {  //public drawing method, call this from your game loop for update image

        Graphics g;
        try {
            g = buffer.getDrawGraphics();
        } catch (Exception e) {
            e.printStackTrace();
            return;
        }
        this.paint((Graphics2D) g);
        g.dispose();

        if (!buffer.contentsLost()) {
            buffer.show();
        }
    }

    private void paint(Graphics2D g) { //real drawing method

        super.paint(g);

        Graphics2D ga = (Graphics2D) dbImage.getGraphics();
        ga.setBackground(new Color(0, 0, 0, 0));
        ga.clearRect(0, 0, dbImage.getWidth(), dbImage.getHeight()); // we clear the intermediate buffer

//===============================        
//... TO DO, ADD dome drawing here using "ga"!!!
//===============================
       ga.dispose();

        g.drawImage(dbImage, 0, 0, null);
        g.dispose();
    }
}
22  Games Center / WIP games, tools & toy projects / Re: Izzy's Revenge on: 2013-01-08 05:08:04
I just finished a simple way of doing hot air or water distortion effects in Java 2D. It is made with a particle generator, where the particles are portions of the original screen slightly translated and very transparent:

<a href="http://www.youtube.com/v/tpKI_l8OgI4?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/tpKI_l8OgI4?version=3&amp;hl=en_US&amp;start=</a>
23  Java Game APIs & Engines / Java 2D / Re: OpenGL VM flag degrade performance on Java2D??? on: 2013-01-07 18:18:53
Oh, yes! davedes post remind me an important thing. Sometimes Java2D cannot recognize the hardware, so the direct3D pipeline cannot be activated. This happens for example in laptops with nvidia optimus.

You can solve this with the environment variable J2D_D3D_NO_HWCHECK=true, so you deactivate any hardware checking and pipeline can be enabled.

I would love to try java2D in more computers. But yes, it seems that if you go outside standard configurations, weird things can happen. That makes development more thrilling  Grin
24  Java Game APIs & Engines / Java 2D / Re: OpenGL VM flag degrade performance on Java2D??? on: 2013-01-07 18:07:06
Hi alesky!

I've been working a little bit with an intel HD3000 with Java2D in my laptop (JDK 7 and Windows 7) and:

I tried both flags: for using direct3D and openGL pipeline with:

    System.setProperty("sun.java2d.opengl", "True"); or    System.setProperty("sun.java2d.d3d", "True");

And I get much better performance with direct3D pipeline.

Also, I have to say that, for some reason, the global performance of intelHD with java2D is quite bad, maybe is a driver issue. I have also a Nvidia GT520 in the laptop. In theory Nvidia GPU is not much better than the intel HD, but the performance in java2D is much better, maybe 5 times faster. Also, sometimes, the intel behaves weirdly. The performance suddently drops when I add some extra pictures.

-------------------------------------------

About the code you show. Several months ago a did many microbenchs in order to get the best performance with java2D, but I don't remember all the details.

You use a jPanel for drawing the stuff?. Did you tried to use a BufferStrategy over a canvas instead? As far I remember it gives better performance.

Ok, then you apply a set of affineTransforms, right?, so you create an intermediate BufferedImage called "filtered" with all the changes. Do you tried directly to draw the image to dbg without creating that "filtered" image?

something like this:

dbg.scale(scaleX,scaleY);
dbg.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,desired_alpha));
dbg.drawImage(image,brightness_operation,posX,posY);



also, are you creating a new image each cycle?

"dbImage = JPanel.createImage(pWidth, pHeight); // create the double buffer immage"

Why don't you reuse it, I found that the command clearRect is really efficient for clearing an image, is even more efficient than fillRect.

//-----------------------------

I would not mind to take a look at your full code, I enjoy optimizing Tongue

Cheers.
25  Java Game APIs & Engines / Java 2D / Re: quickest most effecient way to darken/lighten image on the fly? on: 2013-01-06 20:18:48
One is using LookUpOp operations. The other is just draw something on top (like a rectangle, or initialized VolatileImage) filled with a certain color with a certain alpha. You fill it each time so the alpha can be changed anytime.

Interesting what you are saying. TBH I just look at the rendering time of my loops for evaluating the algorithms.  I didn't got any noticeable FPS drop with the lookupOp. Drawing a layer over caused more FPS drops, specially in low end GPUs like an intel HD3000.  My desktop uses a mid/high-range GPU: a GTX460.

26  Java Game APIs & Engines / Java 2D / Re: quickest most effecient way to darken/lighten image on the fly? on: 2013-01-06 19:41:29
I agree that, for a serious game, Java2D is not the best option, as it has several serious flaws. But it is perfectly able to handle 60 frames per second when the graphics are not very complicated.

<a href="http://www.youtube.com/v/wfh_jN23jfA?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/wfh_jN23jfA?version=3&amp;hl=en_US&amp;start=</a>

In this video I use two techniques for changing object brightness on the fly. The orange region has on top a layer wich alpha is changed dynamically. The gray part uses the technique I mentioned before.  
27  Games Center / WIP games, tools & toy projects / Re: Izzy's Revenge on: 2012-12-30 08:54:32
Hi all! Today I want to show you some artwork of our level artist. The first level of the game is Izzy's house, wich is will be used for introducing the game history and gameplay.

It was quite hard to decide the art style, specially if we should do a pure 2D (side view) game or add some perspective to the levels. At the end we decided to choose the second option, although it forced us to do some modifications in the game engine.





You can see full post here: http://www.indie4fun.com/post/39200643151/backgrounds-izzys-house-pablo
28  Java Game APIs & Engines / Java 2D / Re: quickest most effecient way to darken/lighten image on the fly? on: 2012-12-29 09:09:59
In my opinion, an efficient way of doing this in java2D/windows is using the drawImage with a LookupOp operation


 LookupOp LU;
...
g.drawImage(image,LU,posX,posY);

by modifying the LookupOp you can change the image brightness:


e.g. Darken image, half of the brightness:

            brightnessBloq=new byte[256];
        for(int i=0;i<256;i++){brightnessBloq=(byte)(i/2);
        LU = new LookupOp( new ByteLookupTable(0,brightnessBloq), null);

later, by just modifying values of brightnessBloq array, it automatically change the brigtness fo the next painted image.

Also, I agree that if you want good performance with high resolutions, java2D can be a little bit problematic Tongue

BR


29  Games Center / WIP games, tools & toy projects / Re: Izzy's Revenge on: 2012-12-16 19:07:22
I convinced the artist to improve the animations Wink, meanwhile i've been working on a configurable particle system. We want to use them for many effects, like smoke, fire or blood:



<a href="http://www.youtube.com/v/yvo5RbQQ4u0?version=3&amp;hl=en_US&amp;start=" target="_blank">http://www.youtube.com/v/yvo5RbQQ4u0?version=3&amp;hl=en_US&amp;start=</a>

We tried to add as many configurable parameters as possible, like disperssion, external forces, or random selection of different particles:

30  Games Center / WIP games, tools & toy projects / Re: Izzy's Revenge on: 2012-12-11 06:04:30
Thanks!! I personally agree with you! The artist wanted to speed up the final part, but she has to add at least one extra frame.
About the final position, good point, maybe we have to thing about it a little bit more.


P.S. Beheading is also being considered, I'm figuring out how to implement this:
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.

pw (18 views)
2014-07-24 01:59:36

Riven (17 views)
2014-07-23 21:16:32

Riven (14 views)
2014-07-23 21:07:15

Riven (17 views)
2014-07-23 20:56:16

ctomni231 (45 views)
2014-07-18 06:55:21

Zero Volt (40 views)
2014-07-17 23:47:54

danieldean (32 views)
2014-07-17 23:41:23

MustardPeter (36 views)
2014-07-16 23:30:00

Cero (51 views)
2014-07-16 00:42:17

Riven (50 views)
2014-07-14 18:02:53
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!