Questions about coding and drawing

Discuss, get help with, or post new graphics for TTDPatch and OpenTTD, using the NewGRF system, here. Graphics for plain TTD also acceptable here.

Moderator: Graphics Moderators

User avatar
fridaemon
Director
Director
Posts: 625
Joined: 27 Oct 2019 21:06
Location: Czech Republic

Questions about coding and drawing

Post by fridaemon »

Hello everyone ;)

I play OpenTTD for years. After GarryG contacted me with ideas for his new graphics, I decided to gradually start creating my own graphics. I started with objects (for me the simplest graphic). During the shopping, I realized that in the cities there are no shopping centers. So I've created two ones for now. I had no idea where to start, but in the end I created something. GarryG sent me folder with needed files and created .grf file for me, but In the future I'd like to do it alone.

I started this topic because if someone else wanted to create something of his own to know where to start.

My OpenTTD friend told me to install NML 5, but I lost in the 1st step. I downloaded ir from https://www.openttd.org/downloads/grfco ... atest.html , extract folder to D:\openttdgraphic\... , and now what? :shock:

I created websites in CSS and HTML so programming is not so far from me. But I never (maybe 2-5 times very earlier) code in Command Promt. Can somebody help me with it, please? I'm Windows 10 User.

My first graphics:
Image

Image
Last edited by fridaemon on 04 Aug 2021 13:05, edited 1 time in total.
ImageImageImageImageImage
Beach Objects * Shopping Centres * Skyscrapers * Garage Entrances
Modular Warehouses * Trucks & Buses Parking Lots * Bus Depots * Bus Terminals
Road Waypoints * Road Stops * Eyecandy Objects * Building Set

Winner of the Screenshot of 09/20, 11/20, 02/21, 06/21, 07/21, 05/22 and 06/22.:twisted:
User avatar
Emperor Jake
Tycoon
Tycoon
Posts: 3427
Joined: 24 Apr 2007 09:37
Skype: Discord: Emperor Jake #4106
Location: Not Actually Japan
Contact:

Re: Releasing New Object Graphic - Begginer Tutorial

Post by Emperor Jake »

fridaemon wrote: 04 Aug 2020 18:04 My OpenTTD friend told me to install NML 5, but I lost in the 1st step. I downloaded ir from https://www.openttd.org/downloads/grfco ... atest.html , extract folder to D:\openttdgraphic\... , and now what?
You said you need NML, but what you actually downloaded there is GRFCodec. NMLC and GRFCodec are different programs, and while both are essential for any GRF creator, NMLC is the one you want, get it here: http://bundles.openttdcoop.org/nml/releases/0.4.5/ (I'm not sure where to find windows binaries for newer versions so if someone could point me in the right direction...) Everything's moved to github now so here: https://github.com/OpenTTD/nml/releases

Here's now to install it: https://www.tt-wiki.net/wiki/NMLTutorial/Installation

Now NML doesn't need to be coded in the command prompt. Just use a text editor such as notepad++. The only command you'll be needing is something along the lines of

Code: Select all

nmlc -c --grf mygrf.grf mygrf.nml
Once that's all set up, here's the tutorial on coding Objects: https://www.tt-wiki.net/wiki/NMLTutorial/Object

Hope this helps :)
Last edited by Emperor Jake on 05 Aug 2020 11:34, edited 1 time in total.
perverted monkey
Traffic Manager
Traffic Manager
Posts: 161
Joined: 02 Mar 2009 02:07

Re: Releasing New Object Graphic - Begginer Tutorial

Post by perverted monkey »

:D Nice shopping centers.
But flipping the image doesn't suffice because then shading is wrong. You will have to redraw and/or reshade.
User avatar
fridaemon
Director
Director
Posts: 625
Joined: 27 Oct 2019 21:06
Location: Czech Republic

Re: Releasing New Object Graphic - Begginer Tutorial

Post by fridaemon »

Emperor Jake wrote: 05 Aug 2020 04:44 Hope this helps :)
Perfect! Love you! :lol: I've just created my first grf file :D
I had just one problem with downloading nml folder - I had to few times press resume in downloading beacouse of this error.
Image
ImageImageImageImageImage
Beach Objects * Shopping Centres * Skyscrapers * Garage Entrances
Modular Warehouses * Trucks & Buses Parking Lots * Bus Depots * Bus Terminals
Road Waypoints * Road Stops * Eyecandy Objects * Building Set

Winner of the Screenshot of 09/20, 11/20, 02/21, 06/21, 07/21, 05/22 and 06/22.:twisted:
User avatar
fridaemon
Director
Director
Posts: 625
Joined: 27 Oct 2019 21:06
Location: Czech Republic

Re: Releasing New Object Graphic - Begginer Tutorial

Post by fridaemon »

perverted monkey wrote: 05 Aug 2020 06:01 But flipping the image doesn't suffice because then shading is wrong. You will have to redraw and/or reshade.
Thanks for the warning, I honestly didn't think of that. :) I'll repair it.

If anyone have any advice, come with it :)
ImageImageImageImageImage
Beach Objects * Shopping Centres * Skyscrapers * Garage Entrances
Modular Warehouses * Trucks & Buses Parking Lots * Bus Depots * Bus Terminals
Road Waypoints * Road Stops * Eyecandy Objects * Building Set

Winner of the Screenshot of 09/20, 11/20, 02/21, 06/21, 07/21, 05/22 and 06/22.:twisted:
User avatar
jfs
Tycoon
Tycoon
Posts: 1750
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: Releasing New Object Graphic - Begginer Tutorial

Post by jfs »

The newer NML downloads are here: https://github.com/OpenTTD/nml/releases
User avatar
Chataigne
Engineer
Engineer
Posts: 16
Joined: 20 Apr 2018 08:01
Location: Lyon, France

Re: Releasing New Object Graphic - Begginer Tutorial

Post by Chataigne »

Hey, very nice shopping center ! :D

I'm planning to create some shopping center/supermarket too for my new project "European Building Set" viewtopic.php?f=26&t=87346
I coded some grf file for me, with NML and particulary for house set. If you need help to code this building i can help you :wink:
User avatar
fridaemon
Director
Director
Posts: 625
Joined: 27 Oct 2019 21:06
Location: Czech Republic

Re: Releasing New Object Graphic - Begginer Tutorial

Post by fridaemon »

Thanks to you, Chataigne, and to all here :))) I'm impatiently waiting for your graphics :twisted: GarryG helps me with coding, Now I can create grf file, edit and add other buildings here, but only in 2x2 size. I need templates for other sizes - 1x1, 2x1, 1x2 for now. Can u send me them? And coding for these templates like an object. Or If you have any link with this informations, I'll be happy about it :)
ImageImageImageImageImage
Beach Objects * Shopping Centres * Skyscrapers * Garage Entrances
Modular Warehouses * Trucks & Buses Parking Lots * Bus Depots * Bus Terminals
Road Waypoints * Road Stops * Eyecandy Objects * Building Set

Winner of the Screenshot of 09/20, 11/20, 02/21, 06/21, 07/21, 05/22 and 06/22.:twisted:
User avatar
Chataigne
Engineer
Engineer
Posts: 16
Joined: 20 Apr 2018 08:01
Location: Lyon, France

Re: Releasing New Object Graphic - Begginer Tutorial

Post by Chataigne »

I know much more NML for house set than object. Here is the template i use for a 1x1 house size :
Template_House 1x1.nml
(2.89 KiB) Downloaded 116 times
Template_house1x1_ground.png
Template_house1x1_ground.png (1.92 KiB) Viewed 4306 times
Template_House1x1_building.png
Template_House1x1_building.png (3.33 KiB) Viewed 4306 times

Making a 1x2, 2x1 or 2x2 is not quite different than the 1x1. just change "HOUSE_Size_1x1" by the one you want in

Code: Select all

item(FEAT_HOUSES, BUILDING001, 01, HOUSE_SIZE_1X1)
and assume that your next house ID is the second part of the building. You will have

Code: Select all

item(FEAT_HOUSES, BUILDING001, 01, HOUSE_SIZE_1X2)
/* first part of the house*/ 
 item(FEAT_HOUSES, BUILDING002, 02, HOUSE_SIZE_1X2)
 /* second part of the house */ 
Last edited by Chataigne on 06 Aug 2020 12:41, edited 1 time in total.
User avatar
fridaemon
Director
Director
Posts: 625
Joined: 27 Oct 2019 21:06
Location: Czech Republic

Re: Releasing New Object Graphic - Begginer Tutorial

Post by fridaemon »

Or is here a way how to extract grf file to nml, gfx and lang files. I'd like to see source codes of objects and learn it.
ImageImageImageImageImage
Beach Objects * Shopping Centres * Skyscrapers * Garage Entrances
Modular Warehouses * Trucks & Buses Parking Lots * Bus Depots * Bus Terminals
Road Waypoints * Road Stops * Eyecandy Objects * Building Set

Winner of the Screenshot of 09/20, 11/20, 02/21, 06/21, 07/21, 05/22 and 06/22.:twisted:
User avatar
fridaemon
Director
Director
Posts: 625
Joined: 27 Oct 2019 21:06
Location: Czech Republic

Re: Releasing New Object Graphic - Begginer Tutorial

Post by fridaemon »

Chataigne wrote: 06 Aug 2020 12:39
Thanks =)
ImageImageImageImageImage
Beach Objects * Shopping Centres * Skyscrapers * Garage Entrances
Modular Warehouses * Trucks & Buses Parking Lots * Bus Depots * Bus Terminals
Road Waypoints * Road Stops * Eyecandy Objects * Building Set

Winner of the Screenshot of 09/20, 11/20, 02/21, 06/21, 07/21, 05/22 and 06/22.:twisted:
User avatar
Chataigne
Engineer
Engineer
Posts: 16
Joined: 20 Apr 2018 08:01
Location: Lyon, France

Re: Releasing New Object Graphic - Begginer Tutorial

Post by Chataigne »

Unfortunately there is no way to extract a NML file from a GRF. You can extract to a NFO (i don't understand anything to NFO :lol: ) and gfx in png for exemple using grfcodec.

For object i can show you this exemple i do :
Template_Object.nml
(2.83 KiB) Downloaded 91 times
Template_Object.png
Template_Object.png (3 KiB) Viewed 4292 times
User avatar
kamnet
Moderator
Moderator
Posts: 8548
Joined: 28 Sep 2009 17:15
Location: Eastern KY
Contact:

Re: Releasing New Object Graphic - Begginer Tutorial

Post by kamnet »

fridaemon wrote: 06 Aug 2020 12:41 Or is here a way how to extract grf file to nml, gfx and lang files. I'd like to see source codes of objects and learn it.
If it's in NML, then most likely whoever wrote it still has the original source code. Just politely ask them if you can look at it.
User avatar
2TallTyler
Route Supervisor
Route Supervisor
Posts: 495
Joined: 11 Aug 2019 18:15
Contact:

Re: Releasing New Object Graphic - Begginer Tutorial

Post by 2TallTyler »

I learned nearly everything I know about NML from the NML specs on TT-Wiki.

Looking at other people's code is also helpful. My industry set includes objects of various sizes (code) and my town set replaces all base game houses and adds a lot of new logic (code). Both use built-in sprite numbers instead of new sprites, but the item definitions may help you.
User avatar
GarryG
Tycoon
Tycoon
Posts: 5850
Joined: 14 Feb 2015 00:44
Location: Newcastle, Australia

Re: Releasing New Object Graphic - Begginer Tutorial

Post by GarryG »

These might be of use to you guys .. when making objects and other things for OpenTTD the old way if the item was larger then 1x1 you had to cut it in pieces to code it is. Your template be something like this for a 2x1 object.
template_2x1_001.png
template_2x1_001.png (3.18 KiB) Viewed 4183 times
But some time back Quast65 and I worked on a way so no need to do that.
Now the templates be like this.
test1x2x4_1.png
test1x2x4_1.png (2.74 KiB) Viewed 4183 times
We had them all uploaded on forum a few years ago but they be buried some where in all those pages of my objects and other locations, so if like here they are again.

This has 2x2, 2x3, 3x3 and 4x4 sizes.

Hope they help.
Attachments
Sprite_Templates_Objects.rar
(331.07 KiB) Downloaded 101 times
Soot Happens
Screenshot Of The Month Winner March 2020
All my projects are GPLv2 License unless stated.
Auz Road Sets: viewtopic.php?f=29&t=87335
Auz Project Releases: viewtopic.php?f=67&t=84725
Auz Trains: http://www.tt-forums.net/viewtopic.php?f=26&t=74193
Auz Industry Sets: http://www.tt-forums.net/viewtopic.php?f=26&t=74471
Auz Objects: viewtopic.php?f=26&t=75657
Auz Bridges: viewtopic.php?f=26&t=75248
Auz Stations: viewtopic.php?f=26&t=76390
Auz Tracks: viewtopic.php?f=26&t=82691
Auz Subway Stations: viewtopic.php?f=26&t=85335
Auz Eyecandy TramTracks: viewtopic.php?t=89908
User avatar
GarryG
Tycoon
Tycoon
Posts: 5850
Joined: 14 Feb 2015 00:44
Location: Newcastle, Australia

Re: Releasing New Object Graphic - Begginer Tutorial

Post by GarryG »

Here the 2x1 I forgot to add to the others.

Also done similar for Industries as well in size1x2, 1x3, 2x2, 2x3, 3x3, 4x4, 6x6, 8x8 and 12x12. Let us know if want these as well.

Cheers
Attachments
ObjectsTest1x2_4views.rar
(43.22 KiB) Downloaded 114 times
Soot Happens
Screenshot Of The Month Winner March 2020
All my projects are GPLv2 License unless stated.
Auz Road Sets: viewtopic.php?f=29&t=87335
Auz Project Releases: viewtopic.php?f=67&t=84725
Auz Trains: http://www.tt-forums.net/viewtopic.php?f=26&t=74193
Auz Industry Sets: http://www.tt-forums.net/viewtopic.php?f=26&t=74471
Auz Objects: viewtopic.php?f=26&t=75657
Auz Bridges: viewtopic.php?f=26&t=75248
Auz Stations: viewtopic.php?f=26&t=76390
Auz Tracks: viewtopic.php?f=26&t=82691
Auz Subway Stations: viewtopic.php?f=26&t=85335
Auz Eyecandy TramTracks: viewtopic.php?t=89908
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: Releasing New Object Graphic - Begginer Tutorial

Post by wallyweb »

fridaemon wrote: 06 Aug 2020 12:41 Or is here a way how to extract grf file to nml, gfx and lang files. I'd like to see source codes of objects and learn it.
If a GRF is licensed under GPL, then the source code must be readily/easily available. Ideally it should be included with the distribution, but as I understand it, it is also acceptable to substitute a link that points to the repository that includes the source code. Check the readme file that should also be included with the distribution.
User avatar
fridaemon
Director
Director
Posts: 625
Joined: 27 Oct 2019 21:06
Location: Czech Republic

Re: Releasing New Object Graphic - Begginer Tutorial

Post by fridaemon »

Hello again, I'm back and working and testing. I have to go to work and do houseworks so my time here is limited :D
Now I have few shops, still demos. The first one is Tesco Market from Poland Building set. I combine my graphic with AuzCarParks and AuzObjects. viewtopic.php?f=26&t=75657


Image
fridaemonobjects.grf
(214.94 KiB) Downloaded 112 times


First - I have few questions, again:
Image
  • 1. As you can see - Fridaemons: Shops. How can I change it? It's two different sets. See nothing in .lang and .nml.
  • 2. How can I do in one grf file few submarks? For example In the set AuzAddons there are: OfficeBuildings / Terminals / Truck Bays / ...
  • 3. How can I do only 1 or 2 views of object? My opinion is - num_views change to 1 or 2, delete spritelayout_blablablal_t1_view2-4;
    }
    Image
  • 4. How can I have non-snow versions? Just remove this code?

    Code: Select all

    building {
            sprite: spriteset_hotel_t1_SNOW(0);
            hide_sprite: nearby_tile_height(0, 0) < snowline_height;
            xoffset: 0; //from NE edge
            yoffset: 0; //from NW edge
            zoffset: 0;
            xextent: 16;
            yextent: 16;
            zextent: 16;
        }
ImageImageImageImageImage
Beach Objects * Shopping Centres * Skyscrapers * Garage Entrances
Modular Warehouses * Trucks & Buses Parking Lots * Bus Depots * Bus Terminals
Road Waypoints * Road Stops * Eyecandy Objects * Building Set

Winner of the Screenshot of 09/20, 11/20, 02/21, 06/21, 07/21, 05/22 and 06/22.:twisted:
User avatar
fridaemon
Director
Director
Posts: 625
Joined: 27 Oct 2019 21:06
Location: Czech Republic

Re: Releasing New Object Graphic - Begginer Tutorial

Post by fridaemon »

My plans till the end of 2020 with this project:
  • create it as industrial addition set - accept (/produce?) goods, accepting and producing passengers - have no idea how to do it
  • create underground parking addons
  • create oldschool markets
  • add shopping markets from other sets If I'll get permission from authors. There is some users which created some buildings and never release them.
ImageImageImageImageImage
Beach Objects * Shopping Centres * Skyscrapers * Garage Entrances
Modular Warehouses * Trucks & Buses Parking Lots * Bus Depots * Bus Terminals
Road Waypoints * Road Stops * Eyecandy Objects * Building Set

Winner of the Screenshot of 09/20, 11/20, 02/21, 06/21, 07/21, 05/22 and 06/22.:twisted:
User avatar
fridaemon
Director
Director
Posts: 625
Joined: 27 Oct 2019 21:06
Location: Czech Republic

Re: Releasing New Object Graphic - Begginer Tutorial

Post by fridaemon »

Now I'm working on underground garage entries. I wanted to create my markets first and after this garages for them. But I started with Industrial garages.
Image
Attachments
coffee1_32.png
coffee1_32.png (37.4 KiB) Viewed 3729 times
garage2_32.png
garage2_32.png (35.99 KiB) Viewed 3729 times
ImageImageImageImageImage
Beach Objects * Shopping Centres * Skyscrapers * Garage Entrances
Modular Warehouses * Trucks & Buses Parking Lots * Bus Depots * Bus Terminals
Road Waypoints * Road Stops * Eyecandy Objects * Building Set

Winner of the Screenshot of 09/20, 11/20, 02/21, 06/21, 07/21, 05/22 and 06/22.:twisted:
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: Bing [Bot] and 19 guests