Download Architecture and Prototype of a Game-Engine

Transcript
Fast Evaluation
A game engine updates hundreds or thousands of Game Objects per
cycle. If the scripting language is used for game mechanics
descriptions, the evaluation time of an expression becomes critical.
Small Memory Footprint
Besides pure performance in terms of evaluation speed, the memory
usage of resources is generally an important magnitude for game
development.
Garbage Collection friendly
As .Net is a garbage collected language, it can be of importance for
performance optimizations to tune the scripting language in respect
to its object creation and destruction behavior.
Fast Parsing
Scripting languages are often used for many different purposes in a
game engine. As in Telesto, if the scripts are intended to also store
large data, such as models, the parsing speed becomes a relevant
factor. A byte code read/write might be required.
Locking
Many Game Objects will be updated at the same time, but it is also
probable that multiple scripts are evaluated for the same Game
Object at the same time. This might involve dealing with locking; a
topic most functional languages don't have to bother with.
Repeating Evaluations
In the typical game scenario, there is a large probability for recurring
requests. This could include asking for an object’s transformation or
the hitpoints of a unit for a GUI display.
Known scripts
While the game is running, all potential scripts in the complete
system are known. This is because a user does not insert new scripts,
but interacts with the game via lambda calls (such as a button press).
In contrast, an application will have to deal with user-created scripts
at runtime.
9.2.1. Avoiding Lisp call-chains
The basic and most important element in Lisp and other functional languages is the lambda. A
lambda is an anonymous function, allowing functions to be passed around just like normal
information (integers for example) in procedural languages. The name is derived from the Lambda
Calculus, a generic function description system. Dealing with functional languages is very rewarding.
My whole view on problems and the way I write programs changed as I started to venture into Lisp
and Smalltalk years ago - and, at least from my perspective, my coding improved. That's especially
helpful as functional concepts, like lambdas, are returning to the procedural world at the moment
and there are several widely spread functional languages, like LUA, or new ones appearing at the
horizon, like the newest .NET child F#. Dealing with the very interesting details and the opportunities
of functional programming would go beyond the scope of this document. I will state the most
important facts about Lisp as I talk about game-relevant aspects, but if you want to read further, I
may recommend Lambda the Ultimate (47), a good site about all kinds of functional languages.
61