Logic Signals patch

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

maddy_
Engineer
Engineer
Posts: 20
Joined: 24 Jan 2011 19:08

Re: Logic Signals patch

Post by maddy_ » 29 Aug 2013 06:22

Very cool 2457.

These 1:1 splits were in my mind, among other things, when making this patch. Very happy to see it is working.

I have no idea why using a newGRF trainset broke it though. Maybe someone with more knowledge can answer this one.

2457
Engineer
Engineer
Posts: 126
Joined: 06 Dec 2009 21:57

Re: Logic Signals patch

Post by 2457 » 29 Aug 2013 20:35

hmm, actualy i was thinking moooar people will post here.
but seems like i was wrong X(

oh well, i still do hope this patch makes it into one of the nighlys, and then to stable, it is allready far too
good to leave it out. actualy since the introduction of PBS signals this is the first thing that has my full attention.
finaly something to get rid of the "logic tracks".
The Prophet -thx Pikka-

maddy_
Engineer
Engineer
Posts: 20
Joined: 24 Jan 2011 19:08

Re: Logic Signals patch

Post by maddy_ » 02 Sep 2013 05:35

Has anyone else tried the patch? Did it work as expected? I am waiting for more feedback as well. :)

User avatar
JacobD88
Chief Executive
Chief Executive
Posts: 674
Joined: 16 Aug 2008 17:51
Location: Long Eaton, Nottinghamshire. UK
Contact:

Re: Logic Signals patch

Post by JacobD88 » 02 Sep 2013 12:06

I've applied the patch and have found it really useful; although ultimately it may be worth looking at expanding it's features to encompass all of the features available to TTDP players as described here;

http://uwe.s2000.at/ttdx/signal/restric ... hp?lang=en

OTTD is far behind TTDP in terms of signalling and i hope that your work will continue to go some way to improving that situation. Other than that i don't really have any suggestions, but will report any bugs :D :bow:

2457
Engineer
Engineer
Posts: 126
Joined: 06 Dec 2009 21:57

Re: Logic Signals patch

Post by 2457 » 02 Sep 2013 17:00

actualy the TTDX style of signals i would not prefer...
I better like this approach.
Actualy there may be a few more , not jut or and xor logic, and a switch to make the default signal behaviour switch between block and pbs.

it should be in the trunk/nightly, for sure.
sofar i em extreemly statisfied.

if at least 4 people post here, i can set up a server with the patched version, so we can experiment in multiplayer.
i can leave it on 24/7.
The Prophet -thx Pikka-

User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4552
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: Logic Signals patch

Post by Zuu » 02 Sep 2013 21:11

Code: Select all

SignalProgram::AddLink
SignalProgram::RemoveLink
SignalProgram::ClearAllLinks
Perhaps substitute "Link" with "Input" in these method names. It does seem to fit better with the concepts of your patch.

Code: Select all

+/**
+ * The main command for editing a signal program.
+ * @param tile The tile which contains the edited signal.
+ * @param flags Internal command handler stuff.
+ * @param p1 Bitstuffed items
+ * - p1 = (bit 0-2) - The Track part of the signal program tile.
+ * - p1 = (bit 3-5) - Subcommand to execute.
+ * - p1 = (bit 6-7) - The value to set to the signal program.
+ * @param p2 Target SignalReference for linking of two signals
+ * @return the cost of this operation (which is free), or an error
+ */
+CommandCost CmdProgramLogicSignal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
+{
+	Track  track   = (Track) GB(p1, 0, 3);
+	uint32 sub_cmd = GB(p1, 3, 3);
+	uint32 value   = GB(p1, 6, 2);
+
...
+
+	if (sub_cmd == 1) {
Perhaps define an enum for the sub_cmd parameter and use the Extract<> method instead of GB so that we get a compiler error if the enum is extended (and the Extract-definition) without updating the command procedure.

Code: Select all

-extern const uint16 SAVEGAME_VERSION = 185; ///< Current savegame version of OpenTTD.
+extern const uint16 SAVEGAME_VERSION = 200; ///< Current savegame version of OpenTTD.
In the final version of your patch, only increment the savegame version with one step.


AI API
I notice that your patch do not yet address AI support. This is something that in general should be separated into a second patch in a patch queue. Eg. please consider to add it, but use HG queues or the Git equivalent to separate AI support into a separate .patch file as AI support include quite a few bit of generated code which will create a somewhat long patch on itself.

That said, for your initial patch, you should run src/script/api/generate_widget.sh to update the GSWindow class which include references to all widgets in the game.

All files related to AI (and Game Script) API is located in src/script. Eg. add code to src/script/api/script_rail.*, document API additions in src/script/api/ai_changelog.cpp, run src/script/api/squirrel_export.sh to generate some new glue code. If it makes sense, programming signals can possible be included all in AIRail, but it may need also new API classes for the API to make sense. Maybe there should be a AIProgrammingSignalList that list all tiles that contain a programming signal.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)

maddy_
Engineer
Engineer
Posts: 20
Joined: 24 Jan 2011 19:08

Re: Logic Signals patch

Post by maddy_ » 08 Sep 2013 12:08

Thanks for the feedback Zuu and others.

As we know, there now exists a few different patches for advanced signal types in openttd. My patch is one way to do things, but I am not saying in any way it's the best or correct approach. The community needs to have a discussion of what new signal type (if any) should be added to openttd, and eventually included in trunk.

That being said, I am likely not going to continue development of this patch in the immediate future. The reason is that interest in my patch appeared relatively low in the end. If that changes, I will try to become more active with it.

So lets start the discussion of what new signal type should be included in trunk, if any.

michael blunck
Tycoon
Tycoon
Posts: 5269
Joined: 27 Apr 2005 07:09
Contact:

Re: Logic Signals patch

Post by michael blunck » 08 Sep 2013 12:27

maddy_ wrote: That being said, I am likely not going to continue development of this patch in the immediate future. The reason is that interest in my patch appeared relatively low in the end. If that changes, I will try to become more active with it.

So lets start the discussion of what new signal type should be included in trunk, if any.
Well, there was already a comprehensive post by Eddi on page 1 of this thread, and there were also hints to take a look on TTDPatch which already implemented both programmable and restricted signals (amongst others).

Just to re-iterate myself, most important would be restrictive signals. These would allow to split lines according to train´s needs, thus getting rid of spoiling the map with "waypoints" and the need to include them into schedules. OTOH, programmable signals are a bit more exotic, and have already turned out to address only a minority of players. But o/c we´d need both of them, at least in the long run. :cool:

The current lack of advanced signalling is a severe handicap in OTTD, and it would be an important step forward to include this feature.

regards
Michael
Image

User avatar
MasterMeNL
Engineer
Engineer
Posts: 79
Joined: 12 Oct 2012 17:16
Skype: melvinvermeeren
Location: Netherlands

Re: Logic Signals patch

Post by MasterMeNL » 13 Sep 2013 20:09

maddy_ wrote:As we know, there now exists a few different patches for advanced signal types in openttd. My patch is one way to do things, but I am not saying in any way it's the best or correct approach. The community needs to have a discussion of what new signal type (if any) should be added to openttd, and eventually included in trunk.
I haven't seen anything like it really. Care to explain?
maddy_ wrote:The reason is that interest in my patch appeared relatively low in the end. If that changes, I will try to become more active with it.
Interest is pretty high if you'd ask me, it's just that OpenTTD doesn't have that big of a playbase and even less check out the forums and actually want to mess around with patches because it can be very difficult if you've never done anything like it before.
Maybe put some sort of [compiled] tag in the thread name so people know. And "OpenTTD Development" doesn't sound like a download area for actual new game functions, something should really change here.

I'm willing to help if I can do anything at all, maybe uploading new binaries or something similar?

Edit: I just made a new thread here, it includes this patch and 3 others. I'm planning to upload more things soon.

Regards,

Melvin.
Anyone up for some casual co-op?
MMNL Ready2Play MP PatchPacks; Request here!.

User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: Logic Signals patch

Post by adf88 » 22 Sep 2013 08:19

michael blunck wrote:Just to re-iterate myself, most important would be restrictive signals.
How about rail signs?

I mean a kind of signals with fallowing characteristics:
  • The way it affects movement of a train can be based on the train.
  • It's static (don't change in time).
  • Have nice looking sprites allowing you to differentiate rules.
For example:
  • no pass
  • pax/freight only
  • short/long only
  • fast/slow engine only
:] don't worry, be happy and checkout my patches

User avatar
YNM
Tycoon
Tycoon
Posts: 3535
Joined: 22 Mar 2012 11:10
Location: West Java

Re: Logic Signals patch

Post by YNM » 22 Sep 2013 11:16

adf88 wrote:How about rail signs?
For example:
  • no pass
  • pax/freight only
  • short/long only
  • fast/slow engine only
I thought somebody made patch for that back then ?
YNM = yoursNotMine - Don't get it ?

TinyMusic
Tycoon
Tycoon
Posts: 1423
Joined: 02 Feb 2013 02:03

Re: Logic Signals patch

Post by TinyMusic » 22 Sep 2013 14:18

YNM wrote:
adf88 wrote:How about rail signs?
For example:
  • no pass
  • pax/freight only
  • short/long only
  • fast/slow engine only
I thought somebody made patch for that back then ?
Like this one?
Formerly known as UseYourIllusion.
Java Scenario Found Here - Version 2 out
[tweɪ̂ pû tɕʰì wɔ̀ mǐlɤ lû tɕʰìŋ nì pɑ́ŋmɑ̌ŋ]

User avatar
adf88
Chief Executive
Chief Executive
Posts: 644
Joined: 14 Jan 2008 15:51
Location: PL

Re: Logic Signals patch

Post by adf88 » 23 Sep 2013 17:24

The key of my suggestion is "Have nice looking sprites allowing you to differentiate rules.". This means non-programmable probably (you can just build a sign of a certain type).
:] don't worry, be happy and checkout my patches

Guvnor
Engineer
Engineer
Posts: 10
Joined: 01 Nov 2012 01:03

Re: Logic Signals patch

Post by Guvnor » 24 Sep 2013 22:21

Maddy,

Thanks for making this patch. I have a bug report. I am trying V2 of this build here.... http://www.tt-forums.net/viewtopic.php?f=33&t=68654

It seems that the regular path signals and regular one-way path signals are both broken. They are behaving like block signals. Makes it impossible to make big stations. Let me know if you need a save file or anything.

Thanks,

Guvnor

Edit: In the attached screenshot, the second train refuses to pass the one-way path signal to enter the second bay of the station.
Attachments
broken path signals.PNG
(1.01 MiB) Downloaded 3 times

User avatar
MasterMeNL
Engineer
Engineer
Posts: 79
Joined: 12 Oct 2012 17:16
Skype: melvinvermeeren
Location: Netherlands

Re: Logic Signals patch

Post by MasterMeNL » 25 Sep 2013 09:19

Guvnor wrote:Maddy,

Thanks for making this patch. I have a bug report. I am trying V2 of this build here.... http://www.tt-forums.net/viewtopic.php?f=33&t=68654

It seems that the regular path signals and regular one-way path signals are both broken. They are behaving like block signals. Makes it impossible to make big stations. Let me know if you need a save file or anything.

Thanks,

Guvnor

Edit: In the attached screenshot, the second train refuses to pass the one-way path signal to enter the second bay of the station.
I just tested V2 and it works properly.
I think you used a programmable signal instead of a one-way path-signal, their graphics are currently the same. You test if it is a programmable one by using the program-a-signal button thing, it has the same icon as the options menu.
A programmable signal is also green when no train is behind it (like a block signal) if not programmed, while a path signal is always red until the train asks if it's allowed to continue.

Regards,

Melvin.
Anyone up for some casual co-op?
MMNL Ready2Play MP PatchPacks; Request here!.

Guvnor
Engineer
Engineer
Posts: 10
Joined: 01 Nov 2012 01:03

Re: Logic Signals patch

Post by Guvnor » 26 Sep 2013 17:39

MasterMeNL wrote:
Guvnor wrote:Maddy,

Thanks for making this patch. I have a bug report. I am trying V2 of this build here.... http://www.tt-forums.net/viewtopic.php?f=33&t=68654

It seems that the regular path signals and regular one-way path signals are both broken. They are behaving like block signals. Makes it impossible to make big stations. Let me know if you need a save file or anything.

Thanks,

Guvnor

Edit: In the attached screenshot, the second train refuses to pass the one-way path signal to enter the second bay of the station.
I just tested V2 and it works properly.
I think you used a programmable signal instead of a one-way path-signal, their graphics are currently the same. You test if it is a programmable one by using the program-a-signal button thing, it has the same icon as the options menu.
A programmable signal is also green when no train is behind it (like a block signal) if not programmed, while a path signal is always red until the train asks if it's allowed to continue.

Regards,

Melvin.
I had originally been running V5 of your patch pack Melvin and it was crashing so I reverted to V2 so I could continue to play the same map. But I believe the save file wasn't compatible and so the signals were off (which is what prompted my post above). I have since started a new map with V2 and have had no problems so far.

Guvnor

User avatar
MasterMeNL
Engineer
Engineer
Posts: 79
Joined: 12 Oct 2012 17:16
Skype: melvinvermeeren
Location: Netherlands

Re: Logic Signals patch

Post by MasterMeNL » 27 Sep 2013 07:42

Guvnor wrote:I had originally been running V5 of your patch pack Melvin and it was crashing so I reverted to V2 so I could continue to play the same map. But I believe the save file wasn't compatible and so the signals were off (which is what prompted my post above). I have since started a new map with V2 and have had no problems so far.

Guvnor
I have only found 1 bug so far which I added on the post of the compilation pack. It happens when a path signal checks a tunnel or bridge with signals on it. It always crashes for some reason. But besides that there shouldn't be any problems or I'm not aware of them.

Regards,

Melvin.
Anyone up for some casual co-op?
MMNL Ready2Play MP PatchPacks; Request here!.

User avatar
Muzzly
Traffic Manager
Traffic Manager
Posts: 226
Joined: 09 Jun 2010 20:54
Location: Vilnius, LT

Re: Logic Signals patch

Post by Muzzly » 16 Oct 2013 17:42

I have difficulty with signal logic. No matter what signal color and logic operation I choose, the train is not moving.

I would expect, that if signal is not programmed ( default state ), it should let trains to pass.
Attachments
blocking the train.png
(144.16 KiB) Not downloaded yet

User avatar
MasterMeNL
Engineer
Engineer
Posts: 79
Joined: 12 Oct 2012 17:16
Skype: melvinvermeeren
Location: Netherlands

Re: Logic Signals patch

Post by MasterMeNL » 16 Oct 2013 17:59

Muzzly wrote:I have difficulty with signal logic. No matter what signal color and logic operation I choose, the train is not moving.

I would expect, that if signal is not programmed ( default state ), it should let trains to pass.
I think that if it's not programmed it acts like a block/path signal to prevent crashes.

Regards,

Melvin.
Anyone up for some casual co-op?
MMNL Ready2Play MP PatchPacks; Request here!.

User avatar
Muzzly
Traffic Manager
Traffic Manager
Posts: 226
Joined: 09 Jun 2010 20:54
Location: Vilnius, LT

Re: Logic Signals patch

Post by Muzzly » 16 Oct 2013 18:24

I tested it a bit more. I seems that in a circle should always be at least two path signals in order train to move. Sorry, it was not your fault. With two programmable signals (with default green light) it also works !!!

Train window status has confused me. Should it not be "Waiting for free path" for pragrammable signal too?
Attachments
works with two signals.png
works with two signals.png (76.44 KiB) Viewed 2391 times
different status.png
different status.png (71.78 KiB) Viewed 2391 times

Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 3 guests