Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

ahw

JAVA as a scripting engine ?

This topic is 6385 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I was reading this postmortem on Vampire Redemption by Nihilistic studios ... and they explain that they took JAVA and put it in their own game. Now the question I have is : How the heck did they get the source code of the Java Virtual MAchine and integrate that in their own software. Or is there a third party VM that I dont know of. Anyone ? youpla :-P

Share this post


Link to post
Share on other sites
Advertisement
Hey ahw,
I''m not sure how they used Java in their game... but, if your interested in embedding a scripting language into your game... I wouls suggest Python.

If you are interested in using Java as your scripting engine - I seem to remember an issue of Dr. Dobb''s Journal that had something showing how to do it. I remeber reading something on Gamasutra as well.


Game On,

Dave "Dak Lozar" Loeser

Share this post


Link to post
Share on other sites
Check out the Q2Java page at http://planetquake.com/q2java. They made a dll to make Quake 2 mods in Java.

It''s me, it''s that T-H-E-D.

Share this post


Link to post
Share on other sites
It seems very hard to implemment a JAVA script engine in a game.
These day i try to make my own scripting engine ( C-like with Yack & lex) but Java can be better and maybe faster (and with less bugs).

Share this post


Link to post
Share on other sites
I''m not really sure what the problem is here...
There is a part of the JDK, or the standard Java library, called JNI, and it stands for Java Native Interface. Now, I''m not going to tell you about the inner workings of it, but please take time to read the following overview:

http://java.sun.com/docs/books/tutorial/native1.1/concepts/index.html

as for your VM question:
"The JNI allows Java code that runs within a Java Virtual Machine (VM) to operate with applications and libraries written in other languages, such as C, C++, and assembly. In addition, the Invocation API allows you to embed the Java Virtual Machine into your native applications. "

That should answer your question.

Combining the power of JNI, dynamic class loading, reflection etc, I''d say the possibilities are pretty much endless to what you can do. I know, I''ve done it myself on several occasions.

BTW, you guys just gave me a great idea there, writing a scripting engine in Java.....it''s so obvious!
Thanks!

Don''t hesitate to mail me if you have any questions about the abovementioned technologies.

// Mario

PS. If you are thinking about embedding a VM into your game/app/engine, make you pick one of the high-performance VM''s, like HotSpot.


"Use the force, read the source"
- Anonymous

Share this post


Link to post
Share on other sites
Just a follow up to my message... I stumbled onto this link whilst surfing codeguru.

This article shows you how to embed the JVM in your C++ code:
http://codeguru.earthweb.com/java/articles/216.shtml


Game On,


Dave "Dak Lozar" Loeser

Share this post


Link to post
Share on other sites
this is not really a answer. more likely another question.
instead of building complicated scripts for you program, why not use a dymically linked library? (.DLL)
just leave some source-code in how to explain the programming structure, and then make a VERY easy scripting code to that.

Let me explain in this example.
let''s say i''m making an adventure game, and i want to make a new character.
now, i programmed my game to read a certain file for additional characters.
this file might look like this:

Edgin, Barbarian, EDGIN.DLL

the parameters in the file is: Name, proffesion, .DLL filename

now, the program will read the code in this file, as if it was a part of the original source code.

see? you''ve got the most powerful scripting tool (C++), and yet you''re not loosing any valuable computer-resources, trying to translate it!


TAKE NOTE!! this is only an idea i got. i''m not even close familiar to .DLL programming - i just know in general how it works - so i''m not even sure it''s practically managable.


Electron

"Who need more than 640kb of RAM?" -Bill gates -89


Share this post


Link to post
Share on other sites
It depend.
If you have too much programmer than a dll system is good.
But if you don''t have enough programmer, than i think make a scripting language and allow the scenarist to script what they want to add to their world.
In a big RPG-Game, i think, this is the best way.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!