Daylength hack

Talk about the sequel to the original TT, Transport Tycoon Deluxe.
mtwist
Traffic Manager
Traffic Manager
Posts: 196
Joined: 23 Mar 2005 14:30

Daylength hack

Post by mtwist »

Hi,

due to the fact that the gamespeed is too high for enjoying all of the nice features offered by the patch I developed a hack to modify the daylength. It is currently a bad exe hack but I am working on the code to include this into the patch. I hope I will fully understand the patch coding soon :D .

I am not sure if I break the board rules with this description, so please moderators delete this topic if I do so. And sorry for that.

The hack is currently only available for the windows version. It modifies GameGFX.exe file, so you better copy the file before.


:arrow: Open the GameGFX.exe with a hex editor.

:arrow: Search for the string 67 E2 C1. The daylength value is 14 bytes after the occurence of this string. (In german version of GameGFX.exe it is address 0x151c9f). You will find the bytes 75 03 there. This is the default value 0x375 for daylength delay (be careful, the bytes are swapped).

:arrow: Now decrease this hex value. A small value means a long daylenth. The smallest possible value is 0x1, which results in a daylenght of around 25 minutes!

:arrow: Save GameGFX.exe.

:arrow: If you are useing TTDpatch delete the TTDLOADW.OVL file.


Note: There are no calculation adaptions at the moment. When the daylength is very high, the running costs will get negligible, because they are calculated on daybase. On the other hand you will earn more money per day. So the balance between costs and income is not longer the same. I will clarify the impact and try to fix this for the switch in TTDpatch.
Last edited by mtwist on 10 Aug 2006 15:37, edited 1 time in total.
User avatar
m3henry
Tycoon
Tycoon
Posts: 1985
Joined: 15 Feb 2006 12:00
Location: Hampshire

Post by m3henry »

sounds interesting, longer games :)
The occasional look back at your past can teach you a great many things...
Patchman
Tycoon
Tycoon
Posts: 7575
Joined: 02 Oct 2002 18:57
Location: Ithaca, New York
Contact:

Re: Daylength hack

Post by Patchman »

mtwist wrote: :arrow: Go to address 0x151c9f. You will find the bytes 75 03 there. This is the default value 0x375 for daylength delay (be careful, the bytes are swapped).
That will only work with one specific language version of gamegfx.exe, the offsets are different in each version...
Josef Drexler

TTDPatch main | alpha/beta | nightly | manual | FAQ | tracker
No private messages please, you'll only get the answering machine there. Send email instead.
mtwist
Traffic Manager
Traffic Manager
Posts: 196
Joined: 23 Mar 2005 14:30

Post by mtwist »

Oh, thanks for that hint. I used the german version. Instead of useing the address 0x151c9f one should search for the unique string 67 E2 C1. The daylength value is 14 bytes after the occurence of this string. I really must get into the patch coding :D
User avatar
uzurpator
Transport Empire Moderator
Transport Empire Moderator
Posts: 2178
Joined: 10 Jan 2003 12:21
Location: Katowice, Poland

Post by uzurpator »

This... is... ubercool!!!

EDIT:

Hehe - checked that :P value of 0x22 gives a nice 30 second day. However this does not multiply the running costs accordingly - so with 30 second day (which is about 10 times longer) the train will not cost 10 times more to run.

Nonetheless - this is very cool :)
All art and vehicle stats I authored for TT and derivatives are as of now PUBLIC DOMAIN! Use as you see fit
Just say NO to the TT fan-art sprite licensing madness. Public domain your art as well.
User avatar
Dave
Moderator
Moderator
Posts: 17243
Joined: 26 Dec 2005 20:19
Location: North London

Post by Dave »

Hmm is there any chance of this becoming part of the Patch, patchman?

With proper changes of course :P

I can't do these hacks.
Official TT-Dave Fan Club

Dave's Screenshot Thread! - Albion: A fictional Britain
Flickr


Why be a song when you can be a symphony? r is a...
User avatar
m3henry
Tycoon
Tycoon
Posts: 1985
Joined: 15 Feb 2006 12:00
Location: Hampshire

Post by m3henry »

if it does, it will be near the middle of the list :( meaning patchman is doing something more important (fun/great :D )
The occasional look back at your past can teach you a great many things...
mtwist
Traffic Manager
Traffic Manager
Posts: 196
Joined: 23 Mar 2005 14:30

Post by mtwist »

uzurpator wrote:Hehe - checked that value of 0x22 gives a nice 30 second day. However this does not multiply the running costs accordingly - so with 30 second day (which is about 10 times longer) the train will not cost 10 times more to run.
This is exactly what I meant with disturbed balance...I will try to integrate the hack into the patch as fast as possible - including an adapted calculation of running costs. But I am not sure yet, if it is that easy. A possible workaround would be a general multiplier for the running costs.
User avatar
stevenh
TTDPatch Developer
TTDPatch Developer
Posts: 759
Joined: 24 Jul 2005 05:07
Location: Canberra, Australia
Contact:

Post by stevenh »

mtwist: congratulations, you've done something I half-promised to look into a while back.
Integrating this into the patch would be quite simple (if you chose to hardcode the changed timespan) until it came to the actual ability of changing the parameter.
Josef will be able to help you with that.

As far as running costs are concerned; I don't see that they really need to be modified?

This is quite a welcomed addition actually, finally my trains can arrive at their destination in the same day (especially since they only have to travel very short distances). :)
mtwist
Traffic Manager
Traffic Manager
Posts: 196
Joined: 23 Mar 2005 14:30

Post by mtwist »

stevenh wrote:Josef will be able to help you with that.
I am already in contact with Josef :D .
stevenh wrote:As far as running costs are concerned; I don't see that they really need to be modified?
For me that's the same, but it would be nice to have an option for adapting the calculation. Currently TTD increases a DayPart variable every twelve ticks (or clock cycles, I am not sure with that) with the delay value of 0x375. When this addition causes an overflow (bigger than 0xFFFF) the day is over and another Date variable is increased. In addition all necessary claculations are done. A possible adaption for the running costs would be the following:
- Increase the DayPart variable as it is.
- Include a new variable, let's say DayLength which is increased, when DayPart causes the overflow.
- All calulations are done now, but the Date variable won't be increased. This will be done, when the new DayLength variable reaches the given delay value.

I haven't clarified yet how the running costs are calculated and if it is date depended or only triggerd by the overflow mentioned above.
User avatar
jacke
Director
Director
Posts: 533
Joined: 19 May 2002 14:47
Location: Sweden

Post by jacke »

Very interesting, this feature in the patch would be really great! Good luck mtwist!
User avatar
Hyronymus
Tycoon
Tycoon
Posts: 13233
Joined: 03 Dec 2002 10:36
Location: The Netherlands
Contact:

Post by Hyronymus »

Can we welcome you to the Patch Dev team yet, mtwist? I assume you have a throrough knowledge of assembly if you found this stuff out :). Looking forward to testing this feature, although it might get boring somewhere down the line.
User avatar
ISA
Tycoon
Tycoon
Posts: 3384
Joined: 17 Oct 2005 20:56
Location: Estonia

Post by ISA »

stevenh wrote: you've done something I half-promised to look into a while back.
Yay my sugsesion what I offer wile back is in progress. Keep up the good work :)
mtwist
Traffic Manager
Traffic Manager
Posts: 196
Joined: 23 Mar 2005 14:30

Post by mtwist »

Hyronymus wrote:Can we welcome you to the Patch Dev team yet, mtwist? I assume you have a throrough knowledge of assembly if you found this stuff out :).
I started to check out the required work for getting into the patch coding. Assembly coding should not be the problem, because I have some experience, currently it is only the stuff to get the changes into the patch that causes some problems. But I am sure I will solve them :D
User avatar
ISA
Tycoon
Tycoon
Posts: 3384
Joined: 17 Oct 2005 20:56
Location: Estonia

Post by ISA »

OK I wanna make days longer but im doing something wrong :? i found that string 67 E2 C1 there i read 14 bytes.... and there is

Code: Select all

75 03 OF etc
SO I changed this 03 to 22 and day is going faster. Hmmm explain me please that part. What "code" I must add to have 30 sec days.
User avatar
Dave
Moderator
Moderator
Posts: 17243
Joined: 26 Dec 2005 20:19
Location: North London

Re: Daylength hack

Post by Dave »

mtwist wrote: :arrow: Now decrease this hex value. A small value means a long daylenth. The smallest possible value is 0x1, which results in a daylenght of around 25 minutes!
LOWER numbers mean longer days. 22 is NOT lower than 3.
Official TT-Dave Fan Club

Dave's Screenshot Thread! - Albion: A fictional Britain
Flickr


Why be a song when you can be a symphony? r is a...
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

Actually, thats "0x2275 is not lower than 0x0375". Remember what m3henry said about the bytes being reversed.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
User avatar
Aegir
Tycoon
Tycoon
Posts: 2884
Joined: 09 Feb 2004 10:02
Contact:

Post by Aegir »

That was mtwist, Dalestan. Not m3henry.
Currently working under the name 'reldred' on Github, and Discord.
NFO/NML coder, part-time patch writer for JGRPP, and all round belligerent.

14:40 <orudge> I can't say I discriminate against any particular user
14:41 <Aegir> orudge: I can!
mtwist
Traffic Manager
Traffic Manager
Posts: 196
Joined: 23 Mar 2005 14:30

Post by mtwist »

DaleStan is absolutly right. The bytes are swapped in the exe file. A few examples:

Value 0x0375 would be 75 03 in the file
Value 0x0001 would be 01 00 in the file
Value 0x0022 would be 22 00 in the file
...

It is also possible to set the value to zero, but then the current day won't end at all...Who does not remind of "Groundhog Day" :D
User avatar
ISA
Tycoon
Tycoon
Posts: 3384
Joined: 17 Oct 2005 20:56
Location: Estonia

Post by ISA »

mtwist wrote: Value 0x0375 would be 75 03 in the file
Value 0x0001 would be 01 00 in the file
Value 0x0022 would be 22 00 in the file
Ty I knew I forgot something. Damn zeros :D
Edit: /me try it and it worked :]
Post Reply

Return to “Transport Tycoon Deluxe”

Who is online

Users browsing this forum: No registered users and 2 guests