Higher level NFO?
Moderator: Graphics Moderators
Actually, you know what's interesting? Jonty, WhiteHand and I are all active users of GRFMaker, we're all under 18, and we all have zero to minimal programming experiance. Okay, I have a bit more than 'minimal', but anyways, it again shows, using GRFMaker isn't _hard_, but it isn't trivial.
Creating grf files is never (In my oppinion) going to get to the point where it's just 'push a few buttons and ZOMG! ITS TEH .GRF FILE', It's just something you have to put a bit of effort into learning.
Creating grf files is never (In my oppinion) going to get to the point where it's just 'push a few buttons and ZOMG! ITS TEH .GRF FILE', It's just something you have to put a bit of effort into learning.
Currently working under the name 'reldred' on Github, and Discord.
NFO/NML coder, part-time patch writer for JGRPP, and all round belligerent.
14:40 <orudge> I can't say I discriminate against any particular user
14:41 <Aegir> orudge: I can!
NFO/NML coder, part-time patch writer for JGRPP, and all round belligerent.
14:40 <orudge> I can't say I discriminate against any particular user
14:41 <Aegir> orudge: I can!
- Raichase
- Moderizzle
- Posts: 11509
- Joined: 15 Dec 2002 00:58
- Location: Sydney, Australia. Usually at work in the underground railway station...
- Contact:
Had to split the bad part off this topic.
Can we please stick to the topic? Thanks.
Can we please stick to the topic? Thanks.
Posted by Raichase. Visit my Flickr! Gallery, Blog (get a feed of everyone at once at Planet TT-Forums).
Raichase - Perfect timing, all the time: [13:37] * Now talking in #tycoon


Official TT-Dave Worley Fan Club
Official TT-Andel-in-a-pink-hat Fan Club
Raichase - Perfect timing, all the time: [13:37] * Now talking in #tycoon


Official TT-Dave Worley Fan Club
Official TT-Andel-in-a-pink-hat Fan Club
-
- Tycoon
- Posts: 5954
- Joined: 27 Apr 2005 07:09
- Contact:
Just some thoughts from someone who used to be a coder...
The problem I found with the NFO was not all the tedious things you had to make correct, but more the rapid expansion in things that could be done with the code with little or no explanation as to how it works or what function it serves.
I was getting by okay with simple stuff like new vehicles, wagon over-rides, partial loading graphics, rear-vehicle looking different, etc., but suddenly there came a burst of a whole new bunch of things.
What, in essence, seemed to strike me is that there was basically an 'in-crowd' of coders who were trying to do a lot of things inside the code that was impossible, and the developers responded by adding it in. Which is fine... Except only really the developers who'd implemented it and the in-crowd who'd ask for it knew what it was all about.
In the end, I had enough stuff to get done in my life without learning the nuances of a proto language that ultimately only existed to tweak a single game from years back.
I'd be quite interested in re-learning NFO coding. Even now after nearly two years I can look at my old code and know how it worked and what it did. But there's very little by way of demonstration to help people ease into the ever expanding functions. Just descriptions on syntax... For things which serve *what* purpose exactly?
Ronnie
The problem I found with the NFO was not all the tedious things you had to make correct, but more the rapid expansion in things that could be done with the code with little or no explanation as to how it works or what function it serves.
I was getting by okay with simple stuff like new vehicles, wagon over-rides, partial loading graphics, rear-vehicle looking different, etc., but suddenly there came a burst of a whole new bunch of things.
What, in essence, seemed to strike me is that there was basically an 'in-crowd' of coders who were trying to do a lot of things inside the code that was impossible, and the developers responded by adding it in. Which is fine... Except only really the developers who'd implemented it and the in-crowd who'd ask for it knew what it was all about.
In the end, I had enough stuff to get done in my life without learning the nuances of a proto language that ultimately only existed to tweak a single game from years back.
I'd be quite interested in re-learning NFO coding. Even now after nearly two years I can look at my old code and know how it worked and what it did. But there's very little by way of demonstration to help people ease into the ever expanding functions. Just descriptions on syntax... For things which serve *what* purpose exactly?
Ronnie
Any TT, TTD or OTTD sprites I have ever posted to this forum or elsewhere may be used as-is or in edited form free of charge for any purpose without credit in perpetuity.
There are parts of the NFO format for which I, too, am wondering if that question has an answer. But I trust that it does, and I proceed to file those parts under "Things to deal with later".Ronstar wrote:For things which serve *what* purpose exactly?
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
There are several things that I added because they were cool, easy to do and might potentially be useful (like procedure calls), but for which I didn't see an immediate use.
Still, most things do get used eventually... but you're right, most of the specs describe how things work, not what they're useful for. But I'm not in a position to fix that, since I only make sure they work as advertised, making them useful is up to the grf coders...
Still, most things do get used eventually... but you're right, most of the specs describe how things work, not what they're useful for. But I'm not in a position to fix that, since I only make sure they work as advertised, making them useful is up to the grf coders...
I am sorry to digg this topic out, but I changed my opinion.
Yes, it is not that hard to work with the NFO code if you understand it. But that changed nothing to the fact, that the Code structures are unclear and hard to read when you look over it after months.
I suggest to to put an XML-layer on top. There tons of libraries available, so no parser engine is needed. It's very common, easy to learn and human readable.
Locomotion uses it as well. OK, NFO is more powerful, but XML is very flexible.
just my 2¢
Yes, it is not that hard to work with the NFO code if you understand it. But that changed nothing to the fact, that the Code structures are unclear and hard to read when you look over it after months.
I suggest to to put an XML-layer on top. There tons of libraries available, so no parser engine is needed. It's very common, easy to learn and human readable.
Locomotion uses it as well. OK, NFO is more powerful, but XML is very flexible.
just my 2¢
I think the major problem with nfo (as far as I've understood it so far) is the lack of re-usability.
If you program with a high-level programming language, especially object-oriented, you can divide your project in many many kind and smart pieces (in OO that are the classes), that may be re-used in other projects or even the same project at another point, which increases efficiency (you "don't have to invent the wheel again and again").
The only question is how to implement something like this for nfo language. I have had the idea of a "compiler" that converts directly from a high level nfo language to grf files - or maybe a two-step-compiler: High level -> nfo text file -> grf file (where the last step is done by the already existing grfcodec).
The following was a very rough and quick mockup of a possible description language made by me in the beginning of this year. I neither know if it's useful, nor do I know if it really fulfills my own specification - as stated above: 'reusability' - but I nevertheless will put it here, maybe it inspires someone to overthink the problem more in detail, or at least it shows that a framework set on top of nfo does not make sense at all.
If you program with a high-level programming language, especially object-oriented, you can divide your project in many many kind and smart pieces (in OO that are the classes), that may be re-used in other projects or even the same project at another point, which increases efficiency (you "don't have to invent the wheel again and again").
The only question is how to implement something like this for nfo language. I have had the idea of a "compiler" that converts directly from a high level nfo language to grf files - or maybe a two-step-compiler: High level -> nfo text file -> grf file (where the last step is done by the already existing grfcodec).
The following was a very rough and quick mockup of a possible description language made by me in the beginning of this year. I neither know if it's useful, nor do I know if it really fulfills my own specification - as stated above: 'reusability' - but I nevertheless will put it here, maybe it inspires someone to overthink the problem more in detail, or at least it shows that a framework set on top of nfo does not make sense at all.
Code: Select all
// this is a comment, it will be ignored on compiling
name
"my set"
description
"my desc"
grfid
"TW" & 0x0305
spritelist
myfirstsprite = sprite(
"sprites/train.pcx",
pos(98, 8),
compressed,
size(18, 8),
relative(-3, -10) )
mysecondsprite = sprite(
... )
// this list could be autogenerated by a program that checks the pcx
// file for "blue boxes" and creates proper sprite definitions
spritesets
mygreatloco = set( nameofsprite1, ..., nameofspriteN )
actions
mylocomotive = create_rail_vehicle()
mybus = create_road_vehicle()
myship = create_ship()
myboeing747 = create_plane()
mystation = create_station()
mygoldengatebridge = create_bridge()
myhomesweethome = create_house()
myindustry = create_industry()
myufo = create_object()
mycargo = create_cargo()
mylocomotive.add_sprites(mygreatloco)
mylocomotive.set_props(weight, power, maxvelocity, color, ...)
loco1 = mylocomotive.clone()
loco2 = mylocomotive.clone()
loco1.set_velocity(x)
loco2.set_velocity(y)
// this is how a callback could be implemented:
if ( simulation.get_year > 1950 )
mylocomotive.use_sprites(mygreatlocowithRedColor)
else
mylocomotive.use_sprites(...)
etc....
// how to change game internal variables:
myvars = new global_variables()
if ( simulation.get_year > 1950 )
game.use(myvars)
else
...
// or maybe instead:
global_variables.inflation.set(100%) // set a hyperinflation period ^^
Like sun is to the dark soil,
so is true enlightenment to the soil's friends.
N.F.S. Grundtvig
so is true enlightenment to the soil's friends.
N.F.S. Grundtvig
-
- Tycoon
- Posts: 5954
- Joined: 27 Apr 2005 07:09
- Contact:
I have a strong feeling that RK digged the wrong thread.
The more interesting discussion had been here.
regards
Michael
The more interesting discussion had been here.
regards
Michael
I dunno, I find my nfo is pretty reusable. It's all standardised action 0s and blocks of action 2s that do particular things (and have a lot of comments to remind me exactly what they do!). When I make a new vehicle that doesn't have to do anything that I haven't done before, I copy and paste what I need, change a few values, and bosh it's done.Red*Star wrote:I think the major problem with nfo (as far as I've understood it so far) is the lack of re-usability.

I don't think NFO needs an OO abstraction. That would lead into a lot work.
I am sorry for that. Maybe I can bring that discussion to life again.michael blunck wrote:I have a strong feeling that RK digged the wrong thread.
The more interesting discussion had been here.
regards
Michael
Actually I made some preliminary XML specs for NFO coding, it's somewhere in my docs folder.. I can dig it up if someone is interested...RK wrote:...
I suggest to to put an XML-layer on top. There tons of libraries available, so no parser engine is needed. It's very common, easy to learn and human readable.
Locomotion uses it as well. OK, NFO is more powerful, but XML is very flexible. ...
Author of Hungarian signal set Current version: 0.2b, Semaphore drawing in progress.Linux is like a wigwam: no Gates, no Windows, Apache inside...
Maybe I still understand the nfo language not good enough to see where things could be reused. The only thing that got me to think about a higher-level nfo was that I regularly get confused by this assembler-like nfo language, or assembler in generalPikkaBird wrote:I dunno, I find my nfo is pretty reusable. It's all standardised action 0s and blocks of action 2s that do particular things (and have a lot of comments to remind me exactly what they do!). When I make a new vehicle that doesn't have to do anything that I haven't done before, I copy and paste what I need, change a few values, and bosh it's done.Red*Star wrote:I think the major problem with nfo (as far as I've understood it so far) is the lack of re-usability.

Of course it would be ^^. But I haven't said that it has to be explicitly OO. OO isn't even possible, because OO is a /programming/ paradigma, and nfo coding is not programming.RK wrote:I don't think NFO needs an OO abstraction. That would lead into a lot work.
Like sun is to the dark soil,
so is true enlightenment to the soil's friends.
N.F.S. Grundtvig
so is true enlightenment to the soil's friends.
N.F.S. Grundtvig
And where exactly did you get that idea?Red*Star wrote:and nfo coding is not programming.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
I wouldn't say that. Not all of NFO coding can be called programming, but handling non-trivial action2 chains (for callbacks, variational graphics and animations) is indeed programming, I've learnt that while coding the three TTRS versions. And if you don't believe me, ask George whether coding the complex behaviour of his industries is programming or just putting some sprites together...Red*Star wrote:nfo coding is not programming.
I agree with your main point, though. OO would be overkill for NFO.
Reality is that which, when you stop believing in it, doesn't go away.—Philip K. Dick
Here: [1]DaleStan wrote:And where exactly did you get that idea?Red*Star wrote:and nfo coding is not programming.
I know, it's kinda grey area, because you also could understood [O]TTD[Patch] as a kind of "interpreter" for "the nfo language". It's not that clear a I stated above, and I does not meant to do harm to any of you coders, out therewikipedia wrote:Computer programming (often shortened to programming or coding) is the process of writing, testing, and maintaining the source code of computer programs.

[1] http://en.wikipedia.org/wiki/Computer_programming
Like sun is to the dark soil,
so is true enlightenment to the soil's friends.
N.F.S. Grundtvig
so is true enlightenment to the soil's friends.
N.F.S. Grundtvig
-
- Tycoon
- Posts: 5954
- Joined: 27 Apr 2005 07:09
- Contact:
Even producing something like this
would be filed under "programming".
regards
Michael
Code: Select all
1001100011110010110001111110100010001101010
0100011000111110111110100100010000000010000
101001010000101010100101000101010 ...
regards
Michael
I definitely prefer WhiteSpace
(Now, why didn't that url come out right??)
http://tinyurl.com/ywp8kq
(Now, why didn't that url come out right??)
http://tinyurl.com/ywp8kq
Who is online
Users browsing this forum: Bing [Bot] and 26 guests