Web Images Videos Maps News Shopping Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion Script or database?
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Lucas Ackerman  
View profile  
 More options Jul 6 2003, 5:13 pm
Newsgroups: rec.games.roguelike.development
From: gli...@gweep.net (Lucas Ackerman)
Date: 6 Jul 2003 14:13:51 -0700
Local: Sun, Jul 6 2003 5:13 pm
Subject: Re: Script or database?
Hi, I'll admit to being biast up front.  I think databases aren't that
interesting but often serve for managing art assets in modern games,
while scripting languages are about defining the proper problem domain
tools to make writing your game easier.

The Sheep <sh...@atos.wmid.amu.edu.pl> wrote in message <news:slrnbgaom2.uic.sheep@atos.wmid.amu.edu.pl>...
> There are at least two alternatives to handling external data files:

> database-like and script-like

> The database-like files are parsed and converted to actual in-memory objects
> first, and then you can do any additional operations on them. The order they
> come in, and some other things are irrelevant.

In this treatment, you're saying you want it to act like an extension
to the running game engine.  That's fine, but this doesn't address
*how* it got to the running state, what the bootstrapping or creation
process for a new (or loaded) game is like.  So it would seem you also
need an initilization subsystem or scripting language anyway.

> On the other hand, script-like files use some scripted commands to create the
> objects in memory as they are parsed. The order, the actual environment and
> other things are importatnt.

A smartly done scripting system would handle all the dependancies
without intervention, at a resonably fine granularity.  There are lots
of ways to make module systems in Lua for example.  Perhaps it's
better to think about what information you need to access, not what
goes on under the hood to prepare it for you.  Game content code
shouldn't have to care.

> The problem I have now is: which to choose?

I think the problem is deciding what issues you really want it to
address.

> I don't want to use a scripting language as powerful as lua, to define game data.

Because your game development is moving along too quickly and easily,
so you want to make more work for yourself?  Get real :)  Lua is a
brilliant, tiny powerhouse.

I'm working on a game language in Lua, but that's neither here nor
there.

> The files should hold only the definitions of items, monsters, level themes, etc.
> Any extensions to the game would be written in C and linked (statically, or
> dynamically, as plugins) into game's engine.

> Even if the data files would be `script-like', there would be no flow control
> commands.

Bzzzzt.  Thanks for playing.
What I think you mean to say, is that they're responsible for
providing access to representations of these game objects, while the
game code resides executable side.  You obviously don't have to use
the scripting language for game code or extensions if you don't want,
but that's an independant issue.

What form the game objects are described in (as self-building objects,
lookup tables, or generating functions) is the real problem you need
to solve, and you should definitely leave it open-ended so you can use
the best tool for each job.  Maybe monster stats should be tables, but
items should be clonable objects, and maps are configurable generation
procedures.  However it works, you can always just provide the
resulting objects (monsters, items, maps) to your game code through
well defined interfaces, but leave the definitions very flexible.
There's no reason to artificially limit your options.

> So, at first I wanted to make it just a database -- offcourse still human-readable.

> But then, doing it as script allows me to control the process of game's initialization
> better. I can, for exaple, load only the set of colors that would be used -- ignoring
> all the other ones.
> With database it's much easier to load and unload data -- there would be problems with
> cancelling the effects of scripts when you want to unload them.

I think a database should be treated as transparent, the game code
should act as if it's all loaded all the time and proceed as usual,
but the DB can do all the real work lazily.  That's kind of the point:
to not manage it manually.

Scripting language (like Lua) tend to be garbage-collecting, so you
can load whatever whenever and it will go away when it's no longer
needed.  If a script just offers similar access to objects, it's
trivial to discard anything that's no longer needed, or persist
objects that aren't needed currently.

> So, I'd like to discuss some pros and cons of these approaches.

The DB is simpler, in that you'd be able to use popular DB software to
handle the real work.  It lacks the power and flexibility of a
language like Lua however.

The scripting language takes more upfront work from a design
standpoint: deciding what your interfaces should be and how the system
is arranged.  But given the basics, there's just so much more work it
can do for you.

The bottom line is that C code is much more brittle than DBs or
scripts are, so you want to change your interfaces and data structures
in C as little as possible.  Whether you go with a DB or script
system, the key is to figure out what those interfaces need to do
first, then arrange to provide lots of resources and services to them
via the (DB or scripting) back-end.  To roughly quote a software
engineering course I had once, "The primary problem in designing
software objects and interfaces is that of assigning
responsibilities."

-Lucas


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google