If i have to create a Battle System for a game which is like Final Fantasy 10 Turn Based battle system or Shadow Hearts Ring Based Battle System and likewise.

How should i start with scripting a particular part of the game? Any reference,blogs,sources,code snippets will be helpful.

Any scripting language will do as i have to overlook some examples directly of different scripting languages.

Please try to provide a small example of scripting for some part of game say cutscene,battle,combat system etc. in UnrealScript.

  • 6
    \$\begingroup\$ The same way you would code any game logic? Scripting is just a way of making it easier to change game code, without full recompile. \$\endgroup\$ – The Communist Duck Nov 16 '10 at 16:39

Lua is what's often used for game scripting, and the big reason for this is that its libraries are small, it has a fairly small memory footprint, and it's pretty simple to integrate with c++.

Before you begin to script or choose a language or start to integrate support for a language you need to have a good idea of what you want your scripting system to be able to do, and you need to prepare your underlying code to support it. You ought to isolate actions that you want the scripting system to perform so its easy to write wrappers for the scripting system to access this code. If you do this, it will be much easier to set up and effectively use ANY scripting system you want.

For example, if you are doing a topdown rpg, you probably have a way to walk around on your c++ layer. You want your scripting system to be able to tell your NPC to walk from point A to point B, so it's important that your walking logic is in its own function in c++. This can be a black box to anything outside of it...all your scripting system and the rest of your c++ code needs to know is that this function will cause your player to walk from point a to point b. Your input system calls this function when you use the wasd keys. Your lua script calls it when you call actions.walk(mypointer, pointA, pointB). This seems really obvious, but a lot of people just code by the seat of their pants and don't think about design. At this point, integrating the walk function becomes a matter of wrapping your c++ function in a glue wrapper and handling parameter passing between the scripting language and c++.


World of Warcraft uses Lua for scripting. There are a lot of tutorials about Lua:




Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.