Pinball

I am opening this thread to prevent hijacking http://www.java-gaming.org/forums/index.php?topic=15814.0
This game is far from done, but I provided a link because the other topic was quite related to what I had done. Go ahead and give it a shot but bear in mind that it is far from done.

Download (Outdated, use webstart below instead)

The download is for windows only. Unzip and doubleclick the .bat file. I will add a cross platform webstart when/if my changes to slick2d is added to a build… Use keys q,w,e to select game mode, 1,2,3 and enter to eject ball, and mouse to ctrl bat, shift keys to ctrl flippers.

This is in part a test to see what slick2D can do. If you haven’t tried it and are coding 2D games, then you should give it a shot. Made by a game coder for game coders. You will get something up and running with OpenGL speed, sound, music, particle systems, great fonts and more in literally minutes. It is still in its infancy, but is very promising. Great work Kev & Co!

Update:
Slick has been updated with lots of goodies, and I can now link to it in my webstart, so here it is:
WebStart
I have made some improvements compared with previously published version. Not sure what :stuck_out_tongue: Somewhat changed table design and a new font for score and so on. Flippers should behave a bit better as well. Still not at all ready for real deployment, but I guess it still can be OK to play around with.

I’ve tried it, lacks contest but it looks promising

you have to work on your collision detection, ball sometimes crosses border or destroys an explosive object from wrong side of the border. Also when you move window, as in Frame, the ball tilts a little? This can be seen if you play pinball (w), and when ejecting the ball it bounces exactly every time, but if you move a window a little bit ball will change trajectory. Good luck, I love pinball games. Shame Psycho pinball from 1995. dosen’t work in win xp, even with doxbox. Best pinball ever.


http://img179.imageshack.us/img179/8546/pinballcollisionbugmq8.th.jpg

Heh um your pinball game seems to have taken a drastic turn into something that looks more like breakout =)

I’m going to assume you know why.

Anyway, uh, commenting on the breakout, if the ball is at an angle of like -10 degrees (in reference to the standard positive x axis, i.e. to the right) and it hits the paddle near the right side of the rectangle, it bounces to the left instead of upwards and then maybe bounces in between the two paddle sides a few times before going off the screen below. Looks kinda like


              O
----------------
|______________|

right before it does it.

Particle effect on hit adds a nice touch to the game and the music is good enough that I played it a second time mostly because it was there. And I can’t find any ogg or wave files, where’d you hide the music? Does slick put them in those jar files? Or did you just do the music using a programmable midi thing?

Yep, I think I have most of the behavior down, but definitely a lot of polishing left to do. Balls shouldn’t move through walls… The pinball table was mostly created to test the features. Anybody willing to create a table editor is very welcome to help :slight_smile:

Not quite sure what you mean with that, but I think that what you see is when you move the window, there will be a long time between frame updates, because of how Slick/OpenGL works. That gives the ball a slightly different trajectory. I should probably put a limit to max frame delta time that I allow the game to move. Thanks for pointing that out, hadn’t noticed.

Yup, follow the first link I gave and you’ll see why :wink: Press ‘e’ to switch to a more pinball-like mode.

I have a pinball in progress, but after reading Chris´ thread I realized I had 90% of a twisted breakout done. I then added the breakout bat, but haven’t put much effort into it, and probably won’t unless Chris or someone else gives me a reason to (multiballs, glue, different size bats better look and so on would be nice). The bat will work quite fine if you don’t move it fast when the ball hits it :slight_smile: Not a difficult fix to do, but it will affect the pinball code so I won’t do it unless the breakout will be used somehow.

Resources are “hidden” under lib/resources.jar. I put them in a jar since I was planning to webstart it. Most of the resources were picked up at http://www.flashkit.com Good place for music and soundFX.

Just pressed W and woah that makes an intense breakout game. Adding physics to breakout is really really cool (at least on first impression). You should pursue a complete second game with this. Most exciting breakout I’ve played in months, probably years (at least considering it’s stage of completion). Or maybe you could have breakout stages in between pinball stages as bonuses or something. I dunno but it’s really cool playing like that. :slight_smile:

How is framerate related to game engine? I mean when you move the window, game engine still ticks and moves the ball (or not if it is still), only rendering doesn’t occur, right? Ball should have same trajectory all the time. Example, when in pinball mode (e), let your ball fall all the way down between bats. Let it be still. Then move the window up / down as fast as you can, you’ll see it will bounce into the air!? I do not know how is it possible for a Frame window to have an effect on game engine physics.
Also doing this I noticed that ball doesn’t slow down when moving in a straight horizontal line, like no force that slows her down, always same speed until it hits something, then it slows down.

OK one vote for that. I quite like the physics aspect of the breakout as well, but I am not 100% sure if that is the general consensus. Thanks for the feedback.

Nope, Slick2D has one gameloop per frame update (just like most java game engines). I locked the delta tick to 35ms and that completely removed the strange bouncing you talked about.

Yep, slowdown doesn’t work well with a breakout game, so I removed it. I might make it table specific so that there will be slowdown in pinball and no slowdown in breakout.

Hey, JoJoh, can’t wait to try this from home!

Thats the default behaviour. You can actually configure the update loop minimum delta to change this but most people don’t need to.

Just to reiterate, Slick is still very early days. I’m sure there are plenty of bugs to shake out even in the basic code thats currently in place - so if anyone does try it please keep this in mind.

Kev

New slick is available, so I can now webstart against it. As promised, here is the webstarted version:
WebStart
Any updates that I have made in the meantime are also included. Still far from ready…

I tried this on Mandriva Linux 2007, Java 1.6, and I get a painful delay before the game starts, on the order of two minutes. Not sure if this is normal or not, but it is annoying. I had already written a message saying that it doesn’t work in Linux, and now I had to erase that and start again! :wink:

Well, there is a rather painful delay in startup, but it should be ~ 2 sec. :slight_smile: Have you tried to restart it again. It might be getting the resources the first time? I also do some ad-hoc ways of creating the gfx (convert from Java2D to Slick2D), so I guess it is possible that it would be really slow on Linux, but going from 2s to 2min seems crazy. Have you tried other Slick games?

Restarting makes no difference: there is still a ~2.5 minute delay. I just tried the Slick StateBasedGame test via JWS, and it fired up with no problem.