Sign in to follow this  

Why use scripting languages? And which one to use?

This topic is 2033 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, i ve read that using scripting language is usefull in videogame programming (expecially for ARtificial Inteligence), but why? And which is the most suitable scripting language for videogames on a java based game? Thanks

Share this post


Link to post
Share on other sites
At least on of its benefits is that you dont need to rebuild the whole program to update lets say the behaviour of those AI's. You just need to edit a text file or something similiar. That is useful when you want to tweak the behaviour of something which might require you to rewrite the stuff multiple times and then keep adjusting the variables until it works properly.

I would also say that scripting languages are usually simpler to write code with than lets say C++

Share this post


Link to post
Share on other sites
Being able to change things on the fly without having to rebuild the game is the typical reason I see for embedding a scripting language into the game. AI is commonly implemented as scripts for this reason. It can also be used to develop extensions: WoW and other MMOs expose an API that can be used to write addons in Lua and possibly other languages.

Another thing I like Lua for is data. Pretty much anywhere XML is used, I prefer Lua. I find it less verbose and easier to read, and if I'm going to be using Lua anyway, then why not use it for this as well?

There are, of course, other scripting languages: Python, JavaScript, etc. Each has its own strengths, but I hope I've given you some ideas.

Share this post


Link to post
Share on other sites
Another big reason for using scripting languages is usability. The scripting language is generally sandboxed, so that if you make a mistake, it has very little consequence. For example, if you divide by zero in native code BOOM. But if your script pulls something like that, it generally just logs an error message somewhere and runs on it's merry little way. This allows you to give less experienced/senior dev's or even designers access to scripting with less fear of causing a completely meltdown if they screw up.

Additionally, scripting languages tend to be higher level and handle more of the details for the programmer, resulting in an increase in productivity.

Share this post


Link to post
Share on other sites
Let me just add that if you cannot think of a good reason to add scripting to your game, chances are you don't need it (yet). Don't add features just because you see them somewhere else. If you keep adding features that don't directly benefit your game, you will lose track and likely never finish. Edited by kloffy

Share this post


Link to post
Share on other sites
I've only begun to use scripting, but the biggest thing it seems to be useful for (to me) is tweaking user-interface elements. By defining user interactions functions in a script, I can quickly evaluate the impact of UI changes on the fly without leaving my program. An example of this would be controlling the zoom levels of a map. You're never going to figure out the ideal parameters without using it, and you might not even know what the basic structure of the function should look like (polynomial, exponential, bounded?).

Share this post


Link to post
Share on other sites
I agree with the previous comment, only add scripting if there are benefits to you.

I am a big fan of the V8 engine by Google. This could offer excellent scripting support for a game an is relatively easy to integrate.

For me the biggest benefit of scripting is usability, again like previously said. If you have multiple people working on various aspects of the game then it is likely that they will have varying levels of skill.

Allowing developers to script can make the game a lot easier to produce. So if you knew a web developer who wanted to get involved but doesnt know C++, chances are they could script with JavaScript.

Share this post


Link to post
Share on other sites

This topic is 2033 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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