Hard Light Productions Forums

General FreeSpace => FreeSpace Discussion => Topic started by: TheGardinator on February 20, 2013, 04:29:25 pm

Title: FREDding - a programming language?
Post by: TheGardinator on February 20, 2013, 04:29:25 pm
Last time i worked around with some missions, this thought spooked in my head.

I mean, creating events, setting SEXP and all this stuff, based on logical linkages look for me like a, kinda simple, programming language.
I wonder, if you could define it as one, or it's just a way to create missions?
Title: Re: FREDding - a programming language?
Post by: The E on February 20, 2013, 04:39:36 pm
sexps are a lisp dialect. Describing them as a programming language is completely correct.
Title: Re: FREDding - a programming language?
Post by: Luis Dias on February 20, 2013, 04:46:32 pm
I don't see how it isn't a programming language. Most talented and experienced Fredders even use notepad to edit their missions.
Title: Re: FREDding - a programming language?
Post by: MatthTheGeek on February 20, 2013, 04:48:17 pm
It's turing-complete, isn't it ?
Title: Re: FREDding - a programming language?
Post by: TheGardinator on February 20, 2013, 04:54:20 pm
so, theoretically, when someone asks me, if i know a programming language, i can say: "Yes, i speak FRED" ?

I don't see how it isn't a programming language. Most talented and experienced Fredders even use notepad to edit their missions.

Oh, that's really a common way to edit missions?  :eek2: I do it that way even if I'm not very experienced.  :D
Title: Re: FREDding - a programming language?
Post by: MatthTheGeek on February 20, 2013, 04:57:05 pm
Notepad-editing of missions is useful in certain specific scenarios where FRED would be ill-suited, like large replacings by name, or simply not being arsed to wait for FRED to load :p

A .fs2 isn't much harder to decipher than your average table. A good way to see this would be to simply open FRED, save a blank mission, and see what the .fs2 looks like.
Title: Re: FREDding - a programming language?
Post by: TheGardinator on February 20, 2013, 05:04:52 pm
Thanks for the hint, Matth, it's as you say.

New ways of epic FREDding open up for me. *tries to sound like a god, creating a new race*
Title: Re: FREDding - a programming language?
Post by: MatthTheGeek on February 20, 2013, 05:24:37 pm
Don't get in over yer head, even our most senior FREDers here still use FRED for most of the job. UI has its undeniable advantages. It's just good to know that it's text-editable when you need it.
Title: Re: FREDding - a programming language?
Post by: Klaustrophobia on February 20, 2013, 07:04:29 pm
i can't imagine trying to remember all the available SEXPs and their syntax to write a mission entirely by notepad.
Title: Re: FREDding - a programming language?
Post by: Apollo on February 20, 2013, 07:23:42 pm
I use notepad sometimes, but I'm always scared I'll break something.

You know, POF files can be opened in notepad. I guess it would be technically possible (though extremely difficult) to make a model that way. :D
Title: Re: FREDding - a programming language?
Post by: Rodo on February 20, 2013, 07:45:55 pm
Yes, it's a sort of programing language.
Title: Re: FREDding - a programming language?
Post by: Goober5000 on February 20, 2013, 11:04:46 pm
FRED is Turing-complete because its programming language provides sequential execution, branching, and looping, plus variables.

Additionally, FRED comes with a bonus Turing-complete language if you consider the variable array (all 200 FRED variables) as "memory" and create sexps to interpret variable values as program instructions.
Title: Re: FREDding - a programming language?
Post by: The E on February 21, 2013, 07:45:04 am
I use notepad sometimes, but I'm always scared I'll break something.

You know, POF files can be opened in notepad. I guess it would be technically possible (though extremely difficult) to make a model that way. :D

No, it wouldn't. POF files are binary, so you're better off using a hex editor; text editors have much greater potential to **** things up.
Title: Re: FREDding - a programming language?
Post by: blowfish on February 21, 2013, 01:43:43 pm
i can't imagine trying to remember all the available SEXPs and their syntax to write a mission entirely by notepad.

The Wiki and the source code provide a handy reference.

You know, POF files can be opened in notepad. I guess it would be technically possible (though extremely difficult) to make a model that way. :D

There are chunks which are relatively easy to edit with a hex editor (I've done this in the past for certain things), but a lot of the data is simply too complicated and dense to reasonably expect it to be human-understandable.  Particularly for things like collision data.  An XML format like DAE might be a bit more readable, but I wouldn't recommend trying to get any substantial amount of editing done this way.
Title: Re: FREDding - a programming language?
Post by: FSW on February 22, 2013, 04:07:37 pm
Out of curiosity: could there be any FS2 mission designs that are impossible to achieve using FRED, but can be coded through a text editor?
Title: Re: FREDding - a programming language?
Post by: Axem on February 22, 2013, 05:36:52 pm
It's possible, though both FRED and Freespace check for the same sort of errors when parsing missions. So any tricks you try to bypass FRED with, Freespace would probably catch them.

BUT, there are some campaign file shenanigans you can only pull off in notepad and not FRED. FRED doesn't really allow infinitely looping campaign paths. You can go down a path, but not up. But by fiddling with the advancement conditions in notepad, you can make the campaign advance to a previous mission. FRED and FreeSpace will allow it and won't complain about it. JAD2 and War in Heaven Act 3 have used that technique for some neato tricks. As well Goober's FreeSpaceLancer was a proof of concept for the whole technique.
Title: Re: FREDding - a programming language?
Post by: karajorma on February 22, 2013, 08:40:29 pm
Out of curiosity: could there be any FS2 mission designs that are impossible to achieve using FRED, but can be coded through a text editor?

Actually anything involving in-mission cutscenes like Wing Commander had is impossible since I never got around to creating the Editor to add them. :D
Title: Re: FREDding - a programming language?
Post by: mjn.mixael on February 22, 2013, 08:43:52 pm
I use those in BtA too.
Title: Re: FREDding - a programming language?
Post by: jg18 on February 22, 2013, 10:05:31 pm
FRED is Turing-complete because its programming language provides sequential execution, branching, and looping, plus variables.

Additionally, FRED comes with a bonus Turing-complete language if you consider the variable array (all 200 FRED variables) as "memory" and create sexps to interpret variable values as program instructions.

Hm, so in theory, FSO could be used to implement a compiler or interpreter? I look forward to seeing a C compiler (or JVM!) written in FRED. I wonder if those would be fun to play. ;7
Title: Re: FREDding - a programming language?
Post by: karajorma on February 22, 2013, 11:28:42 pm
I have a build knocking about which allows mission designers to implement deques if that would help. :p
Title: Re: FREDding - a programming language?
Post by: Apollo on February 25, 2013, 07:29:13 am
I use notepad sometimes, but I'm always scared I'll break something.

You know, POF files can be opened in notepad. I guess it would be technically possible (though extremely difficult) to make a model that way. :D

No, it wouldn't. POF files are binary, so you're better off using a hex editor; text editors have much greater potential to **** things up.

Oh. I thought that any type of file could be edited in Notepad, even if it's extremely difficult to do it that way.
Title: Re: FREDding - a programming language?
Post by: Luis Dias on February 25, 2013, 10:32:54 am
I use notepad sometimes, but I'm always scared I'll break something.

You know, POF files can be opened in notepad. I guess it would be technically possible (though extremely difficult) to make a model that way. :D

No, it wouldn't. POF files are binary, so you're better off using a hex editor; text editors have much greater potential to **** things up.

Oh. I thought that any type of file could be edited in Notepad, even if it's extremely difficult to do it that way.

lolwot
Title: Re: FREDding - a programming language?
Post by: Crybertrance on February 26, 2013, 07:48:01 am
I use notepad sometimes, but I'm always scared I'll break something.

You know, POF files can be opened in notepad. I guess it would be technically possible (though extremely difficult) to make a model that way. :D

No, it wouldn't. POF files are binary, so you're better off using a hex editor; text editors have much greater potential to **** things up.

Oh. I thought that any type of file could be edited in Notepad, even if it's extremely difficult to do it that way.

 :wtf: Lol... You can't even edit a .doc file with notepad! About 99% of the files you are likely to have on a PC cannot be edited in n/p
Title: Re: FREDding - a programming language?
Post by: FreeSpaceFreak on February 26, 2013, 11:32:29 am
Oh. I thought that any type of file could be edited in Notepad, even if it's extremely difficult to do it that way.
If a text editor is able to write all 256 possible bytes (I'm not sure if M$ Notepad does), then yes, it is technically possible. But, as you noted, for binary-encoded files (like .doc, .pof and also .exe) this would be extremely difficult, bordering on the impossible. Hex editors are more suited for that, they are for binary files what Notepad is for ASCII files.
Title: Re: FREDding - a programming language?
Post by: Luis Dias on February 26, 2013, 12:57:31 pm
Damn I remember the days when I used a dos hex editor to edit dune2, simcity (etc.) player files and get infinite cash.