News:

Simutrans Wiki Manual
The official on-line manual for Simutrans. Read and contribute.

Port of Simutrans to the iPhone & iPod Touch (AppStore)

Started by zodttd, February 27, 2009, 08:56:38 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

zodttd

Hello from ZodTTD of ZodTTD.com!

I've been in contact with Hajo and prissi about a port of Simutrans to the iPhone & iPod Touch. I made many similar ports before (OpenTTD for jailbroken iPhones for instance), though Simutrans is a perfect fit!
I will be in close contact with everyone here on my progress, and be sure to submit my sources back. It is planned for AppStore as a free release.

Considering I have ported SDL over to the iPhone for my quick OpenTTD port, if SDL is needed, that is not a problem. There are times replaces SDL calls with calls to Apple's API (within a wrapper) is better, but that will be determined soon enough. My main concerns are playability on the landscape 480x320 resolution screen. I have been in discussion on how to handle the size of objects with such a small screen with a high resolution.

I'm wide open to feedback and comments. I am beginning the port today, and will be needing some beta testers soon. I move fast, so it will be less than a week to get some beta (AdHoc as Apple calls them) builds to you if all is well. :)

Of note, my nickname ZodTTD is for my port of OpenTTD to the Tapwave Zodiac years ago. Perhaps it's time for a new nickname. ;)

I'm glad to be joining this community! Thanks so much,
ZodTTD

Fabio

Welcome! I think your idea is simply great!

We had a pak32.comic, probably this size would be the best to start with

http://forum.simutrans.com/index.php?topic=1471.0


QuoteBorn from some wierd idea to make some comic-style buildings, pak32.comic was concieved. It is there, if there will be ever done a simutrans version for PDAs ...

zodttd

fabio: Hi! And thanks! prissi recommended pak32. pak32.comic looks great! Seems to fit in very well like the quote states.


jamespetts

Fascinating project - and, at last, a use for Pak32.Comic!
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

zodttd

Update!
I have Simutrans up and running on the iPhone! So far this has been a very clean and tidy port too!
I'm working at getting sound enabled, improving performance, and all the rest. At the moment all I can say is Simutrans loaded on the iPhone and displayed the in-game menu and playfield. I had touch controls disabled at the moment, so I need to enable them now! Exciting!

There is a chance I will need to rewrite the SDL port some, though. Beyond that looks like things will be progressing even faster than expected! Not bad for a late night. ;)

Thanks everyone!

vilvoh

woW, how fast! Do you have any image or video of the port running on the iphone?

Escala Real...a blog about Simutrans in Spanish...

zodttd

Screenshots coming soon! Want to fix up some things in SDL first. :)

Silver

mmm very complicated right? but, not impossible!

first, an fusion of the executable and the pak, after it, launch versions for PDA or Cell (ext.: .jad or .jar)

result: many months of work


Edit.

netbeans maybe serve as a program known this to begin developing the idea.
Push here

zodttd



Here's a screenshot I took right off the iPhone. I rotated it 90 degrees to the right since the iPhone is oriented landscape when playing.
Everything is working except music, which may not be implemented right away...at least until I port over something like the Timidity library for MIDI output.

You'll notice due to the 480x320 resolution, the text on the status bar tends to run over each other. Also the 'create a new game' seems to be a bit too tall.

I'd like to know if there is an option for auto scroll around the map when the cursor is on the edge of the screen...or if I could use a right click to move around the map?

The closing of windows is hard due to the X in the corner being a bit too small still.

Everything else works, including sound effects. I'll be sure to keep everyone updated. If anyone here has a suggestion, I'd like to know it! :)

Thanks,
ZodTTD
http://www.zodttd.com

jamespetts

Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

vilvoh

Two thumbs up for this great port! althought reading the comments on your website, people would prefer an OpenTTD port... :D

Escala Real...a blog about Simutrans in Spanish...

zodttd

LOL @ the OpenTTD port. I considered it, but OpenGFX isn't far enough along, and sound/music are still copyrighted.

zodttd

By any chance, does anyone here have a (jailbroken?) iPhone or iPod Touch and some time to try a build/suggest some playability enhancements?

zodttd

Pak64 on iPhone:

Pak96.comic also works. I tried Pak128 but it consumes too much memory for the iPhone.

jamespetts

Very impressive! I think that you'll have to change the text such that there's less of it at the bottom, though.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

VS

Some menu icons are hidden.

That could be solved by adapting the whole menu system to smaller icons (already possible on pak level!) - all it needs is rewriting a few numbers and making the icons smaller.

My projects... Tools for messing with Simutrans graphics. Graphic archive - templates and some other stuff for painters. Development logs for most recent information on what is going on. And of course pak128!

vilvoh


Escala Real...a blog about Simutrans in Spanish...

Fabio

that's great! bravo!

(pak64 is impressive there, but on an iphime i'd rather use ABO pak 64)

prissi

One could add another date setting, like six to display a compat date like
26.1.1935 23h and save a lot of space. Also the name of the company may be replaced by the color of the income and the obey era is not show. Then this shoudl work on small screens.

Fabio

Quote from: prissi on March 01, 2009, 07:17:47 PM
The name of the company may be replaced by the color of the income

and what about the debts which are in red???

zodttd

Thanks for the input! I'm working on the suggestions as we speak!

zodttd


prissi

All the ones right outside the screen ... there is a file menuconf.tab, and it would allow you to set any menu size. Thus, if one of the grphics people would make buttons 20x20 instead 32x32 then such a menu would fit on the screen (and also such toolsbars would need way less space). This can be done today, just the images needs to be adjusted in the pak-files.

That is why I think you it would be best if some of the graphic artists would assist to adapt a pakset to the resolution.

zodttd

Thanks prissi! That would be great! I'm moving fast!

One semi-important usability issue is that when someone moves their finger off the edge of the screen, it's (currently) considered a mouse up event. I am not sure how to handle this just yet. But what happens is someone drags their finger off the screen and whatever action is selected, such as laying down tracks, it activates due to the mouse up event.

One thing I added was the ability to "scroll the map" when the cursor is on the edge of the screen.

So I could disable mouse up events along the border/edges of the gameplay area to avoid this, but then window placement must respect that rule so they can be moved and closed properly.

To some extent this must be done already, since it's very hard to close a window on the very edge of the iphone screen. Registering touch events in about a 20 pixel area along the edge of the iphone screen is difficult, but give it 30-50 pixels and its fine. So two things can be done in this area. Either place all windows a bit inward from the edge of the screen (I do this in my test builds a bit already), or make the menu's top bar larger to allow for larger "X" icons to close, etc. If the menu size settings change this, that would be really great!

The only other issue is the height of a few windows such as "Create a New Game" are too tall to fit on the 320px high iPhone screen. I'm trying to avoid taking a larger screen and scaling down to the 480x320 screen if at all possible. Not sure how to handle this one yet either.

Frank

Quote from: prissi on March 01, 2009, 08:46:32 PM
All the ones right outside the screen ... there is a file menuconf.tab, and it would allow you to set any menu size. Thus, if one of the grphics people would make buttons 20x20 instead 32x32 then such a menu would fit on the screen (and also such toolsbars would need way less space). This can be done today, just the images needs to be adjusted in the pak-files.

That is why I think you it would be best if some of the graphic artists would assist to adapt a pakset to the resolution.

there exists a version of pakHAJO with 24x24 buttons

http://sourceforge.net/project/showfiles.php?group_id=196471&package_id=251094&release_id=653583 pakHAJO_24x24_0-101.zip

a older screenshot

zodttd


zodttd



Seems HAJO with 24x24 (until other paks get 24x24 icons) might work out the best for iPhone so far!

prissi

SInce the iPhone has an orientation sensor and simutrans support resolution changes on the fly, one could think that the problems with dialogues could be fixed by rotation of the screen.

(BTW: THere are some Quick time based sound routines in the sound and music folder. Maybe they are useful for creating sound on the mac then. Timidity is overkill ... )

mobo

Very intersting, and impressive!

I'm really considering, to change the buttons on p32 comic now. I didnt know i really could (and how) before i read this.

Which size would be good? 20x20?

The problem is: this is some effort, and will take some time (I'm really slow, especially with boring tasks), and the pakset still isn't complete after this, there are still many objects missing, so it isn't really playble yet, and i would rather not "release" it officially when it's only half finished (you know people will think "simutrans sucks" instead of "this pak set has not all the features possible").
So it'd be better to concentrate on vehicles first. They don't have buttons (so I don't work further in the wrong direction), and they're the most important objects to make it playable.

BTW: changing the buttons of a well working set is not much more effort, and maybe sometimes easier, because in some sets they're separated from the object they belong to (and now i even understand why that makes sense  ;) ).

zodttd

prissi: I will try the  on the fly rotation of the screen technique, if possible within my SDL setup.

mobo: The final say on icon sizes will depend if I will rotate to portrait mode, which leaves only 320px width for the toolbar. Note that the iPhone version won't need the screenshot icon, and perhaps the two spacer icons can be removed as well? So that would be 17 icons. So plan for 19 pixel wide icons, though that number could change soon. Do the icons have to be square? Perhaps 19x30 icons would make things easier to tap on the iPhone.

zodttd

I've also added multitouch scrolling to Simutrans on the iPhone via my SDL port.

One thing I really need help with is tracking down a bug:
Process to reproduce bug: build a garage, build station 1 -> build station 2 -> tap garage -> add new line -> select a valid location such as a station or road
Once that sequence is made I get a segfault.

In my attempts to debug I was using your debug mode + stderr. I will use a log file instead, since it seems stderr is delayed on the iPhone even with fflush. So far it seems the bug is within:
simworld.cc: void karte_t::interactive_event(event_t &ev)

I'll try to provide more debug info shortly. Thanks!

zodttd

Update to the bug hunt:
I added logging by text file and found out the crash is within...
EDIT:
void karte_t::sync_step(long delta_t, bool sync, bool display )
within the function inside it:
intr_refresh_display( false );

So I'm stepping through intr_refresh_display now... Fun times. :P

prissi

This is the routine that draws everything (we are doing cooperative multitasking). We had some errors with ggc 4.xx which aparently produces some wrong clipping coordinates in the schedule window. Maybe it is related to this.

valgrind is probably not an option on a iPhone ...

By the way, non-rectangular buttons (19x30) are perfectly possible.

zodttd

Ah this would make sense!
I traced things further and found:
The segfault is further within "display_win" and more specifically at the line:
komp->zeichnen(wins[win].pos, gr);

The disp_height was clipped to 288 from 320 in win_display_flush.

I'm forced to use GCC 4.x in this case. Any workarounds at the moment?

zodttd

In the meantime I will try to fix the clipping issue in GCC 4.x. I might know why...