Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (499)
Games in Android Showcase (118)
games submitted by our members
Games in WIP (568)
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  
  Enhancing game engine with scripting capabilities  (Read 2343 times)
0 Members and 1 Guest are viewing this topic.
Offline williamwoles

Senior Newbie





« Posted 2011-02-24 14:24:18 »

Hello experts Smiley

Maybe few of you remember me with my half-fail(or probably full-fail) game which I released like half year ago(or more). I have learned a lot from making it and was regaining forces during half year to start everything from scratch. Sorry for off top, going now directly to the questions.

I have started making new game engine and I want to enhance it with scripting capabilities. I want be able to use scripting on the map(for now adding new NPCs, objects and items, some map events) and NPC AI programming. I have already read some documentation of Groovy and Jyton, most likely to use Groovy, it appeared to me more attractive, unless some of you could give me advice using any other scripting language. This was the first question.. The second question which I have is about embedding the script. The way I'm thinking to do this for the map for example is:
i) I create the map object with some tiles
ii) In separate file I create the script, which will have access to the map object, granted by embed mechanisms in my server code
iii) I place the script file only on the server and when some event occur I send the data to the client

Do I think correctly? Can you correct me and point the right way of doing this?
Thank you in advance,
ww

Offline nsigma
« Reply #1 - Posted 2011-02-24 14:52:20 »

Hello experts Smiley

 Huh Well, despite that I'm going to jump in anyway ...  Smiley

I have started making new game engine and I want to enhance it with scripting capabilities. I want be able to use scripting on the map(for now adding new NPCs, objects and items, some map events) and NPC AI programming. I have already read some documentation of Groovy and Jyton, most likely to use Groovy, it appeared to me more attractive, unless some of you could give me advice using any other scripting language.

Another approach might be Janino - http://docs.codehaus.org/display/JANINO/Home but then maybe I'm too lazy to bother learning a new language just to get some dynamic coding.  Grin  I've been using it recently, and it seems to work really well - and of course, everything is as fast as the rest of your code.

Praxis LIVE - open-source intermedia toolkit and live interactive visual editor
Digital Prisoners - interactive spaces and projections
Offline BatKid

Senior Newbie





« Reply #2 - Posted 2011-02-24 18:00:58 »

I'm not too familiar with Groovy, but I am familiar with Jython.  May I ask why do you think Groovy is more attractive that Jython?  One advantage of Jython that I can think of is that Python is very popular among the developer community and if you use Jython, you can leverage a lot of existing developer resources that may or may not exist with Groovy.

Regarding the actual mechanism in embedding a interpreter into your engine, what I found is that once you have a scripting engine, the possibilities are limitless in terms of what you can do with external scripts vs. what you can do in your codebase.   As long as you pass the relevant objects to your scripts, the scripts can take over the entire execution of your game if you like. 

I created an experiment just to explore this possibility a while back, is it called whalechat and you can find it at http://whalechat.com.  I have the vision of teaching computer programming using an online collaborative model within a 3D environment.  When you launch the whalechat client, you can issue the "/editor" command which will bring up an editor for you to type in jython scripts, which is then uploaded to the server and executed in a shared environment. 

The architecture that I went with is that I try to keep the core engine code as small as possible, with the engine focusing on the infrastructure stuff, and have the scripts handle all of the interaction logic etc.   It works amazingly well and I managed to create a couple of mini-games inside the environment in this way.  One such example is a little zombie game which you can access directly using the following URL:

http://whalechat.com/webstart.php?room=zombie

The script to the entire game can be found at http://whalechat.com/asset_server/rooms/zombie

Maybe this will give you some ideas on what is possible. 

Learn Java in 3D with env3d
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline williamwoles

Senior Newbie





« Reply #3 - Posted 2011-02-24 19:37:42 »

Hey

I'm not too familiar with Groovy, but I am familiar with Jython.  May I ask why do you think Groovy is more attractive that Jython?  One advantage of Jython that I can think of is that Python is very popular among the developer community and if you use Jython, you can leverage a lot of existing developer resources that may or may not exist with Groovy.

One the first things that come in favour of Groovy is it's "proximity" to Java(including syntax), integration seems to be much easier then with Jython, at least this is what I read in some forum posts. I'm aware that Python is more stable and balanced. I have some experience with Python(I have already made Tetris game), but I really prefer Java, just a question of personal preference.

Regarding the actual mechanism in embedding a interpreter into your engine, what I found is that once you have a scripting engine, the possibilities are limitless in terms of what you can do with external scripts vs. what you can do in your codebase.   As long as you pass the relevant objects to your scripts, the scripts can take over the entire execution of your game if you like. 

I already have imagined that potential of scripts is very high, but in large games it's probably very hard to keep the codebase at the minimum, architecture must be planned very carefully and with several "heads"(people) (though this applies almost to all projects)

Thanks for you help and very demonstrative example. Bookmarked for future study Tongue

Offline sproket

Junior Member


Medals: 1



« Reply #4 - Posted 2011-02-28 23:44:06 »

Hi,

I do this using the built-in Rhino engine in Java6 (trying to keep dependencies down). I use it for menu code, puzzle code, maps and game interactions.  Works great. 


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.

Riven (3 views)
2014-10-02 14:36:20

Pippogeek (41 views)
2014-09-24 16:13:29

Pippogeek (32 views)
2014-09-24 16:12:22

Pippogeek (22 views)
2014-09-24 16:12:06

Grunnt (47 views)
2014-09-23 14:38:19

radar3301 (30 views)
2014-09-21 23:33:17

BurntPizza (65 views)
2014-09-21 02:42:18

BurntPizza (37 views)
2014-09-21 01:30:30

moogie (44 views)
2014-09-21 00:26:15

UprightPath (53 views)
2014-09-20 20:14:06
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!