What are Scripting languages used for in games?

it’s not that i need a scripting language or have a problem, i’m simply asking how are they used and for what, and if it would help. i’m basically asking what use they have in game development in order to research it and learn it and maybe implement scripting into future games.

at the end of the day, i was asking for their use in game development because i heard of some games using them and i haven’t touched them, so i’m asking for information and advice.

My impression is that for most small team / idie game dev, the reason they use one or more scripting languages is because of tattoos. Ya know…all the cool kidz have 'em, so I should too.

Semi sane reasons:

  1. User is a non-programmer. Large teams where world builders are artists, writers and/or new programmers. Also can be use to allow end-user provided content, add-on, total conversions etc. So provide some easy to use high level functionality which also disallows access to low level engine functions. Errors will tend to be localized.

  2. The general purpose programming language being primarily used makes implementing something hard to impossible.

  3. Hot swapping. Not needing to take-down and start back up a server to add new or correct broken non-core code. Another usage is live-coding of content during development. Break the exit, edit, compile, restart game, load the state I want to re-look at and pray cycle.

  • They are useful if you want to change behaviour in the game without recompiling the whole project after a change. This is more important for languages with slow build processes. At times you can even load scripts dynamically, so you can e.g. change enemy behavior in the running game without a need to start freshly after a rebuild.

  • They are useful if you want to let users change or expand the game, and don’t want to open the sources of the games core.

  • Sometimes they are also useful to describe game assets like levels or items, but sometimes a scripting language isn’t needed, text files or the like will do, too.

If there is absolute necessary of a scripting language, I’d take a look at Beanshell 2 as it can evaluate java code upto a certain extent. They used to advertise it as Scripting Java for Java apps if I remember correctly.

Otherwise, if you want to take a look at JRE-8 as suggested above, take a look at Nashorn. It’s a better JS script engine than rhino (that’s what they say, never used it really).