Advertisement

Java instead of a custom scripting language??

Started by April 10, 2000 04:43 PM
4 comments, last by KaneTHP 24 years, 8 months ago
Maybe this is the wrong place to ask this but.. I was reading a thread that was talking about the JVMs getting faster, etc. and I am currently writing a scripting lanaguage for my game library/engine. Then I thought - wouldn''t it be cool if instead of using a custom scripting language I just used a Java virtual machine - and had some builtin engine interface classes. So I guess what I''m asking is is there source for the JVM available (or some detailed language descriptions, etc.) yea, yea maybe I should just check Sun''s website first but..I''m lazy, you know?
I think Freshmeat (www.freshmeat.net) has a few free JVM implementations listed. On the whole, though, I''m not crazy about the idea of using Java as a scripting language for a game. It seems like a better idea to create a new language that is more tightly integerated with the game objects rathar than through a set of native interfaces, as Java would have to be.
Advertisement
Pros of using existing languages for scripting: Users may already be proficient with the language - well defined existing language reference - compliler / lexer / parser / interpreter often already done, just needs integrating - common algorithms and solutions may be available in snippet form.

Pros of using your own new language: No added baggage or bloat from unneeded features - no unseen security holes where language intrinsically allows for more than desired - guarantee that the language is relevant to your application and optimised as such - may be easier to integrate than many premade languages - will undoubtedly be easier to extend to add new functionality.

If you can answer all those questions, you will know what to do
Don''t use java as a scripting language. That''s just wrong, you would need to create an object for everything, that would get annoying. Most scripting lanuages are interperted anyhow. If you visit alphaworks.ibm.com they have plenty of scripting languages for java, so they''d probably have good scripting languages for whatever your games is in. Also, I''ve been thinking that php would be a good scripting language, www.php.net and www.zend.com.
I''d have to say that I think Java still isn''t ready to be used as a scripting language for games. Its still a bit heavy, even if you cut out all the graphics and other unneeded APIs.

My suggestions for good gaming scripting languages would be:

Python (www.python.org) OO goodness without the bloat!

or

Lua (http://www.tecgraf.puc-rio.br/lua/) Very light-weight. Has been used in the scripting engines of various commercial games, including Grim Fandango, MDK2 and Baldur''s Gate.

Hi !

Well, I created my own scripting language (full OOP) and it basically works the same as Java (syntax, technologie), however it''s very fast and very small. The Virtual Machine DLL is about 50 KB big.
A scripting language is about 20-30 times slower than native C++ code. So, you will need a scripting language that is very fast. If you fail to create or use a fast scripting language your game will be very slow.
And Java is too big to be a very fast scripting language for a game engine.

Instead, study java and based on their technologie create your own scripting language. That''s what I did and it worked fine. It took me just 2 months to create my full-featured OOP scripting language.

Phillip Schuster
Phillip Schuster

This topic is closed to new replies.

Advertisement