Archived

This topic is now archived and is closed to further replies.

atcdevil

scripting languages

Recommended Posts

I was just wondering. I always hear of people writing scripting languages in their games based on real programming languages. In my game, the scripting language consists of functions specific to the game like MESSAGE which displays a message from a character or LOADMAP which loads a map file. I don''t understand what good embedding a C like language or Python or whatever I always hear about? Scripting, I would think would be something game designers could play around with or something, so it would be simplified. So making it be essentially a real programming language would defeat that purpose. So my question is how do some of those languages work? Am I mistaken about the way these things work? Do they just share the same syntax? and have specific functions in them like mine does. I''m curious because there are almost definetely better ways of creating scripting languages than the way I did. -Andrew

Share this post


Link to post
Share on other sites
Scripting languages are more than something programmers can ''play around with''.

They have the potential to drive your game in a huge way - scripts can be compiled and run at runtime. You can edit your script while your engine is still running and have the changes applied immediately. The importance of this ability alone is immediately obvious, but I digress.

Scripting languages that have the power of a ''real'' programming language are the most useful. No longer does code have to be written in C/C++ and recompiled whenever you find a bug. You can write much of your game code in the scripting language, and test changes without having to recompile. This makes testing/debugging easier and much faster.

A lecturer of mine wrote an entire game engine from scratch, along with a scripting engine, which was collectively called Pi. Now, it wasn''t perfect - the scripting language, while powerful, lacked some of the more basic constructs of today''s HLLs although they could be emulated using tables and what not, but nm. The thing I liked about Pi - the game environment - was that everything was integrated. You had a virtual filesystem that doubled as a way of storing variables from the scripting language, and you could persist the results of a script in the VFS to be retreived at any point in time. Furthermore, the VFS could be saved to disk to be restored at a later date, or compressed and sent across a network. It was an impressive little piece of work.

Anyway there, you see, a scripting language actually became part of the programming environment. Entire games in this system could potentially be made with a soft architecture.

I''m just ranting now so I''m off, but I hope you see what I''m on about.

Tom L

Share this post


Link to post
Share on other sites
Carmack compiled C code to a virtual machine for Q3A game code*. His reasons were portability and security. Though he noted up to a 20% speed slowdown.

*that's not 100% correct since there's also the option of compiling the game code to a DLL.

[edited by - RollingRock on December 23, 2002 11:42:57 PM]

Share this post


Link to post
Share on other sites