Nintendo DS port (Alpha 6)

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

User avatar
AntBUK
Transport Coordinator
Transport Coordinator
Posts: 319
Joined: 02 May 2007 12:29
Location: Sheffield, England
Contact:

Re: Nintendo DS port

Post by AntBUK »

Not having my R4DS is really driving me mad now :D
Rasing Awareness: Aspergers Syndrome 1 (NAS UK)2 (BBC)3 (YaleDDC)


Something is driving you insane... It is me.
nb-au
Engineer
Engineer
Posts: 24
Joined: 10 Oct 2007 08:20
Location: NSW, Australia

Re: Nintendo DS port

Post by nb-au »

Rather then switch screens to use tools perhaps a better option would be to always have the menu buttons on the non-touch screen and be selected by going through them using a key or keys (if you want directional), with another key as enter/drop-menu (time dependent).

Also a nice idea for viewports if you dont want them taking up valuable realestate is to have an area at the top were if you drag and hold the viewport there it will go upto the top screen. To get it back (incase you want to use buttons on the viewport) just hold the stylus near the top of the screen once more.

A good idea borrowed off GPS systems would be to have the zoom icons on the touch screen. Just a plus and minus on the right hand side of the screen (with an option to switch for lefties).

So yeah just a few ideas, good luck with the port. its looking promising so far :)
bobulator
Engineer
Engineer
Posts: 25
Joined: 20 Nov 2006 16:27
Location: The U of K

Re: Nintendo DS port

Post by bobulator »

I love the new menu icons slye_fox!

I found that your picture was 256px wide whilst the DS's screen is only 160px wide. I've laid the icons out on a 160px by 120px image (i'll put in the background later).

I thought that the message and music settings could be placed under the settings button.
I liked nb-au's idea of placing the zoom buttons on the lower screen so I have omitted that from the image.
Attachments
A possible layout of the openTTD DS icons.
A possible layout of the openTTD DS icons.
panellayout.png (7.33 KiB) Viewed 8551 times
Erm...
Thats It.
User avatar
Ploes
President
President
Posts: 956
Joined: 30 Jul 2006 16:04
Location: 127.0.0.1

Re: Nintendo DS port

Post by Ploes »

bobulator wrote:I found that your picture was 256px wide whilst the DS's screen is only 160px wide. I've laid the icons out on a 160px by 120px image (i'll put in the background later).
Tech specs I have are
Screens: Two separate 3-inch TFT LCD, resolution of 256 x 192 pixels
bobulator
Engineer
Engineer
Posts: 25
Joined: 20 Nov 2006 16:27
Location: The U of K

Re: Nintendo DS port

Post by bobulator »

Whoops!
I'll think I'll have to read stuff over before I post...
I'm such a silly newb!
Erm...
Thats It.
User avatar
dominik81
OpenTTD Developer
OpenTTD Developer
Posts: 768
Joined: 16 Aug 2003 12:55
Location: Bonn, Germany

Re: Nintendo DS port

Post by dominik81 »

Edit: I put my initial post in here to have the first post updated with the current version.
-----------------------------------------------------------
Hi everyone!

Some might remember me, I was an early OpenTTD developer and helped shaping this game between March 2004 and spring 2005. Well, I'm back. With a Nintendo DS port! You might have noticed me lurking around in #openttd with some weird questions...

I've been working on the Nintendo DS port for almost a month and twice I was close to giving up. The hardware is extremely limited and this is my very first project for the DS. I'd say it must probably be the most difficult port to write out of all the systems OpenTTD has been ported to. And it's far from being fully playable yet.

Image Image

Here are the details of my very first version running on hardware:
  • - it's more or less only a "proof of concept"
    - only the bottom screen is used
    - "mouse input" with the touchscreen
    - starts with a random 64x64 map
    - lots of things make the game crash, e.g. building railroad tracks
    - you can't use parts of the gui due to limited screen size
    - starting takes 45 seconds
    - one game day takes 2 seconds (that's full speed I think)
    - no sound
    - no network
Some technical implementation details:
  • - using SDL turned out not being feasable so I had to write my own video driver
    - the game binary is 1.7 MB, which leaves only 2.3 MB main memory
    - the screen surface (48 KB) has to be in main memory due to 8bit writes
    - the whole sprite data (300 KB) has to be in main memory as well (8bit writes are the reason again)
    - optimizing struct Spritecache for 16bit enabled me to store sprite information for up to 7372 sprites in VRAM (144 KB)
    - when the game is running approximately 244 KB of memory are free to use
    - approximately 384 KB of VRAM are free to use
As you can see memory clearly is the main concern for this port. I have already squeezed every possible bit out of the hardware. One further improvement would be to write an own blitter that only does 16 bit writes, enabling me to directly use VRAM (freeing 48 KB of main RAM) and making use of the second screen as well.

To make OpenTTD enjoyable on the NDS I think I will have to fork it and make it independent from the main branch. Then it would be possible to prune lots of things unnecessary for the DS to reduce the binary size and memory usage. And even adapting the GUI for the DS would then be an option. I was even thinking of forking it from an older version of OpenTTD which used less memory. Currently the NDS port is based on revision 11485 (ca. 0.6.0beta1).

It's still a very long road ahead to make OpenTTD playable on the DS and unfortunately I don't have much spare time to work on it. I'll release an alpha version as soon as I need testers.

-----------------------------------------------------------

I've been working hard to track down the crashes over the past few days. You can't believe how great a relief it is that I finally got rid of them. (It's pretty frustrating to work on the same thing for days without any progress at all. And in the end it's only a change of 4 lines...)

For the current version I activated both screens and you can swap the top and bottom screen with the left shoulder button. You can still overlay the console for debug purposes. But most importantly: You can build tracks and trains! :) The station GUI is crashing at the moment though. So no stations yet.

Image Image
Wolf01 wrote:are you planning to return an active OTTD developer?
No, not for OpenTTD in general. I barely have time for the DS port and couldn't spare any more. But if the port would go into trunk you might see one or the other patches being carried over from the DS port.
AntBUK wrote:You thought about adding an option to use a RAM expansion like the one that comes with the Opera browser?
A RAM expansion might even be compulsory when I release it. I haven't done any testing with it yet but the problem is that external RAM is pretty slow compared to main RAM. A EZflash 3-in-1 sitting ready on my desk waiting for the point where I have to test it.
Rubidium wrote:In my opinion there can be enough room in OpenTTD to make a compile time configuration option for low memory/small binary size. Also making the current windows useable at very low resolutions is something that I've been working on every now and then in OpenTTD myself to 'aid' people who want to port it to a small device, such as a Nintendo DS or a Windows Mobile or a Symbian.
You can't really compare a single-purpose, hardware-relying console like the DS to a multi-purpose device like a Symbian or even PSP. The DS is very different, not only in appearance (with two screens) but also concerning the hardware. Instead of a fast processor it has three very distinct graphics engines. A program not tailored to those wastes most of tho power.
Rubidium wrote:However, the primary reason for not doing the branch is that it becomes easier for other porters to use 'just' standard trunk with 'low memory' mode for their small devices instead of a (maybe) outdated version of the DS port. It will furthermore make keeping the DS port synced with main OpenTTD version much simpler as all kinds of API changes will be done for you by the people who are performing the changes.
Tbh, when I was thinking about a fork I don't even consider keeping it synched with the trunk. That would be the whole purpose of forking, to keep it independent of any changes to main OpenTTD.

There are advantages to both and I will try to keep it compatible with the trunk for now. But I'm pretty sure there's no way around forking at some point in the future. To quote someone from the gbadev forums: "What this means is that, largely unmodified, OpenTTD will probably never be happy on the DS."

I'm currently playing games like ThemePark, Settlers, Zoo Tycoon and Sim City on the DS to get some ideas of good layout and control schemes. I'll list just a few examples of what has to be modified in the OpenTTD port which came to my mind:

Cosmetic changes:
- a "draw track" tool to draw tracks with the stylus. Eliminates the need of 5 (!) different build track buttons.
- the "build vehicle" window (and similar windows) should appear so that all informational elements (cost, speed, ...) are on the top screen and the interactive elements (select train, sort, ...) are on the bottom.
- remove some buttons (fast forward probably won't work anyway), move some functions (save/load, sound options) to a seperate window that opens when pressing "start"
- remove newspaper window and ticker, instead only a transparent overlay ticker

Internal changes:
- separate sound core and make all sound processing run on the second processor
- rewrite blitter for 16bit writes so that all video stuff can go into VRAM
- ensure that all writes to _spritecache_ptr are 16bit so we can move it to VRAM
- make pools (like station pool) fixed size and map them to a fixed location (maybe on external RAM expansion)
- use a background map and/or Object Attribute Memory to display some stuff, e.g. menu icons. (in this case the 16x16 icons would come in handy for a tiled map)
- maybe use hardware scaling for zoomed out view (unlikely)
- get rid of some non-vital code: all newgrf code, the pathfinder and AI would be candidates
- maybe even make the map size static again

Those are only very few examples. To make OpenTTD fun on the DS a lot has to be changed. It's no surprise that commercial companies usually rewrite a game from the ground up when "porting" to the DS. Of course, everything "could" go into the trunk with conditional #defines and I'll try my best but it might get ugly.
Last edited by dominik81 on 21 Jan 2008 10:16, edited 1 time in total.
"There's a readme that comes with the source. I suggest you read it."
- Korenn
User avatar
Ploes
President
President
Posts: 956
Joined: 30 Jul 2006 16:04
Location: 127.0.0.1

Re: Nintendo DS port

Post by Ploes »

You mention the 3-in-1 you have, but what Slot -1 are you using?

Excellent update by the way :) Looking forward to this.
User avatar
Bilbo
Tycoon
Tycoon
Posts: 1710
Joined: 06 Jun 2007 21:07
Location: Czech Republic

Re: Nintendo DS port

Post by Bilbo »

dominik81 wrote: Tbh, when I was thinking about a fork I don't even consider keeping it synched with the trunk. That would be the whole purpose of forking, to keep it independent of any changes to main OpenTTD.
Well, some changes (various minor improvements or bugfixes) would be certainly beneficial, so it may be usefult to keep differences to trunk source code to a necessary minimum.
dominik81 wrote: Cosmetic changes:
- a "draw track" tool to draw tracks with the stylus. Eliminates the need of 5 (!) different build track buttons.
This may even end up in trunk - there are few people with touch screens or tablets that may like to use this way of building track.
dominik81 wrote: Those are only very few examples. To make OpenTTD fun on the DS a lot has to be changed. It's no surprise that commercial companies usually rewrite a game from the ground up when "porting" to the DS. Of course, everything "could" go into the trunk with conditional #defines and I'll try my best but it might get ugly.
Maybe not the DS specific code (unless entire DS would be in trunk), but some code usable by other "limited memory/cpu" devices may end in trunk IMHO)
If you need something, do it yourself or it will be never done.

My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility

Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
stewis
Traffic Manager
Traffic Manager
Posts: 153
Joined: 20 Feb 2003 22:32

Re: Nintendo DS port

Post by stewis »

hehe... i just bought my girlfriend a DS for christmas ;) looks like i may be stealing it :)
elf_sander
Engineer
Engineer
Posts: 26
Joined: 12 Sep 2005 15:35
Location: Nederland
Contact:

Re: Nintendo DS port

Post by elf_sander »

Wow.. this is the best news this year! I can't wait to test it :D
User avatar
AntBUK
Transport Coordinator
Transport Coordinator
Posts: 319
Joined: 02 May 2007 12:29
Location: Sheffield, England
Contact:

Re: Nintendo DS port

Post by AntBUK »

I got fed up of not finding my R4 and have bought another one, I shall soon be playing OTTD where ever I am!
Rasing Awareness: Aspergers Syndrome 1 (NAS UK)2 (BBC)3 (YaleDDC)


Something is driving you insane... It is me.
Skies
Engineer
Engineer
Posts: 3
Joined: 02 Jan 2008 17:53

Re: Nintendo DS port

Post by Skies »

It looks good so far. I have a few ideas.

Icons can be put on the top screen and tabbed up and down with the LEFT shoulder button, use the d-pad for left/right to select what you want.

Zoom could be controlled by holding one of the main buttons on the front and then pressing up/down on the d-pad.

I shall be checking back for news on a test version, I use supercard.
User avatar
AntBUK
Transport Coordinator
Transport Coordinator
Posts: 319
Joined: 02 May 2007 12:29
Location: Sheffield, England
Contact:

Re: Nintendo DS port

Post by AntBUK »

Going to need DLDI support :)
Rasing Awareness: Aspergers Syndrome 1 (NAS UK)2 (BBC)3 (YaleDDC)


Something is driving you insane... It is me.
dante
Engineer
Engineer
Posts: 75
Joined: 17 Dec 2007 16:56

Re: Nintendo DS port

Post by dante »

so how do i get it running on my NDS light? i have a game slot adapter so i can use mini sd cards in the NDS.

any guide avaleble how i get it working on my nds?
User avatar
AntBUK
Transport Coordinator
Transport Coordinator
Posts: 319
Joined: 02 May 2007 12:29
Location: Sheffield, England
Contact:

Re: Nintendo DS port

Post by AntBUK »

Well first we need the *.ds.gba or *.nds file. After that we will need a DLDI patch (DLDI Homepage) respective to the device we have (R4 in my case, two of now I've found my old one :roll: ) to let us save the games, if its implemented. . Some hardware has auto-patching built in, but I don't trust it and prefer to do it myself :) Then you just copy the file on to your Micro/Mini SD card, put it in your DS then load it up :)

If you need more specifics then either use google or PM me with what adaptor your using :)

If you see anything on the internet telling you that you need to "flash" your DS (using FlashMe more then likely), ignore it as flashing your DS Firmware will immediately void the warranty on your DS.
Rasing Awareness: Aspergers Syndrome 1 (NAS UK)2 (BBC)3 (YaleDDC)


Something is driving you insane... It is me.
dante
Engineer
Engineer
Posts: 75
Joined: 17 Dec 2007 16:56

Re: Nintendo DS port

Post by dante »

i have an R4 card. i'll PM you about it :)
User avatar
AntBUK
Transport Coordinator
Transport Coordinator
Posts: 319
Joined: 02 May 2007 12:29
Location: Sheffield, England
Contact:

Re: Nintendo DS port

Post by AntBUK »

Out of boredom and want for OpenTTD on my DS, I made an R4 theme! :D

The preview was made using R4 Theme Creator Alice.
Hope nobody minds me using the OpenTTD logo :) I know certain parties will mind the use of the other logos...
Rasing Awareness: Aspergers Syndrome 1 (NAS UK)2 (BBC)3 (YaleDDC)


Something is driving you insane... It is me.
elf_sander
Engineer
Engineer
Posts: 26
Joined: 12 Sep 2005 15:35
Location: Nederland
Contact:

Re: Nintendo DS port

Post by elf_sander »

You could have used different logo's and make bckgrnd_1 and 2 a bit more image like ;)

Wait.. I'll make a better one :p
User avatar
AntBUK
Transport Coordinator
Transport Coordinator
Posts: 319
Joined: 02 May 2007 12:29
Location: Sheffield, England
Contact:

Re: Nintendo DS port

Post by AntBUK »

I made it a bit more picture like for you. I also ditched using Alice to make the theme preview...
(attachments in the previous post deleted)
Attachments
OpenTTD R4 Theme.zip
Extract to one of the theme folders in the _system_ directory on your MicroSD card to use. Back up the folder first if you want to use the original theme again.
(180.31 KiB) Downloaded 175 times
Theme preview by me (mockup)
Theme preview by me (mockup)
preview.png (138.34 KiB) Viewed 6750 times
Rasing Awareness: Aspergers Syndrome 1 (NAS UK)2 (BBC)3 (YaleDDC)


Something is driving you insane... It is me.
elf_sander
Engineer
Engineer
Posts: 26
Joined: 12 Sep 2005 15:35
Location: Nederland
Contact:

Re: Nintendo DS port

Post by elf_sander »

Mine still looks better.. I created with my own DS Skinning program.

Ndsthemes has approved it... the download: http://www.ndsthemes.com/themes/details/70e7546e0d

Image
Image


I'm done with the newest version of my skin tester..
You can download it: through my site (http://microse.nl/downloads/?snm=dsskin), MicroSE Connect (http://microse.nl/downloads/?snm=connect) or GBatemp.net (http://gbatemp.net/index.php?download=1593). You need at least .Net 2.0 to run it. The program is Dutch and English. (This program is only to be used for R4DS and M3 Simply and has nothing to do with OpenTTD)
Last edited by elf_sander on 10 Jan 2008 10:15, edited 1 time in total.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 11 guests