Func_Msgboard: .ent -> .fgd Converter

News | Forum | People | FAQ | Links | Register | Log in

|  | .ent -> .fgd Converter

Posted by necros [99.227.132.108] on 2012/02/07 20:41:26

http://necros.slipgateconstruct.co... (v0.1)
This is a java program, so you must have java installed. I wrote this with the 1.7 JDK, but it doesn't use any fancy stuff, so it probably works with older versions.
to run, you must type: java -jar QDefConv ENTFile FGDFile
ENTFile: the .ent file you wish to convert
FGDFile: (optional) the file you want to write to. if nothing is specified here, it will just use the same name with the FGD extension.
This is command line only for now.
Some warnings:
+For obvious reasons, make backups of your original files. There are no overwrite checks.
+The parser isn't perfect. because of the nature of .ent files, there is no standardized way of writing definitions. As a result, the parser has to guess at a lot of things.
-It interprets texts inside " or ' as a keyval. If you don't enclose your keyvals with anything it probably won't work.
That said, it can cope with the stock .ent file for quake.
-If you follow the conventions that were used there (and even the stock defs aren't great btw...) then most stuff should parse fine.
-Sometimes you may see keyvals that are incorrect popping up in your smart edit boxes... this is just the parser getting fooled.
+Smart edit mode will not have nice labels for the keyval pairs. for example, in the stock worldcraft FGD for worldspawn, the 'sounds' key is labeled "CD track to play" in WC. With the converter, you'll just get a straight up conversion. The parser CAN understand descriptions of keys, but often the descriptions are way too long to fit in the key labels, so i opted not to try to convert those.
+There are no caught exceptions, so if something goes wrong you'll get some crash messages. If you do get some, i'd appreciate if you post them here or email me about it.
For those familiar with the .fgd format, you may see some goofy things in the generated versions. this is because the converter doesn't understand inheritance as it is used in the .fgd format yet and the .ent format has no concept of that at all.
All it does is hardcode the AppearanceFlags baseclass and makes every other entity inherit from there.
It doesn't, for example, make a Monster baseclass and have all monsters inherit from there, instead it will redefine each monster alone.
note: There are, apparently, multiple formats that share the .ent extension.
This converter only accepts the standard QuakEd definitions (plain text with block comments beginning with /*QUAKED)

Ent / Def / Inheritance
#1 posted by SleepwalkR [85.178.123.199] on 2012/02/07 21:06:15
necros, def files do have a notion of inheritance, see the following which was taken directly from QuakeEd's def file:
/*QUAKED _light_style
{
choice "style"
(
(0,"normal")
(1,"flicker (first variety)")
etc, etc,
);
}
*/
/*QUAKED light (0.0 1.0 0.0) (-8 -8 -8) (8 8 8) START_OFF
{
base("_light_style");
}
Non-displayed light.
Default light value is 300
If targeted, it will toggle between on or off.
Default "style" is 0.
*/
Here, the definition "light" inherits everything from "_light_style".
Ok,
#2 posted by necros [99.227.132.108] on 2012/02/07 21:32:18
there seems to be 3 versions of .ent files then.
this is a .ent file in QE3 (and how i remember them from GTKRadiant):
/*QUAKED light (1 1 0) (-8 -8 -8) (8 8 8) start_off
Non-displayed light. If targeted, it will toggle between on or off.
Flags:
"start_off"
starts off until triggered
Keys:
"light"
sets brightness (default: 300)
"style"
0 = normal
1 = flicker (first variety)
2 = slow strong pulse
3 = candle (first variety)
4 = fast strobe
5 = gentle pulse
6 = flicker (second variety)
7 = candle (second variety)
8 = candle (third variety)
9 = slow strobe
10 = flourescent flicker
11 = slow pulse, not fading to black
styles 32-62 are assigned by the light program for switchable lights
(default: 0)
"targetname"
entity name
"delay" sets the attenuation formulae, possible values are:
0 (default) - Linear falloff, identical to id's original light program.
1 - Use the 1/x attenuation formula, has wider range than default.
2 - Use the 1/(x*x) attenuation formula, faster falloff than delay 1.
3 - No attenuation (light stays same brightness at any distance).
4 - Local minlight (no attenuation, non-additive and minlight override).
5 - Similar to 2 but with more attenuation and never brighter than "light" value.
*/
an regular QuakEd definition is what is in the quake source code and only has rigid syntax for the first line (which describes entity size, colour, classname and flags).
the rest is just plain text.
which editor are you using that has a definition like that?
Wow
#3 posted by Tronyn [24.79.203.208] on 2012/02/07 22:34:15
what a useful idea
Hmm
#4 posted by SleepwalkR [85.178.123.199] on 2012/02/07 22:55:26
Actually, I took that file from ToeTag, I think. No idea where Willem got it from. I thought it was the original file!
#5 posted by necros [99.227.132.108] on 2012/02/07 23:22:21
looks like he added some extensions to it.
thanks for bringing that to my attention though. eventually, i'd like to get all formats supported and the ones that actually have some syntax are much easier to deal with (the fgd reader was very straightforward to write).
#6 posted by Willem [199.255.40.36] on 2012/02/09 19:53:51
Is ... is there code in ToeTag that does something with that? I honestly can't remember writing that or doing anything with it. Those days were a blur of code though so I may have forgotten.
Willem
#7 posted by SleepwalkR [85.178.61.235] on 2012/02/09 19:59:00
I don't know if you use the information, but I think I ripped the .def file from ToeTag to use in my own editor. Hmm.
#8 posted by [99.227.132.108] on 2012/02/17 16:47:58
http://necros.slipgateconstruct.co...
so... the whole parser/converter is sort of taking a back seat...
it's still there (i have fgd parsing pretty much done, so fgd->ent is almost done, there's just no ent writer, but that's not that hard) but i think it'd be better to just make a program that lets you create entity definitions and then lets you export to whatever format you want.
and yeah, i'm making those guis by hand... :)
#9 posted by necros [99.227.132.108] on 2012/02/17 16:48:36
huh, how did i get logged out?
#10 posted by necros [174.113.119.133] on 2012/04/12 01:02:05
preliminary version of the gui converter:
http://necros.slipgateconstruct.co...
It's java, so you need the jvm. 1.6 is fine, i think. then you can just double click the .jar file.
Adding/Modifying/Deleting flags is broken, but everything else works fairly well.
There are also some missing features (like being able to add descriptions to keyvals and flags)
I tested on OSX and Ubuntu, and was annoyed to find some windows don't open properly making the program unusable. once everything is done, i'll look into fixing it.
I tried to make the GUI fairly user friendly, but i'm sure there will be things that are confusing. I started out making the guis by hand without a gui builder, so there were times where it was just too much effort to build the gui in the way i wanted and just settled for what was easier. :P
that said, it will import WC defs and Radiant defs (as well as /*QUAKED*/ defs out of .qc files!)
There is some data loss however, so don't rely too much on this.
Also, because I suck, some changes that might need to be made will make previous saved .qdb files incompatible.
so yeah... i suck.
anyway, i'd appreciate it someone just goofed around with it and let me know what they think.
A note on inheritance: Inheritance from FGD files works. Base classes are shown in [] brackets and other entities can ONLY inherit from them. (base classes can inherit other base classes).
When you export a database with inheritance as a .def or .ent, it basically bakes the inheritance onto the entities, so no information is lost there.
#11 posted by necros [174.113.119.133] on 2012/04/13 00:51:26
Fixed version:
http://necros.slipgateconstruct.co...
flag adding/modifying/deleting works now.
checks were added for overwriting files when saving/exporting

Post A Reply:

Name: |
Title: |
Body: |

Website copyright © 2002-2013 John Fitzgibbons. All posts are copyright their respective authors.