there is no enough space/memory to do thatkrtaylor 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.?
New suggestions for the patch (no new suggestions here!)
Moderator: TTDPatch Moderators
-
- Tycoon
- Posts: 14275
- Joined: 09 Jan 2003 08:37
what are you looking at? it's a signature!
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...


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
http://www.as-st.com/ttd
Japan, American Transition, Planeset, and Project Generic Stations available there
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?
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
http://www.as-st.com/ttd
Japan, American Transition, Planeset, and Project Generic Stations available there
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.).
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.).
- spaceman-spiff
- Retired Moderator
- Posts: 20634
- Joined: 28 Jul 2002 07:08
- Location: Belgium
- Contact:
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...
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...
Bridges and Signals
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
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
........
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

Would it be possible to have the watercourse pass under the rails via a concrete subway/pipe or tunnel


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
http://www.as-st.com/ttd
Japan, American Transition, Planeset, and Project Generic Stations available there
Not possible, really there isn't any bit free for place signals on or under bridges.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.
I have currently the same problem to add support for speedlimit signs.
ohh, now everyone knows what I am doing next

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
http://www.as-st.com/ttd
Japan, American Transition, Planeset, and Project Generic Stations available there
-
- Tycoon
- Posts: 14275
- Joined: 09 Jan 2003 08:37
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
http://www.as-st.com/ttd
Japan, American Transition, Planeset, and Project Generic Stations available there
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
http://www.as-st.com/ttd
Japan, American Transition, Planeset, and Project Generic Stations available there
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
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/
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/
Re: Bridges and Signals
Why not split the bridge in two by raising a square of terrain someways in its path and planting your signals there?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...
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
(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
- spaceman-spiff
- Retired Moderator
- Posts: 20634
- Joined: 28 Jul 2002 07:08
- Location: Belgium
- Contact:
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
-> 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

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