Author Topic: Double height paks  (Read 5191 times)

0 Members and 1 Guest are viewing this topic.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8654
  • Total likes: 283
  • Helpful: 226
  • Languages: De,EN,JP
Double height paks
« on: September 13, 2013, 04:03:00 PM »
Is there somewhere some more documentation about double height paks (beyond copy pak128.britain) since I want to make a pak64 double height where old paks are single and new double. Also what images are needed for borders?

btw. wiki.simutrans.com need to be updated to point to the wiki.
« Last Edit: September 23, 2013, 01:29:01 PM by Fabio »

Offline kierongreen

Re: Double height paks
« Reply #1 on: September 13, 2013, 05:00:29 PM »
I don't think I've got access to wiki and I've posted all of this at one time or another but here it all is:

LightTexture
Code: [Select]
Obj=ground
Name=LightTexture
Image[0...n...80][0]=...
n is the slope number - this is formed by 1xSW corner + 3xSE corner + 9xNE corner + 27xNW corner

ShoreTrans:
Code: [Select]
Obj=ground
Name=ShoreTrans
Image[0..n..11][0]=...
n=0 to 3 is same as existing images. 4 to 10 are unused. 11 is transition for when land is surrounded on all sides by water

SlopeTrans:
Code: [Select]
Obj=ground
Name=SlopeTrans
Image[0..n..14][0]=...
n=0 to 3 is same as existing images. 4 to 13 are transitions used for snowline where it is crossing various double height tiles. The easiest way really is to look at the ones in pak128.Britain and adapt those. 14 is transition for when one climate is surrounded on all sides by others.

Borders:
Code: [Select]
Obj=ground
Name=Borders
copyright=prissi

Image[0..n..26][0]=...
n here is formed from 1xSW corner + 3xNE corner + 9xNW Corner

Basement/Slopes:
Code: [Select]
Obj=ground
Name=Basement/Slopes

Image[0...n...21][0]=...

n = 0 and n = 11 are unused.
n = 1 to 8 are formed from 1xSW height difference + 3xNW height difference
n = 9 is SW height difference -1 NW height difference 1
n = 10 is SW height difference 1 NW height difference -1

n = 12 to 19 are formed from 1xNW height difference + 3xNE height difference
n = 9 is NW height difference -1 NE height difference 1
n = 10 is NW height difference 1 NE height difference -1


Marker:
Code: [Select]
Obj=ground
Name=Marker
...
Image[0...n...53][0]=...
n = 0 to 26 is front part of marker - formed from slope%27
n = 27 to 53 is back part of marker - formed from (slope%3) + ((slope-(slope%9))/3)

Ways and wayobjects:
Code: [Select]
Obj=way/way-object
...
{Front/Back}Image[x][s]=...
{Front/Back}Diagonal[x][s]=...
{Front/Back}ImageUp[x][s]=...
{Front/Back}ImageUp2[x][s]=...
Front/Back are optional
x can be:
Image: -/N/S/E/W/NS/EW/NSE/NSW/NEW/SEW/NSEW/NE/SE/SW/NW describe sides connected
Diagonal: NE/SE/SW/NW (optional) describe sides connected. If not present Image NE/SE/SW/NW are used instead.
ImageUp: 3/6/9/12 is used for single height straight slopes
ImageUp2: 3/6/9/12 (optional) is used for double height straight slopes. If not present way can only be built on single height slopes.
For all above s is optional season image.

Bridges:
Code: [Select]
Obj=bridge
...
{Front/Back}Image[x][s]=...
{Front/Back}Start[x][s]=...
{Front/Back}Ramp[x][s]=...
BackPillar[x][s]=...
{Front/Back}Image2[x][s]=...
{Front/Back}Start2[x][s]=...
{Front/Back}Ramp2[x][s]=...
BackPillar2[x][s]=...

Image NS/EW is used for middle bridge sections where way is 1 tile above ground.
Image2 NS/EW is used for middle bridge sections where way is 2 or more tiles above ground. If not present then Image is used.
Start N/S/E/W is used when starting bridge from that direction single height slope.
Start2 N/S/E/W is used when starting bridge from that direction double height slope. If not present Start is used.
Ramp N/S/E/W is used when bridge begins or ends on flat ground and is rising by 1 height step.
Ramp2 N/S/E/W is used when bridge begins or ends on flat ground and is rising by 2 height steps. If not present then bridge can only rise by 1 height step
backPillar S/W is used to fill gap between bridge and ground
*NOT IMPLEMENTED* backPillar2 S/W is used to fill gap between bridge and ground where gap is larger than 1 height step

For all above s is optional season image.


Simuconf.tab:
Code: [Select]
tile_height = y

height_conversion_factor = n
y = 16 for current single height paksets (except for a few including TTD one where it is 8 ).
n = 1 is default - this means that steeper slopes are available. Just keep y as it is now.

n = 2 means that shallower slopes are available. If using n = 2 then you should halve previous y value (pak128.Britain was 16 is now 8 ).

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8654
  • Total likes: 283
  • Helpful: 226
  • Languages: De,EN,JP
Re: Double height paks
« Reply #2 on: September 13, 2013, 07:59:55 PM »
Thank you, the climate tools I will get from pak128.britain. Now just to draw the 400 images ...

I assume TODO images are not used at all.

EDIT: No matter what I do I will always get wrong foreground slope when building artificial slopes. Why, those shoudl not appear at all.

Just ignore that the lightmap, markers and borders have the wrong height: Make an artificial slope and seem what I mean using the attached files. (All other stuff is with pak64 on sf).
« Last Edit: September 13, 2013, 09:56:00 PM by prissi »

Offline kierongreen

Re: Double height paks
« Reply #3 on: September 14, 2013, 06:49:17 AM »
Away for weekend will look when I get back.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8654
  • Total likes: 283
  • Helpful: 226
  • Languages: De,EN,JP
Re: Double height paks
« Reply #4 on: September 14, 2013, 08:15:51 PM »
Here is a program to generate lightmaps for any pak and any slop step size in pixel.

Syntax: -pak[size] -slope[pixel] target.png

For pak64 this is "-pak64 -slope16 texture-lightmap.png

You will need this lightmap file ...
Code: [Select]
-
Obj=ground
Name=LightTexture
Image[0][0]=texture-lightmap.0.0 # flat ns|ew
Image[1][0]=texture-lightmap.0.1 # sw1
Image[2][0]=texture-lightmap.0.2 # sw2
Image[3][0]=texture-lightmap.0.3 # se1
Image[4][0]=texture-lightmap.0.4 # se1,sw1 ns
Image[5][0]=texture-lightmap.0.5 # se1,sw2
Image[6][0]=texture-lightmap.0.6 # se2
Image[7][0]=texture-lightmap.0.7 # se2,sw1
Image[8][0]=texture-lightmap.0.8 # se2,sw2 ns2
Image[9][0]=texture-lightmap.0.9 # ne1
Image[10][0]=texture-lightmap.0.10 # ne1,sw1
Image[11][0]=texture-lightmap.0.11 # ne1,sw2
Image[12][0]=texture-lightmap.0.12 # ne1,se1 ew
Image[13][0]=texture-lightmap.0.13 # ne1,se1,sw1
Image[14][0]=texture-lightmap.0.14 # ne1,se1,sw2
Image[15][0]=texture-lightmap.0.15 # ne1,se2
Image[16][0]=texture-lightmap.1.0 # ne1,se2,sw1
Image[17][0]=texture-lightmap.1.1 # ne1,se2,sw2
Image[18][0]=texture-lightmap.1.2 # ne2
Image[19][0]=texture-lightmap.1.3 # ne2,sw1
Image[20][0]=texture-lightmap.1.4 # ne2,sw2
Image[21][0]=texture-lightmap.1.5 # ne2,se1
Image[22][0]=texture-lightmap.1.6 # ne2,se1,sw1
Image[23][0]=texture-lightmap.1.7 # ne2,se1,sw2
Image[24][0]=texture-lightmap.1.8 # ne2,se2 ew2
Image[25][0]=texture-lightmap.1.9 # ne2,se2,sw1
Image[26][0]=texture-lightmap.1.10 # ne2,se2,sw2
Image[27][0]=texture-lightmap.1.11 # nw1
Image[28][0]=texture-lightmap.1.12 # nw1,sw1 ew
Image[29][0]=texture-lightmap.1.13 # nw1,sw2
Image[30][0]=texture-lightmap.1.14 # nw1,se1
Image[31][0]=texture-lightmap.1.15 # nw1,se1,sw1
Image[32][0]=texture-lightmap.2.0 # nw1,se1,sw2
Image[33][0]=texture-lightmap.2.1 # nw1,se2
Image[34][0]=texture-lightmap.2.2 # nw1,se2,sw1
Image[35][0]=texture-lightmap.2.3 # nw1,se2,sw2
Image[36][0]=texture-lightmap.2.4 # nw1,ne1 ns
Image[37][0]=texture-lightmap.2.5 # nw1,ne1,sw1
Image[38][0]=texture-lightmap.2.6 # nw1,ne1,sw2
Image[39][0]=texture-lightmap.2.7 # nw1,ne1,se1
Image[40][0]=texture-lightmap.2.8 # nw1,ne1,se1,sw1 TODO 0 up 1
Image[41][0]=texture-lightmap.2.9 # nw1,ne1,se1,sw2 TODO 1 up 1
Image[42][0]=texture-lightmap.2.10 # nw1,ne1,se2
Image[43][0]=texture-lightmap.2.11 # nw1,ne1,se2,sw1 TODO 3 up 1
Image[44][0]=texture-lightmap.2.12 # nw1,ne1,se2,sw2 TODOns 4 up 1
Image[45][0]=texture-lightmap.2.13 # nw1,ne2
Image[46][0]=texture-lightmap.2.14 # nw1,ne2,sw1
Image[47][0]=texture-lightmap.2.15 # nw1,ne2,sw2
Image[48][0]=texture-lightmap.3.0 # nw1,ne2,se1
Image[49][0]=texture-lightmap.3.1 # nw1,ne2,se1,sw1 TODO 9 up 1
Image[50][0]=texture-lightmap.3.2 # nw1,ne2,se1,sw2 TODO 10 up 1
Image[51][0]=texture-lightmap.3.3 # nw1,ne2,se2
Image[52][0]=texture-lightmap.3.4 # nw1,ne2,se2,sw1 TODOew 12 up 1
Image[53][0]=texture-lightmap.3.5 # nw1,ne2,se2,sw2 TODO 13 up 1
Image[54][0]=texture-lightmap.3.6 # nw2
Image[55][0]=texture-lightmap.3.7 # nw2,sw1
Image[56][0]=texture-lightmap.3.8 # nw2,sw2 ew2
Image[57][0]=texture-lightmap.3.9 # nw2,se1
Image[58][0]=texture-lightmap.3.10 # nw2,se1,sw1
Image[59][0]=texture-lightmap.3.11 # nw2,se1,sw2
Image[60][0]=texture-lightmap.0.12 # nw2,se2
Image[61][0]=texture-lightmap.3.13 # nw2,se2,sw1
Image[62][0]=texture-lightmap.3.14 # nw2,se2,sw2
Image[63][0]=texture-lightmap.3.15 # nw2,ne1
Image[64][0]=texture-lightmap.4.0 # nw2,ne1,sw1
Image[65][0]=texture-lightmap.4.1 # nw2,ne1,sw2
Image[66][0]=texture-lightmap.4.2 # nw2,ne1,se1
Image[67][0]=texture-lightmap.4.3 # nw2,ne1,se1,sw1 TODO 27 up 1
Image[68][0]=texture-lightmap.4.4 # nw2,ne1,se1,sw2 TODOew 28 up 1
Image[69][0]=texture-lightmap.4.5 # nw2,ne1,se2
Image[70][0]=texture-lightmap.4.6 # nw2,ne1,se2,sw1 TODO 30 up 1
Image[71][0]=texture-lightmap.4.7 # nw2,ne1,se2,sw2 TODO 31 up 1
Image[72][0]=texture-lightmap.4.8 # nw2,ne2 ns2
Image[73][0]=texture-lightmap.4.9 # nw2,ne2,sw1
Image[74][0]=texture-lightmap.4.10 # nw2,ne2,sw2
Image[75][0]=texture-lightmap.4.11 # nw2,ne2,se1
Image[76][0]=texture-lightmap.4.12 # nw2,ne2,se1,sw1 TODOns 36 up 1
Image[77][0]=texture-lightmap.4.13 # nw2,ne2,se1,sw2 TODO 37 up 1
Image[78][0]=texture-lightmap.4.14 # nw2,ne2,se2
Image[79][0]=texture-lightmap.4.15 # nw2,ne2,se2,sw1 TODO 39 up 1
Image[80][0]=texture-lightmap.5.0 # nw2,ne2,se2,sw2 TODO 0 up 2
-

Somehow this does not agree with the lightmap grphics when trying in the program. Do you use a different definition of SQ = left corner (as written in koord.cc?)
« Last Edit: September 14, 2013, 08:28:09 PM by prissi »

Offline kierongreen

Re: Double height paks
« Reply #5 on: September 14, 2013, 09:06:47 PM »
One reason lightmaps weren't auto generated was I could never get the alignment 100% correct.

Offline kierongreen

Re: Double height paks
« Reply #6 on: September 14, 2013, 09:23:04 PM »
One reason lightmaps weren't auto generated was I could never get the alignment 100% correct.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8654
  • Total likes: 283
  • Helpful: 226
  • Languages: De,EN,JP
Re: Double height paks
« Reply #7 on: September 15, 2013, 02:57:09 PM »
The problem is rather that the tiles does not match. This stems from emtpy tiles, which confuses the renderer.

And the calculation is also wrong for the brightness. But drawing those tile per hand will not give better results.

Offline kierongreen

Re: Double height paks
« Reply #8 on: September 15, 2013, 04:11:25 PM »
There shouldn't be empty tiles. The TODO tiles are unused but should still be there (in paks that I've created I just point them to a flat tile image). If you're auto-generating there's no reason why you can't generate these along with the rest.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8654
  • Total likes: 283
  • Helpful: 226
  • Languages: De,EN,JP
Re: Double height paks
« Reply #9 on: September 15, 2013, 09:20:18 PM »
Yes, but with slope=16, the are invisible tiles.

Anyway, the algorithm for the triangle normal is wrong. Oh my, my vector mathematics have really got rusty. As soon as I have finish, there will be a new version of the program. Might be helpful for pak96, pak48 and so on.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8654
  • Total likes: 283
  • Helpful: 226
  • Languages: De,EN,JP
Re: Double height paks
« Reply #10 on: September 16, 2013, 10:12:29 PM »
Ok, here is the program. Somehow I think I still messed the vectors for the front/back tiles up, as the light is wrong. It will need libz and libpng for linking.

Offline Fabio

  • Devotee
  • Administrator
  • *
  • Posts: 2898
  • Total likes: 5
  • Helpful: 91
  • The Pak128 Guy
    • Visit me on Facebook
  • Languages: EN, IT, RO, FR
Re: Double height paks
« Reply #11 on: September 27, 2013, 11:17:41 AM »
I just split the discussion about bridge ramps and tunnels here in order to leave this thread to artists' reference.

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4119
  • Total likes: 124
  • Helpful: 147
  • Languages: EN, DE, AT
Re: Double height paks
« Reply #12 on: September 28, 2013, 09:07:00 AM »
the lightmap generation does not work for me. With the parameters in the pak64-Makefile at sourceforge I get something like the attached file.
Parsley, sage, rosemary, and maggikraut.