Question Ah yes another curious question for the development team

KrakenLoreFinder21

Swashbuckler
So when you had started making the game and reviving it. How did you get the models and coding for the game, did someone just happen to save the files of the game or was this in progress well before POTCO had closed?
 
Hi!

So, what we started with was essentially what each and every one of us downloaded in order to run the game.

Every model, so swords, characters, foliage, buildings, etc, was downloaded onto each player's computer, along with "client-side" code.

Client-side code is like one piece of the puzzle. Since POTCO is an MMO, the game functions by consistently connecting your client (what you have downloaded on your computer) to the server. On the server, there's more code, and together, they make up the game you know as POTCO.

We had to rewrite all of the AI/server code ourselves, since none of it was stored locally on our computers. It's an incredibly difficult guessing game - trying to code brand new files that interact as flawlessly as possible with the client code we have from Disney.


So in short:


Multiple folks had the POTCO files saved after closure. Work began in earnest around 2015.
 
So when you had started making the game and reviving it. How did you get the models and coding for the game, did someone just happen to save the files of the game or was this in progress well before POTCO had closed?
Hi!

I'm the person who first reverse engineered the POTCO client back in 2014. There are multiple parts to getting the source code from the client, each with varying levels of difficulty. This is a complicated programming topic, so my response is going end up being very technical. I'll try and simplify it the best that I can, but it's hard to do that given the topic at hand being so difficult.

If you wanted to get the Python source code from the client, this is a very involved process. To start, you need to extract the "bytecode" from the client. This bytecode is a compiled Python source file, and is located in a specific place in memory after the application is started. To get this bytecode, you need to inject code into the game and hook onto that memory location and write the content following that location to disk, making sure to observe the delimitation points between source files that allow you to break apart each file individually as they should be.

After doing this, you need to reverse engineer the bytecode you obtained into a human readable Python source file. Thankfully, there's a lot of open source python decompilers; however, these are imperfect solutions for a number of reasons. Frequently, the decompilers will not reverse engineer the contents of the source file correctly - or in some cases, it will actually outright fail to reverse engineer it completely. Because of this, we had to manually reverse engineer bits and pieces of every single source file by hand. We did this by comparing the raw disassembly of the dumped bytecode from the client vs a new bytecode file we'd generate from the source file we're 'verifying'.

Here's an example of what Python disassembly looks like:

478c79c745b93b54573aaf0722fe19f3.jpg

When we went from beta phase 1 to beta phase 2, most of the dev team had spent all their time for like 3 months doing only this; manually reverse engineering the game again from scratch. We'd compare the two disassembled files side-by-side and tweak the reverse engineered Python source file until the verification tools came back saying the two files were identical.

Now, there's two parts of the game that are specific to POTCO which were coded in C++: water and nametags. For those of you who remember back in Alpha and early Beta, our water never really looked like POTCO water; this was because the C++ portion of the game was absent.

In the Pirates game installation, there are two dll files of interest: libotp.dll, which is responsible for nametags; and libpirates.dll, which is responsible for water. Because these are compiled C++ applications, there is no Python bytecode to extract. We had to manually reverse engineer the code from this using only disassemblers. There were no variable names, only memory addresses. We originally reverse engineered these portions of code into Python, but it turns out they were offloaded as a C++ dll because they both are intensive to run. There's a significant performance improvement having it in C++.

Another dev and I recently spent some time rewriting the nametags from Python to C++. We actually open sourced this code, you can view it here if you'd like to check it out (go to the "nametag" folder for the C++ one). It's now live on our Test Server, and we have observed a significant performance improvement since rolling it out.

Moving on, it's very simple to get the textures, 3D models, and music out of the game files. You need to grab yourself a copy of the Panda3D SDX, this has a tool called "multify" which is used to decompress the resources into the physical files.

After you download and install the Panda3D SDX, open up your system's command-line interface and navigate to the POTCO installation. Type in the following and the resources will be extracted:

multify -x -f phase_#.mf

You need to change the # to the number of the phase file you're extracting (phase_2 to phase_5). Note: TLOPO encrypts their resources, multify will not extract TLOPO's resources as a result.

Now, to get a server hooked up, you first need to recreate OTP. This is a proprietary server technology created by Disney. Thankfully, the folks who developed Toontown Rewritten created a new server technology called Astron which is 'inspired' by OTP (it's basically the same thing) and open sourced it. This was developed using a few YouTube videos Disney published talking a little about how the server technology works, as well as through studying the Toontown Online client and seeing how the client was supposed to interface with the server.

In the case of the Toontown client, most of the server files were actually downloaded by the game's launcher when you played the game; Disney just never excluded them from the production build for some silly reason. In the case of POTCO, these server files were absent in every version we've ever decompiled - and we've decompiled a lot of them.

Now, because the server files are absent in the POTCO game installation, this means we need to recreate them from scratch. To do this, we needed to study the Pirates Online client and see what it sent to the server and what it expected as a response. Using this information, we need to "fill in the blank" for lack of a better phrase. We create the method on the server that the client expects to exist, and then we need to guess how to process the information it receives from the client and then respond correctly. This is why it's taken us so darn long to develop the game, everything is literally an educated guess by us.

There a few files inside phase_2 called "otp.dc" and "pirates.dc". These describe the client<->server communication protocol. I.e. what the client expects to send/receive/own/have interest in/etc. It is very useful in figuring out what needs to exist on the server.

And then for everything in-between that might've existed on Disney's server exclusively, we just have to completely guess - like enemy attack AI or how Disney's PvP matchmaker worked.

Hope this answers your question. :)
 
Last edited:
@The Crew , as someone who knows nothing about coding I found this break down of how TLOPO came to fruition very interesting and enlightening! Neat to learn about one of the reasons why a Pirates recreation took longer than Toontown: no server files to access! What a time-consuming and detailed process to reverse engineer the files. Thank you for bringing our game back and shedding some light on the process in such a clear and understandable way for a novice computer user like myself. An enjoyable read. Cheers!
 
Last edited:
@The Crew, I have loved this game since it came out and you all are amazing people. The project may still be going on but even if the game has little to no players at any point. I will probably just log on and walk around just to sink in the nostalgia, remember the times of elementary school when one of my friends gave me his premium account and let me have it after he left to go home to Russia...I still miss the guy and I still have the account name written down on a sticky note. everyone on your team are extremely talented (but that's very clear) and make the community on this game feel awesome!
 
Back
Top