Transport Tycoon Forums

The place to talk about Transport Tycoon
It is currently Wed Jul 23, 2014 4:01 pm

All times are UTC




Post new topic Reply to topic  [ 63 posts ]  Go to page 1, 2, 3, 4  Next
Author Message
 Post subject: LED counter
PostPosted: Sun Jun 08, 2008 7:08 pm 
Offline
Engineer
Engineer

Joined: Mon May 19, 2008 11:28 pm
Posts: 14
While playing this game, messing around with train signals, I wondered whether it was possible to create electronic circuitry with the help of signals, trains and tracks. After several days of trial and error, the attached save game is the result.
In short: I have made a ´LED´ display that counts the amount of times a train passes a certain track (see image, showing the number 3). At this moment the display will only count to 7, and then reset.

In terms of efficiency, we're doing not so well: the display takes a couple of days to update, which gives it a clock speed of approximately 0.000002 Hertz (consider that regular computers are into the gigaherz range).

Attachment:
LED.png
LED.png [ 27.19 KiB | Viewed 15369 times ]

This savegame runs on the latest stable build of OpenTTD (0.6.1.0).

Check it out :)


Attachments:
Iglandir2.sav [705.83 KiB]
Downloaded 1318 times

_________________
if triangles had a god, He would have three sides
Top
 Profile  
 
 Post subject: Re: LED counter
PostPosted: Sun Jun 08, 2008 7:23 pm 
Offline
Traffic Manager
Traffic Manager
User avatar

Joined: Tue Apr 08, 2008 9:47 am
Posts: 220
Location: Finland
That's wicked, but how about a little closer zoom screenie?


Top
 Profile  
 
 Post subject: Re: LED counter
PostPosted: Sun Jun 08, 2008 7:34 pm 
Offline
Director
Director
User avatar

Joined: Sun Jul 13, 2003 12:47 pm
Posts: 615
Location: Alphen aan den Rijn
You sir.... you've got way to much time on your hands! Incredible fun to watch. It took me some time to find out where the clock was though, I hadn't noticed the passenger line was such an important part of the design. Show's quite well that conditional orders aren't needed to make a nice switch board, or should I regard your design as 'too low level' to be usable? ;).


Top
 Profile  
 
 Post subject: Re: LED counter
PostPosted: Sun Jun 08, 2008 8:01 pm 
Offline
Engineer
Engineer

Joined: Fri Jul 06, 2007 8:48 am
Posts: 107
Location: Wismar, Germany
I guess, the "computer" could be made slightly faster by using maglev trains in the switches as well as in the "display", though I still don't know how exactly this thing works after staring at it for ten minutes... :shock: quite impressive, to say the least...

_________________
halbmoki.tumblr.com <- my blog


Top
 Profile  
 
 Post subject: Re: LED counter
PostPosted: Sun Jun 08, 2008 8:39 pm 
Offline
Chairman
Chairman
User avatar

Joined: Sun Jul 01, 2007 10:33 pm
Posts: 822
Location: Manchester, UK
This is some what mad.

Well done !! 8)

_________________
Chogie DOT eu

Image


Top
 Profile  
 
 Post subject: Re: LED counter
PostPosted: Sun Jun 08, 2008 10:40 pm 
Offline
Transport Coordinator
Transport Coordinator

Joined: Thu Mar 30, 2006 12:05 pm
Posts: 329
Location: Germany
This is sick ;)
How much time did you "waste" on this savegame?


Top
 Profile  
 
 Post subject: Re: LED counter
PostPosted: Sun Jun 08, 2008 11:53 pm 
Offline
Transport Coordinator
Transport Coordinator
User avatar

Joined: Wed May 02, 2007 12:29 pm
Posts: 319
Location: Sheffield, England
Sounds like somebody needs to discover a copy of WireWorld...

_________________
Rasing Awareness: Aspergers Syndrome 1 (NAS UK)2 (BBC)3 (YaleDDC)


Something is driving you insane... It is me.


Top
 Profile  
 
 Post subject: Re: LED counter
PostPosted: Mon Jun 09, 2008 2:43 am 
Offline
Tycoon
Tycoon

Joined: Sun Apr 08, 2007 4:07 am
Posts: 1884
Interesting.. I've started to make some comments on it with signs, but I've given up on the magic that's happening in the east oO It's too late right now for such things :shock: here's my commented save file for those who are interested in it.

Unfortunately I've done it with trunk, not 0.6.1, so you'll need trunk/nightly too to load it...

Here's also a screenshot.


Attachments:
File comment: comments by me. Work by Igloo. ;)
LED comments.png [66.01 KiB]
Downloaded 1655 times
File comment: The savegame. Made with r13419.
Iglandir2 comments.sav [707.02 KiB]
Downloaded 566 times

_________________
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
Top
 Profile  
 
 Post subject: Re: LED counter
PostPosted: Mon Jun 09, 2008 7:48 am 
Offline
Director
Director

Joined: Sun Mar 11, 2007 4:50 pm
Posts: 542
So what this does is count how many trains pass on a certain line?


Top
 Profile  
 
 Post subject: Re: LED counter
PostPosted: Mon Jun 09, 2008 9:51 am 
Offline
Engineer
Engineer

Joined: Mon May 19, 2008 11:28 pm
Posts: 14
Thanks for all the replies, and yes I am slightly mad ;-). This project took several days of slow and steady improvement.

The savegame contains a network that counts the trains that pass from east to west along the maglev line. However, it does take quite some time to update because the network is quite slow. Updating the system to maglev is possible, however, when I did that not all gates worked correctly so I stuck with railroad.

Roujin: you deciphered it correctly =]. Tonight after work and soccer I'll post a version including more details.

_________________
if triangles had a god, He would have three sides


Top
 Profile  
 
 Post subject: Re: LED counter
PostPosted: Mon Jun 09, 2008 10:38 am 
Offline
Tycoon
Tycoon

Joined: Sun Apr 08, 2007 4:07 am
Posts: 1884
Igloo wrote:
Thanks for all the replies, and yes I am slightly mad ;-). This project took several days of slow and steady improvement.

The savegame contains a network that counts the trains that pass from east to west along the maglev line. However, it does take quite some time to update because the network is quite slow. Updating the system to maglev is possible, however, when I did that not all gates worked correctly so I stuck with railroad.

Roujin: you deciphered it correctly =]. Tonight after work and soccer I'll post a version including more details.


Looking forward to it. I didn't really get the rest (where I didn't place signs) yesterday, e.g. why there's two 3-bit numbers, of which one is increased as soon as the passenger train reaches the point I've labelled "start of mechanism", and the other is adapted to what the first one holds as soon as the passenger train reaches the point "checkpoint 1".
Also the eastern part which probably counts up by one and then handles overflows and such was too confusing for me to be understood in each detail :? I also failed to understand what your structures there using trains with ~3 wagons exactly do.

_________________
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage


Top
 Profile  
 
 Post subject: Re: LED counter
PostPosted: Mon Jun 09, 2008 5:54 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Mon Apr 07, 2008 6:29 pm
Posts: 1871
Location: Czech Republic
That's awesome. I had to laugh when I was looking at the refreshing display.

Btw, couldn't "tunnels can cross each other" cheat make your work easier?


Top
 Profile  
 
 Post subject: Re: LED counter
PostPosted: Mon Jun 09, 2008 8:42 pm 
Offline
Transport Coordinator
Transport Coordinator

Joined: Mon Feb 06, 2006 11:58 pm
Posts: 340
Impressive :)
Reminds me of the old NAND-Signals Patch ;)

_________________
Copy & Paste Patch for OTTD
Distant-Joined Stations Patch for OTTD
Eyecandy Patch for OTTD


Top
 Profile  
 
 Post subject: Re: LED counter
PostPosted: Mon Jun 09, 2008 10:31 pm 
Offline
Engineer
Engineer

Joined: Mon May 19, 2008 11:28 pm
Posts: 14
After playing this game for a while it became clear that the signals are very powerful. Which led me to wonder whether it is possible to build all logical gates in openTTD using only trains and signals. From there on it went downhill. The attached save game is the same save game I posted previously, but now with lots of comments.

Overview of the logic gates
In the system a green sign represents a value of 1 and a red sign represents a value of 0.

The OR gate is trivial:
Attachment:
OR.PNG
OR.PNG [ 19.74 KiB | Viewed 14035 times ]


The AND gate is not quite so simple. When the first train stops before the sign near Bit I or Bit 2 the presignals send the second train through the checkpoint. This turns the output to red. If both Bit I and II are green the trains will never go through the checkpoint.
Attachment:
NOT.PNG
NOT.PNG [ 23.1 KiB | Viewed 14049 times ]


The NOT gate was the hardest. By using a combination of presignals and standard signals it was possible to keep one piece of track occupied continuously if the input is green.
Attachment:
The attachment OR.PNG is no longer available


The memory is simple in itself. However because the system does not use a clock-pulse it became more complex. To work around this problem the memory stores it's state internally before the output is updated. Hence two trains for each bit.

The other parts of the system are large combinations of ORs to convert binary numbers to decimal and to update the LED display on basis of the decimal value.

_________________
if triangles had a god, He would have three sides


Top
 Profile  
 
 Post subject: Re: LED counter
PostPosted: Mon Jun 09, 2008 10:34 pm 
Offline
Engineer
Engineer

Joined: Mon May 19, 2008 11:28 pm
Posts: 14
Apparently only three files can be included in a post :?


Attachments:
Iglandir comments.sav [708.15 KiB]
Downloaded 361 times

_________________
if triangles had a god, He would have three sides
Top
 Profile  
 
 Post subject: Re: LED counter
PostPosted: Mon Jun 09, 2008 11:03 pm 
Offline
Tycoon
Tycoon
User avatar

Joined: Mon May 02, 2005 11:05 am
Posts: 15415
Location: localhost
I've tried to do the logic gates too one day, OR is not so hard as it is the default of presignals. AND becauses a bit harder but isn't that hard to get as you can simply add an extra signal IIRC, it has been a while though.
I think I never got the NOT gate to work although I fiddled quite a bit with it.
I also remember having completed another logic gate but I don't know which one.

Kudos on the LED counter though, I haven't looked at it but it sure seems like it took you A LOT of time and thinking to make it work.

_________________
Don't panic - My YouTube channel - Follow me on twitter (@XeryusTC) - Play Tribes: Ascend - Tired of Dropbox? Try SpiderOak (use this link and we both get 1GB extra space)
Image
OpenTTD: manual #openttdcoop: blog | wiki | public server | NewGRF pack | DevZone
Image Image Image Image Image Image Image


Top
 Profile  
 
 Post subject: Re: LED counter
PostPosted: Tue Jun 10, 2008 7:38 am 
Offline
President
President
User avatar

Joined: Sun Jun 18, 2006 6:18 pm
Posts: 953
Location: Switzerland
OMG, that is crazy! ;-)

Nice to see, someone reached to make a NOT and AND (NAND) without patching: viewtopic.php?f=33&t=26364


Greets
Ammler

_________________
Image
Town Names: Image Portuguese Image Belarusian Image French Image Swiss · Image Temperate Lumber Mill
Still work in progress: OpenGFX or/and OpenSFX - Please help!


Top
 Profile  
 
 Post subject: Re: LED counter
PostPosted: Wed Jun 11, 2008 9:43 pm 
Offline
Engineer
Engineer
User avatar

Joined: Wed Apr 28, 2004 10:07 am
Posts: 62
Location: Salzburg
crazy :o

thank you for amazing me.

_________________
*<(:-}


Top
 Profile  
 
 Post subject: Re: LED counter
PostPosted: Wed Jun 11, 2008 9:48 pm 
Offline
Tycoon
Tycoon

Joined: Sun Apr 08, 2007 4:07 am
Posts: 1884
Thank you for posting the commented version. Now I also understand the eastern part. Who would have thought that these wacky constructions with the waypoints are nothing else than AND-gates? 8) Great job on managing to build them! :)

edit: now, how long will you take to build a turing machine out of rails, and emulate OpenTTD on it? :lol:

_________________
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage


Top
 Profile  
 
 Post subject: Re: LED counter
PostPosted: Thu Jun 12, 2008 8:00 am 
Offline
Director
Director

Joined: Tue Jan 03, 2006 8:45 pm
Posts: 560
Location: Netherlands
This is really nice :)
It reminds me of a similar program I once programmed in QBasic, which basically was a binary adder (the thing that adds two numbers, not the snake) using a train and a lot of switches. If one figures how to make the switches work reliably in OpenTTD, then one could make a binary adder in OpenTTD as well, although it will be quite large, I guess.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 63 posts ]  Go to page 1, 2, 3, 4  Next

All times are UTC


Who is online

Users browsing this forum: kutagh and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB © 2000-2013 phpBB Group

Copyright © Owen Rudge/The Transport Tycoon Forums 2001-2013.
Hosted by Zernebok Hosting.