Reverse engineering of RTC in order to create a free and open-source clone

General messages about RTC and it's development.

Moderator: George Gilbert

Forum rules
Please read the Forum rules and policies before posting.
Post Reply
tavvva
Novice
Posts: 15
Joined: Mon Nov 23, 2020 3:54 pm

Reverse engineering of RTC in order to create a free and open-source clone

Post by tavvva »

Hello everyone.
Since George Gilbert is very probably never gonna return to fix bugs and keep the RTC engine alive, I was thinking about reverse engineering the whole thing.
Gambit37 wrote: Sun Sep 10, 2023 9:16 pm I recall there was a weird hack where it's possible to open . RTC files in the editor, but I don't think they can be saved back out as .TXT files.
Any chance you could recall how to do that? Even without saving back to TXT it could be helpful.

Thank you.
tavvva
Novice
Posts: 15
Joined: Mon Nov 23, 2020 3:54 pm

Re: Reverse engineering of RTC in order to create a free and open-source clone

Post by tavvva »

Any chance someone here knows anything about the RTC file format?
tavvva
Novice
Posts: 15
Joined: Mon Nov 23, 2020 3:54 pm

Re: Reverse engineering of RTC in order to create a free and open-source clone

Post by tavvva »

I believe it would be very helpful if the authors of existing custom dungeons could somehow share the original files from which we could reconstruct the binary blobs. This could also help us understand the format. And even if we don't succeed, at least there will be a chance to create a new well-documented format. Personally, I don't believe that someone who enjoys playing dungeons and solving puzzles would cheat unless they became absolutely desperate due to being stuck for a long time.
User avatar
Sphenx
On Master
Posts: 593
Joined: Sun Sep 09, 2001 11:23 am
Contact:

Re: Reverse engineering of RTC in order to create a free and open-source clone

Post by Sphenx »

I suppose you're talking about reverse engineering the file format and not the program -- we would have enough knowledge to develop a clone, but maybe not being able to read the original RTC files. Or even tweak some already existing clone to convert TXT contents for that clone ?
About the RTC format, it is some sort of compiled version of TXT. I don't specifically knows about the hack Gambit talks about.
For the experimentation, you could create your own TXT then compile them into RTC. The fun part is that even doing that produces different result every time. George might have added an encryption seed over the compiled information.
Anyway, if you are willing to do this, I may assist as I am also interested.
User avatar
Gambit37
Should eat more pies
Posts: 13766
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Reverse engineering of RTC in order to create a free and open-source clone

Post by Gambit37 »

tavvva wrote: Wed Aug 21, 2024 7:05 am
Gambit37 wrote: Sun Sep 10, 2023 9:16 pm I recall there was a weird hack where it's possible to open . RTC files in the editor, but I don't think they can be saved back out as .TXT files.
Any chance you could recall how to do that? Even without saving back to TXT it could be helpful.
I'm not sure, but it's something like: load an .RTC file as if it were a text file in the editor through the normal menu, then when it fails, its listed in the recent files list. If you then select that entry, the editor will load it as if it were a .TXT file. If it includes any external resources, they will be missing or messed up though. Something like that anyway, but I might be entirely wrong.

What's your purpose here though?

Do you want to enhance the engine, or just extract compiled dungeons? I don't think enhancement is worthwhile considering DSB exists and does way more than RTC already.

If you want to convert RTC dungeons into DSB though.... that would interesting.

If you just want to reverse engineer to see if you can: well, go nuts then :D

You should be careful about how you position this though. You can't create an open source clone from George's proprietary code. It belongs to him and is copyright to him, and it also includes other third party code which isn't his and is already under licence.
User avatar
Sophia
Concise and Honest
Posts: 4306
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Reverse engineering of RTC in order to create a free and open-source clone

Post by Sophia »

Gambit might be misremembering or there might be a second valid method. The way that worked for me was:
:arrow: Load a .txt file, such as SomeDungeon.txt
:arrow: SomeDungeon.txt will now show up in your recent files
:arrow: Delete SomeDungeon.txt, rename File.rtc to SomeDungeon.txt and put it in the same place
:arrow: Load it from the recent files, and the editor will load it

As Gambit has noted, this will work, but there will probably be some small glitches and resources that are compiled into the RTC file won't be preserved.

Anyway, there were tools for converting RTC text files to DSB, although they're pretty obsolete these days. No attempt was ever made to make it parse binary RTC files, though. There are enough differences between how RTC and DSB do things internally that it'd probably need a bunch of hacks, like there are for converted DM/CSB.

In addition to copyrighted code, the other issue is that RTC still contains the copyrighted graphics and sounds from DM. This is also the reason why DSB also can't be considered "free and open-source" despite the source code being available.
tavvva
Novice
Posts: 15
Joined: Mon Nov 23, 2020 3:54 pm

Re: Reverse engineering of RTC in order to create a free and open-source clone

Post by tavvva »

Sorry guys ... I just woke up after a long sleep and apparently a lot of things changed ... I just know I enjoyed playing RTC dungeons and I guess majority of them haven't been ported to DSB yet as the engines are probably not 100% compatible, or are they already? I just didn't want them to slowly disappear as the RTC rotting continues ... Many authors of the RTC dungeons are probably unreachable as well, right?
tavvva
Novice
Posts: 15
Joined: Mon Nov 23, 2020 3:54 pm

Re: Reverse engineering of RTC in order to create a free and open-source clone

Post by tavvva »

Gambit37 wrote: Thu Aug 22, 2024 1:58 pm If you want to convert RTC dungeons into DSB though.... that would interesting.
Yeah... I either wanted a conversion or add a support for the RTC format in any of the existing engines or eventually write a new engine from scratch, depending on the analysis outcome.
Gambit37 wrote: Thu Aug 22, 2024 1:58 pm You can't create an open source clone from George's proprietary code. It belongs to him and is copyright to him, and it also includes other third party code which isn't his and is already under licence.
Well ... I believe copyrights work a bit different way ... Of course I wouldn't copy any binary blobs of code from the RTC exe files. That wouldn't make any sense to me. However, unless George has the internal principles patented, it's absolutely ok to reverse-engineer them by watching and analysing the behavior and by trying to get as close as possible.
tavvva
Novice
Posts: 15
Joined: Mon Nov 23, 2020 3:54 pm

Re: Reverse engineering of RTC in order to create a free and open-source clone

Post by tavvva »

Looking at the DSB source, it's a pity it doesn't support Linux builds yet...
User avatar
Sphenx
On Master
Posts: 593
Joined: Sun Sep 09, 2001 11:23 am
Contact:

Re: Reverse engineering of RTC in order to create a free and open-source clone

Post by Sphenx »

Sophia wrote: Thu Aug 22, 2024 9:58 pm Gambit might be misremembering or there might be a second valid method. The way that worked for me was:
:arrow: Load a .txt file, such as SomeDungeon.txt
:arrow: SomeDungeon.txt will now show up in your recent files
:arrow: Delete SomeDungeon.txt, rename File.rtc to SomeDungeon.txt and put it in the same place
:arrow: Load it from the recent files, and the editor will load it
... I am not successful with it; whatever I do, RTC will throw me a list of errors, even from recent files list, which is logical to me anyway. How are you able to do that ? I am using RTC 0.49.

On the other point, why do say RTC to DSB tool is obsolete, in which way ? Could you point me to such tool ? At some point, I did work partially on RTC reader/converter.
User avatar
Sophia
Concise and Honest
Posts: 4306
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Reverse engineering of RTC in order to create a free and open-source clone

Post by Sophia »

Sphenx wrote: Sun Aug 25, 2024 1:32 pmHow are you able to do that ? I am using RTC 0.49.
I guess I misremembered too! It's a little more complicated.

:arrow: Load a .txt file, such as SomeDungeon.txt
:arrow: SomeDungeon.txt will now show up in your recent files
:arrow: Close RTC editor
:arrow: Open Regedit, the Windows registry editor (insert standard disclaimers about editing your registry)
:arrow: Go to Computer\HKEY_CURRENT_USER\SOFTWARE\George Gilbert\RTC Editor\Recent File List
:arrow: Edit the File1 (or whatever) key from SomeDungeon.txt to File.rtc
:arrow: Reopen RTC editor
:arrow: Load File.rtc from the recent files, and the editor will load it
Sphenx wrote: Sun Aug 25, 2024 1:32 pmOn the other point, why do say RTC to DSB tool is obsolete, in which way ? Could you point me to such tool ? At some point, I did work partially on RTC reader/converter.
It was the same one! Here's the thread, though the links are dead. You yourself even hosted it for a time. Maybe you still have it?
viewtopic.php?t=26678
User avatar
Sphenx
On Master
Posts: 593
Joined: Sun Sep 09, 2001 11:23 am
Contact:

Re: Reverse engineering of RTC in order to create a free and open-source clone

Post by Sphenx »

Thanks Sophia! That actually worked. That's interesting, so the open file window can only filter "txt" to load, but you go through the recent file list to open anything. Good.

About RTSB, I still host the old version here. But I don't have RTSB 2 which seems to be lua. It seems it would have been hosted on your site ? Don't you have it ? Or someone else ?
Post Reply