Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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.

share|improve this question
6  
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. –  The Communist Duck Nov 16 '10 at 16:39
add comment

2 Answers 2

up vote 6 down vote accepted

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++.

share|improve this answer
add comment

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

http://csl.sublevel3.org/lua/

http://lua-users.org/wiki/LearningLua

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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