Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (538)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (601)
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  
  recompile while running...  (Read 2443 times)
0 Members and 1 Guest are viewing this topic.
Offline MickeyB

Senior Devvie




my game will work, my game will work!


« Posted 2004-01-06 01:42:02 »

think mud server.  some have a surface scripting language that allows you to add content real-time.  but what about changing core code and recompiling while maintaining state and connections?  possible?  want to be able to to add a new function or command on the fly during live play.

MickeyB

Current Project: http://www22.brinkster.com/mbowles/
Offline Herkules

Senior Devvie




Friendly fire isn't friendly!


« Reply #1 - Posted 2004-01-06 04:11:38 »

Hm, java.lang.Class implements Serializable...

So if you manage to implement you features by using a certain base interface(command pattern?), you'll be able to write a ClassLoader that grabs your new functions from the net and executes them.

HARDCODE    --     DRTS/FlyingGuns/JPilot/JXInput  --    skype me: joerg.plewe
Offline Jeff

JGO Coder




Got any cats?


« Reply #2 - Posted 2004-01-06 04:29:09 »

Right. java is a late binding language so reload is built into the system.

Up to 1.5 the way to reload has been to use a custom calss loader.  In order to make the clas loader dump the calsses all the instances have to be gone.  I wrote a "reloadable" libnary awhiel back that did this bit of trickery by tracking all insatnces of Reloadables and, whena  reload was requsted, serlializing then all to byte buffera temporarily, making a new class loader and de-serializing them using it.

I believe our 1.5 actually has some preliminary support for dumping and reloading method code indvidually (though not fields yet).


Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Reply #3 - Posted 2004-01-06 09:21:50 »

Quote


I believe our 1.5 actually has some preliminary support for dumping and reloading method code indvidually (though not fields yet).



That would be very cool (and if so, we'll be able to make some funky demos to show it off; we've done some detailed work in this area, specifically to reload in a complex environment where you need to have both versions loaded and active simultaneously...). Will be interesting to see whether 1.5 makes this any easier.

malloc will be first against the wall when the revolution comes...
Offline swpalmer

JGO Coder


Exp: 12 years


Where's the Kaboom?


« Reply #4 - Posted 2004-01-06 11:38:45 »

Even with 1.4 debuggers have a change and continue feature... I thought I read that the same mechanism was intended to support patching a live system.

Offline Jeff

JGO Coder




Got any cats?


« Reply #5 - Posted 2004-01-07 05:38:13 »

Ah hokay, i didnt realize it was in 1.4 already.  Thanks for the correction.

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline Golthar

Junior Devvie




;)


« Reply #6 - Posted 2004-01-07 07:06:44 »

Yeah with Eclipse I can do hot code swapping in debug mode

come visit us: http://www.otf1337.com
Offline MickeyB

Senior Devvie




my game will work, my game will work!


« Reply #7 - Posted 2004-01-08 14:15:51 »

sounds great.  so again, thinking mud server, I could create a scripting language or use somehting like Perl to create "classes" or modify old ones and compile and use the above mentioned methods to keep the game alive and get new functionality into it.  Devs, coders, admins could essentially say " firebals do too much damage and come fromthe wrong power reserve, edit the fireball spell class, recompile and somehow get it into the live game world.  (or am I missing this completely?)

Would love to see some sample code or demos of this just to poke around with.  

MickeyB

Current Project: http://www22.brinkster.com/mbowles/
Offline Jeff

JGO Coder




Got any cats?


« Reply #8 - Posted 2004-01-08 20:29:42 »

Yes.

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline swpalmer

JGO Coder


Exp: 12 years


Where's the Kaboom?


« Reply #9 - Posted 2004-01-08 21:30:00 »

With the debugging live code replacement in Eclipse at least, you can not change the "shape" of a class.  That is, you cannot add or remove member data or methods.

I do not know if that is inherent in the 1.4 VM or if it is the same in 1.5...

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline MickeyB

Senior Devvie




my game will work, my game will work!


« Reply #10 - Posted 2004-01-08 21:33:31 »

ok jeff, yes I can do it? or yes, I am missing something?

MickeyB

Current Project: http://www22.brinkster.com/mbowles/
Offline Jeff

JGO Coder




Got any cats?


« Reply #11 - Posted 2004-01-08 23:06:59 »

Sorry.  yes you can do it.

Class reloading, while a bit of a pain to implement, will allow you to change fields and methods.  the new debugger facility will allow you to change just methods.

I am not sure if connecting to the debugger interface has an impact on our VM's performance.  It may.

The facility to re-load classes and late-bind btw is why I maintain that (a) Java is an excellent choice for a scripting language and (b) games that are pure Java need no other scripting language.

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Reply #12 - Posted 2004-01-09 05:22:53 »

Quote
Sorry.  yes you can do it.

Class reloading, while a bit of a pain to implement, will allow you to change fields and methods.  the new debugger facility will allow you to change just methods.


Mucking about with classloading is how we've been experimenting with similar hot-swapping of classes. The real difficulty comes when you need multiple instances of different versions of the same class simultaneously, and things can get nasty.

malloc will be first against the wall when the revolution comes...
Offline MickeyB

Senior Devvie




my game will work, my game will work!


« Reply #13 - Posted 2004-01-09 12:21:19 »

This is completely new territory to me.  I assume there are tutorials on Sun for this?  (I am searching now) If not, anyone have some sample or demo code they can scribble on the white board?

Thanks

MickeyB

Current Project: http://www22.brinkster.com/mbowles/
Offline Jeff

JGO Coder




Got any cats?


« Reply #14 - Posted 2004-01-09 23:28:05 »

Read up on custom class loaders.  Yes there is info on java.sun.com as well as in the javadoc for ClassLoader and URLClassLoader.  There may be an article on class laoders in the article set that comes with the JFK download, I forget. if so thats a good place to start as well.

FInally the classic books on the JDK APIs shoudl all have info. I know thre is info in lee's The Java Class Libraries volumes and the Java2 appendix book in that set.

Once you unndesrstand class loaders the following will make sense:

(1) Every Class Loader contains references to the Classes it has loaded.  When a new instance of the class is created the Class is request from the current class loader.

The goal is to replace the Class objects.  To do this you need to replace the class loader. You do this by creating a new class loader and requesting the class from it.

If you have old instances whose data you want to rpeserve you need to seralize them to a buffer or to disk and then unserialize them using the new class loader.  (This can be accomplished by de-serializing with an ObjectInputStream by explicitly requesting the ObjectInputStream Class from the new class loader and then instancing it.)

Be warned if you are going to do this then you will likely need to over-ride the SerialversionUID.  There is info on THAT in the artical on serializatio nthat coems with the JDK.

So, start reading and experimenting!  You'll get it eventually and what you learn abotu Java in the process will open up all kinds of new abilities you never realized the language had.

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline MickeyB

Senior Devvie




my game will work, my game will work!


« Reply #15 - Posted 2004-01-10 15:37:46 »

fantastic ...starting today.   I did find some stuff on sun to start with.

Thanks again all,

M

MickeyB

Current Project: http://www22.brinkster.com/mbowles/
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.

rwatson462 (29 views)
2014-12-15 09:26:44

Mr.CodeIt (20 views)
2014-12-14 19:50:38

BurntPizza (42 views)
2014-12-09 22:41:13

BurntPizza (76 views)
2014-12-08 04:46:31

JscottyBieshaar (37 views)
2014-12-05 12:39:02

SHC (50 views)
2014-12-03 16:27:13

CopyableCougar4 (47 views)
2014-11-29 21:32:03

toopeicgaming1999 (114 views)
2014-11-26 15:22:04

toopeicgaming1999 (102 views)
2014-11-26 15:20:36

toopeicgaming1999 (30 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

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