patch adds Programmable Signals to OpenTTD. Programmable signals are a special form of combo presignal, that can choose it's output dependent upon it's inputs in a way you control.
File comment: Overview
PSig-Overview.png [ 42.88 KiB | Viewed 25460 times ]
Creating a Programmable Signal
Programmable signals occupy the slot in between combo and PBS signals in the signal GUI.Programming a Programmable Signal
The program button is the bottom-right of the signal GUI window; the one which (for now) shares it's icon with the settings button. Finding a signal
If you've lost the signal the open window points to, the little right arrow will take you to it (Todo: Better icon)Adding & Removing instructions
Select the instruction you want to insert the new instruction before
and select the instruction to insert from the Insert dropdown list. To remove an instruction, select it and press remove. If this instruction is an If, then all of its children will be removedManipulating an instruction
The three buttons on the top row manipulate an instruction, and change depending upon its type.Possible instructions
- If: Conditional branch upon a condition
- Set Signal: Set the signal's state to the selected value and terminate the program
- Always: Always take the Then branch of an if
- Never: Always take the Else branch of an if
- Green Signals: Compare the number of green exit signals behind this signal to a value
- Red Signals: Compare the number of red exit signals behind this signal to a value
- Signal state: Look at the state of another exit signal that you own on the map
Unless someone comes up with any compelling features, this patch will probably enter maintainance mode - that is, I now regard it as stable, and hope for it to be tested for inclusion in trunkWhere is the patch?
Find the latest diff here
. Find the Git repository I use for development at Gitorious
. (The updates are pushed to Gitorious by an automated script on my server every quater of an hour. There may be some lag with that.)I found a bug!
Please, try and devise the minimum scenario to report it. Whenever possible, try without NewGRFs or other patches enabled. In particular, in the case of other patches, then I cannot always isolate the problem as belonging to ProgSigs or the other patch, and subtle interactions between them (As they are not expecting to be used together) can make debugging especially difficult.
If you are playing with a patch pack, please report the bug to the pack's maintainer. They can better isolate the bug, and then report it to the maintainer of the appropriate patch.
If you have found a bug, please help me out in tracking it down by
- Whenever possible, building in debug mode (Linux/OS X users, pass --enable-debug to configure)
- Running the game with misc debugging enabled with command line parameter "-dmisc10" or console command "debug-level misc=10"
- If the bug occurs while saving, additionally enable debugging for that: "-dsl10" or console command "debug-level sl=10"
If the bug causes a crash, please provide the generated crash.log, crash.png and crash.sav (if generated), plus the most recent save before the crash and, where applicable, instructions to reproduce it.
Providing this information is of great help for tracking down the bug quickly.
--------------------------------------------------------------------------Old Content Alert! Old Content Alert! Old Content Alert!
From here down is old stuff kept for historic reasons
This patch adds a NAND-type combo signal to OpenTTD.
The behaviour of the NAND signal is quite simple, and will be familiar to anyone who is familiar with logic gates:
- The signal is red if, and only if, the signals behind it are all green
- Otherwise it is green
This signal type has an interesting consequence: Traditional combo signals cannot, however indirectly, change their own state by seeing themselves. NAND signals potentially can: The simplest example of this is a NAND on track which is a circle from front to back, which would, without limitation, continuously oscillate (And therefore cause OpenTTD to hang). A restriction is therefore in place: The number of NAND signals changes which may occur at once is capped, and can be set to any number between 64 and 4096, with the default being 256.
These signals open many possibilities: While many (#openttdcoop being most notable) have created logic gates in OpenTTD, they have done so using trains, which implies that there are propagation delays. NAND signals sidestep this issue.
Using NAND signals, you should be able to build logical constructions as complex as your heart's desire; theoretically, one could even implement a small-ish processor. Flip-flops are certainly possible.
- We need a proper NAND signal graphic. At present, the patch uses the PBS-exit graphic, which is unused in OpenTTD, but potentially confusing
- OpenGFX users take note: OpenGFX does not include said PBS-exit graphic for electric signals; instead, it includes a duplication of the normal PBS graphic. Undoubtedly this could be confusing. Semaphores are unaffected (OpenGFX and the default graphics both use the same semaphores)
The patch is attached; diff is against r19495.