Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (487)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (553)
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] 3 4
  ignore  |  Print  
  Preparations..  (Read 15887 times)
0 Members and 1 Guest are viewing this topic.
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 783
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #30 - Posted 2010-10-31 20:42:42 »

I fixed it. It was entirely my fault. Due to some realtime gzip feature I added to my http server, "Content-Encoding" was cleared if I turned off the gzip-ing. Silly me, what was I thinking!

Can everybody try again?

http://indiespot.net/app/java-four-kay-test?task=html&resource=49c5cf2a366148c8eb4d229fbeb0a81b.6&className=W

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 783
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #31 - Posted 2010-10-31 20:47:37 »

For some reason, the plugin requests the archive 3 times, but it works.

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

JGO Knight


Medals: 8
Projects: 3


Java tames rock!


« Reply #32 - Posted 2010-10-31 20:48:28 »

In a nutshell

1.  Browser asks webserver for Falcon4k.jar and sets the following http headers:
Accept-Encoding = "pack200-gzip, gzip"
2. Web server has special add on code and looks for "pack200-gzip" in the header Accept-Encoding
3. Server then sends back the .gz file instead of the .jar file with:
Content-Encoding = "pack200-gzip"

Note that these http headers are case sensitive.

You can make this more complex and serve up gzip files as well if you are keen

If you try to do this in .htaccess you need one of the following Apache mod add-ons
mod_negotiation
mod_rewrite

I think there is also some facility for multi file type associations that might have some mileage.
Edit: It was Multiview - I found the article I vaguely remembered - It's a bit of a kludge though
http://sixlegs.com/blog/java/pack200-apache.html

Of course this can be done in PHP

Time flies like a bird. Fruit flies like a banana.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline zeroone
« Reply #33 - Posted 2010-10-31 21:04:02 »

Alan_W,

Thanks for the info.  I am hosting my web page on an Apache server and I know little about how to configure it.  I copied-and-pasted some stuff to my .htaccess to make it work, but I really don't understand what any of it means:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
AddType application/x-java-jnlp-file .jnlp

# Return the right mime type for JARs
AddType application/x-java-archive .jar
# Enable type maps
AddHandler application/x-type-map .var
Options +MultiViews
# Tweak MultiViews - this line is for
# APACHE 2.0 ONLY!
MultiViewsMatch Any

<Files *.pack.gz>
  # Enable the Content-Encoding header for .jar.pack.gz files
  AddEncoding pack200-gzip .jar
  # Stop mod_gzip from messing with the Content-Encoding
  # response for these files
  RemoveEncoding .gz
</Files>

What do those mod add-ons do?  How do I get them?  I am not hosting stuff locally; so, I may not be able to install them.  Also, I don't know PHP.  Is there some PHP trick that can solve these deployment problems?
Offline zeroone
« Reply #34 - Posted 2010-10-31 21:07:06 »

Quote
I fixed it. It was entirely my fault. Due to some realtime gzip feature I added to my http server, "Content-Encoding" was cleared if I turned off the gzip-ing. Silly me, what was I thinking!

Can everybody try again?

Riven,

I just tested it.  It works perfectly.  Thanks for fixing it.
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 783
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #35 - Posted 2010-10-31 21:12:21 »

Surely you can port this to PHP:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
         File file;

         String acceptEncoding1 = request.getHeader("Accept-Encoding");
         String acceptEncoding2 = request.getHeader("accept-encoding");
         String acceptEncoding = acceptEncoding1 == null ? acceptEncoding2 : acceptEncoding1;

         if (acceptEncoding != null && acceptEncoding.contains("pack200-gzip"))
         {
            response.setHeader("Content-Encoding", "pack200-gzip");

            file = new File(JavaFourKayShrinkService.GENERATED_FILE_BASE, resourceName + ".pack.gz");
         }
         else
         {
            file = new File(JavaFourKayShrinkService.GENERATED_FILE_BASE, resourceName + ".jar");
         }

         System.out.println("serving: " + file.getAbsolutePath() + " [exists: " + file.exists() + "]");

         if (file.exists())
         {
            response.setStatusCode(StatusCode.OK);
            response.setKeepAlive(true);
            response.setTransferEncodingChunked(true);
            response.setContentType("application/x-java-archive");
            response.stream(new FileInputStream(file), file.length());
         }
         else
         {
            response.setStatusCode(StatusCode.NOT_FOUND);
            response.setKeepAlive(true);
            response.setTransferEncodingChunked(true);
            response.setContentType("text/plain");
            response.setContent("file not found: " + file.getName());
         }

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

JGO Knight


Medals: 8
Projects: 3


Java tames rock!


« Reply #36 - Posted 2010-10-31 21:12:48 »

I'm not great on Apache myself. The Multiviews feature attempts to guess a suitable file extension based on the requested encoding, when there isn't a direct match to the requested file extension.  See the link I added to me previous post.  The trick appears to rename the .jar to something else, as otherwise Multiviews never comes into play.  Thats all from me for the moment, as I think the writers in the links know what they are doing far better than me.  Personally, I liked the Mod-Rewrite solution (see link a few posts back)

Time flies like a bird. Fruit flies like a banana.
Offline zeroone
« Reply #37 - Posted 2010-10-31 21:28:10 »

Riven,

If I understand your servlet code correctly, it checks the request header to determine if the plugin running in the browser accepts pack200.  Then, it delivers a .pack.gz if it does.  Otherwise, it delivers a .jar file.  Is the .jar file a normal, non-pack200 jar?  Meaning, you have to maintain a pack200 version and a normal version on the server?

On a side note, I'll research PHP.  I can't run servlets on my web server unfortunately.  Thanks for the snippet.
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 783
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #38 - Posted 2010-10-31 21:31:37 »

If I understand your servlet code correctly, it checks the request header to determine if the plugin running in the browser accepts pack200.  Then, it delivers a .pack.gz if it does.  Otherwise, it delivers a .jar file.  Is the .jar file a normal, non-pack200 jar?  Meaning, you have to maintain a pack200 version and a normal version on the server?

Yes. See here for the worst spec ever.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline zeroone
« Reply #39 - Posted 2010-10-31 21:51:19 »

Riven,

Thanks for the link.  I think I found that before and it scared the hell out of me.  Smiley

By the way, does your animated image on this forum change based on the name of the user who logged in?  How did you do that?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 783
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #40 - Posted 2010-10-31 21:54:04 »

By the way, does your animated image on this forum change based on the name of the user who logged in?  How did you do that?
Let's not derail it anymore than the previous thread.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline zeroone
« Reply #41 - Posted 2010-10-31 21:58:41 »

Riven,

LOL!  You don't want to share your secrets?!   Grin

Edit: For some reason, it is currently showing "Riven" on your image and it says "Hi Riven!" on your Compile-And-Shrink service at this time (for me only of course).
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 783
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #42 - Posted 2010-10-31 21:59:27 »

Riven,

LOL!  You don't want to share your secrets?!   Grin

Not in public (again). PM me if you wish.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline zeroone
« Reply #43 - Posted 2010-10-31 22:03:30 »

Quote
Not in public (again). PM me if you wish.

Thanks, but I'll hold off for now. 

Could you consider documenting how Compile-And-Shrink works?
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 783
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #44 - Posted 2010-10-31 22:05:27 »

Thanks, but I'll hold off for now. 

Could you consider documenting how Compile-And-Shrink works?

You can browse the previous thread for that info too.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline zeroone
« Reply #45 - Posted 2010-10-31 22:09:46 »

Riven,

Thanks a lot for all your help.  And, thanks again for creating and maintaining Compile-And-Shrink.
Offline nonnus29

Senior Member




Giving Java a second chance after ludumdare fiasco


« Reply #46 - Posted 2010-11-01 01:21:27 »

Can you guys maybe try some old app in my compile-and-shrink app, to see whether my pack200 test htmlpage works reliably on a wide range of browsers?

I tried an applet with a private inner class (not anonymous) and it didn't work.

entered work queue
sourcecode
OK
javac

Note: /home/indiespot/http-files/4k/GameApplet.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

OK
jar
OK
proguard

ProGuard, version 4.4
Reading program jar [/home/indiespot/http-files/4k/GameApplet.normal.jar]
Reading library jar [/root/jdk1.6.0_18/jre/lib/rt.jar]

Warning: GameApplet: can't find referenced class GameApplet$Quad
Warning: GameApplet: can't find referenced class GameApplet$Quad
Warning: GameApplet: can't find referenced class GameApplet$Quad
Warning: GameApplet: can't find referenced class GameApplet$Quad
Warning: GameApplet: can't find referenced class GameApplet$Quad
Warning: GameApplet: can't find referenced class GameApplet$Quad
Warning: GameApplet: can't find referenced class GameApplet$Quad
Warning: GameApplet: can't find referenced class GameApplet$Quad
Warning: there were 8 unresolved references to classes or interfaces.
         You may need to specify additional library jars (using '-libraryjars'),
         or perhaps the '-dontskipnonpubliclibraryclasses' option.
Error: Please correct the above warnings first.

Exit value: 1
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 783
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #47 - Posted 2010-11-01 06:57:17 »

I tried an applet with a private inner class (not anonymous) and it didn't work.

I think the instructions are pretty clear:

   // your class MUST NOT define any (anonymous) inner classes


Which, would be read as:
   // 1. your class MUST NOT define any inner classes
   // 2. your class MUST NOT define any anonymous inner classes

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline zeroone
« Reply #48 - Posted 2010-11-01 13:53:05 »

Riven,

For Compile-And-Shrink, could you make it possible to download the normal (non-pack200, non-optimized) jar as well?

Appel,

Can you make it possible to upload the pack200 gz and the normal jar as per the discussion above? 
Offline nonnus29

Senior Member




Giving Java a second chance after ludumdare fiasco


« Reply #49 - Posted 2010-11-01 14:20:11 »

I think the instructions are pretty clear:

   // your class MUST NOT define any (anonymous) inner classes


Which, would be read as:
   // 1. your class MUST NOT define any inner classes
   // 2. your class MUST NOT define any anonymous inner classes

Thanks for the clarification, I read that as must not define any anonymous inner classes.
Offline Groboclown
« Reply #50 - Posted 2010-11-04 04:15:07 »

What's the verdict on JDK 1.6 support?  Are we staying with JDK 1.5 as the base platform?

Offline appel

JGO Wizard


Medals: 50
Projects: 4


I always win!


« Reply #51 - Posted 2010-11-05 01:36:51 »

What's the verdict on JDK 1.6 support?  Are we staying with JDK 1.5 as the base platform?

There's always the problem with Mac Os X having 1.5.

Check out the 4K competition @ www.java4k.com
Check out GAMADU (my own site) @ http://gamadu.com/
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 783
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #52 - Posted 2010-11-05 01:39:53 »

There's always the problem with Mac Os X having 1.5.

The latest Mac OS X version has Java 6. It would be interesting to see how rapidly it gets adopted.

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

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Reply #53 - Posted 2010-11-05 01:44:20 »

The latest Mac OS X version has Java 6. It would be interesting to see how rapidly it gets adopted.
Pretty much everyone should have it now, as it is auto-updated with system update.

See my work:
OTC Software
Offline Nate

JGO Kernel


Medals: 145
Projects: 4
Exp: 14 years


Esoteric Software


« Reply #54 - Posted 2010-11-05 03:40:18 »

Probably auto-uninstalled soon. Smiley

Offline appel

JGO Wizard


Medals: 50
Projects: 4


I always win!


« Reply #55 - Posted 2010-11-07 22:24:49 »

Pretty much everyone should have it now, as it is auto-updated with system update.

I'm willing to raise the bar to Java 6 if everyone agree that's the consensus.

 Smiley

Check out the 4K competition @ www.java4k.com
Check out GAMADU (my own site) @ http://gamadu.com/
Offline Alan_W

JGO Knight


Medals: 8
Projects: 3


Java tames rock!


« Reply #56 - Posted 2010-11-09 09:57:00 »

While I have Java 6 on my PC, my old powerpc powerbook g4 only has java 5, so I can either compile for java 6 but not test on the mac, or compile for java 5.  I know from past experience that a few tweaks are usually required to get the mac version working.  So the question is "are there any improvements in java 6 that give better gaming performance (due to compilation, not runtime), or smaller executables?"

Time flies like a bird. Fruit flies like a banana.
Offline steveyO
« Reply #57 - Posted 2010-11-09 17:05:40 »

What are the stats?  According to http://www.statowl.com/java.php 6% of users are on 5.  This is big enough to stick with 5 imo, if this is accurate.

https://play.google.com/store/apps/details?id=com.bullsquared.alggame Annoying Little Gits (Android)
www.bullsquared.com   Play java (applet) games! www.chessclockpro.com Free Online Chess Clock
Offline kappa
« League of Dukes »

JGO Kernel


Medals: 77
Projects: 15


★★★★★


« Reply #58 - Posted 2010-11-09 17:17:35 »

What are the stats?  According to http://www.statowl.com/java.php 6% of users are on 5.  This is big enough to stick with 5 imo, if this is accurate.

Java 5 is losing market share at almost 1% a month according to those stats, by the time the contest is done next year some time it'll be pretty small Smiley

But then again don't see any killer reason to support 1.6 over 1.5.

Maybe next year we can do plugin2 only Smiley

Does the java4k site collect any stats on the versions of java used? IMO better to look at what the target audience for java4k has and decide on that.

Also really crap thing about the java plugin is that if jars are compiled for a newer version of java the plugin just blows up with an exception, unlike flash which gives you a nice message to update your flash install.
Offline SimonH
« Reply #59 - Posted 2010-11-09 17:55:38 »

What are the stats?  According to http://www.statowl.com/java.php 6% of users are on 5.  This is big enough to stick with 5 imo, if this is accurate.
I agree - from these stats 69% are 1.6, 8% are 1.5 and 21% are undetected - that means over 10% of detected JVMs are 1.5.
Are the advantages of 1.6 a good enough reason to say goodbye to 10% of our audience?

People make games and games make people
Pages: 1 [2] 3 4
  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.

TehJavaDev (12 views)
2014-08-28 18:26:30

CopyableCougar4 (24 views)
2014-08-22 19:31:30

atombrot (37 views)
2014-08-19 09:29:53

Tekkerue (30 views)
2014-08-16 06:45:27

Tekkerue (29 views)
2014-08-16 06:22:17

Tekkerue (18 views)
2014-08-16 06:20:21

Tekkerue (27 views)
2014-08-16 06:12:11

Rayexar (65 views)
2014-08-11 02:49:23

BurntPizza (41 views)
2014-08-09 21:09:32

BurntPizza (33 views)
2014-08-08 02:01:56
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!