92

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

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


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" { ...


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.


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

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

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


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

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


6

1) Would one embed the script itself in the entity object before persisting to it to the disk? Is this okay? You'll get cleaner diffs in your version control and encourage reusable scripts by providing the actual script out-of-line and having the entity merely store, say, a filename and script parameters. Storing the script in the entity itself is viable ...


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

Where I come from, we see the upgrade problem as subsumed by the persistence problem. In this case, that means: Most games need saved games; you will want some way to save the entire state of the game and resume it later. Get that implemented now, and define your hot-reload as follows: Save game to a temporary buffer. Discard all game state and loaded ...


6

The method I have used with good results is to give each class that needs Lua bindings a static class method with the following signature: static luabind::scope luaBindings(); The definition of this method looks like this: luabind::scope MyClass::luaBindings() { using namespace luabind; return class_<MyClass>("MyClass") .def(...


6

That shouldn't be too much of a problem with an interpreted language like LUA or Python. I know about a LUA binding that's ready and available in the Unity Asset Store. It seems there are other bindings available as well. Just search the Asset Store in the "Scripting/Integration" category. Here's one for python that I found.


6

In the simplest terms i can put it. There will be some kind of "trigger" volume in most cases. When the player steps into this volume it will trigger the "event". Volumes will be a cube, or a sphere, or some other 3D primitive. The script will either be a pre-animated cutscene, in which case an animation will be played, or the gameplay script will be some ...


6

There are many ways to implementing scripting in game engines, or applications in general. Most conventional scripting languages are just like any other library. Just as libpng interprets a particular data format and provides APIs to read the results of processing that format, a scripting language library like Lua read in a particular format (Lua source ...


6

What you're describing is effectively running gameplay mechanics in a virtual machine, which can simplify the process of authoring them and insulate against bad behaviour. As it happens, a lot of games already do their gameplay like this under the hood! If you've ever heard developers talk about incorporating scripting languages like Lua, or node graph ...


5

To launch a dedicated global server, run: UDK.exe server yourmap For a listen server, launch the game with your desired map as normal and append ?listen: UDK.exe yourmap?listen For a lan server, append ?lan to the map name (e.g. UDK.exe server yourmap?lan) To connect to the server, you can start the game with your IP address instead of a map: UDK.exe ...


5

Although XML is more predictable, kinda have a defined structure and all that. I would go with scripts. Rolling your own language(if you have the time, but usually this is not the best choice), or even implementing one. There are LOTS of script languages out there, they're all nice, some examples: Squirrel, Lua, Angel Script, Python, and many many many ...


5

I've been writing a few blog posts about this recently. Specifically for entities data files, and the just published post for taking those data files and turning them into entities. Essentially, you write your own parser for a custom script language. The parser reads components into "blueprint" form for your factory. Each entity will have a set of component ...


5

I have seen this suggested but most poeple suggest lua but that does not seem to fit my type of programming. OK, let's try this from a different angle: what is it about Lua that you don't like? Is it something that is easily fixable, or is it something fundamental? For example, take the use of keywords such as then/do/end to denote code block rather than ...


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