[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Scripting in games.
- To: linuxgames@sunsite.dk
- Subject: Re: Scripting in games.
- From: "J. Perkins" <jason@379.com>
- Date: Mon, 23 Sep 2002 08:51:05 -0400
- Delivered-To: archiver@seul.org
- Delivered-To: mailing list linuxgames@sunsite.dk
- Delivery-Date: Mon, 23 Sep 2002 09:08:44 -0400
- Mailing-List: contact linuxgames-help@sunsite.dk; run by ezmlm
- References: <3D8E90B2.8090702@airmail.net>
- Reply-To: linuxgames@sunsite.dk
- User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.1b) Gecko/20020721
I have a bit of experience here, so I'll take a crack at it...
> * I could provide (for example) a function to position an object that
> 'belongs'
> to the script at a specified X,Y,Z,Heading,Pitch,Roll - but should I
> instead
> make the interface be Velocity+Direction and let the game do the
> integration
> down to positions - or perhaps the interface should just be a place to
> head
> towards and a choice of several 'modes' of getting there?
You'll probably all three approaches. A script might want to add a
new static object to the world (1), or maybe apply forces to all
dynamic objects to push them away from an explosion (2) or run a
pathfinding algo to get from a to b (3). Pathfinding is generally
too cpu-intensive to be coded in a script.
> * How should the game handle collision detection for scripted objects?
Collision detection should happen in your C code (too slow for
scripts, and script writers don't want to be bothered). When a
collision is detected call a hit() function or similar on the
scripted object and pass it the object that it hit. The script
can then determine what to do about the contact.
> * How does the scripting interface deal with telling the script the
> position
> of the player and other creatures?
I have a FindEntity() that can locate another object by name.
The script can store a reference to the entity in a variable, and
then call GetPosition() etc. as needed. That is, the scripted
object should ask for what it needs.
> * Should scripts be able to communicate with each other?
If you allow this, it should definitely be through some sort of
indirection like messaging or an event system. That way a script
can safely ignore events that it doesn't recognize. For game objects
it's not too bad, because you can standardize the interface to
a "thing", but for the AI logic it does get kind of fuzzy. The
best bet is to keep object boundaries clear.
> How do existing games deal with this stuff? Is there a 'classic' game
> somewhere with a scripting interface that's known for having "Got It
> Right" ?
It has been my experience that the *best* way to this stuff is via
a plugin/component system. No matter how much stuff you give the
scripters, there will always be something you didn't think of.
Create a simple base of functionality, a standard object system
for your scripts, and a standard way to add to it.
A good place for info on these kind of things is the unrealtech page
at http://unreal.epicgames.com.
Jason
379