Page 1 of 1
Reverse engineering of RTC in order to create a free and open-source clone
Posted: Wed Aug 21, 2024 7:05 am
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.
Re: Reverse engineering of RTC in order to create a free and open-source clone
Posted: Wed Aug 21, 2024 7:08 am
by tavvva
Any chance someone here knows anything about the RTC file format?
Re: Reverse engineering of RTC in order to create a free and open-source clone
Posted: Wed Aug 21, 2024 7:24 am
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.
Re: Reverse engineering of RTC in order to create a free and open-source clone
Posted: Thu Aug 22, 2024 7:39 am
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.
Re: Reverse engineering of RTC in order to create a free and open-source clone
Posted: Thu Aug 22, 2024 1:58 pm
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
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.
Re: Reverse engineering of RTC in order to create a free and open-source clone
Posted: Thu Aug 22, 2024 9:58 pm
by Sophia
Gambit might be misremembering or there might be a second valid method. The way that worked for me was:

Load a .txt file, such as SomeDungeon.txt

SomeDungeon.txt will now show up in your recent files

Delete SomeDungeon.txt, rename File.rtc to SomeDungeon.txt and put it in the same place

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.
Re: Reverse engineering of RTC in order to create a free and open-source clone
Posted: Fri Aug 23, 2024 9:17 pm
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?
Re: Reverse engineering of RTC in order to create a free and open-source clone
Posted: Fri Aug 23, 2024 9:35 pm
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.
Re: Reverse engineering of RTC in order to create a free and open-source clone
Posted: Fri Aug 23, 2024 9:44 pm
by tavvva
Looking at the DSB source, it's a pity it doesn't support Linux builds yet...
Re: Reverse engineering of RTC in order to create a free and open-source clone
Posted: Sun Aug 25, 2024 1:32 pm
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:

Load a .txt file, such as SomeDungeon.txt

SomeDungeon.txt will now show up in your recent files

Delete SomeDungeon.txt, rename File.rtc to SomeDungeon.txt and put it in the same place

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.
Re: Reverse engineering of RTC in order to create a free and open-source clone
Posted: Mon Aug 26, 2024 12:16 am
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.

Load a .txt file, such as SomeDungeon.txt

SomeDungeon.txt will now show up in your recent files

Close RTC editor

Open Regedit, the Windows registry editor (insert standard disclaimers about editing your registry)

Go to Computer\HKEY_CURRENT_USER\SOFTWARE\George Gilbert\RTC Editor\Recent File List

Edit the File1 (or whatever) key from SomeDungeon.txt to File.rtc

Reopen RTC editor

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
Re: Reverse engineering of RTC in order to create a free and open-source clone
Posted: Mon Aug 26, 2024 9:58 am
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 ?