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

Re: [kidsgames] Re: [Fwd: Kids Game Builder version 0.0.1]



> > Content, at least as far as history or locale-specific information like
> > lists of presidents or names of capital cities, could probably be loaded
> > into similar resource files and selected at runtime as well.
> > 
> 
> Hmmm, can you elabarote (like a mini howto) on how to go about doing
> this....

Heheh.. well I hadn't given it a lot of thought until just now, but here's
the basic idea... a PO resource file (used with xgettext) looks like this:

# comments etc
msgid "some string needing translation"
msgtext "the translated equivalent"

over and over. One of these files is created for each language. The PO
files are then compiled with 'msgfmt' into MO (machine object) files and
loaded at runtime by your program.

Most games like Descent/Doom/Quake/Hexen/etc work this way.. those WAD
files are really just a bunch of compressed images and sounds loaded by
the engine for each level in the map. That's why replacing the WAD file
allows you to change the look of the characters, change the sounds, the
maps, whatever. We can make use of this technique as well.. the data files
don't need to be complex.. they follow the complexity of the game engine.
For a simple quiz type program, it could be something as simple as:

# Sample resource file
ITEMS=5 #number of Q/A pairs
Q="What is the capital of Hawaii?"
A="Honolulu"
Q="What is the airspeed velocity of an unladen swallow?"
A="African or Europeen?"
Q="What is your favorite color?"
A="Blue! No, yellooooooooooooooowwwwwwww"
etc

I think you get the idea ;) For more complex types of games, the data
files will obviously hold more information, and in different formats. The
main advantages of this approach are that you design the engine separate
from the content allowing the same engine to be used for all types of
games (eg the same basic 3d engine is used for Wolfenstein, Doom, Quake,
Hexen, Heretic, and on and on) and you can change the game data without
modifying any actual CODE. The drawback of course is that you need level
editing tools and such in order to create content, but again, you don't
have to be a programmer in order to make levels this way.

Anyway, it's hardly an original idea, but if it's good enough for Michael
Abrash, it's good enough for me :) [For those who don't know, Mike Abrash
wrote large parts of the Quake engine and has been hacking high
performance game code for years. I highly recommend his "Zen of Assembly
Language" and "Graphics Programming Black Book" to anyone interested in
writing games]

    \|/    -segfault- 
   (O O)   
  ^  V  ^   "640k ought to be enough for anybody."
///( . )\\\   -- Bill Gates, when asked about DOS's 640k barrier  
 ---m-m---   

-
kidgames@smluc.org  -- To get off this list send "unsubscribe" in the
body of a message to majordomo@smluc.org