t4kns [fits in 4k now!]

[quote=“JonathanC,post:40,topic:31046”]
Ah, you can use the arrow keys. =)

Arrow keys weren’t working all the time. Just every now and then, for no apparent reason. Apart from that, it’s looking very cool. I’d rather see an apparent health bar for the tanks than having four variants, though… :slight_smile:

Here’s 4KJO: http://www.x2d.org/java/4k/Moogies4KJO.zip

I didn’t have the original, so I just threw all the files I thought were relevant from my 4KJO folder in a zip. Let’s hope everything is in there. If not, tell me. Might be one or two files from something I’ve done that isn’t relevant.

looks awesome,I really hope that you will be able to fit it into 4k! a 4ko full RTS would be really impressive…

EDIT:
another things… I think that’s really nice that it work as an applet :slight_smile:

[quote=“Morre,post:42,topic:31046”]
Unfortunately, that results in a bigger jar than just jarg + kzip.

I still need to cut out some 604 bytes… Not easy.

Looking good… but 604 bytes is a lot :-\ I wish you luck!

I notice it’s an Applet. There is a requirement that all games must be webstart, hopefully that won’t mess everything up for you ::slight_smile:

Webstart supports launching applets!

I see that you have embedded data. Perhaps actually injecting the data into the generated bytecode? similar to what i did for the image data in my 2007 entry (http://javaunlimited.net/hosted/moogie/SubPar/source.html)

Way cool!

But kind of unfortunate too, as this game would be so cool with decent AI and / or multiplayer… but thats just not gonna happen in 4K :-\

Maybe it’s time to move on to 64KB demos! :wink:

Well, it is not much but i have shaved 15 bytes from the version on your website by this combination:

PROGUARD OPTIMIZER
JODE OPTIMIZER
JOGA OPTIMIZER
JARG OPTIMIZER
KZIP with split of 288

http://www.cuteandcuddlypet.com.au/tank/tankApplet.jar.BEST_OPT_COMPRESSED.jar

It potentially could save more if given the original source. (i decompiled your already optimised version)

You might gain a few bytes by replacing the usage of Random#nextInt(int) with your own implementation, as they do pull in a rather large set of constant pool entries.

The jdk uses :-


int seed = System.currentTimeMillis();
int next() {
       seed = (seed * 0x5DEECE66DL + 0xBL) & ((1L << 48) - 1);
       return (int)(seed >>> (48 - 32));
}

But i’m sure something smaller, & slightly less random would suffice.

Thanks for the shrinking suggestions. =)

I’m down to some 450 bytes over the limit now after squeezing it down some 200 bytes or so by removing the third silo (you drop crystals in the base now) and getting rid of some minor eye candy stuff… I’ll probably remove the Scanner unit as well since it doesn’t actually DO anything yet, which should save me perhaps another 50 bytes or so if I’m lucky… but after that I really don’t want to remove anything more… argh.

I tried getting rid of the fancy fog of war so the map stays lit after you’ve explored it, but that didn’t save many bytes at all, and it really adds a lot to the gameplay.
I guess I could cut out all keyboard controls to save another 50 bytes or so… but then the game starts to become annoying to play, which is bad.

Perhaps someone should approach innaworks for a 3 month demo license, that limits output jar size to ~8kb…
http://www.innaworks.com/mBooster.html.

It would be good publicity for their tool.
I attempted to pass your latest t4kns jar through it, just to confirm that it will give significant reductions… but our mbooster servers have a maximum library jar size limit of 4mb (rt.jar is more than 40! :’( )

[quote](rt.jar is more than 40! )
[/quote]
you may take another rt.jar ?
Java 1.4.2.2 rt.jar 25.2 mo
Java 1.5.06 rt.jar 32.1mo
Java 1.6.0.1 rt.jar 39.3 mo
Java 1.6.0.2 rt.jar 39.4 mo

I never notice that rt.jar was significantly increaing in size… every days

Shouldn’t it be possible to make a “fake” library jar containing empty java.lang.Math and java.awt.Applet and so classes, then pointing mbooster at that?

yeah, tried that… but my stub generator tool doesn’t handle java1.5+ constructs, and I can’t be bothered updating it :wink:

I got the upload limit upped… and got this lovely error when trying to mbooster it :slight_smile:


     [java] ERROR - Internal failure detected at step id: 1
     [java] ------------------------------------------------------
     [java] java.lang.IllegalStateException: Ooops! default case reached.
     [java] at java.lang.Void.<unknown>(Unknown Source)
     [java] at java.lang.Void.<unknown>(Unknown Source)
     [java] at java.lang.Void.<unknown>(Unknown Source)
     [java] at java.lang.Void.<unknown>(Unknown Source)
     [java] ------------------------------------------------------
     [java] Please contact Innaworks support at support@innaworks.com

Might have a closer read of the documentation - I have a sneaking suspicion the entry point has to be a subclass of MIDlet :o

aww

I’ve been kinda toying around with the idea of writing my own java compiler. :wink:

Adding new optimisations (and bug fixes!) to Proguard would be an excellent contribution =D

but less fun, hehe

I had to cut a lot of fancy artwork stuff and one building and one unit had to go, but it now fits in 4kb!! YAAAY!

I’ve tweaked the difficulty a bit as well, but I’m not sure how playable it is. :wink: