Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: How do raws work?  (Read 769 times)

OneRaven

  • Bay Watcher
    • View Profile
How do raws work?
« on: November 10, 2009, 10:18:39 pm »

I've been wondering for a while, and figured I'd finally ask. How do raws work? How does the game assemble an item from the tags in a plain-text file? It's such a wonderfully modding method because it's amateur-friendly and quite intuitive once you learn your way around. Seeing the complexity of the whole thing makes me wonder what's under the hood.

Sorry if this is the wrong place to ask, but the modding forums seemed the best bet.
Logged
Messing with hardcoded stuff is playing with fire. And we all know how dwarves react to fire.

Greiger

  • Bay Watcher
  • Reptilian Illuminati member. Keep it secret.
    • View Profile
Re: How do raws work?
« Reply #1 on: November 10, 2009, 10:41:33 pm »

I don't know the raw parser code, but what I've noticed so far it checks the first word of the filename to determine what kinda things it should expect inside.  Possibly using that header at the top of the file instead of the actual filename.  Then the second header in the brackets tells the parser EXACTLY what data to expect.

Then it goes through the text file line by line ignoring everything not enclosed in brackets.  Lower tags overwrite higher ones in case of conflict.  If it encounters something in brackets it doesn't recognize it copies the offending entry to the errorlog.

Then it turns everything it recognized into a data file in objects/data that the game can read easier on the fly.  It does all this on every startup of the game.
« Last Edit: November 10, 2009, 10:43:30 pm by Greiger »
Logged
Disclaimer: Not responsible for dwarven deaths from the use or misuse of this post.
Quote
I don't need friends!! I've got knives!!!

Deadmeat1471

  • Bay Watcher
    • View Profile
Re: How do raws work?
« Reply #2 on: November 11, 2009, 12:06:45 pm »

Brain break.  :o
Logged

Meanmelter

  • Bay Watcher
  • A Dwarven Demon, yeah, he is pissed.
    • View Profile
Re: How do raws work?
« Reply #3 on: November 11, 2009, 05:20:27 pm »

Logged
huh. took a bunch of sleeping pills and slept in a pharmacist, wake up, i am now albino. 
Story of my life.

Deon

  • Bay Watcher
  • 💀 💀 💀 💀 💀
    • View Profile
Re: How do raws work?
« Reply #4 on: November 11, 2009, 06:54:47 pm »

The only "hard" thing there should be a parser, besides that, it doesn't matter which kind of input do you have, some graphical UI or a text code, because in the end it's all about the data which is fed to the engine, and Toady is not going to release it open-sourced thus you won't get an answer to your question.
Logged
▬(ஜ۩۞۩ஜ)▬
✫ DF Wanderer ✫ - the adventure mode crafting and tweaks
✫ Cartographer's Lounge ✫ - a custom worldgen repository

Greiger

  • Bay Watcher
  • Reptilian Illuminati member. Keep it secret.
    • View Profile
Re: How do raws work?
« Reply #5 on: November 11, 2009, 10:09:02 pm »

Actually, now that I think of it, wasn't the raw parser in Battle Champs?

It had raw files just like DF, just with fewer tags.

EDIT: Hell I even remember modding my copy.
« Last Edit: November 11, 2009, 10:11:58 pm by Greiger »
Logged
Disclaimer: Not responsible for dwarven deaths from the use or misuse of this post.
Quote
I don't need friends!! I've got knives!!!

Untelligent

  • Bay Watcher
  • I eat flesh!
    • View Profile
Re: How do raws work?
« Reply #6 on: November 11, 2009, 11:22:48 pm »

Where can I get Battle Champs?
Logged
The World Without Knifebear — A much safer world indeed.
regardless, the slime shooter will be completed, come hell or high water, which are both entirely plausible setbacks at this point.

Greiger

  • Bay Watcher
  • Reptilian Illuminati member. Keep it secret.
    • View Profile
Re: How do raws work?
« Reply #7 on: November 12, 2009, 10:29:09 am »

http://www.bay12games.com/forum/index.php?topic=23442.msg261144#msg261144

Figured it would be easy to find. Ha. A half hour of my life later I found it :)
Logged
Disclaimer: Not responsible for dwarven deaths from the use or misuse of this post.
Quote
I don't need friends!! I've got knives!!!

OneRaven

  • Bay Watcher
    • View Profile
Re: How do raws work?
« Reply #8 on: November 12, 2009, 01:45:29 pm »

The only "hard" thing there should be a parser, besides that, it doesn't matter which kind of input do you have, some graphical UI or a text code, because in the end it's all about the data which is fed to the engine, and Toady is not going to release it open-sourced thus you won't get an answer to your question.

My assumption is that the game assembles the parsed data into objects. I don't know enough about C/C++ to create objects on the fly (rather than as part of the code) but I assume what happens is that the objects for the items/materials/creatures/etc are created and saved as easier-to-read data files? Looks like I'll have to learn more about C++, rather than the raws themselves.
Logged
Messing with hardcoded stuff is playing with fire. And we all know how dwarves react to fire.