Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.
90

Scripting is a programming abstraction in which you (conceptually) have a program (the script) running inside another program (the host). In most cases, the language in which you write the script is different from the language in which the host is written, but any program-inside-a-program abstraction could be considered scripting. Conceptually, the common ...


42

No. At least, probably not. This is a very frequent case of reinventing the wheel is game development, a mistake that is still quite popular. If you're asking this question, you're very likely to be influenced by what others do, so just look at what Epic Games just did with the Unreal Engine: UE3 had a custom, weird, non-optimized, hard-to-debug ...


42

Scripts written in scripting / embedded / interpreted languages such as "Lua", "Lisp" or "AngelScript" (more here) can be updated during the game [*] and then are interpreted (= executed) on the fly. You can bind elements from those scripts to your native compiled coding (C++, etc.) so that the scripts can then execute logic from your application. E. g. a ...


17

My game uses an entity component framework and uses scripts to define entities (this doesn't directly define behavior, I'll talk more about that at the end). The scripts define the actual components to be used for creating each entity. It uses a simple scripting language I created. Here is a simplified version of one of my scripts: ENTITY:"Goblin" { ...


17

Dialogue could be provided in any form/structure you wish it depends on how you parse the information that makes the difference. I will provide you with a basic XML syntax to get you started without understanding your games structure or language I afraid i cant provide an implementation. <?xml version="1.0" encoding="UTF-8"?> <npcs> &...


15

Scripts are written for a scripting language. People can use the words in slang sentences to get the muddling that you are referring to but ask anyone for the definitions of Script, Scripting and Scripting Language and you will get something like: Scripting is the act of writing Scripts using a Scripting Language. When you embed a scripting language into a ...


15

Unity is using Mono behind the scenes. Every time you make a change to your C#/UnityScript scripts it recompiles the code almost instantly. If you look in the data directory of a standalone unity player, you can see it has compiled all the scripts into Assembly-CSharp.dll, or similar. So yes, the C# is being compiled.


14

There are a few ways you can work to avoid tight script coupling. Internal to Unity is a SendMessage function that when targetted at a Monobehaviour's GameObject sends that message to everything on the game object. So you might have something like this in your health object: [SerializeField] private int _currentHealth; public int currentHealth { get { ...


13

The major advantage that comes to my mind is that it allows the configuration to be edited/managed by a non-programmer without requiring them to touch any of the game scripts.


12

Have you looked into entity component systems and event messaging strategies? Status effects should be components of some sort which can apply their persistent effects in an OnCreate() method, expire their effects in OnRemoved() and subscribe to game event messages to apply effects which occur as a reaction to something happening. If the effect is ...


12

Embedded language is the proper technical term. In practice, languages which are used inside other applications (such as games) are often referred to as scripting or even interpreted languages, although they should not necessarily be interpreted or used for automating routine tasks. Googling "scripting languages for games" would probably yield more useful ...


11

I can't compare the two, as I've only had experience embedding IronPython in a C# game so far. Here's what I like about it though: 1) It's easy! Download the IronPython DLLs, add reference in project, using IronPython.Hosting; var engine = Python.CreateEngine(); var product = engine.Execute<System.Numerics.BigInteger>(@" print ' '.join(['hello',...


11

RobStone is on the right track, but I wanted to elaborate since this is exactly what I did when I wrote Dungeon Ho!, a Roguelike that had a very complex effects system for weapons and spells. Each card should have a set of effects attached to it, defined in such a way that it can indicate what the effect is, what it targets, how, and for how long. For ...


11

You are looking for a way to change the code into some actions. This is precisely what interpreters are doing. Take a look at Python. You run it, and bam! You land in REPL(Read Eval Print Loop). You define a function "hello" which prints "Hello, world". And there you have it! Notice that you didn't compile anything; interpreter did some magic to create ...


9

Using scripting has many advantages over "core language". Some of these include: Moving (more) of the content from core developers to artists, freeing the core developers to engine tasks from gameplay tasks Scripts tend to be sandboxed, can't do anything really dangerous in it Modifying scripts does not require recompilation and re-execution of the game


9

Have you made your own scripting language and why did you chose to roll your own instead of using an existing one? I have, although I borrowed the syntax from other languages. All in all it was a great learning experience and in my case not that hard because the language was simple. I did it mainly because I wanted to use a regular C-style syntax for my ...


8

@Michael directed me to an excellent resource for exporting bones from Blender. It provides all the information I needed. It's actually already built into Blender, it's the DirectX Model Format. Go to user preferences, addon section, "Import-Export" category and install "DirectX Model Format (.x)". Then use File->Export to select the newly added format. ...


7

Both, in general. Your scripts should talk to an abstracted -- or at least intermediate -- layer of functionality and not the engine itself. First, this provides you an extra measure of control and security. It allows you to easily, cleanly define the interface a script is allowed to have with your game and thus what it can muck about with, as well as ...


7

My suggestion is honestly just to find a format that Blender will export its bones as well, and then look through the script of that format exporter. I was doing something similar and realized how much of a pain it was to find a good resource on exporting bones. But here's this specification that helped me a lot, on armature modules


7

I've figured out how to do this. As I expected, since IronPython compiles down to CLR, C# and IronPython objects can interact with each other just fine with no special treatment necessary. I've created a script which actually creates a new type of Component which can be referenced just fine from C#. A brief word on my game's structure: Its solution has two ...


7

Do python games use Lua? Generally? No. Is it a resonable thing or I should just stick to pure python? Define "reasonable"? Python has been used in many game development scenarios. While Lua may be well known among some game mod circles (like WoW GUIs, Garry's Mod, and so forth), Python was the language of choice for Civilization IV modding. So it's ...


7

Lua is a pretty well developed scripting engine that is flexible and easy to integrate to your games, and is already supported in many game engines, for instance: 2D Agen (Lua; Windows) Blitwizard (Lua; Windows, Linux, Mac) Corona (Lua; Windows, Mac; iOS/Android) EGSL (Pascal/Lua; Windows, Linux, Mac, Haiku) Grail Adventure Game Engine (C++/Lua; Windows, ...


7

Generally, you bind or expose some native functions to Lua (often using a utility library to do so, although you can do it by hand). That allows Lua code to make calls into your native C++ code when your game executes that Lua code. In this sense, your assumption that the Lua code just calls into the native code is true (although Lua has its own standard ...


7

It depends on what kind of modding the game allows. When the game in question already includes a sufficiently powerful script interpreter, one could write a transcompiler which takes a script written in Lua and transforms it into a program in the scripting language of the game so that it can be executed. Alternatively, one could even create a Lua ...


7

I personally NEVER use SendMessage. There's still a dependency between your components with SendMessage, it's just very poorly shown and easy to break. Using interfaces and/or delegates really removes the need to use SendMessage ever( which is slower, although that shouldn't be a concern until it needs to be ). http://forum.unity3d.com/threads/free-vfw-full-...


6

Roblox is a game scripted in Lua, it's 3D, free (You can pay for virtual money), and has lots of tools. Lua is a very easy language. Roblox is a basically a website, where you make games or play games. There is a shop to customize your avatar and buy gear. The only problem is that mostly everything in the shop is extremely expensive. The games in it can be ...


6

I'm fairly sure Lua can do everything you need relatively simply. I use Lua and C++ in my game. I looked at various wrappers like LuaBind, or using a generator like Swig, but I decided I didn't want any of that stuff and I wrote my own wrapper which I ended up making open source in case other people found it useful. Using my little library you can do stuff ...


6

A corollary of FxIII's answer is that you should design everything (that would be moddable) in the scripting language first (or at least a very decent portion of it) to ensure that your integration logic actually provisions for modding. When you are certain that your scripting integration is versatile enough rewrite the required bits in C#. I personally ...


6

Scripting is generally used in bigger projects to allow non-programmers to easily add content to the game. This can be new quests, interfaces, gameplay for levels, etc. A scripting language in itself shouldn't be difficult for a programmer to learn, what will take time is the integration into your game framework. Whether it's worth it or not is really your ...


6

A script is usually a piece of code that runs outside your core engine. It is usually contained within text files wherever you like to keep them. Then it is usually loaded by the engine, parsed, and executed at runtime. What generally happens is that whatever language you use (Lua, Angelscript for example), this language usually has some facilities that ...


Only top voted, non community-wiki answers of a minimum length are eligible