Tilt 4k

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

Jar 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). :slight_smile:

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 :slight_smile:

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

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 :stuck_out_tongue:

Great game :slight_smile:

[quote]PPS: I could really do with some tips on how to shrink this sucker down the final 500 bytes.
[/quote]
-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.

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 :D)

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.

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:
Shaving
Midlet size

Awesome game! I’m very very impressed :slight_smile: Good work! Now anti-alias the lines… :slight_smile:

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.

My mistake, I was assuming you meant the .7z or whatever it is.

You guys rock! :slight_smile: 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 :slight_smile: (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 :slight_smile:

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 :slight_smile:

Kev

Oooooh nice game ;D

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 :wink:

98 bytes smaller, leaving a total of 108 bytes for some additions (maybe one level more?).

Thank-you!!! :slight_smile:

1 more level… or maybe 3 :slight_smile: 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

how about random level generation? ;D

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 tags, then you could make tons of levels! :smiley:

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 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 :wink:

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

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? :slight_smile:

Kev

god damn it!

[quote]java.lang.ArrayIndexOutOfBoundsException: 10
at G.draw(Unknown Source)
at G.(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)
[/quote]
when completing last level grumble - oh well no fame for me :confused:
Very nice! - this screams for a 3d version, like the old wooden board thingy

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! :wink:

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 :slight_smile:

Let me know if performance is suddenly a problem.

Cheers,

Kev

I beat it WOOO!!! :slight_smile:

Anti-alias and add mouse control! :slight_smile:

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