[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scripting

Jorrit Tyberghein wrote:

> is out of the question since you need a compiler to do run those scripts.
> And who is going to include a C++ compiler in their game?

Who says you need to when gcc is a download away, template makefiles and 
"scripts" are easy to distribute and you have dlopen?

But we've been down this road before - some people prefer interpreted 
scripting, some prefer interpreted compiled bytecodes, some people prefer 
compiled dynamic linked libraries. Each have their good and bad points, in 
the end the one you use is largely down to personal preference, the amount 
of heavyweight code that needs to be scripted as opposed to compiled in* and 
who will be actually writing the scripts anyway.

* for example, in one of my games I've got some very complex AI code. If I 
wanted to interpret it, *even on a fast machine* it would run like a pig 
unless I wrote a JIT compiler and god knows what else to keep the speed up.
My view is why go to the lengths of writing an interpreter and compiler when 
gcc is available for free and you can't interpret code faster than the 
processor can execute it... For someone with a less demanding set of 
requirements, the complexities of doing all scripting from C++ (of which 
there are many) may outweight the speed penalty of interpreting, or speed 
may not even be an issue.

> I would also only use scripting for the following:
>     - AI (but with a lot of help from a fast C++ library)
>     - Behaviour of entities (this is closely related to AI but not always)
>       Like: what happens if someone opens this chest.
>     - Scenariou setup.
> Things like physics, rendering, and so on should be done in the native
> language (i.e. C++).

Agreed 100%


  .------{ http://www.starforge.co.uk }-----. .--------------------------.
=[     Explorer2260, Designer and Coder     \=\ P: TexMaker, ROACH, site \
=[___You_will_obey_your_corporate_masters___]==[ Stack: EETmTmTRRSS------ ]