Skip to main content
gamedev.net
🔒 Locked

JavaScript as game scripting engine ?

Started by RedDrake 4 replies 1.5k views
Original Post
RedDrake
RedDrake
So this onslaught of new JIT compilers for JS makes JS probably the fastest portable scripting language AFAIK. Lua has a tracing JIT but it has only one platform and I doubt it will be faster than the Google/Mozilla implementation. So does this bring JS as a serious scripting language option ? It's about as simple as it gets without having to explain Lua "quirks" to designers who are probably already familiar with it if they ever tried web design or anything similar. Is JS becoming a good scripting solution for games too ?
d000hg
d000hg
I don't think JS is as simple as you think it is. It can do some pretty cool stuff, which are impossible in C++ and har work in Java/C#.
RedDrake
RedDrake
I know, but basic usage is pretty straightforward for non coders proven by the web designers who know very little about programming and still manage to use it quite efficiently [AFAIK].
benryves
benryves
For .NET you could always use JScript, of course.

// This C# code compiles and executes a JScript string.var Script = @"import System; Console.Write(""What is your name? ""); var Name = Console.ReadLine(); Console.WriteLine(""Hello, {0}!"", Name);"var Provider = CodeDomProvider.CreateProvider("JScript");var Results = Provider.CompileAssemblyFromSource(new CompilerParameters() { GenerateExecutable = true }, Script);Results.CompiledAssembly.EntryPoint.Invoke(null, new[] { new string[] { } });

Quite fun to play around with!
[Website] [+++ Divide By Cucumber Error. Please Reinstall Universe And Reboot +++]
Hodgman
Hodgman
Quote:
Original post by RedDrake
So this onslaught of new JIT compilers for JS makes JS probably the fastest portable scripting language AFAIK. Lua has a tracing JIT but it has only one platform and I doubt it will be faster than the Google/Mozilla implementation.

Check these out:
http://code.google.com/p/llvm-lua/
http://code.google.com/p/py2llvm/

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.