Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (536)
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  
  Time to plan for '08  (Read 21259 times)
0 Members and 1 Guest are viewing this topic.
Offline moogie

JGO Knight


Medals: 12
Projects: 6
Exp: 10 years


Java games rock!


« Reply #30 - Posted 2007-08-09 00:34:18 »

I think i can say that this seemingly yearly occurrence of bickering around the rules of the competition is not good for the image of the competition.

I have voiced my opinions but i am not evangelical about forcing my view. I have listed counter arguments for the other proposals so that people can make up their own mind.

What ever the outcome, the rules have only a minor part in the development of a 4k game, most of the challenge and fun does come from optimising, hacking and using tools to hunt down those last 15 bytes Smiley

I will be attempting to enter a game no matter the rules. It would be a little childish to boycott the competition and the fun it is just because a rule! Sure i would love to have the extra 1k that PACK200 would give me to make a much more detailed game world. But I will make do with constraints given.
Offline Abuse

JGO Coder


Medals: 11


falling into the abyss of reality


« Reply #31 - Posted 2007-08-09 00:36:49 »



I just had an absolutely stonkingly crazy, but potencially amazing size saving idea Tongue

:hint: the constants pool can be almost entirely eliminated  Lips Sealed

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline kappa
« League of Dukes »

JGO Kernel


Medals: 74
Projects: 15


★★★★★


« Reply #32 - Posted 2007-08-09 00:36:50 »



lol, nice art skillz  Grin
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Abuse

JGO Coder


Medals: 11


falling into the abyss of reality


« Reply #33 - Posted 2007-08-09 00:40:45 »

lol, nice art skillz  Grin

Certain element or irony.... that image is more than 4kb in size  Grin

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline kappa
« League of Dukes »

JGO Kernel


Medals: 74
Projects: 15


★★★★★


« Reply #34 - Posted 2007-08-09 00:48:55 »

Certain element or irony.... that image is more than 4kb in size  Grin


fixed, now its 2.75kb Smiley
Offline Abuse

JGO Coder


Medals: 11


falling into the abyss of reality


« Reply #35 - Posted 2007-08-09 01:26:00 »


fixed, now its 2.75kb Smiley

Pah, using superior compression - cheating!

It should be supplied as an uncompressed bmp, and compressed on the server ><

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline Markus_Persson

JGO Wizard


Medals: 14
Projects: 19


Mojang Specifications


« Reply #36 - Posted 2007-08-09 01:35:59 »

Pah, using superior compression - cheating!

It should be supplied as an uncompressed bmp, and compressed on the server ><

Ouch. Meow. Wink

That decompression code was a really good point, though. I hadn't thought about that.

Play Minecraft!
Online Riven
« League of Dukes »

JGO Overlord


Medals: 748
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #37 - Posted 2007-08-09 01:51:37 »



I just had an absolutely stonkingly crazy, but potencially amazing size saving idea Tongue

:hint: the constants pool can be almost entirely eliminated  Lips Sealed


Hm? Any reference to a class or method or field causes UTF-constants to be inserted inthere. Little you can do about it. If you use your on-the-fly decompressor, the original compressed bytecode, has an constant-pool too, so you're not really saving much. Reflection is another way to shrink the constant-pool, but it has significant overhead everywhere you use it. Hm... I'm out of ideas. You got something figured out that will make us worship you for the rest of your days.

One more hint could do!

1  
2  
3  
4  
5  
6  
7  
8  
g.drawLine(..);
g.drawRect(..);

*cough*

Method[] m = Graphics.class.getMethods();
m[54].invoke(...);
m[33].invoke(...);


* Riven hopes not.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline woogley
« Reply #38 - Posted 2007-08-09 02:18:43 »

Anyway, the slightly more or less than 4K isn't a problem as, as said earlier, it whould be a 8K bytecode contest, but heck, why am I even bothering, you're attacking it like there's not tomorrow, so I'm not really expecting to convince you.

again, what the hell are you talking about? to this day, I have never said anything against (or for) the 8k contest. it's like you're *trying* to cause an argument with me that doesn't exist.

but in regards to the 8k, I'm fairly sure it would be a repeat of what happened with the 16k

but "attacking it like there's no tomorrow"? bullshit. I've never even mentioned it in my posts. ever.
Online Riven
« League of Dukes »

JGO Overlord


Medals: 748
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #39 - Posted 2007-08-09 02:37:53 »

You are reacting to my suggestions of how to make a 8K-source variant. In my interpretation, that was your response against it.


You've been using strong words three times in a row now. I'm like... why...

"it would be rediculous to..." & "what the hell are you..." aren't exactly the usual replies on these forums - before you start getting that worked up, you might reread what was said, or look for some source for miscommunication. I'm not here to try to have a fight with you. I'm just sharing my opinion with others - some argree, some disagree strongly - that's all right, as long as we all keep our cool..

Now hopefully, you're not taking this the wrong way. Kiss

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline woogley
« Reply #40 - Posted 2007-08-09 02:45:16 »

get over the harsh language, twice in a row you've more or less accused me of things I haven't done (saying you're trying to make everything hard, saying the 8k is a bad idea, etc.)

I'm not even here to talk about the 8k, everything I'm talking about here is the 4k. if you want to make an 8k, go for it, but this thread is not the place to organize it. this topic, as the subject suggests, is clearly about planning for the '08 4k contest.

my personal stance on the matters in this thread:

- 8k: neutral, you can organize that elsewhere
- pack200: see my second post on this thread
- compression: while I agree it's not the most fun part of the contest, there's no feasible away around it. Abuse says it perfectly when he says "you cannot escape it"

also, Riven, I did not disagree with your comments without making a fair argument. please re-read my reasoning before taking it personally.
Offline Jamison

Junior Member




We're all idiots in one way or another.


« Reply #41 - Posted 2007-08-09 13:21:18 »

Can't we all just, get along?

I don't like you. Check out my site Smiley www.gamedevforums.com
Offline Abuse

JGO Coder


Medals: 11


falling into the abyss of reality


« Reply #42 - Posted 2007-08-09 17:58:18 »


Hm? Any reference to a class or method or field causes UTF-constants to be inserted inthere. Little you can do about it. If you use your on-the-fly decompressor, the original compressed bytecode, has an constant-pool too, so you're not really saving much. Reflection is another way to shrink the constant-pool, but it has significant overhead everywhere you use it. Hm... I'm out of ideas. You got something figured out that will make us worship you for the rest of your days.

One more hint could do!

1  
2  
3  
4  
5  
6  
7  
8  
g.drawLine(..);
g.drawRect(..);

*cough*

Method[] m = Graphics.class.getMethods();
m[54].invoke(...);
m[33].invoke(...);


* Riven hopes not.

yeah, that's the ticket - though I was intending to do a lot more than that, and perform it automatically via bytecode manipulation.

I wonder if the set of public classes defined in the "java.*" package inside the "rt.jar" can be assumed as being a constant.
If so, an entire method invocation could be simplified down to 1 or 2 integers. (rather than several 100 bytes as is when accessed via the constants pool)

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline Abuse

JGO Coder


Medals: 11


falling into the abyss of reality


« Reply #43 - Posted 2007-08-09 17:59:44 »

I suppose it would be a form of static linking  Roll Eyes

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Online Riven
« League of Dukes »

JGO Overlord


Medals: 748
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #44 - Posted 2007-08-09 19:15:57 »

I can guarantee you methods are added to these classes in every release, messing up the order, making your indices break.

Further, the code to invoke a method by reflection (push int, push array, fetch element, push object, push args, invoke method), is larger than simply invoking it (push object, push args, invoke method).


It's a very nice idea, and I couldn't have thought of it by myself. Maybe it's a step-stone to another hack.. We'll see!

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Abuse

JGO Coder


Medals: 11


falling into the abyss of reality


« Reply #45 - Posted 2007-08-09 20:23:29 »

I can guarantee you methods are added to these classes in every release, messing up the order, making your indices break.

Further, the code to invoke a method by reflection (push int, push array, fetch element, push object, push args, invoke method), is larger than simply invoking it (push object, push args, invoke method).


It's a very nice idea, and I couldn't have thought of it by myself. Maybe it's a step-stone to another hack.. We'll see!

I agree, the cost per invocation would be greater, especially for primitive type parameters.

Perhaps using reflection is too costly and not a good direction to investigate, rebuilding the constants pool using the static-linking mechanism maybe a more profitable (and lower overhead) means of implementing a similar compression scheme. (though only feasible if the static-linking mechanism can be made to work!)

hmm......I wonder if self-modifying code is feasible =D

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Online Riven
« League of Dukes »

JGO Overlord


Medals: 748
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #46 - Posted 2007-08-09 20:57:19 »

It's probably best not to invoke methods in the first place - (doh Grin) - doing your own software rendering instead of using Graphics.

Anyway, when importing a lot of awt/swing classes, the constantpool looks like:
java.awt.Frame
java.awt.Graphics
java.awt.Color
java.awt.KeyEvent
java.awt.MouseEvent
paint(java.lang.Graphics;):v
setColor(java.lang.Color):v
etc etc etc

Look how often the package-name occurs. Now, ZIP is nice, but can't really do this efficiently, as there is binary data between those entries.

It might be good to have a method-pattern-finder, like:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
Method m(int i, String a, String b) {
   for(Method m: Class.forName("java"+(i==0 ? ".awt." : "x.swing.")+a).getMethods()) // generates a StringBuilder... hm
    if(m.getName().startsWith(b))
        return m;
  return null;
}

Integer[] i_ = new Integer[65536]; // positive ints
Integer[] i_neg = new Integer[65536]; // negative ints
for(int k=0; k<65536;k++) {i_[k]=k; i_neg[k]=-k;}

Method[] t = new Method[QUITE_A_LOT];

// manually link
t[0] = m(0,"Graphics","drawS"); // java.awt.Graphics.drawString(java.lang.String;II):void
t[1] = m(0,"Graphics","drawL"); // java.awt.Graphics.drawLine(IIII):void
t[2] = m(1,"JPanel","rep"); // javax.swing.JPanel.repaint():void

// or load from String[]
String[] ss = {"Graphics","drawS",  "Graphics","drawL",  "JPanel","rep"}; // doubles will have a single pool-entry
for(int k=0, p=0; k<n; k++)
   t[k] = m({0,0,1}[k],ss[p++],ss[p++]);

t[0].invoke(g,"highscore",i_[50],i_[185]); // g.drawString("highscore",50,185) -- no auto-boxing!


I doubt it will help though, the overhead is massive Smiley To build this into a bytecode encoder would only add insult to injury... does Rube-Goldberg device ring a bell? Cool

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Markus_Persson

JGO Wizard


Medals: 14
Projects: 19


Mojang Specifications


« Reply #47 - Posted 2007-08-09 23:26:07 »

It might be good to have a method-pattern-finder, like:

1  
<code>

Isn't this pretty much "just" embedding pack200?

I've done some interesting experiments with reflection.. you can't rely on the class names being in the same order, of course, but.. say.. if you need to name 200 enemies in a game, picking class names from java.awt might be an interesting approach. Wink

Play Minecraft!
Offline Abuse

JGO Coder


Medals: 11


falling into the abyss of reality


« Reply #48 - Posted 2007-08-10 00:23:01 »

Didn't someone last year try embedding a pack200 jar inside a class file?
If I remember rightly, most if not all the gains were eaten up by the overhead in unpacking & instanciating the contained class within said pack200 archive?

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline Morre

JGO Knight


Medals: 2
Projects: 10


I'm Dragonene on IRC.


« Reply #49 - Posted 2007-08-10 02:41:24 »

You're all insane. I love it.
Granted, I've far less experience with these things than most of you guys, but this way of thinking is well above my skills on so many levels. I mean, I understand what you're saying (for the most part), but there's no way I'd ever have thought of some of those things myself. Brilliant, I say. And pretty silly. :>

May I say I fear the day Markus and Abuse re-enters the contest? (I can't remember if Riven participated or not last year?)

Offline moogie

JGO Knight


Medals: 12
Projects: 6
Exp: 10 years


Java games rock!


« Reply #50 - Posted 2007-08-10 02:49:35 »

Didn't someone last year try embedding a pack200 jar inside a class file?
If I remember rightly, most if not all the gains were eaten up by the overhead in unpacking & instanciating the contained class within said pack200 archive?

Yeah that was me Smiley

for my entry it did not help, but for many other 4k entries i tested it did give net gains.

I will probably attempt to optimise the 'launcher' code further this year to see if it will give net gain for my entry this  year.
Offline Abuse

JGO Coder


Medals: 11


falling into the abyss of reality


« Reply #51 - Posted 2007-08-10 11:13:07 »

You're all insane. I love it.
Granted, I've far less experience with these things than most of you guys, but this way of thinking is well above my skills on so many levels. I mean, I understand what you're saying (for the most part), but there's no way I'd ever have thought of some of those things myself. Brilliant, I say. And pretty silly. :>

May I say I fear the day Markus and Abuse re-enters the contest? (I can't remember if Riven participated or not last year?)

Given my field is J2ME, I have a vested interest in any new tech. that can reduce code size  Wink (though obvious mangling with the bytecode stream, or manipulating the reflection api is beyond the scope of what is possible in J2ME)

A further optimisation that has yet to be investigated is the J2SE JSR/RET instruction ([jump to | return from] sub-routine).
it is normally only used for flow of control when handling finally{} blocks, however given that 4kb games are typically contained within a single 'main' (be that the 'main' method, or the class constructor), it could be used to embed utility methods within this 'main' method allowing them to be executed as sub-routines. (reducing their invocation cost, and eliminating several constant pool entries)

It is worth noting the JSR instruction, while still supported, is no-longer used in classes generated by the 1.6 compiler. (instead, the contents of the finally block are duplicated)
A change that has come about due to the reorganizing(optimisation) of the class file verifier (so it operates in a similar way to those employed in J2ME VMs)

Therefore, if a bytecode tool to perform this optimisation were to be attempted, you'd have to use the java 1.5 compiler (not sure if 1.6 compiler -target 1.5 will work)

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline Abuse

JGO Coder


Medals: 11


falling into the abyss of reality


« Reply #52 - Posted 2007-08-10 17:06:57 »

Yeah that was me Smiley

for my entry it did not help, but for many other 4k entries i tested it did give net gains.

I will probably attempt to optimise the 'launcher' code further this year to see if it will give net gain for my entry this  year.

That was one of my fears - a game that has already been heavily optimised to reduce the constants pool size is unlikely to gain a significant benefit from pack200 compression.

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline moogie

JGO Knight


Medals: 12
Projects: 6
Exp: 10 years


Java games rock!


« Reply #53 - Posted 2007-08-11 03:35:41 »

That was one of my fears - a game that has already been heavily optimised to reduce the constants pool size is unlikely to gain a significant benefit from pack200 compression.

Well, i found i do get significant benefit from using pack200 compression per se, its just having to use a launcher which kills the benefit Sad

hmm... i wonder if a subset of pack200 techniques could achieve benefit... i would have to be able to decompress the class though.
Offline moogie

JGO Knight


Medals: 12
Projects: 6
Exp: 10 years


Java games rock!


« Reply #54 - Posted 2007-08-11 03:50:47 »

Given my field is J2ME, I have a vested interest in any new tech. that can reduce code size  Wink (though obvious mangling with the bytecode stream, or manipulating the reflection api is beyond the scope of what is possible in J2ME)


I am not 100% sure whether it will work with J2ME... it should, but i found by creating a new Class Attribute and then embedding image data inside this attribute significantly saves precious bytes by removing an entry in the JAR and is better than embedding using Hex ecoded values in the source.

The JVM ignores this new unknown attribute and it is simple to read in the image data by means of pre-appending a unique byte sequence ( in my entry last year it was
Quote
||
) In your code use the .getResourceAsStream(<the class filename>)  and seek until you reach this magic unique sequence. From there is is as simple as reading in you images as usual.

e.g.

1  
2  
3  
4  
5  
6  
   InputStream is=this.getClass().getResource("a.class").openStream();
           
            //search for the magic number
           while (!(is.read()=='|' && is.read()=='|'));
           
            //read in sprite infomation


It could be helpful for J2ME....

Offline Abuse

JGO Coder


Medals: 11


falling into the abyss of reality


« Reply #55 - Posted 2007-08-11 11:55:10 »

Unfortunately most J2ME VMs prevent you getting a stream to the class files within the jar Sad

There is also the memory overhead of embedding any kind of data inside class files - in that it will effectively be loaded into memory twice - once in the class file definition, and a second time in your expanded in-memory representation.

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline nonnus29

Senior Member




Giving Java a second chance after ludumdare fiasco


« Reply #56 - Posted 2007-08-13 01:13:37 »

To me the allure of pack200 was getting those few hundred more bytes into the game.  The original appeal of the j4k was 'can it be done?' and then it turned into 'yes, it can be done, now what cool games can be made?' and Kevin, Markus (and a few other people I can't name) proved that really cool games can be made in 4k.

I'm sure there are lots more cool games to be made in 4k, even without pack200.  Me, I'm still waiting for the  lwjgl 16k.

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

CogWheelz (14 views)
2014-07-30 21:08:39

Riven (21 views)
2014-07-29 18:09:19

Riven (14 views)
2014-07-29 18:08:52

Dwinin (12 views)
2014-07-29 10:59:34

E.R. Fleming (32 views)
2014-07-29 03:07:13

E.R. Fleming (12 views)
2014-07-29 03:06:25

pw (42 views)
2014-07-24 01:59:36

Riven (42 views)
2014-07-23 21:16:32

Riven (29 views)
2014-07-23 21:07:15

Riven (31 views)
2014-07-23 20:56:16
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!