Java-Gaming.org Hi !
Featured games (81)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (576)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1] 2
  ignore  |  Print  
  Bubo 4k  (Read 8948 times)
0 Members and 1 Guest are viewing this topic.
Offline ReBirth
« Posted 2011-12-16 02:36:35 »

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.  Cool

UPDATE : here

Offline ra4king

JGO Kernel


Medals: 350
Projects: 3
Exp: 5 years


I'm the King!


« Reply #1 - Posted 2011-12-16 02:53:40 »

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.

Offline Bonbon-Chan

JGO Coder


Medals: 12



« Reply #2 - Posted 2011-12-16 08:06:43 »

I don't see the point of this game too  Huh
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.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Mike

JGO Wizard


Medals: 85
Projects: 1
Exp: 6 years


Java guru wanabee


« Reply #3 - Posted 2011-12-16 08:30:21 »

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

My current game, Minecraft meets Farmville and goes online Smiley
State of Fortune | Discussion thread @ JGO
Offline ReBirth
« Reply #4 - Posted 2011-12-17 03:12:56 »

Thx for replies. I'd blame myself if everything went well on my first try  Shocked

@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  Huh 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,
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
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?

Offline ra4king

JGO Kernel


Medals: 350
Projects: 3
Exp: 5 years


I'm the King!


« Reply #5 - Posted 2011-12-17 03:45:37 »

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.

Offline ReBirth
« Reply #6 - Posted 2011-12-17 12:23:10 »

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? Huh

1  
2  
3  
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.

Offline BoBear2681

JGO Coder


Medals: 19



« Reply #7 - Posted 2011-12-17 15:25:40 »

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

JGO Kernel


Medals: 350
Projects: 3
Exp: 5 years


I'm the King!


« Reply #8 - Posted 2011-12-17 21:07:51 »

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 Tongue

Offline ReBirth
« Reply #9 - Posted 2011-12-18 02:37:38 »

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.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline ra4king

JGO Kernel


Medals: 350
Projects: 3
Exp: 5 years


I'm the King!


« Reply #10 - Posted 2011-12-18 04:02:00 »

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.

Offline ReBirth
« Reply #11 - Posted 2011-12-18 05:52:16 »

Really I can't find out the problem Huh 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.

Offline jojoh

JGO Knight


Medals: 5
Projects: 7


games4j.com


« Reply #12 - Posted 2011-12-18 17:54:05 »

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.

Offline ra4king

JGO Kernel


Medals: 350
Projects: 3
Exp: 5 years


I'm the King!


« Reply #13 - Posted 2011-12-18 21:39:52 »

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.

Offline ReBirth
« Reply #14 - Posted 2011-12-18 21:56:04 »

thanks for the info both of you Grin

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

Offline ReBirth
« Reply #15 - Posted 2011-12-20 02:48:12 »

FPS fixed to 60. Someone please try it Grin

Offline ra4king

JGO Kernel


Medals: 350
Projects: 3
Exp: 5 years


I'm the King!


« Reply #16 - Posted 2011-12-20 05:30:42 »

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

Offline philfrei
« Reply #17 - Posted 2011-12-20 05:32:01 »

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.

"It's after the end of the world! Don't you know that yet?"
Offline ReBirth
« Reply #18 - Posted 2011-12-20 12:45:48 »

@philfrei
Thank you very much for trying Grin

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 Smiley 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  Undecided

@ra4king
おもしろい... here is my "new loop" btw
1  
2  
3  
4  
5  
for (long delta = 0, start = System.nanoTime(); inGame; delta = System.nanoTime() - start, start = System.nanoTime()){
//update
//render
Thread.sleep(2L);
}

help?

Offline ra4king

JGO Kernel


Medals: 350
Projects: 3
Exp: 5 years


I'm the King!


« Reply #19 - Posted 2011-12-20 22:24:02 »

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

Offline philfrei
« Reply #20 - Posted 2011-12-20 23:53:06 »

I would suggest only sound cueing the collisions and pops.

The collision/creation of sphere could be bell-like, maybe a little crystalline sounding. (I am partial to windchimes, after all.) It should have a crisp start, then fade to a low level until the pop. (Or a slight increase in volume before the pop.) The pop could be a second cue, started as the bell is turned off.

If you could vary the rate of playback of a single bell-like cue, you could get many different pitches, creating a very colorful mass of sound.

I can think of a couple different approaches to coding this, but not in 4k! and not before 2012. I made a variant of the Java Clip that allows multiple playbacks, concurrently, AND pitch variation. If you can find a way to adapt the code, you are welcome to it.
http://www.java-gaming.org/topics/audiomixer/24999/msg/214001/view.html#msg214001
You'd probably want to eliminate the stereo, use a cheaper audio resolution, and you'd have to handle going directly to a SourceDataLine output rather than to the AudioMixer output.

Anyway, your game is fascinating to watch, and not every game has to be for brainiac strategizers. There is a definite nice, artistic "generative" aspect that I like a lot.

"It's after the end of the world! Don't you know that yet?"
Offline ReBirth
« Reply #21 - Posted 2011-12-21 12:30:59 »

Anyway, your game is fascinating to watch, and not every game has to be for brainiac strategizers. There is a definite nice, artistic "generative" aspect that I like a lot.
Thanks, that encourages me a lot Grin especially after I feel not success on LD22 yesterday.

Quote
I can think of a couple different approaches to coding this, but not in 4k! and not before 2012. I made a variant of the Java Clip that allows multiple playbacks, concurrently, AND pitch variation. If you can find a way to adapt the code, you are welcome to it.
http://www.java-gaming.org/topics/audiomixer/24999/msg/214001/view.html#msg214001
You'd probably want to eliminate the stereo, use a cheaper audio resolution, and you'd have to handle going directly to a SourceDataLine output rather than to the AudioMixer output.
I'll try it after I get free time  Pointing

Offline StephR

Senior Duke


Medals: 9



« Reply #22 - Posted 2011-12-21 20:25:04 »

Difficult to write a better comment than philfrei's one, who shared a lot of my feelings about your game. My first thought was that it would fit well in some interactive exibition of modern art...

But I persisted, and when I understood how it worked, I passed the first levels without too much difficulty. Then, I literally flew over level 5 to 19, but I had to restart many times level 20 before winning. At this point, it seemed that I was playing to some kind of new age casino game, as I had the feeling I didn't control anything.

I also searched and played to the HTML5 original game, and found your remake almost as good. A better feature of the original game, is that it anticipates sooner when the game is lost. Thus the rythm of the game seems better.

Interesting work anyway, as I didn't feel as I was wasting entirely my time !
Offline Pit

Junior Duke


Projects: 2



« Reply #23 - Posted 2011-12-22 16:05:19 »

Really cool game. Even if there isn't much to do, it's still quite fun to watch the chain reactions. And I managed level 20 faster than I would have expected after the first try^^

But I agree, the right sound effects could add a nice touch to the game.
Offline ra4king

JGO Kernel


Medals: 350
Projects: 3
Exp: 5 years


I'm the King!


« Reply #24 - Posted 2011-12-22 19:21:31 »

All these compliments make me really want to try out this game, but it still runs at 333 FPS for me and there is no movement at all Sad

Offline ReBirth
« Reply #25 - Posted 2011-12-26 05:31:21 »

Still haven't find a way to fit sound into 4KB. However I did update on gameplay. Now you can choose between two modes, original or skill. Skill mode is same, except
- higher number of balls to pass
- balls don't bounce on wall hit, but translated to opposite wall
- you can click any small ball to change its direction randomly (either change dx or dy)

@ra4king:
I also change the sleep value as you suggested, and it works like charm!
1  
16000 - (System.nanoTime()-start)

please try it again. and tell me how you got this value  Grin

Offline toasten

Junior Duke





« Reply #26 - Posted 2012-01-08 11:19:00 »

Hi,

just tried it. On "Fate" the balls often hit the wall and then just move along the wall. Balls often change directions, looks like they are "drunk"..   Grin
Offline ra4king

JGO Kernel


Medals: 350
Projects: 3
Exp: 5 years


I'm the King!


« Reply #27 - Posted 2012-01-08 21:19:45 »

You can't sleep in nanoseconds! It runs at > 1000 FPS for me and nothing is happening!

1  
Thread.sleep(16 - (System.currentTimeMillis()-start));


And if "start" is in nanoseconds, then do this:
1  
Thread.sleep(16 - Math.round((System.nanoTime()-start)/1e6));

Offline ReBirth
« Reply #28 - Posted 2012-01-09 03:16:09 »

@toasten
that's the annoying little bug which I can't get rid. I did it like this
1  
2  
3  
4  
if (y[i] < 0){
    dy[i] = -dy[i];
    y[i] = 1;
}

however I change the code a bit by make it do that check before moving a ball. Hope you want to try out once more after I posted this Cheesy

@ra4king
still 30fps for me. your case is really unique. Okay I'll change it once more to your second code (above) and tell me how it work.

Updated again:
- with sound (OMG!) - you can tell me if the sound is creepy or annoying, it's my first try of procedural sound afterall.
- with shake effect when a ball explode

Offline ra4king

JGO Kernel


Medals: 350
Projects: 3
Exp: 5 years


I'm the King!


« Reply #29 - Posted 2012-01-09 03:24:55 »

Oh hey it works now at a constant 65FPS!

I still kinda don't understand how it works though :S I just place the ball randomly and wait for reactions Smiley

Also is it a feature or a bug where some moving balls go through reacted balls?

Pages: [1] 2
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

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

The first screenshot will be displayed as a thumbnail.

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

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

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

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

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

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

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

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

BurntPizza (39 views)
2014-10-11 23:10:45

BurntPizza (81 views)
2014-10-11 22:30:10
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!