New suggestions for the patch (no new suggestions here!)

Got an idea for a new feature in TTDPatch? Post it here.

Moderator: TTDPatch Moderators

Locked
SHADOW-XIII
Tycoon
Tycoon
Posts: 14275
Joined: 09 Jan 2003 08:37

Post by SHADOW-XIII »

krtaylor wrote:It may not be possible to alter the AI. Would it be theoretically possible to disconnect the AI altogether and competely rewrite it, with the new code using the old pointers to lay track, operate, etc.?
there is no enough space/memory to do that
what are you looking at? it's a signature!
User avatar
eis_os
TTDPatch Developer
TTDPatch Developer
Posts: 3603
Joined: 07 Mar 2003 13:10
Location: Germany
Contact:

Post by eis_os »

If you want rewrite the AI please do it we will try to pack it in memory. But you have to write the AI routines.
TTDPatch dev in retirement ... Search a grf, try Grf Crawler 0.9 - now with even faster details view and new features...
Image
User avatar
krtaylor
Tycoon
Tycoon
Posts: 11784
Joined: 07 Feb 2003 01:58
Location: Texas, USA
Contact:

Post by krtaylor »

Please, please, there are so many great Patch things under development, and more we are waiting for, that an enormous project like rewriting the AI is NOT a real request. I was asking if, theoretically, it is even possible. It sounds like we are not even sure if it is theoretically possible. Let's not worry about it. Maybe later (much, much, much later...) It seems like the understanding of the TTD code is growing by leaps and bounds, I keep reading about new ways to fiddle with it that nobody thought could be done, that now are understood. Who knows, maybe someday Josef will reverse-compile the whole thing and we'll be all set. :-)
Development Projects Site:
http://www.as-st.com/ttd
Japan, American Transition, Planeset, and Project Generic Stations available there
Sokko
Route Supervisor
Route Supervisor
Posts: 464
Joined: 24 Apr 2003 21:01

Post by Sokko »

Good point; is it at all possible to decompile TTD? If you know what it's written in, there's a good chance that you can find some decompilers on the internet that will do the job nicely. Depending on the language, I think you can lose some of the information. Let's hope not.
How many boards would the Mongols hoard if the Mongol hordes got bored?
User avatar
krtaylor
Tycoon
Tycoon
Posts: 11784
Joined: 07 Feb 2003 01:58
Location: Texas, USA
Contact:

Post by krtaylor »

I am not an expert in this area, but my understanding is that TTD is written in some sort of unusual low-level code that makes it very challenging to reverse engineer. When it was written it was not uncommon to write a whole custom "game engine" as a platform to develope the actual game on, so in effect it would be two separate layers of different code, neither of which being straightforward. Am I correct in understanding that the way the patch works, is actually by going up into main memory and changing various pointers around after TTD is loaded into the computer's memory? In other words, it isn't changing any code at all, it is more of a "parasite" that rides on top of what is already there without really interacting with it.
Development Projects Site:
http://www.as-st.com/ttd
Japan, American Transition, Planeset, and Project Generic Stations available there
Patchman
Tycoon
Tycoon
Posts: 7575
Joined: 02 Oct 2002 18:57
Location: Ithaca, New York
Contact:

Post by Patchman »

TTD was written in assembly, and you can download the disassembly (which is what's closest to decompiling for assembly language) from Marcin's site at http://kufel.immt.pwr.wroc.pl/~mgrzegor/ttdpatch/ida/ .

And you're incorrect. The patch actually mostly changes the code, there's only very little data it changes. For the most part, it finds a line of code where TTD does something important, and replaces it with a call to TTDPatch's improved version of that code.

For example, when a train enters or leaves a signal block, TTD finds out whether the signals can go green. This check is replaced by a call to TTDPatch, which additionally takes pre-signals into account.

Same for the selectgoods feature. TTD scans the area around an industry for stations. When it finds one, it distributes part of the cargo to it. TTDPatch replaces that with a check which first tests whether the cargo should be delivered at all, i.e. whether there was a carrier for it there before.

So the patch in general finds a "hook" into TTD's code, and replaces this hook with a call to an improved version that does more than TTD does. That's the patched code. Basically, it works on the old saying, "give me a big enough lever and the right hook and I can move the Earth."

Trivia time: Currently, there are about 280 code hooks, and 140 data hooks (to find locations of TTD variables etc.).
User avatar
spaceman-spiff
Retired Moderator
Retired Moderator
Posts: 20634
Joined: 28 Jul 2002 07:08
Location: Belgium
Contact:

Post by spaceman-spiff »

I thought it was like that, nice workaround if you haven't got the source code, that's probably the reason when you add/fix something, sometimes other things go broke :?:
Well, back to work, lot's of it in the near future
Patchman
Tycoon
Tycoon
Posts: 7575
Joined: 02 Oct 2002 18:57
Location: Ithaca, New York
Contact:

Post by Patchman »

We do have the source code (i.e. the disassembly). It's just not what "normal" people would use as a programming language. I guess that means CS isn't "normal"...

Anyway, the patching really gets complicated if you need 50 hooks to add one feature. This would be the case for example for the two-runway-airport or other similarly complicated things. The first problem is that it takes hours to find each hook, and the second is that you can be sure that you forgot to change one important one, and won't find out until two days after the release version is out...
User avatar
Flavius
Tycoon
Tycoon
Posts: 1531
Joined: 22 Apr 2003 03:55
Location: Gold Coast, Queensland, Australia.

Bridges and Signals

Post by Flavius »

Hi

Currently i am playing a game where my trains cross a short high speed bridge into a very big busy terminal. I cannot place signals on the bridge
so traffic builds up all the time :cry:

Would it be possible to have the watercourse pass under the rails via a concrete subway/pipe or tunnel :?: Thus i could place signals then 8) ........
User avatar
krtaylor
Tycoon
Tycoon
Posts: 11784
Joined: 07 Feb 2003 01:58
Location: Texas, USA
Contact:

Post by krtaylor »

Another way of putting this would be, can we put signals on a bridge? This has come up before but I don't remember where it went.
Development Projects Site:
http://www.as-st.com/ttd
Japan, American Transition, Planeset, and Project Generic Stations available there
User avatar
eis_os
TTDPatch Developer
TTDPatch Developer
Posts: 3603
Joined: 07 Mar 2003 13:10
Location: Germany
Contact:

Post by eis_os »

krtaylor wrote:Another way of putting this would be, can we put signals on a bridge? This has come up before but I don't remember where it went.
Not possible, really there isn't any bit free for place signals on or under bridges.
I have currently the same problem to add support for speedlimit signs.
ohh, now everyone knows what I am doing next :)
User avatar
krtaylor
Tycoon
Tycoon
Posts: 11784
Joined: 07 Feb 2003 01:58
Location: Texas, USA
Contact:

Post by krtaylor »

What's the purpose of speedlimit signs? Why would you want to slow down the trains beyond what already slows them down (curves, hills, etc.)?
Development Projects Site:
http://www.as-st.com/ttd
Japan, American Transition, Planeset, and Project Generic Stations available there
SHADOW-XIII
Tycoon
Tycoon
Posts: 14275
Joined: 09 Jan 2003 08:37

Post by SHADOW-XIII »

if you could add speedlimit signs with red/green ligts (or semaphores) then we will get slow down ligts
what are you looking at? it's a signature!
User avatar
krtaylor
Tycoon
Tycoon
Posts: 11784
Joined: 07 Feb 2003 01:58
Location: Texas, USA
Contact:

Post by krtaylor »

I'm still not sure I quite understand this. Is this anything like the "caution" signals I talked about some time back, where the signal behind a train would be red, then the one behind THAT would be yellow (slow down), then the one behind THAT would be green (full speed)?
Development Projects Site:
http://www.as-st.com/ttd
Japan, American Transition, Planeset, and Project Generic Stations available there
User avatar
eis_os
TTDPatch Developer
TTDPatch Developer
Posts: 3603
Joined: 07 Mar 2003 13:10
Location: Germany
Contact:

Post by eis_os »

Speedlimit signs before and behind a rail / road crossings makes sense or?

Maybe I will affect town ratings if your trains travel 200km/h in Towns :P
We will see what I can add to TTD :roll:

-add-
No I don't change anything in the Presignals,
it will break the complete routines for it. No No...
User avatar
krtaylor
Tycoon
Tycoon
Posts: 11784
Joined: 07 Feb 2003 01:58
Location: Texas, USA
Contact:

Post by krtaylor »

Speaking of the presignals, ever since I installed the most recent alpha version and the new trainsets, I don't have presignals. They don't get created automatically, and CTRL doesn't do them either. I have the switches turned on in TPS. I do have the semaphore graphics installed but they don't seem to be working either. Any ideas?
Development Projects Site:
http://www.as-st.com/ttd
Japan, American Transition, Planeset, and Project Generic Stations available there
User avatar
Dinges
Tycoon
Tycoon
Posts: 2865
Joined: 07 Jan 2003 18:00
Location: Fryslân Boppe!
Contact:

Post by Dinges »

Whatch for spaces after a line in your newgrfw.txt, DL the latest, place them in another order in your newgrfw.txt

And see if you can see what stands there by using the ? (query) tool
Dinges

Who is the other person in me?

my Blog (dutch) - my Last.fm profile

Owner of http://ttdgraphics.cjb.net/ ! Temp addr: http://ttdgraphics.owenrudge.com/
User avatar
Saiyan
Engineer
Engineer
Posts: 81
Joined: 09 May 2003 12:16
Location: Budapest, Hungary

Re: Bridges and Signals

Post by Saiyan »

Rollo wrote:Hi

Currently i am playing a game where my trains cross a short high speed bridge into a very big busy terminal. I cannot place signals on the bridge
so traffic builds up all the time :cry: ...
Why not split the bridge in two by raising a square of terrain someways in its path and planting your signals there?
Saiyan
(TTDPatch Hungarian translator)

"By all means marry. If you get a good wife, you'll be happy. If you get a bad one, you'll become a philosopher." - Socrates
User avatar
spaceman-spiff
Retired Moderator
Retired Moderator
Posts: 20634
Joined: 28 Jul 2002 07:08
Location: Belgium
Contact:

Post by spaceman-spiff »

That's too easy :P
Well, back to work, lot's of it in the near future
User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1357
Joined: 15 Feb 2003 17:32
Location: Vergezac, France

Post by MagicBuzz »

A little bugfix that should be easy to do :
-> Saving durrency, system measurment, town names mode and drive side screen.

I use to forget updaing these setting each time I start a new game, and I must restart a new game to change these settings.

It may be very cool if these parameters would be kept as the game diffucult settings :)
Locked

Return to “Suggestions”

Who is online

Users browsing this forum: Ahrefs [Bot] and 4 guests