Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (710)
Games in Android Showcase (212)
games submitted by our members
Games in WIP (784)
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  
  Scripting inside of Java  (Read 3159 times)
0 Members and 1 Guest are viewing this topic.
Offline dray

Junior Newbie

« Posted 2007-07-26 21:40:33 »

I'm looking for some examples on how this done i.e Python or Jython.  It can be as simple as a Hello World example that has a greeting module to enhance Hello World to say Glad To See Ya.

Many thanks!
Offline oNyx

JGO Coder

Medals: 2

pixels! :x

« Reply #1 - Posted 2007-07-26 21:57:32 »

弾幕 ☆ @mahonnaiseblog
Offline beowulf03809

Junior Devvie

We live for the code, we die for the code

« Reply #2 - Posted 2007-07-27 13:42:30 »

That's a nice lin oNyx.  I like the way it compares the main options for some key tasks.

I am learning Jython at work for some stand-alone scripting needs ( always just worked in ksh before ) and in that process I've come across some embedding discussion over at the Jython site ( ).  This actually looks to be an extension of the "Hello World" question from dray.

For me itt's not so much the technical "how" that has me looking for more info on this as the more nebulous "when and why".

In my virtually unlimited < wishful thinking > free time I've been supplementing my (fairly basic) J2EE Java experience to develop some games which are growing slowly in complexity.  I hope to start a basic turn-based strategy game soon and can understand how the use of scripting could help with many things including (if I understand correctly) the ability to tweak the game without need to recompile and re-run which would help speed up areas such as play balance tests, etc., as well as such things as scenario and map events.  However, I have not found a good reference of embedded scripts in action for such tasks.  Often things just click together for me once I see an example but trying to read and apply from a completely theoretical direction is harder.

I hate the situations of a solution looking for a problem and I am not yet at a point where I NEED embedded scripting, but if anyone can point to or explain some basic examples of a problem and how embedded scripting helped solve it I would appreciate it.

If this is going too far from the OP's question I can take it up in a different thread.  It seems it may be along the line of dray's question as well though.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline oNyx

JGO Coder

Medals: 2

pixels! :x

« Reply #3 - Posted 2007-07-27 14:39:54 »

>[...]if anyone can point to or explain some basic examples of a problem and how embedded scripting helped
>solve it I would appreciate it.

You can use scripting for improving turn-over rates.

The usual cycle:
-exit the application
-change the code
-load media

With scripting:
-change the script
-reload the script (eg by pressing F5 or whatever)
-load new media (if any) or force-reload media

Changing the code takes varying amounts of time, but the rest is sorta constant for a given project. On my really slow machine the former adds about 1-1.5 minutes of overhead, whereas the latter basically adds nothing. Saving takes a split second... reloading the script takes another split second.

It's sorta like writing html/css/js. You get instant results.

Btw I'm using Janino myself for the dev cycle (I script full classes) and I simply compile it the usual way at the end.

弾幕 ☆ @mahonnaiseblog
Offline cylab

JGO Kernel

Medals: 162

« Reply #4 - Posted 2007-07-27 15:20:59 »

I am also unsure about the benefits of scripting for java. If such "dynamic" functionality is needed, an application could provide a plugin-mechanism, that can automatically compile java-files in a plugin-directory and load them via a URLClassLoader.

Mathias - I Know What [you] Did Last Summer!
Offline oNyx

JGO Coder

Medals: 2

pixels! :x

« Reply #5 - Posted 2007-07-27 23:40:16 »

Yes, what I'm doing with Janino is pretty much the same... just a zillion times quicker.

Also if I would use it on the client side as well, I would only need the rather small janino.jar instead of that hefty tools.jar. Alternatively you could use jdt (the Eclipse compiler), but I didn't manage to get that one working.

弾幕 ☆ @mahonnaiseblog
Offline Mr_Light

Senior Devvie

Medals: 1


« Reply #6 - Posted 2007-07-28 01:34:09 »

I take it hot code swapping isn't doing it for ya then?

It's harder to read code than to write it. - it's even harder to write readable code.

The gospel of brother Riven: "The guarantee that all bugs are in *your* code is worth gold." Amen brother a-m-e-n.
Offline oNyx

JGO Coder

Medals: 2

pixels! :x

« Reply #7 - Posted 2007-07-28 16:34:22 »

Well, I do exactly that¹. But I'm using some ultra fast on-the-fly compiler, which is geared towards scripting.

[¹ With Janino that is. The system is pluggable and there are also loaders, which load classes directly or use Beanshell, Jython or whatever.]

弾幕 ☆ @mahonnaiseblog
Offline quixote_arg

Junior Devvie

Projects: 1


« Reply #8 - Posted 2007-07-28 17:13:30 »

If anyone is interested, I wrote a magazine article on java scripting using Java 6 scripting API

the catch is that it is in spanish, so only for spanish speakers Smiley
Offline shasheppard

Senior Newbie

Hopefully this works out.

« Reply #9 - Posted 2007-09-22 22:58:11 »

 entonces, donde esta la link carnal?
Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

theagentd (92 views)
2017-02-18 13:42:33

theagentd (96 views)
2017-02-18 13:35:16

h.pernpeintner (1261 views)
2017-01-24 22:39:11

h.pernpeintner (1250 views)
2017-01-24 22:38:32

Galdo (1808 views)
2017-01-12 13:44:09

Archive (1914 views)
2017-01-02 05:31:41

0AndrewShepherd0 (2452 views)
2016-12-16 03:58:39

0AndrewShepherd0 (2295 views)
2016-12-15 21:50:57

Lunch (2374 views)
2016-12-06 16:01:40

ral0r2 (2155 views)
2016-11-23 16:08:26
List of Learning Resources
by elect
2016-09-09 09:47:55

List of Learning Resources
by elect
2016-09-08 09:47:20

List of Learning Resources
by elect
2016-09-08 09:46:51

List of Learning Resources
by elect
2016-09-08 09:46:27

List of Learning Resources
by elect
2016-09-08 09:45:41

List of Learning Resources
by elect
2016-09-08 08:39:20

List of Learning Resources
by elect
2016-09-08 08:38:19

Rendering resources
by Roquen
2016-08-08 05:55:21 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‑
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!