kevglass
|
 |
«
Posted
2005-01-01 14:51:12 » |
|
Its been a busy day, dragged myself out of bed this morning at 10.30 and started coding.. here's my first attempt at the 4k games contest. http://www.cokeandcode.com/4k/tilt/Webstart is here: http://www.cokeandcode.com/4k/tilt/tilt4k-mouse.jnlpJar is here: http://www.cokeandcode.com/4k/tilt/tilt4k-mouse.jar Which you'll have to run with: java -cp tilt4k-mouse.jar G I've not quite brought it in under the 4k limit yet but I'm still working on it. As far as I'm aware it should happily work on all platforms. Controls are: Space - Start Game Escape - Quit Game Cursors - Tilt Board 5 levels in the 4k entry. Feedback would be appreciated as always (especially to do with platform issues).  Finally, it doesn't use a hires timer as yet (though I think I'll make the final entry use the 1.5 one) so if you're running on windows and get a bit of time related stuttering you know why  ** UPDATE ** - Source is now available on the website. Kev PS. Gravity Battle new version is also up at: http://www.cokeandcode.com/grav2/grav2.jnlp (which should also work on all plaformts now, DrA!) PPS: I could really do with some tips on how to shrink this sucker down the final 500 bytes.
|
|
|
|
woogley
|
 |
«
Reply #1 - Posted
2005-01-01 15:08:05 » |
|
great game! runs perfect for me. as far as shrinkning it, I don't know if you read my reply to you in the Site Polls, but there's some tips there. Also, in your jar, I notice you have stuff like: 1.dat 2.dat ... Game.class Use one-letter files. You don't need an extension for the files. The only file that needs an extension is Game.class, and you can even save that as G.class. Other than that, I'd have to peek at your code to help you shrink it some more. Are you using one-letter variables? Are you using a static intializer or a main method? etc.. edit:another strategy: after I removed all your .dat extensions, I zipped up all your level files and called the file 'g' (left off the .zip extension). When I jared this, the size reduced to 4390bytes (your jar is 4662 bytes). The only snag with this is, in your code you're gonna hafta open the zip to read your files. If you're not sure how to do this I can write up a quick example for you 
|
|
|
|
|
tom
|
 |
«
Reply #2 - Posted
2005-01-01 15:18:01 » |
|
Great game  PPS: I could really do with some tips on how to shrink this sucker down the final 500 bytes. -Use a obfuscator. Will rename functions and vars to save space. Some may have a size option you could try. -Manually inline functions that is only called from one place. -Don't use jar. Instead compress it with 7zip or other zip util.
|
|
|
|
Games published by our own members! Check 'em out!
|
|
woogley
|
 |
«
Reply #3 - Posted
2005-01-01 15:23:02 » |
|
-Don't use jar. Instead compress it with 7zip or other zip util.
this is a good idea, but I'm pretty sure it's against the rules (because the user would have to install 7zip to open 7zip files). By the way the 7zip extension would be the only compression that is better than jar becuase jar uses the standard zip compression (if I'm wrong please prove me wrong, I'd love to hear about better compression  )
|
|
|
|
|
blahblahblahh
|
 |
«
Reply #4 - Posted
2005-01-01 15:30:50 » |
|
What a cool game.
Although, in traditional KG style-ee, one small mistake on a high level forces you to re-do all the others. Oh, the pain of traditional arcade games, no save-points, no level-codes, nothing!
Still kicks ass though. Best 4k game I've ever played...
EDIT: um, best as in "most fun". I've seen some much more impressive visually etc, but they were quite dull, usually just simple space-invaders in 3D.
|
malloc will be first against the wall when the revolution comes...
|
|
|
tom
|
 |
«
Reply #5 - Posted
2005-01-01 15:44:18 » |
|
this is a good idea, but I'm pretty sure it's against the rules (because the user would have to install 7zip to open 7zip files). By the way the 7zip extension would be the only compression that is better than jar becuase jar uses the standard zip compression (if I'm wrong please prove me wrong, I'd love to hear about better compression  ) I did not mean to use 7zips proprietary format, but to use it to create a standard zip file. Wich is what a jar really is. There are different ways to implement a zip compressor, and different utilities will result in different sizes. 7zip is regarded to be one of the best last time I checked. Found two threads about reducing jar size in the j2me section: ShavingMidlet size
|
|
|
|
Malohkan
|
 |
«
Reply #6 - Posted
2005-01-01 15:55:51 » |
|
Awesome game! I'm very very impressed  Good work! Now anti-alias the lines... 
|
|
|
|
tom
|
 |
«
Reply #7 - Posted
2005-01-01 15:59:12 » |
|
Had a closer look at your jar file. You have to get rid of those dat files. I appended all the dat files to the class and 7ziped it. The result was 4009 bytes. I suggest you embed the content of the files in one or more arrays in the code. You'll be under the 4k limit with room to spare.
|
|
|
|
woogley
|
 |
«
Reply #8 - Posted
2005-01-01 16:39:14 » |
|
I did not mean to use 7zips proprietary format, but to use it to create a standard zip file.
My mistake, I was assuming you meant the .7z or whatever it is.
|
|
|
|
|
kevglass
|
 |
«
Reply #9 - Posted
2005-01-01 16:54:04 » |
|
You guys rock!  Thanks for the all the lovely positive feedback. I can now actually say I'm going to be entering the 4k contest since I've managed to bring the entry jar down to.. dum dum dum: 4086 bytes  (10 to spare.. what to use them for?) I also had room to add an extra feature just for B^3, type "e" to toggle into "Easy Mode" (not that it tells you anywhere since I couldn't fit that in (yet?)  ). This means you don't restart at level 1 when you die, carry on from the current level  I can honestly say after my busy day I'd recommend everyone have a go at this 4k lark, really changes the way you code  Kev
|
|
|
|
Games published by our own members! Check 'em out!
|
|
oNyx
|
 |
«
Reply #10 - Posted
2005-01-01 17:10:21 » |
|
Oooooh nice game  Btw the jar I just downloaded is 4086 bytes. Those two files are just 3999 bytes if you zip it with 7zip (zip/ultra). And it's only 3988 bytes if you zip it with kzip  98 bytes smaller, leaving a total of 108 bytes for some additions (maybe one level more?).
|
|
|
|
kevglass
|
 |
«
Reply #11 - Posted
2005-01-01 17:36:22 » |
|
Thank-you!!!  1 more level... or maybe 3  New version uploaded with 3 additional levels. I'm now 50bytes or so in the black. Got a little indicator to show when easy mode is on too. Oh, also the X on the window will work now. 50 bytes? a) More levels? b) Try and get an icon in there? c) Something else? Thanks again Onyx, KZIP, what a find! Kev
|
|
|
|
woogley
|
 |
«
Reply #12 - Posted
2005-01-01 17:57:49 » |
|
how about random level generation?  actually, now that I think about it.. the rules say the game itself has to be <=4096, but didn't say there was a size limit to what runs it (e.g. the jnlp file) if that's the case, you could make an applet version and have all the level data in some <param> tags, then you could make tons of levels! 
|
|
|
|
|
oNyx
|
 |
«
Reply #13 - Posted
2005-01-01 18:15:58 » |
|
> actually, now that I think about it.. the rules say the game >itself has to be <=4096, but didn't say there was a size limit >to what runs it (e.g. the jnlp file) >if that's the case, you could make an applet version and >have all the level data in some <param> tags, then you >could make tons of levels! Nop. The game and it's data needs to be <=4096 bytes. All cheats like requiring a huge commandline switch (eg containing the images) or anything like that is forbidden (the original rules were a bit more specific there). You can - however - save some bytes by only zipping the class and leaving the data external. So, no zip directory entry overhead, but you lose (of course) some coolness points (like I did) heh 
|
|
|
|
the2bears
|
 |
«
Reply #14 - Posted
2005-01-01 23:21:18 » |
|
Kev,
Great little game, seriously! I'm thinking your advice to try out the 4k stuff is good. I just might:)
I'm glad there's the 'e' secret code. I was frustrated as well having to start at the beginning. I consider it 'e' for experienced, rather than easy.
Cheers,
Bill
|
|
|
|
kevglass
|
 |
«
Reply #15 - Posted
2005-01-02 20:24:37 » |
|
Hola, Thanks all for the feedback thus far, brilliant! I've just uploaded the new version bringing the jar size to exactly.... 4096 bytes! For the extra 300 odd bytes you lucky people get: * A total of 10 levels (some of the very easy ones have been redesigned) * An icon replacing the little java mug * A website address in the title bar (woo!) * Some instructions on how to play * The best time per level is now recorded and shown (only per session I'm afraid, no saving) * 3, yes count them, 3 lives. (Note easy mode still works but I might take it out now to save space) * Gameplay update - you now need to collect the coins (yellow circles) before the exit will appear. At which point you need to use it. Not bad I reakon. I'm going to try and make some cosmetic updates now (speed up rendering) without breaking the limit. For info, my current work flow is: Code carefully => Design levels (I've a level designer tool) => Pack levels into one file => KZIP into a jar => ProGuard the jar. Any additional feedback or tips much appreciated but I'm starting to think I'm reaching the edge of what I can do with this code base. Soko4k or Kart4k next?  Kev
|
|
|
|
Matzon
|
 |
«
Reply #16 - Posted
2005-01-02 21:35:35 » |
|
god damn it! java.lang.ArrayIndexOutOfBoundsException: 10 at G.draw(Unknown Source) at G.<init>(Unknown Source) at G.main(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.sun.javaws.Launcher.executeApplication(Unknown Source) at com.sun.javaws.Launcher.executeMainClass(Unknown Source) at com.sun.javaws.Launcher.continueLaunch(Unknown Source) at com.sun.javaws.Launcher.handleApplicationDesc(Unknown Source) at com.sun.javaws.Launcher.handleLaunchFile(Unknown Source) at com.sun.javaws.Launcher.run(Unknown Source) at java.lang.Thread.run(Unknown Source)
when completing last level *grumble* - oh well no fame for me :/ Very nice! - this screams for a 3d version, like the old wooden board thingy
|
|
|
|
kevglass
|
 |
«
Reply #17 - Posted
2005-01-02 21:52:15 » |
|
Thanks for that, fixed! Hadn't actually got round to completing the game since the 10 levels went in. You mean you don't like my 3D!  I've just uploaded a version with a system property set which (noddraw) which massively improves performance locally. Also manage to save 5 bytes somewhere  Let me know if performance is suddenly a problem. Cheers, Kev
|
|
|
|
Malohkan
|
 |
«
Reply #18 - Posted
2005-01-03 00:58:16 » |
|
I beat it WOOO!!!  Anti-alias and add mouse control! 
|
|
|
|
kevglass
|
 |
«
Reply #19 - Posted
2005-01-03 10:48:53 » |
|
You wish is my command oh master  , well half of it. New version uploaded, and with my spare 30 bytes there is now: a) Antialiasing toggled via the "a" key. (board only) b) A bonus (tricky!) level 11. c) Bug fix for the collision, you should now be able to the end of walls happily. Kev
|
|
|
|
oNyx
|
 |
«
Reply #20 - Posted
2005-01-03 12:16:04 » |
|
*phew* finished it  That was pretty tough  Level 6 was also quite hard (at the end only 1 second left).
|
|
|
|
Malohkan
|
 |
«
Reply #21 - Posted
2005-01-03 18:35:11 » |
|
Great I like the new level! However I didn't notice antialiasing on the board or on the text or on the ball/coins  I think mouse support would make it more like the original wooden/plastic versions of this kinda game because the steadiness of your hand would come back into play  Do that, add 40 more levels, crazy graphics and a GameLizard loader there and you're ready to go 
|
|
|
|
kevglass
|
 |
«
Reply #22 - Posted
2005-01-03 19:00:11 » |
|
Honest, toggle it on with 'a' and tilt the board, the lines look way smoother.. the coins and ball also get smoothed only its very subtle.. Mouse is only out cause the game is for the 4k contest. Although I suppose I could remove keyboard support and just have mouse. I think this one stops at the 4k contest tho..  Kev
|
|
|
|
Malohkan
|
 |
«
Reply #23 - Posted
2005-01-03 20:18:04 » |
|
ahh I forgot it was a toggle 
|
|
|
|
dranonymous
Junior Member  
Hoping to become a Java Titan someday!
|
 |
«
Reply #24 - Posted
2005-01-04 01:46:11 » |
|
Great stuff! I wish I could code out something fun and useful regardless how large it is.  I'm not sure I like the anti-aliasing, the way I thought I would. The black ball looks much nicer as do the circles. The lines look a little worse to me for some reason. I think its because the antialising makes them look fatter, since the colors are so high contrast maybe? Any way of AA'ing the balls, but leaving the lines undone? How about a shadow for the ball? I'd go for more 'glitz' at this point, rather than levels. You can just improove the difficulty of the levels, since the app you have already prooves its point by being so good. Now just put more polish on it to keep the other 4k demos in check.  Dr. A> PS - You have different jnlp links for GB. The website one doesn't match the one you posted at the top of this thread. GB also didn't run on the mac.  It complained about not finding an 800x600 mode. I tried to manually switch my resolution, but it didn't help. 
|
|
|
|
|
tom
|
 |
«
Reply #25 - Posted
2005-01-04 02:19:28 » |
|
I'd like to see a mouse only version. The analog mouse controls is much more challenging. I'd also like to see the game continue after the last level. Continue with level 1, but make it more difficult. Less time to finish, make the ball go faster, or flip/rotate the level. You could also repeat all the previous levels before you get to the next. Like this (numbers represent level): 12123123412345123456 etc. The player will be motivated to see the next level, and you'll increase the time it takes to finish the game. I don't see the need to toggle between antialising or easy mode. Decide on one or the other and use the extra space to add levels or gameplay. And I rather see gameplay added than nicer gfx. I really love the game, btw 
|
|
|
|
kevglass
|
 |
«
Reply #26 - Posted
2005-01-04 06:19:29 » |
|
Ok, I'll take a look tonight. I agree that anti-alias and easy mode shouldn't be toggled.. I take them out. Mouse only - probably the best control system? Remove keyboard all together. Move mouse to start.. Could even make the controls analogue! I really like the idea of flipping the board over to get a new level.. I'll see what I can do with that. You might see a 33 level version soon with flipped boards  Damn, I thought I'd finished.  Kev
|
|
|
|
KONI
Junior Member  
Java games rock!
|
 |
«
Reply #27 - Posted
2005-01-04 11:10:27 » |
|
As for the control system (Mouse), I suggest you have a look at Neverball: http://icculus.org/neverball/ damn funny game and great MOUSE & Keyboard Control.
|
|
|
|
|
kevglass
|
 |
«
Reply #28 - Posted
2005-01-04 20:30:28 » |
|
Thanks for the tip  The mouse control version is now available although I've put it at a different location since its a very different game and I'm not sure which is best.. Webstart: http://www.cokeandcode.com/4k/tilt/tilt4k-mouse.jnlp Jar: http://www.cokeandcode.com/4k/tilt/tilt4k-mouse.jar Run with: java -cp tilt4k-mouse.jar G I can only get as far as level 4 now! I dare someone to complete it! Easy mode has gone, antialiasing is now default (text, pieces, ball and board). I'm not sure its valid making a game harder by changing the control system.. let me know what you think and if its how you'd expected... I'd also be interested on how well java.awt.Robot works on different platforms. Thanks all! Kev
|
|
|
|
blahblahblahh
|
 |
«
Reply #29 - Posted
2005-01-04 20:42:09 » |
|
I can only get as far as level 4 now! I dare someone to complete it! Easy mode has gone, antialiasing is now default (text, pieces, ball and board).
Haven't tried the new version yet, but the previous ones anti-aliased mode caused the framerate to drop from (something smooth) to (just jerky enough to annoy you but still playable) on a 1ghz machine (linux) - and it looked damned ugly on a high res monitor.
|
malloc will be first against the wall when the revolution comes...
|
|
|
|