Bubo 4k

Okay this is my first entry for java4k comp. First, really first ever.

If you ever look up HTML5 demo there’s a game called Chain Reaction. And this one is remake of it, with more rules but less difficult. And different name.

All you have to do is just choose a point and start making a growing ball. React all balls by make them collide to an exactly same level of reacted ball (same color)or to a reacting ball for white ball. A reacted ball can increase its level by one by causing one reaction on other balls (white or same level one).

  • white = level 0 (can grow to any level)
  • green = level 1 (stay for 3s)
  • blue = level 2 (stay for 3.5s)
  • red = level 3 (stay for 4s)
  • yellow = reacting

PLAY HERE

Fact: I didn’t compress it with anything, just jar and shrinked 40% to 3kB. There’s still lot of bytes left. I’m still looking for creating procedural sound to add. I tried Synth4k but it won’t compile. Further all, I hope I can reach 1,000 downloads at comp’s end. 8)

UPDATE : here

I am completely confused on how to play. Plus I think there are rendering issues where the screen doesn’t refresh at all. There was nothing going on until i scrolled the page and some little green particles moved a bit.

I don’t see the point of this game too ???
I confirm the problem with the game. The white ball move but when I continusly scroll down/up, the yellow/blue ball grow far quickly. On level2, the movement of some white ball was not stable too.

Either scroll or move the mouse inside and outside the applet to make it move… interesting choice :wink: IT looks like you aren’t calling redraw on a timer and that the logic is linked to the redraw?

Mike

Thx for replies. I’d blame myself if everything went well on my first try :o

@ra4king
the gameplay is quite creepy, you click anywhere to start the first growing ball to make chain reaction.

@Bonbon-Chan
not stable? every ball has different dx and dy speed. I don’t know why scroll up/down would do something to the applet ??? if you mean blinking, yes it happens when you scroll the webpage but I can’t solve it.

@Mike
I did redraw as I followed template on resource page,


do{
   long n = System.nanoTime();
   d = n - l;
   a += d;
   t++;
   if (a >= 1000000000L) {
       a -= 1000000000L;
       fps = t;
       t = 0;
   }
   //update logic
   l = n;
   //just draw everything
   do {
      Thread.yield();
   }while (System.nanoTime() - l < 0);
   if (!isActive()) return;
} while(inGame);

is something wrong here?

No we mean that the applet itself doesn’t do anything unless we scroll/resize the window/minimize and maximize, which is the sign of system-triggered repainting. This means you are not calling repaint() every frame.

What? no animation? I tested it on my windows which has jre1.7 (default) and jre1.6. I tested it on eclipse which I set to use jre1.6. Everything work as should. Sorry but I think the problem not on code.

However there’re 3 ppl reporting same problem. If the applet really works only on me, then how can it be approved and how about the mad of 200 ppl out there? ???


BufferedImage b = new BufferedImage(800, 600, BufferedImage.TYPE_INT_RGB);
Graphics2D g = (Graphics2D)b.getGraphics();
Graphics p = getGraphics();

I draw everything on ‘b’ through ‘g’, then draw the ‘b’ to container (applet) through ‘p’. The source is up on java4k page, please help me figure out what happens.

Seems to work fine for me, Vista, 1.6.0_??

Hmm it looks like it’s working fine now, I see the FPS changing every second and the balls are moving extremely slowly. However, I’m still really confused on how to play :stuck_out_tongue:

Thanks BoBear for trying out.

+ra4king
thanks for still reporting. what did you mean by “looks like”? To play you go click anywhere you like to start reaction, that simple. How about your fps? I got 65-80 here depends on ball counts.

I get between 700 to 750 FPS

Ok I click anywhere but it looks like nothing is happening. After a while I see the balls moved a tiny bit.

Really I can’t find out the problem ??? if you find the problem, I’ll be pleased to see. My last try is I’ll switch back to canvas and go double buffering then see what’ll happen.

Nothing happening here either after the first dot has been place. ~700FPS. It seems like ppl w high FPS have less action. Makes me wonder if it could be a problem with a timebased movement. Could it be that your delta tick get so small that you round it off to 0 and therefore no movement is done? Just an idea.

Yep I was suspecting the same thing as jojoh and that suspicion has been confirmed: I went on my old laptop which ran the game at 100-150FPS and the balls were moving fast and I could see collisions and reactions. #1 rule of any physics game is a steady FPS so it should be fine if you limit it at 60FPS.

thanks for the info both of you ;D

so the problem lies on fps limit which should be there. I’ll correct it ASAP.

FPS fixed to 60. Someone please try it ;D

Nope I still see 300-350FPS and barely any movement :frowning:

It played well for me. I’m on Windows XP Home, using Firefox 8.0. Once or twice the screen got a little weird, for example when clicking on it and then moving down to see the instructions. I’m not sure exactly what I did. But only a portion of the screen would animate. This went away a soon as I reloaded.

It took a long time for the Level 20 to succeed. I felt like there was a lot of luck involved, that there was little I could do to affect the outcome. It was fun to watch the chain reactions.

One suggestion is to allow the last explosion to complete before moving on to the next level. The levels seem to end so abruptly. If the explosion is allowed to play out, one has time to glance at the various scores before they get cleared/set back to zero.

I didn’t have my headphones on. Was there sound? (Checking. Nothing there.) This could really use some nice sounds for the collisions and pops, nice musical tones. How much room do you have left? Ahh, this is a 4K competition.

@philfrei
Thank you very much for trying ;D

For weird screen, I find small glitch on it. However until now I can’t find the problem. I have double buffering by simply create a bufferimage before drawed to container’s. Should I try using canvas? or has it something to do with renderinghints for anti-alias? I’ll check it out.

Yes it really needs luck. The original also. I played CR for many times and realised that skill has nothing to do here :slight_smile: For tips, start your first ball on empty place so it can grow to max.

Thanks for the suggestion. Current level change is trigerred by last ball removal. Will change it to last particle out.

No sound for now. It only 3K without proguard, just simply jar. I save so many bytes for sound. Still can’t find any good sound for growing ball. It shouldn’t creepy because we have to hear it soooo many times. I created one with sfxr but it has 23KB :-\

@ra4king
おもしろい… here is my “new loop” btw


for (long delta = 0, start = System.nanoTime(); inGame; delta = System.nanoTime() - start, start = System.nanoTime()){
//update
//render
Thread.sleep(2L);
}

help?

You will need to sleep for: Thread.sleep(16 - (System.currentTimeMillis()-start));