How to code vehicles (in short)?

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

akaction
Engineer
Engineer
Posts: 50
Joined: 25 Feb 2010 09:18
Location: Russia, Moscow

How to code vehicles (in short)?

Post by akaction »

Hello everyone.

I am creating models for Locomotion. Some of them you can find at http://translate.google.ru/translate?js ... l=ru&tl=en . So I have some experience in creating 3D models, reending and coding.

But my models grow up over Locomotion. Many years ago Sergej_Sim converted my models into OTTD (http://myforum.net.ua/index.php?showtopic=11896&st=20 ). I sent him 32bit 384x384 sprites and he (or his friends) converted it. It was converted Scania Omni, Liaz 6212, Liaz-677 and some more.

Does anyone have or can create tutorial about convetring sprites into OTTD file? Something like “3d max tutorial - Plane creating” but in this case about coding. Short and understandable step-by-step article…
How to code/decode models?

There are a lot of information in this forum but it is hard to read it all especially for not good englsih readng person.
Please, write ony on business, not bla-bla…
Do not go with the flow, do not go against the flow, go across it, if you want to reach the coast (С)Vantala
Antonio1984
Transport Coordinator
Transport Coordinator
Posts: 282
Joined: 02 Apr 2009 21:57

Re: How to code vehicles (in short)?

Post by Antonio1984 »

Hi...I've looked your models and they are very realistic...however you will surely obtain help in this forum...maquinista for example is very able to code sprites...but it isn't the unique...
User avatar
Zephyris
Tycoon
Tycoon
Posts: 2890
Joined: 16 May 2007 16:59

Re: How to code vehicles (in short)?

Post by Zephyris »

To add a brand new vehicle to the game you will need to produce a grf to do so. This file defines the way the vehicle behaves in-game and the graphics to use (for different orientations, for different loading stages, etc). You can find a starting tutorial and the specifications here: http://wiki.ttdpatch.net/tiki-index.php ... phicsSpecs
This requires non-full zoom 8bpp sprites.

32bpp sprites are then simply alternatives to the 8bpp sprites in the grf. These are rendered and given alignments for in-game and is quite simple once the grf is available.

I hope this helps, but you will probably want to find some people work with because there are not many people who can do all these steps.
akaction
Engineer
Engineer
Posts: 50
Joined: 25 Feb 2010 09:18
Location: Russia, Moscow

Re: How to code vehicles (in short)?

Post by akaction »

Zephyris wrote:.. non-full zoom 8bpp sprites.

32bpp sprites are then simply alternatives to the 8bpp sprites in the grf. These are rendered and given alignments for in-game and is quite simple once the grf is available.

I hope this helps, but you will probably want to find some people work with because there are not many people who can do all these steps.
Thank you. There are still to much information. I will try to read it all, but it will take to much time to understand it. I don`t have enough time. Maybe some template exists...
It will be easily to understand when look at the template. For example, at my first Locomotion steps I just do 5 easy steps: 1) decode existing vehicle (close to my model) 2) rename “vehicle name” in .xml code 3) corrected “bogeypass” (vechicle length) in .xml code 4) replace sprites 5)code it back with another name. Each of these steps can be described with 2 sentences.

Something like i discribe creating models in Loco: http://translate.googleusercontent.com/ ... i0w#p33111
Do not go with the flow, do not go against the flow, go across it, if you want to reach the coast (С)Vantala
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: How to code vehicles (in short)?

Post by planetmaker »

akaction wrote:I will try to read it all, but it will take to much time to understand it. I don`t have enough time. Maybe some template exists...
It will be easily to understand when look at the template. For example, at my first Locomotion steps I just do 5 easy steps:
Well, OpenTTD is not locomotion and vehicles have more properties than just a name and a sprite - which is bound to make things more complicated.

There does exist the WorldAirlineSet and its source code is freely available under the GPL. But it's not a simple decode, replace and re-encode procedure. Well, one *could* do - but what sense would make an Airbus 380 with the stats of a Cesna citation II?
User avatar
Zephyris
Tycoon
Tycoon
Posts: 2890
Joined: 16 May 2007 16:59

Re: How to code vehicles (in short)?

Post by Zephyris »

There is no way to do it that simply, though it would be possible to design a template .grf for a single vehicle which would be more easy to modify. You could also try using grfmaker though I have never tried it and don't know how well it works.
maquinista
Tycoon
Tycoon
Posts: 1829
Joined: 10 Jul 2006 00:43
Location: Spain

Re: How to code vehicles (in short)?

Post by maquinista »

If You have the vehicles modeled, I recomend you to use this ZIP file and extract the template for a single tile (12.5x12.5):
http://www.tt-forums.net/download.php?id=53231
Load the template and import a model. Remember that in OpenTTD world, the vehicles are very short. Sometimes, They looks a bit ridiculous.

There are eight angles in OpenTTD. The diagonal views ( / and \ ) are shorter than the perpendicular views (--- and | ), the scale factor is around ~0.7.
If you want model a train with pantograph, You should keep the height of the overhead wires.


Also, You need a NFO code (to make a GRF file), but We can try to help You with this.
Sorry if my english is too poor, I want learn it, but it isn't too easy.[/list][/size]
akaction
Engineer
Engineer
Posts: 50
Joined: 25 Feb 2010 09:18
Location: Russia, Moscow

Re: How to code vehicles (in short)?

Post by akaction »

Lets try to start with buses.
Sorry attached file has not been opened. Maybe you can conver this template to 3Dmax supported file? (max, 3DS) I am using 3Dmax 2010. So, I created standard set of pictures with length decreased by 50%. 24bit, 384x384dpi. Look in attach. What shall i do with these sprites? And which of them do you need.
Last edited by akaction on 10 Mar 2010 21:46, edited 1 time in total.
Do not go with the flow, do not go against the flow, go across it, if you want to reach the coast (С)Vantala
maquinista
Tycoon
Tycoon
Posts: 1829
Joined: 10 Jul 2006 00:43
Location: Spain

Re: How to code vehicles (in short)?

Post by maquinista »

Not, You need to render the sprites over a transparent background.

In TTD world, the vehicles turn suddenly. You only need 8 views. The train must be shorter in some views (70%). The other vehicles doesn't need to be short in these views.

I recommend You to make the bus a bit smaller. Also, a semi-transparent shadow will look good.
Attachments
Train sprites.
Train sprites.
train.png (67.69 KiB) Viewed 5761 times
Bus sprites.
Bus sprites.
bus.png (87.74 KiB) Viewed 5761 times
Bus size comparation.
Bus size comparation.
buses_size.png (30.88 KiB) Viewed 5759 times
Sorry if my english is too poor, I want learn it, but it isn't too easy.[/list][/size]
akaction
Engineer
Engineer
Posts: 50
Joined: 25 Feb 2010 09:18
Location: Russia, Moscow

Re: How to code vehicles (in short)?

Post by akaction »

Ok 8 sprites - DONE,
transparent background - DONE (i hope so)
I decreased the size but I don`t know is it enough or not. I need some measure (pattern)

I still don`t know how to make semi-transparent shadow (i worked with Locomotion palettes and there are another requirements to render). Your plastic effect looks very good i think it is because of special material + lighting

[file was cut]
Last edited by akaction on 02 Apr 2010 08:04, edited 1 time in total.
Do not go with the flow, do not go against the flow, go across it, if you want to reach the coast (С)Vantala
maquinista
Tycoon
Tycoon
Posts: 1829
Joined: 10 Jul 2006 00:43
Location: Spain

Re: How to code vehicles (in short)?

Post by maquinista »

I have coded the GRF file and the sprites for 8 bits/pixel. I will code the 24 bpp sprites.

I need to know wath is the name of the vehicle set
Also, I don't know the speed of the bus, capacity, power...
Attachments
bus.png
bus.png (27.14 KiB) Viewed 5680 times
Sorry if my english is too poor, I want learn it, but it isn't too easy.[/list][/size]
maquinista
Tycoon
Tycoon
Posts: 1829
Joined: 10 Jul 2006 00:43
Location: Spain

Re: How to code vehicles (in short)?

Post by maquinista »

This is the bus coded. I think that the ligth comes from the wrong side, It should come from right.

I don't know how to code buses for left driving in the same GRF file. Does anyone how to do this?
Attachments
bus.tar
Bus coded.
(118.5 KiB) Downloaded 163 times
bus.zip
Source code. My NFO code is under public domain.
(3.37 KiB) Downloaded 132 times
Screenshot.
Screenshot.
bus_screenshot.JPEG (10.77 KiB) Viewed 5649 times
Sorry if my english is too poor, I want learn it, but it isn't too easy.[/list][/size]
User avatar
Zephyris
Tycoon
Tycoon
Posts: 2890
Joined: 16 May 2007 16:59

Re: How to code vehicles (in short)?

Post by Zephyris »

maquinista wrote:Does anyone how to do this?
Not sure how much help you need, but use an action7 to conditionally skip the sprites in question.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: How to code vehicles (in short)?

Post by planetmaker »

To add on what Zephyris said: you need to check for the proper flag: http://wiki.ttdpatch.net/tiki-index.php ... PatchFlags
maquinista
Tycoon
Tycoon
Posts: 1829
Joined: 10 Jul 2006 00:43
Location: Spain

Re: How to code vehicles (in short)?

Post by maquinista »

Thanks, What are the sprites that I should skip? Only the action 1?
Sorry if my english is too poor, I want learn it, but it isn't too easy.[/list][/size]
User avatar
Zephyris
Tycoon
Tycoon
Posts: 2890
Joined: 16 May 2007 16:59

Re: How to code vehicles (in short)?

Post by Zephyris »

IIRC set up two action1s and their associated real sprites; one with the right hand and one with the left hand sprites. Then use two action7s, one to skip the right hand sprites and action1 if it is a left hand drive game, and one to skip the left hand sprites and action1 if it is a right hand drive game.
maquinista
Tycoon
Tycoon
Posts: 1829
Joined: 10 Jul 2006 00:43
Location: Spain

Re: How to code vehicles (in short)?

Post by maquinista »

akaction wrote:Ok 8 sprites - DONE,
transparent background - DONE (i hope so)
I decreased the size but I don`t know is it enough or not. I need some measure (pattern)

I still don`t know how to make semi-transparent shadow (i worked with Locomotion palettes and there are another requirements to render). Your plastic effect looks very good i think it is because of special material + lighting
If You want, You can render sprites for left hand and right hand driving (the vehicle is rendered like It was viewed on a mirror).
Also, You can add sprites with doors opened for bus stations.
Zephyris wrote:IIRC set up two action1s and their associated real sprites; one with the right hand and one with the left hand sprites. Then use two action7s, one to skip the right hand sprites and action1 if it is a left hand drive game, and one to skip the left hand sprites and action1 if it is a right hand drive game.
Thanks.
Sorry if my english is too poor, I want learn it, but it isn't too easy.[/list][/size]
akaction
Engineer
Engineer
Posts: 50
Joined: 25 Feb 2010 09:18
Location: Russia, Moscow

Re: How to code vehicles (in short)?

Post by akaction »

Wow, it looks good. I think I shall install OTTD to try it :).
The name is: Liaz 5292
Details:
http://translate.google.com/translate?j ... auto&tl=en

Bus speed = 90 km/h
Capacity = 100
power= 200

This bus is right-side moving (like in the majority countres of Europe excepting UK). If look at "bus_screenshot.JPEG" then bus is moving at the correct side of the road. It shall go from the top-right side of the picture to the bottom-left side of the picture.
temp1.JPG
temp1.JPG (8.87 KiB) Viewed 5597 times
I can create the set of the pictures with opened doors. It will be easy because cabin [passenger compartment] is already done. Also I can put passengers for loaded bus (if it is possible to code empty and loaded vechicle). For some vechicles I have “starting sound” in .wav formate (I can convert it to any other universal audio file format).

I will try to render more. I want to learn how to make semi-transparent shadows and flashing on the sun.

I have a lot of vechicles and I can do more.
Do not go with the flow, do not go against the flow, go across it, if you want to reach the coast (С)Vantala
Antonio1984
Transport Coordinator
Transport Coordinator
Posts: 282
Joined: 02 Apr 2009 21:57

Re: How to code vehicles (in short)?

Post by Antonio1984 »

very realistic!
maquinista
Tycoon
Tycoon
Posts: 1829
Joined: 10 Jul 2006 00:43
Location: Spain

Re: How to code vehicles (in short)?

Post by maquinista »

Thanks for the name and the characteristics of the vehicle. Remember that the Sun light comes from right.

About side of driving: I recommend You to render sprites for left and right, because there are OpenTTD players that uses drive on left. It makes the set compatible with other sets.
Sorry if my english is too poor, I want learn it, but it isn't too easy.[/list][/size]
Post Reply

Return to “Graphics Development”

Who is online

Users browsing this forum: Google Adsense [Bot], Semrush [Bot] and 4 guests