Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Use a unique extension for raw files (e.g, .df or .dfraw) instead of .txt  (Read 2454 times)

Mr Crabman

  • Bay Watcher
  • A person with the head and pincers of a crab.
    • View Profile

Instead of using .txt as a file extension for raw files, a unique one should be used instead, such as .df or .dfraw, or .df_raw (whichever seems most suitable/convenient).

The reason I suggest this is because currently, I and another person are working on a language server (syntax highlighting, autocomplete, hover text info; that kind of thing) for dwarf fortress raw files (currently just a VSCode extension, but other IDE's will come after), but having a .txt extension however unfortunately means that for the extension to work, all .txt files end up being parsed as raw files, which harms the usability of the IDE for people working on .txt files for other purposes (ie not dwarf fortress mods) if they have this extension installed.

So having a unique extension would allow the IDE/language server to separate regular text files (which are used in other projects) from raw files, which would ultimately be better for the modding community as they could install the language server without it affecting anything but their dwarf fortress modding.

EDIT:

The new "info.txt" files that are planned for mods (so the game can recognise the zip files containing mods) are also notably .txt files; this may be a good idea to change as well, for similar reasons; depending on the format of the info files, it may be best to make them also .df (or whatever the raw files are changed to), or to make them use a more standard filetype like json or something (commonly used for "version marking" software).
« Last Edit: January 03, 2022, 11:03:16 am by Mr Crabman »
Logged

Shonai_Dweller

  • Bay Watcher
    • View Profile

It would be adding yet another barrier to those who don't want to get into modding because "I can't code! I don't have any modding tools! What's this Dfhack thing?! Help!!".

Editing a text file is as simple as, well, editing a text file. About as noob friendly as you can get. Calling it something other than a text file just makes it seem more unfriendly.

Still, if txt files are preventing important modding work and there's no other workaround, I guess DF will have to go that route. If possible would rather any other method than taking away one of the few absolutely beginner friendly, inviting parts of the game though.

(Of course, I get that there's technically no difference. It's just the presentation that you've hurt).
« Last Edit: April 30, 2021, 08:42:14 pm by Shonai_Dweller »
Logged

DwarfStar

  • Bay Watcher
    • View Profile

Maybe it would work to add a separate field to your database indicating what syntax highlighting scheme to apply to each file. Then set that field on all the DF raw files somehow (manually, maybe, or by setting a default per user), indicating "parse this file as *.df" and Bob's your uncle.
Logged

A_Curious_Cat

  • Bay Watcher
    • View Profile

iUsing a unique file extension would help with filetype detection and allow programs like vim to automatically apply syntax highlighting.:wq
Logged
Really hoping somebody puts this in their signature.

Mr Crabman

  • Bay Watcher
  • A person with the head and pincers of a crab.
    • View Profile

It would be adding yet another barrier to those who don't want to get into modding because "I can't code! I don't have any modding tools! What's this Dfhack thing?! Help!!".

Editing a text file is as simple as, well, editing a text file. About as noob friendly as you can get. Calling it something other than a text file just makes it seem more unfriendly.

Still, if txt files are preventing important modding work and there's no other workaround, I guess DF will have to go that route. If possible would rather any other method than taking away one of the few absolutely beginner friendly, inviting parts of the game though.

(Of course, I get that there's technically no difference. It's just the presentation that you've hurt).

I don't think this would pose any barrier to modding; I've tested and .df files can still be opened by text editors just fine; as for the presentation, it seems unlikely to me that anybody would be intimidated by the file extension, yet not be intimidated even more by the contents of the files themselves after opening them.

Also, a lot of games can't be modded at all, so any sources which let people know that the game can even be modded in the first place, and also which files can be modded/where they are found, could just quickly mention that the files can be opened in a regular text editor.

Maybe it would work to add a separate field to your database indicating what syntax highlighting scheme to apply to each file. Then set that field on all the DF raw files somehow (manually, maybe, or by setting a default per user), indicating "parse this file as *.df" and Bob's your uncle.

An interesting suggestion, but I'm not sure this would be possible, or if it is, whether it would be practical.

Ralpha

  • Bay Watcher
    • View Profile

A first step to doing this would be so DF would allow the parsing of `.df` or `.dfraw` files (as if they where `.txt`).
This does not harm anyone and allows people to use the new extension if they would like to.

Although, with the steam release, and the bundling of a mod in a zip, this would be the ideal time for a change like this.
Because the mod files are not really 'txt' files anyway. They are a special format that follows certain rules. (what plain text files do not have)
Every type of file that even has some (limited) formatting to it would use a different extension. Like: `.md` for Markdown, `.log` for structured log files, `.rtf` for Rich text format, `.py` for python code (similar for every other programming language), `.xml`, `.json` (these are just structures in files and are so similar to df raw files in there structure), ...

There are also a lot of other benefits for having a different extension then `txt`. You might want to open normal text files (on your pc) with notepad.
But you want to edit dwarf fortress mod files using an other editor (Vim, VSCode, Atom, Notepad++, ....).
People can also create stand alone application that open `.df` files. (think for things like "Raw Explorer", "DF Diagnosipack", ...)

I think there are almost no downsides to this change.
  • Old mods don't work after steam release for most part anyway (because of restructuring and graphics changes). So need to be updated anyway.
  • If people want to edit mod files they can still just open them and you could even include a `README` file with some basic info and links to wiki, because they will need that anyways.
  • Changing they extension would be a small change, updating the content of the file would be a bigger change.

In short I think adding support (or replacing `.txt`) for `.df`or `dfraw` would be a very good thing. Especially for the modding community in DF.
It is a change, but would allow so much more.
Logged

voliol

  • Bay Watcher
    • View Profile
    • Website

I’ve messed around with the raws some and also made a few tools, and don’t think this change would do much. It would only become marginally easier to check whether a file is a DF raw files, they are already recognizable as .txt files with first rows following a pattern. The only upside I see is letting the Operating System open .txt files with one program and .dfraw files with another (like one supporting Ralpha & Mr_Crabman’s language server, which I can vest for is pretty cool/useful). That and aestethics.

As for the barrier it would present for modding... there might be one? .txt files are less daunting, because standard OSes recognize them, so the user doesn’t need to know what program to use, or if they have the program installed. Would a readme.txt solve this? Maybe, you’d need to make sure it is in the ”right” folder for people to read it. On the other hand, the existing barrier of ”the raws being hard to parse without explanation” might surmount this new barrier so it doesn’t matter much. You still need the wiki or some other guide to get started.

And by the by, and you may take this any way, but even .txt files aren’t transparent to everyone. I know people who would see me making .txt notes in standard windows notepad and think I was ”hacking” during class. How many people of comparable tech-savviness will be attracted to Dwarf Fortress and the prospect of modding it? I have no idea.