Page 1 of 2

ToyTrax: Coding Questions

Posted: 12 Aug 2017 22:04
by SimYouLater
The ToyTrax development topic can be found here.

Original Post: "TTD-Scale"
[+] Spoiler
Image

UGH! It's hideous! Can't... look... directly... at it...

Image

Yeah, I'll just be turning on OpenGFX now, thank you very-

Image

Wait.

This is...

Actually really boring.

TTD-Scale: How can it be done?

We can all agree that Toyland was an eyesore. The issue I'm seeing with it seems to be that it's too "busy" and bright, though. You might hate the tracks and roads too, but IMO they are the one thing in Toyland that looks worse in OpenGFX. So here's my idea...

A tracktype that uses the original TTD Toyland rails, and static road graphics from same, unless licensing makes this utterly impossible (in which case I guess I'll have to learn to do good spriting for the first time since the webcomic bubble of the mid-2000's). Which means some questions...

Is it possible to re-use original TTD graphics under any license whatsover, or if not, under no license at all?
If so, what options would be available? Is editing them (such as to make the static roads into an NRT roadtype or create static tram tracks/tramtype) banned, if not use?
If not allowed at all, to what degree am I legally allowed to use the original TTD graphics as inspiration?


Is there any single tracktype NewGRFs licensed under GPL v2 and coded in NML which I can use as a starting point?

Re: "TTD-Scale": License Question

Posted: 13 Aug 2017 09:08
by kamnet
As to the legalities, unless somebody is willing to speak as a lawyer (they're not), nobody can say with any certainty what you're legally allowed to do with somebody else's copyrighted works.

But, what you could try, and I'm won't guarantee that this will work... what you could try is to write an NFO or NML file that references the original TTD sprites, and then distribute that file, and require that players a) either own or legally obtain a copy of the TTD sprites, and b) compile the NewGRF on their own, with the understanding that they are not allowed to distribute that NewGRF.

Re: "TTD-Scale": License Question

Posted: 13 Aug 2017 19:18
by Alberth
SimYouLater wrote:Is it possible to re-use original TTD graphics under any license whatsover, or if not, under no license at all?
If you have the rights of some work, you can relicense it to anything you want.

Since you're not the owner of OpenTTD sprites (seems likely at least), you cannot change its license, or distribute it without permission of the owner (unless you can provide proof that he has given such rights away, but given you are asking, you likely don't have that either).

If you want to go ahead anyway, and use the original sprites, you should probably ask a real lawyer instead of some $random noob people at the Internet.


Copying the graphics doesn't make it your work. "Inspired" well yeah, but as a precaution I'd use a free set of tracks as source of inspiration instead. Much less dangerous. Ideally you'd never have seen the tracks, but that's a bit difficult :)
I think you should aim for an improved set rather than a copy, since they already exist, and it's pointless to make it again.

As for toyland being an eyesore, nah, you get used to it, really :)
I played hours and hours in that climate, it has awesome industries!

Alternatively, use OpenGFX+landscape (if I remember correctly), it provides temperate green in toyland climate, so you can play your favourite industries in lucious green grass.

Re: "TTD-Scale": License Question

Posted: 13 Aug 2017 19:48
by Supercheese
But.... I like Toyland! :|

Re: "TTD-Scale": License Question

Posted: 13 Aug 2017 20:31
by SimYouLater
Supercheese wrote:But.... I like Toyland! :|
I do like the infrastructure from it. Useless in most games, but it would be a fun option to have a "TTD-Scale" tracktype and roads. Unfortunately any other Toyland infrastructure except the hideous industries and the cute but unsuitable (IMO) buildings would have to be programmed in NFO IIRC.

Re: "TTD-Scale": Questions

Posted: 20 Aug 2017 18:09
by SimYouLater
Okay, I think I know how I'm going to do this, but I just have one problem. The only NML codebases that I can find for tracktypes are large and composed of .pnml files which are useless to my level of experience, or licensed in GPL v3... and the only GPL v2 tracktype newgrfs I can find are either NFO or, you guessed it, composed of a s***ton of .pnml files.

Help?

Re: "TTD-Scale": Questions

Posted: 21 Aug 2017 06:19
by Gwyd
Sure. What do you need?

Re: "TTD-Scale": Questions

Posted: 22 Aug 2017 04:59
by SimYouLater
Gwyd wrote:Sure. What do you need?
Source code in a single NML file along with with the graphics, containing only a single tracktype, licensed in GPL v2. Thanks beforehand.

Re: "TTD-Scale": Questions

Posted: 22 Aug 2017 05:46
by Gwyd
Would it be possible to link me the large and complex sets of .pnmls, then I can work from there.

Re: "TTD-Scale": Questions

Posted: 22 Aug 2017 06:05
by luxtram
SimYouLater wrote:the only GPL v2 tracktype newgrfs I can find are either NFO or, you guessed it, composed of a s***ton of .pnml files.
Source in pnml is the same as is nml with the difference that you first have to combine a single nml before feeding it to the nmlc (nml compiler). This is usually done by the C (language) preprocessor (i.e. the program that does the same for the C files).

Usually there is a so called main pnml file that then contains multiple #include statements what inserts the individual pnml files. There can be also #define statements that can be used to define constants (i.e. values that have name) or macros (i.e. small code snippets that have name). These can be then used instead of values/code blocks (makes code more understandable and easier to manage in the long run).

So pnml or nml is pretty much the same. There is very small difference in the end.

Only thing you nee is a C compiler (precompiler comes with it).

There is probably included also a .bat file (for Windows) or .sh file (for Linux or OSX, or other Unix derivatives). This contains shell (command line) commands to orchestrate the whole compiling process. So which compiler you need to install mostly depends on this - check if it uses gcc (GNU C Compiler) or vc (Visual studio C compiler, community edition is more than fine for this).

You can also post the link to the source code so I could investigate it.

Re: "TTD-Scale": Questions

Posted: 22 Aug 2017 08:09
by SimYouLater
luxtram wrote:
SimYouLater wrote:the only GPL v2 tracktype newgrfs I can find are either NFO or, you guessed it, composed of a s***ton of .pnml files.
Source in pnml is the same as is nml with the difference that you first have to combine a single nml before feeding it to the nmlc (nml compiler). This is usually done by the C (language) preprocessor (i.e. the program that does the same for the C files).

Usually there is a so called main pnml file that then contains multiple #include statements what inserts the individual pnml files. There can be also #define statements that can be used to define constants (i.e. values that have name) or macros (i.e. small code snippets that have name). These can be then used instead of values/code blocks (makes code more understandable and easier to manage in the long run).

So pnml or nml is pretty much the same. There is very small difference in the end.

Only thing you nee is a C compiler (precompiler comes with it).

There is probably included also a .bat file (for Windows) or .sh file (for Linux or OSX, or other Unix derivatives). This contains shell (command line) commands to orchestrate the whole compiling process. So which compiler you need to install mostly depends on this - check if it uses gcc (GNU C Compiler) or vc (Visual studio C compiler, community edition is more than fine for this).

You can also post the link to the source code so I could investigate it.
It appears it's worse than I thought. Going through the list again to find a GPL v2 single tracktype in .pnmls turned up nothing. The only GPL v2 single tracktype out there is FS-Maglev which is programmed in NFO. I basically need a small and simple example to work with in GPL v2, which doesn't seem to exist.

EDIT: Also, I noticed that the North American Track Set is licensed as GPL v2, yet the "website" button takes me to Nekomaster's userpage. Nothing in the readme indicates where the source code is.

Re: "TTD-Scale": Questions

Posted: 22 Aug 2017 09:13
by Kruemelchen
Why not have a look at NuTracks? I always thought it's clean and easy to understand NML code.

i.e. the main file
http://dev.openttdcoop.org/projects/nut ... racks.pnml

of course you'd need to cut out all the unnecessary parts...
but you can easily take every #included file and cut out everything that defines anything different than what is used for the RAIL tracktype

PS: I guess for single tracktype NewGRFs you won't find pnml examples, as it doesn't make any sense to you pnml if you only have 1 tracktype :)

PPS: If I remember correctly there has been some ruckus with NuTracks and copyright some time ago? But I don't think this had anything to do with the source code, as it is clearly stated as GPLv2 (even though the author puts a copyright claim on it too which doesn't make any sense if you use GPL but that's just my 2 cents...)

Re: "TTD-Scale": Questions

Posted: 23 Aug 2017 10:22
by oberhümer
Kruemelchen wrote: the author puts a copyright claim on it too which doesn't make any sense if you use GPL
On the contrary, it certainly does, because copyright is what allows me to impose license terms in the first place. Copyright statements are still not really necessary, but nice to have.
The copyright issues with NuTracks concerned modified versions that included non-freely licensed track graphics.

As for the NuTracks code, I agree it might be a bit complex for a beginner. SimYouLater, the NML rail/track types page contains a simpler example, if you haven't checked it out yet. Not complete GRF code though, that would be a nice addition.

Re: "TTD-Scale": Questions

Posted: 24 Aug 2017 18:24
by SimYouLater
oberhümer wrote:
Kruemelchen wrote: the author puts a copyright claim on it too which doesn't make any sense if you use GPL
On the contrary, it certainly does, because copyright is what allows me to impose license terms in the first place. Copyright statements are still not really necessary, but nice to have.
The copyright issues with NuTracks concerned modified versions that included non-freely licensed track graphics.

As for the NuTracks code, I agree it might be a bit complex for a beginner. SimYouLater, the NML rail/track types page contains a simpler example, if you haven't checked it out yet. Not complete GRF code though, that would be a nice addition.
This would definitely help. I'll see if I can't release TTD-Scale and FicTown+ Names before going into lurker mode for the forseeable future.

Re: ToyTrax: Coding Questions

Posted: 28 Apr 2018 22:10
by SimYouLater
Can someone explain why the ToyTrax and ElecTrax don't allow normal (standard gauge) trains on them?

Re: ToyTrax: Coding Questions

Posted: 29 Apr 2018 05:58
by Quast65
I am not a trackcoder, so I cant help you personally, but have you checked out Foobars Metro Track Set?
viewtopic.php?f=67&t=49476&hilit=metro+trackset
You can have that either as extra railtype or as replacement for maglev/monorail.
But (via parameter) you can also run "normal" (non)electrified trains on it. Isnt that close to what you want to get?
Its sourcecode may help you (and is GPLv2)...

Re: ToyTrax: Coding Questions

Posted: 29 Apr 2018 17:31
by SimYouLater
Here is my latest set of code. Gwyd was unable to help me fix the issue, and I can't figure it out myself.

Basically, no trains will appear on ToyTrax. We don't know why, the code is supposed to be able to allow RAIL and ELRL to be compatible.

We've already determined that TYTX and ELTX labels are not the issue. Changing them to SAAN and SAAE still results in having no trains available to purchase.

Re: ToyTrax: Coding Questions

Posted: 29 Apr 2018 18:10
by PikkaBird
SimYouLater wrote:Basically, no trains will appear on ToyTrax. We don't know why, the code is supposed to be able to allow RAIL and ELRL to be compatible.
It's been a while since I coded a track set, but I think these properties are not reciprocal; that is, if you want to allow RAIL and ELRL vehicles to use ELTX, you need to modify RAIL and ELRL.

Re: ToyTrax: Coding Questions

Posted: 29 Apr 2018 18:13
by SimYouLater
PikkaBird wrote:
SimYouLater wrote:Basically, no trains will appear on ToyTrax. We don't know why, the code is supposed to be able to allow RAIL and ELRL to be compatible.
It's been a while since I coded a track set, but I think these properties are not reciprocal; that is, if you want to allow RAIL and ELRL vehicles to use ELTX, you need to modify RAIL and ELRL.
Ah. So I would need to include RAIL and ELRL sections in the nml?

Re: ToyTrax: Coding Questions

Posted: 29 Apr 2018 22:12
by CMircea
Try definiting RAIL & ERLR, add your custom track type as compatible to RAIL & ELRL and see if that does the trick.