Sign in to follow this  
THACO

Scripting needs

Recommended Posts

Ok, im new to scripting for the most part did some research, have a few questions before I begin. First off, I am creating pretty much a 2d fighting game and each character will have different moves with some basic moves that are pretty much the same, but the special moves could be complex and very different. I figure the best way is to have them scripted instead of hardcoded. I was looking into lua, luaplus, and squirrel. What I want to do / thinking of doing is having the player object have a default function called each frame, that frame would then send a struct with any buttons pressed to a specific script function. That function would then well do whatever it wanted. In the end it would call a c++ function to render model X and frame Y, and also most likely update the position, damage etc. I would keep most of the variables script side but be able to access them if needed. The script side functions would also be accessing some other c++ functions to check collisions. I was thinking on lua just because it is widly used seems to be somewhat easy to integrate and gamedev has the nice tutorial. I also stumbled upon luaplus but can't find many examples on that. Also in the forums I saw the post on squirrel. I am using this project hopefully as a nice demo to help get a job in the industry so I am leaning towards LUA because it has been used in many games. Thanks for all your input -THACO

Share this post


Link to post
Share on other sites
1. Vanilla Lua (not using template libraries) is relatively easy to learn and use. You can also purchase a written manual, or download the same manual for free. It appears that many commercial game developers ended up having to (sometimes significantly) modify the core Lua code. While not particularly difficult to do (except perhaps adding features such as robust reference counting), it does take extra time, and shows that Vanilla Lua is not ideal for game development.
2. LuaPlus fixes many of the deficiencies of Vanilla Lua, including support for reference counting. It is very powerful, includes a remote debugger, and uses template metaprogramming (making debugging somewhat more complicated). It has been reported that LuaPlus can be difficult to port to other OS's/compilers (probably due to template/compiler issues). Documentation and examples are available online (no written manual).
3. Squirrel is so far the easiest to integrate with C++ classes. That is, it does not require base language refactoring/modification and a simple macro-based helper system can be used to quickly integrate script code with C++ classes. Since Squirrel is heavily influenced by Lua (table code directly from Lua), the skills learned in using Squirrel can be transferred to environments where Lua programming is required. A template library called squadd (Squirrel Additions) uses boost headers (not yet complete). Squirrel has reasonable debugging features, but does not yet include a powerful remote debugger (as with LuaPlus). At some point the language author may release his debugger (used internally for a console game). Documentation and example code is available online (no written manual). Squirrel is the youngest language of this group (around 2 years old).
4. Python is also very popular for game scripting. It includes a great deal of library code and powerful features. It is much larger and more complicated than Lua or Squirrel (a nature of having more features+code). The template metaprogramming boost::python is very popular and powerful (and also comparatively very large and complicated). Lots of printed manuals and documentation are available for python.

Runtime speed for the above languages varies depending on how they are used. When using Vanilla versions of the languages, Lua has been shown to be the fastest (from language shootouts, etc.). Squirrel’s author states that his language is about the same net speed as Lua (sometimes slower, sometimes faster). Python makes up for slower performance via additional built-in features. All of these languages are fast enough for game scripting (the relative speed differences should not matter). When script code becomes slow, the slow code should be moved to C/C++.

In terms of simplicity and small code size, Squirrel is currently the smallest/least-complex (6K lines of core language code) and easiest to integrate with C++ for game applications: Squirrel was specifically designed for use as a game scripting language (after the author used Lua in a large commercial game: FarCry). The DXSquirrel example shows how comparatively trivial it is to set up C++ classes and script code to create a DX9 app and rotate a 3D teapot. The sqplus example library and test app show how easy it is to integrate dynamic class support with correct reference counting and clean up (the class is dynamically allocated from script, operated on, and deleted automatically).

Share this post


Link to post
Share on other sites
Alright well thanks John Schultz for your input you seem like your know what your talking about so if you have any swamp land to sell also i think ill buy. Ok well looks like I will look more into sqplus and well if it is as easy as they say about setting it up then I will most likely go with that.

-THACO

p.s. yes well I know in other forums most people like giving feedback (Mainly the help wanted) so I figured I would mainly ask for feedback on what I am planning on doing since I have hardly any scripting experience. So it was a question hidden in a statement

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this