OpenTTD (Transport Tycoon Deluxe) for Switch v1.0.

EDIT: New update v1.05. Fixes right click drag scroling.

Download and more information: http://github.com/rsn8887/openttd/releases/latest

# OpenTTD port for Switch

This is my Switch port of OpenTTD, a re-implementation of Transport Tycoon Deluxe.

Port by @rsn8887, based on the Vita port by @angguss. I made some control enhancements and I also enabled sound on the Vita port, too (pull request to @angguss made).

openttd_1.jpg


More Screenshots:
openttd_4.jpg openttd_2.jpg openttd_3.jpg

# Thanks

Thanks to the many developers who worked on this game.

Thanks to @angguss for his excellent Vita port, on which this Switch port is based.

Thanks to my supporters on Patreon: Andyways, CountDuckula, Jason Crawford, Greg Gibson, Jesse Harlin, Özgür Karter, Matthew Machnee, Milenko, and RadicalR.

# Installation

- Download (see `assets` below), and unzip openttd_switch.zip and copy the contents over to the `/switch/` folder on your sd card, so that you have a folder `/switch/openttd` with many folders and files inside.

- Use you favorite homebrew launcher to start the game. It comes with everything you need to start playing right away.

- Note: This game takes quite long to load (~15 seconds). But it is worth the wait!

- The public domain graphics and sound sets from www.openttd.org are included.

- If you want the choice to also use the original dos game graphics and sounds, copy over the files
```
SAMPLE.CAT
TRHCOM.GRF
TREND.GRF
TRTITLE.GRF
TRG1.GRF
TRGC.GRF
TRGH.GRF
TRGI.GRF
TRGT.GRF
```
from an original TTD game to `/switch/openttd/baseset/`.

- To install the original music, copy over all files
```
gm/gm_ttxx.gm (xx are numbers)
```

from the folder `gm` from the original windows version of the game to `/switch/openttd/gm/`.

You then get the choice to select `original dos` graphics, sounds, and music when you go to the game settings dialog.

# Controls

- Left analog stick = mouse pointer control
- D-Pad or right analog stick = scrolling the map.
- A/right trigger = left mouse click
- B/left trigger = right mouse click
- Y = zoom-in
- X = zoom-out
- Hold ZL = speed up analog joystick mouse
- Hold ZR = slow down analog joystick mouse, useful to precisely position the pointer
- Minus = switch button mappings between two presets: ZL/ZR = slow/fast mouse and Y/X = zoom, or ZL/ZR = zoom and Y/X = slow/fast mouse
- Double click A / double click right trigger over a text field = bring up on-screen keyboard
- The touch screen is used for indirect mouse input, like on a laptop touchpad. Move a single finger to move the mouse pointer. Use short tap for left click. Hold a single finger while tapping a second finger for right click. Drag with two fingers to drag and drop.

# Current Limitations

- No network support

# Building

libtimidity:
```
git clone https://github.com/rsn8887/libtimidity
cd libtimidity/src/
make -f Makefile.switch
cp libtimidity.a $DEVKITPRO/portlibs/switch/lib/
cp timidity.h $DEVKITPRO/portlibs/switch/include/
cp ../libtimidity.pc $DEVKITPRO/portlibs/lib/pkgconfig/
```

liblzo2:
Download https://www.oberhumer.com/opensource/lzo/download/lzo-2.10.tar.gz and extract, then
```
cd lzo-2.10
./configure CFLAGS='-fPIC' CXXFLAGS='-fPIC' --host aarch64-none-elf --prefix $DEVKITPRO/portlibs/switch/ --disable-shared --enable-static
make clean
make -j12
make install
```

liblzma:
Download and extract xz-5.2.4.tar.gz from https://tukaani.org/xz/ , then
```
cd xz-5.2.4
./configure CFLAGS='-fPIC' CXXFLAGS='-fPIC' --enable-threads=no --host aarch64-none-elf --prefix $DEVKITPRO/portlibs/switch/ --disable-shared --enable-static
cd src/liblzma
make clean
make -j12
make install
```

Then configure and build OpenTTD from my switch branch:
```
git clone https://github.com/rsn8887/openttd
git checkout switch
PKG_CONFIG_PATH=$DEVKITPRO/portlibs/switch/lib/pkgconfig ./configure --os=SWITCH --host aarch64-none-elf --enable-static --prefix=/opt/devkitpro --with-sdl="pkg-config sdl2" --without-fontconfig --disable-strip --without-threads --with-libtimidity --enable-debug=0
make -j12
cd os/switch
git clean -f
cmake ./ -D
make openttd_switch.zip
```

openttd_switch.zip can be found in __cmake/__


# Changelog
1.05

- fix right click drag scrolling

1.04

- re-compile with libnx v2.2.0 to fix potential crashes with firmware 8.0.x

1.03

- bundle with working AI compatibility script files (fixes AI crashing)
- bundle with pre-installed AI opponents and support library scripts

1.02

- compile with lzma and lzo2 compression libraries to allow loading old compressed savegames/scenarios
- hold ZR / ZL for slow / fast mouse to make it easier to position the pointer with the left stick
- correctly display free disk space in load/save dialogs
- press minus to switch button mappings between two presets: ZL/ZR = slow/fast mouse, Y/X = zoom, or ZL/ZR = zoom, Y/X = slow/fast mouse

1.01

- music is now working
- improve smoothness of mouse pointer motion
- reduce analog joystick deadzone for better mouse pointer control
- update graphics and sound files to latest freeware versions from www.openttd.org
- enable cursor key map scrolling on USB keyboard
- enabled mouse wheel zoom

1.00

- initial Switch release based on latest nightly
 
Last edited by rsn8887,

Fan3k

Member
Newcomer
Joined
Dec 17, 2018
Messages
22
Trophies
0
Age
33
XP
165
Country
Germany
Im looking for auto save and im have A problem
"Liblzma returned error code".
Im have game from appstore.
 

rsn8887

Well-Known Member
OP
Member
Joined
Oct 8, 2015
Messages
956
Trophies
1
Age
46
Website
www.patreon.com
XP
3,619
Country
United States
Nsp shortcut is not needed. Hold R while loading any game from main menu.

Using v1.02 from today?

EDIT: I just tested using v1.02... started new game... waited until autosave0 appeared, loaded autosave0 works just fine...

EDIT2: It might be that v1.02 is incompatible with autosaves from v1.01 because in v1.02 I enabled lzma and lzo2 compression modules... but regular savegames are compatible I think.
 
Last edited by rsn8887,

Teddy312

Member
Newcomer
Joined
Apr 17, 2019
Messages
20
Trophies
0
Age
26
XP
156
Country
Netherlands
Man have i been waiting long for this. Until now i always played this game on my PSP. Tried out the Vita version but was kinda sad that it didn't include AI on the vita which is why i have been playing the PSP version through adrenaline on the Vita. I was looking into adding AI on the switch version. I downloaded the SimpleAI on the pc version of OpenTTD to get the required libraries.

I moved them over from the pc version to the switch version and put them in the folder contect_download the same way as they were on the PC version but everytime an AI spawns it succesfully builds a track and then crashes with a "wrong number of parameters" error (my believe is that it happends when the AI spawns a train or other transport vehicle). On PC it works perfectly fine though. The same thing also happends with TownCarsAI and AdmiralAI.

Is it something i am doing wrong or are the libraries/AI not supported on the Switch version?
 
Last edited by Teddy312,

Stwert

Well-Known Member
Member
Joined
Jan 6, 2015
Messages
949
Trophies
1
Age
49
Location
Scotland
XP
2,532
Country
United Kingdom
Really? Another ancient game makes its way to the Switch, which is clearly capable of so much more.

Why bother? Wouldn’t time be better spent making por....


...... Nah, just kidding. This is awesome, cannot wait to try it out, I loved this game back in the day.

Thanks so much for your hard work and the time you must have put into this. I’m sure anyone with any sense will appreciate it.
 
  • Like
Reactions: Technicmaster0

octopus

Custom Title
Member
Joined
Sep 6, 2013
Messages
439
Trophies
1
Location
/
XP
1,935
Country
Somalia
I've been organizing my homebrew library and found out that /switch/openttd is hardcoded, so, it fails to launch if it is moved out of /switch folder. Could you consider fixing this, @rsn8887, please?
 

rsn8887

Well-Known Member
OP
Member
Joined
Oct 8, 2015
Messages
956
Trophies
1
Age
46
Website
www.patreon.com
XP
3,619
Country
United States
That is by design. That’s how almost all Switch and Vita homebrew operates. The fix is to simply leave the folder where it is supposed to be.

Why would you even try to move it? Almost every homebrew will break if you do that.
 

Mc_Burt

Well-Known Member
Newcomer
Joined
Mar 7, 2019
Messages
68
Trophies
0
Age
45
XP
308
Country
France
Many thanks for this amazing project !!! 19 years I play this games and I enjoy to play, the control are nice !
Just two questions :
- How to add AI competitor ? I havent't found how play against the computer.
-Do you will improve the tactile ? For exemple, it's difficulte to hold a car and slide to delete with the tactile. But in generally, it's really cool it work well !
Good job guy ! :)

PS : Sorry for my bad english ^^
 
Last edited by Mc_Burt,

octopus

Custom Title
Member
Joined
Sep 6, 2013
Messages
439
Trophies
1
Location
/
XP
1,935
Country
Somalia
I didn't mean it was broken in any way, sorry, and, yes, it is obvious just to leave it in /switch folder. What I was suggesting is to use a relative path, not a hardcoded one. I understand that it's extra work with small to none benefit, however, I thought I worded my request as polite and non-entitled as possible.

That's a poor design. On Vita it does not matter since everything has an icon, but on Switch hbmenu turns into a mess when all of the homebrews are mixed together, a lot of them having nx- at the beginning of the name.
As I said, I made sub-folders in /switch to organize my homebrews by categories. Out of 31 homebrews I moved into sub-folders only 4 broke. This being one of them.
Not relevant, but hbmenu has this slowdown bug during scrolling when you have a lot of homebrews (around 47). This is the reason I decided to move some out of /switch folder.

Maybe I'm nitpicking over things that don't matter to anyone else, feel free to ignore me.
 
Last edited by octopus,

rsn8887

Well-Known Member
OP
Member
Joined
Oct 8, 2015
Messages
956
Trophies
1
Age
46
Website
www.patreon.com
XP
3,619
Country
United States
I will look into it. A relative path should work in principle.

Concerning AI opponent: I haven't tested AI. The Online content browser is not working in the Switch and Vita ports. I don't know why it is not working in my test builds. Since Online content browser is not working, you have to use the Windows/Mac version of OpenTTD and use the content browser there. You can download AI files and copy them to your Switch/Vita. Then it should work. But as I said, I haven't tested this.

Here are more instructions:
https://wiki.openttd.org/Online_content

Tell me if it works. If AI works that way, it might be good if I cold make a content package .zip file, similar to Rocks'n'Diamonds, with all the AI files and other files pre-installed.
 

Mc_Burt

Well-Known Member
Newcomer
Joined
Mar 7, 2019
Messages
68
Trophies
0
Age
45
XP
308
Country
France
Thank you for your answer ! I am trying, only I do not know how to install an AI manually. I search on the internet and when I succeed I tell you that!
 

Mc_Burt

Well-Known Member
Newcomer
Joined
Mar 7, 2019
Messages
68
Trophies
0
Age
45
XP
308
Country
France
I will look into it. A relative path should work in principle.

Concerning AI opponent: I haven't tested AI. The Online content browser is not working in the Switch and Vita ports. I don't know why it is not working in my test builds. Since Online content browser is not working, you have to use the Windows/Mac version of OpenTTD and use the content browser there. You can download AI files and copy them to your Switch/Vita. Then it should work. But as I said, I haven't tested this.

Here are more instructions:
https://wiki.openttd.org/Online_content

Tell me if it works. If AI works that way, it might be good if I cold make a content package .zip file, similar to Rocks'n'Diamonds, with all the AI files and other files pre-installed.


It work perfectly for the moment ! Just put the file here "openttd\ai".
Thanks !
 

rsn8887

Well-Known Member
OP
Member
Joined
Oct 8, 2015
Messages
956
Trophies
1
Age
46
Website
www.patreon.com
XP
3,619
Country
United States
For anyone who is interested:

Extra content for OpenTTD can be downloaded by installing Windows/Mac version and using the content browser there. Then copy the files to your Switch.
 
Last edited by rsn8887,

Technicmaster0

Well-Known Member
Member
Joined
Oct 22, 2011
Messages
4,406
Trophies
2
Website
www.flashkarten.tk
XP
3,497
Country
Gambia, The
Regarding the relative file path: the default path of the sd file system is the path of the nro. you can simply use the path "assets/a.jpg" instead of "/switch/OpenTTD/assets/a.jpg". It works with SDL, too.
 

Teddy312

Member
Newcomer
Joined
Apr 17, 2019
Messages
20
Trophies
0
Age
26
XP
156
Country
Netherlands
It work perfectly for the moment ! Just put the file here "openttd\ai".
Thanks !

Could you tell the file path of the libraries and AI that you use? I have tried a lot and gave up in the end because they kept crashing. I downloaded the libraries and AI from the pc version but it wont work on the switch for me.
 

Mc_Burt

Well-Known Member
Newcomer
Joined
Mar 7, 2019
Messages
68
Trophies
0
Age
45
XP
308
Country
France
Could you tell the file path of the libraries and AI that you use? I have tried a lot and gave up in the end because they kept crashing. I downloaded the libraries and AI from the pc version but it wont work on the switch for me.

I go to this path : "TTDX\ai\library"
But finally I have problem with AI, they crash and I don't know why.
2019042512142000-DA63280140-B1530-CD17755515-D814-CFE.jpg
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    K3Nv2 @ K3Nv2: Well start walking towards them +1