What scripting language should I support?

The script will be driven by NPC / AI logic.

If I had to implement a game scripting function, which language should it support?

Remember my implementation will work on multiple platforms like .net, flash, javascript, and java.

What are the advantages and capabilities of the listed features? How long will it take to implement the interpreter?

What functions are game scripts looking for? What are the other games?

I am thinking of voting for javascript because everyone can read and write.

What are your thoughts?

+2


source to share


7 replies


I would use Lua because it is very easy to embed. Python nesting turned out to be tricky and I didn't.



This link might be helpful if you want to know more about Lua nesting and its advantages / disadvantages.

+5


source


Use Lua. It is a beautiful language widely accepted in the gaming industry .

There are Lua bindings for most of your platforms:



There is also the llvm-lua project , which can be useful for porting Lua to other platforms.

As for JavaScript as a host platform ... This question appears periodically on the Lua mailing list , but no serious solution has been posted yet. If you really need to put Lua in JS, please ask on the Lua mailing list, maybe some people can share their experiences on this.

+5


source


I would prefer Python for its bindings in many languages.

+3


source


I think you mean "integrate" the interpreter, not "implement" it. Depending on your skills, creating an interpreter for the scripting language can take a long time.

0


source


I know for sure that Python and Lua have bindings for .NET and Java - you can embed interpreters. Don't know if there are any bindings for Javascript and Flash.

The problem with Python is that there are three variations made by different people.

  • IronPython for .NET
  • Jython for Java
  • and regular CPython

I haven't worked on Jython, so I won't comment on it. But there are some portability issues between IronPython and CPython. For example: IronPython does not support native C extensions. If there are scripts in CPython that use them, you will find it difficult to port them to IronPython. Also, if the IronPython scripts use any .NET libraries, you will find it difficult to port them to CPython.

Lua implementations, on the other hand, come from one place and I don't expect such problems.

0


source


It depends on how complex your code will be (how complex the NPC behavior can be). Tcl, Lua and JavaScript are for simple tasks. Writing large pieces of code in these languages ​​quickly becomes unaffordable (especially for casual users).

Squirrel uses a C-like syntax that most people like, but what about tooling support? If you have to write everything with Notepad, this will also severely limit you.

Python is a mature language that is easy to learn (just compare the Lua tutorial "to the one that comes with Python.) While different versions of Python may seem intimidating (see Rohit's answer ), the Python code in your game will be the same for all of them. It comes with an IDE (IDLE), and there are other IDEs that support Python, which gives you code completion, debugging, test cases running, etc.

0


source


If you want to use Python, consider using Stackless as it is better for streaming than CPTP. It has been used in some MMORPGs (EVE Online, IIRC), so it has gotten some track record in games. Also, it's very good for sequels (part of the reason it was designed in the first place), which is a pretty good model for "modeling" type logic that can be used in games.

0


source







All Articles