Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (108)
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]
  ignore  |  Print  
  Applets - using javac on class files  (Read 877 times)
0 Members and 1 Guest are viewing this topic.
Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Posted 2010-07-08 04:57:09 »

Hey all,

In a game I'm working on I want to be able to serve downloadable content, and I figure one of the best ways of doing that without having to recreate the main JAR is to make use of javac to compile class files on the fly (at least for logic updates).

I'm just wondering if anybody has done this with an Applet before and how they've done it? In a local application I would just be saving the class file to their disk somewhere and then would execute it as normal, but the whole sandbox thing makes it all more difficult.

Would it make more sense to just have like a DLC.jar that is only class files and I can update as I want without the user having to see it?

Overall I'm pretty much a noob when it comes to applets, and I'm trying to change that. So thanks in advance for the help and advice.

See my work:
OTC Software
Offline Nate

JGO Kernel


Medals: 145
Projects: 4
Exp: 14 years


Esoteric Software


« Reply #1 - Posted 2010-07-08 09:04:34 »

Just provide the downloadable content as compiled class files. I don't see any benefit to providing Java code that the applet compiles -- it will compile to the same bytecode. You can code to interfaces, etc and have the downloadable portion plug in. URLClassLoader will load classes from a remote JAR file.

Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #2 - Posted 2010-07-08 11:58:13 »

Since you're running an applet, and the user will get the latest application code anyway, why not just add the new functionality to your game jar and enable/disable it as appropriate?

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Reply #3 - Posted 2010-07-08 16:40:51 »

Since you're running an applet, and the user will get the latest application code anyway, why not just add the new functionality to your game jar and enable/disable it as appropriate?
My only thought on that was because if I change the main JAR it will potentially take a long time for the user to redownload everything. But now that I think about it as long as I keep expensive resources (images, sounds) in a separate JAR everything should be fine.

See my work:
OTC Software
Offline JL235

JGO Coder


Medals: 10



« Reply #4 - Posted 2010-07-08 22:12:20 »

I agree that this is a bad idea, but in the interest of solving your original idea you could have the classes compiled on the server and then downloaded as .class files by the applet. The class loaders can load from an array of bytes (the class) and so you don't need a place on the disk for the classes to be stored.

Offline Eli Delventhal

JGO Kernel


Medals: 42
Projects: 11
Exp: 10 years


Game Engineer


« Reply #5 - Posted 2010-07-08 23:06:46 »

Yeah, the main reason I was thinking of keeping it separate was to make paid DLC stuff - like you get to download the extra bundle or whatever if you've paid. But I think just making all this server side code and just don't allow the player to use it. That way they can still view another player using it if they want.

See my work:
OTC Software
Pages: [1]
  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 (16 views)
2014-07-30 21:08:39

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

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

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

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

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

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

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

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

Riven (31 views)
2014-07-23 20:56:16
List of Learning Resources
by SilverTiger
2014-07-31 13:54:12

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