Any more information on how to build NewGRFs with nmlc??

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
lemmy101
Engineer
Engineer
Posts: 15
Joined: 22 Apr 2021 02:20

Any more information on how to build NewGRFs with nmlc??

Post by lemmy101 »

I feel like I want to strangle a bunny. Want to look into how GRFs are put together and the information is so sparse and distributed amongst 20 defunct websites and people linking to pages that no longer exist. I downloaded and built, as best I can tell, nml from the OpenTTD repo. So I then downloaded FIRS source to use as reference, which states a few prerequisites that need to be installed, which I have ostensibly done. I finally got 'make' working, and tried to build it and just want to cry after bashing my head off it for like 4 hours. I think nmlc is failing to load because 'ply' doesn't exist, but I installed ply via pip and python is convinced 'requirements are already satisfied' yet I just get these confusing errors insinuating it doesn't.

Traceback (most recent call last):
File "nmlc", line 3, in <module>
File "PyInstaller\loader\pyimod03_importers.py", line 540, in exec_module
File "nml\main.py", line 21, in <module>
File "PyInstaller\loader\pyimod03_importers.py", line 540, in exec_module
File "nml\parser.py", line 16, in <module>
ModuleNotFoundError: No module named 'ply'
[43728] Failed to execute script nmlc

I'm hoping this is all that is wrong because the makefile seems to be saying every 'CreateProcess' has failed and the output is not clear as to whether there are fails before this or the traceback shown at the end is the reason for those 10 fails above it.

PS D:\OpenTTD\firs> make
process_begin: CreateProcess(NULL, env python3 D:\OpenTTD\firs\bin\find-files --ext=.py --ext=.pynml --ext=.lng src, ...) failed.
process_begin: CreateProcess(NULL, env python3 D:\OpenTTD\firs\bin\find-files --ext=.py --ext=.pynml --ext=.pt --ext=.lng src, ...) failed.
process_begin: CreateProcess(NULL, which dot, ...) failed.
process_begin: CreateProcess(NULL, which gvpr, ...) failed.
process_begin: CreateProcess(NULL, which gvpr, ...) failed.
process_begin: CreateProcess(NULL, which dot, ...) failed.
process_begin: CreateProcess(NULL, env python3 D:\OpenTTD\firs\bin\find-files --ext=.py --ext=.pynml src, ...) failed.
process_begin: CreateProcess(NULL, env python3 D:\OpenTTD\firs\bin\find-files --ext=.py --ext=.png src, ...) failed.
nmlc -c -l generated/lang --verbosity=4 --grf=generated/firs.grf generated/firs.nml
Traceback (most recent call last):
File "nmlc", line 3, in <module>
File "PyInstaller\loader\pyimod03_importers.py", line 540, in exec_module
File "nml\main.py", line 21, in <module>
File "PyInstaller\loader\pyimod03_importers.py", line 540, in exec_module
File "nml\parser.py", line 16, in <module>
ModuleNotFoundError: No module named 'ply'
[37136] Failed to execute script nmlc
make: *** [generated/firs.grf] Error 1

This unix style makefile stuff always feels so obtuse and vague like you're just meant to innately understand how to do it all, I don't think I've ever managed to successfully build something with a makefile without these kinds of cascading problems (that wasn't cmake) and is one reason I've shied away from being involved with open source stuff in the past :( god bless lovely visual studio projects where you just load it up and click compile.
User avatar
2TallTyler
Transport Coordinator
Transport Coordinator
Posts: 306
Joined: 11 Aug 2019 18:15
Location: Massachusetts, USA
Contact:

Re: Any more information on how to build NewGRFs with nmlc??

Post by 2TallTyler »

FIRS is one of the more complicated NewGRFs to build because it uses Python to generate code. Try something simpler like my X2000 train made for a contest. It can be compiled by running nmlc from the command line on the merged NML file in src/merged, or using the simple Python script make.py in the root folder of the repo.

Also, you may want to join the OpenTTD Discord, where most NewGRF and a lot of game development is discussed, more so than the forums. :) There’s an invite link on the website:
https://wiki.openttd.org/en/Community/Community
lemmy101
Engineer
Engineer
Posts: 15
Joined: 22 Apr 2021 02:20

Re: Any more information on how to build NewGRFs with nmlc??

Post by lemmy101 »

Thanks! :)
Eddi
Tycoon
Tycoon
Posts: 7645
Joined: 17 Jan 2007 00:14

Re: Any more information on how to build NewGRFs with nmlc??

Post by Eddi »

lemmy101 wrote: 24 Apr 2021 11:28 ModuleNotFoundError: No module named 'ply'
if you ever encounter this type of error, the first impulse should be to run

Code: Select all

pip install ply
You might not exactly be interested in Ferion, but if you are, have fun :)
lemmy101
Engineer
Engineer
Posts: 15
Joined: 22 Apr 2021 02:20

Re: Any more information on how to build NewGRFs with nmlc??

Post by lemmy101 »

Eddi wrote: 24 Apr 2021 14:02
lemmy101 wrote: 24 Apr 2021 11:28 ModuleNotFoundError: No module named 'ply'
if you ever encounter this type of error, the first impulse should be to run

Code: Select all

pip install ply
Thanks! Yup that's exactly what I did, as I said it just reports "'requirements are already satisfied'" and the error continues.
User avatar
JGR
Tycoon
Tycoon
Posts: 2279
Joined: 08 Aug 2005 13:46
Location: Ipswich

Re: Any more information on how to build NewGRFs with nmlc??

Post by JGR »

You're probably better off using a Linux environment (Linux VM, WSL 2, or similar) and not native Windows.

As soon as you see make, Python, shell scripts, or any other standard POSIX tooling you should take it a strong hint to not use Windows.
Ex TTDPatch Coder
Patch Pack, Github
lemmy101
Engineer
Engineer
Posts: 15
Joined: 22 Apr 2021 02:20

Re: Any more information on how to build NewGRFs with nmlc??

Post by lemmy101 »

JGR wrote: 24 Apr 2021 16:44 You're probably better off using a Linux environment (Linux VM, WSL 2, or similar) and not native Windows.

As soon as you see make, Python, shell scripts, or any other standard POSIX tooling you should take it a strong hint to not use Windows.
Ha yup I can definitely see this is the case, however I've been pretty allergic to linux my entire life, made multiple attempts at installs or vms and can't help feeling it's not made for me, ended up with the rather angry feeling experience above magnified to doing even simpler things in the OS like unzipping a file or editing a text file. Will consider it but more likely will just look at the simpler grf stuff posted above. Too old and set in my ways to be excited to dive into linux again :D
User avatar
kamnet
Moderator
Moderator
Posts: 7556
Joined: 28 Sep 2009 17:15
Location: Eastern KY
Contact:

Re: Any more information on how to build NewGRFs with nmlc??

Post by kamnet »

WSL2 is dead simple to install and set up. I used a couple of YouTube videos to help me. Took all of 10 minutes to have an environment ready to go.
User avatar
Aegir
Tycoon
Tycoon
Posts: 2810
Joined: 09 Feb 2004 10:02
Contact:

Re: Any more information on how to build NewGRFs with nmlc??

Post by Aegir »

I can 2nd using WSL on windows. It's great, I've got a few of my projects to a point I can just shift+right click in a projects main folder, click 'Open Linux Shell Here', type make clean, then make, and just take the finished .grf and do whatever with it.

Also, you can just install all the NML components with PIP and call it a day, it'll install grfcodec, nforenum, nmlc and everything in your $PATH so you don't even have to worry, just run the commands in the Linux shell straight from whatever folder you're in. You can also launch those same linux shells from within VS2019 as well, so you can use VS as your IDE for working on .grf projects be they NFO or NML.

s***'s pretty comfy, yo.
Former NewGRF Coder and Sprite Artist.

Currently working under the name 'reldred' on Github, IRC and Discord.

14:40 <orudge> I can't say I discriminate against any particular user
14:41 <Aegir> orudge: I can!
lemmy101
Engineer
Engineer
Posts: 15
Joined: 22 Apr 2021 02:20

Re: Any more information on how to build NewGRFs with nmlc??

Post by lemmy101 »

Will check that out, thanks all <3
Auge
Route Supervisor
Route Supervisor
Posts: 457
Joined: 23 Oct 2006 02:07
Location: Berlin

Re: Any more information on how to build NewGRFs with nmlc??

Post by Auge »

Hello
lemmy101 wrote: 24 Apr 2021 15:02
Eddi wrote: 24 Apr 2021 14:02
lemmy101 wrote: 24 Apr 2021 11:28 ModuleNotFoundError: No module named 'ply'
if you ever encounter this type of error, the first impulse should be to run

Code: Select all

pip install ply
Thanks! Yup that's exactly what I did, as I said it just reports "'requirements are already satisfied'" and the error continues.
Do you possibly run multiple Python versions on your machine? Maybe a 2.7.x and a 3.x?

Tschö, Auge
lemmy101
Engineer
Engineer
Posts: 15
Joined: 22 Apr 2021 02:20

Re: Any more information on how to build NewGRFs with nmlc??

Post by lemmy101 »

Auge wrote: 25 Apr 2021 11:26 Hello
lemmy101 wrote: 24 Apr 2021 15:02
Eddi wrote: 24 Apr 2021 14:02
if you ever encounter this type of error, the first impulse should be to run

Code: Select all

pip install ply
Thanks! Yup that's exactly what I did, as I said it just reports "'requirements are already satisfied'" and the error continues.
Do you possibly run multiple Python versions on your machine? Maybe a 2.7.x and a 3.x?

Tschö, Auge
Nope! :(
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 7 guests