Case study: GTA3 Open Source

Quintillus

Restoring Civ3 Content
Moderator
Supporter
Joined
Mar 17, 2007
Messages
8,422
Location
Ohio
I stumbled upon this article today, about what the Grand Theft Auto 3 fan community has done to create an open-source version: https://www.eurogamer.net/articles/...-without-so-far-getting-shut-down-by-take-two

It's interesting and relevant. They used a combination of code injection (a la TOTPP), reverse engineering the assembly into C++, and an end goal of replacing more and more of the code, until they wound up with enough code for everything to be open source.

Also relevant is that both GTA3 and Civ roll up to the same parent company, and so far the project is still alive. It probably helps that it requires original GTA3 files to play, so if anything it encourages sales. Still, the "reverse engineering assembly into C++" is not a very clean-room implementation compared to what we've been debating. My takeaway is this bodes well for us, at least as long as an original copy of Civ3 is required.
 
I'm curious - Have you gone through the ton or two of code which Antal1987 posted on Github? (My apologies if so, as I did post that link elsewhere, as well.)

PS I found a few comments on Civ3 being written in Visual C++ here at CFC - https://forums.civfanatics.com/threads/editing-code.115343/

PPS ... And I just keep Googling away - Here's the "Freeciv Hacker's Guide." It's not our Rosetta Stone, but it might offer some guidelines about data structures. There's also more than meets the eye, like the Coding Style & the coding Roadmap. This is just some of what an be found by digging through the Freeciv page on Fandom. (I do apologize: I'm in a rush, so all of this info was found "bottom-up," which is quite unusual for me.)

:popcorn:
 
Last edited:
I'm curious - Have you gone through the ton or two of code which Antal1987 posted on Github? (My apologies if so, as I did post that link elsewhere, as well.)

PS I found a few comments on Civ3 being written in Visual C++ here at CFC - https://forums.civfanatics.com/threads/editing-code.115343/

PPS ... And I just keep Googling away - Here's the "Freeciv Hacker's Guide." It's not our Rosetta Stone, but it might offer some guidelines about data structures. There's also more than meets the eye, like the Coding Style & the coding Roadmap. This is just some of what an be found by digging through the Freeciv page on Fandom. (I do apologize: I'm in a rush, so all of this info was found "bottom-up," which is quite unusual for me.)

:popcorn:

I haven't. I really need more time. More focus would be nice, too.

I can confirm that Civ3 and the Firaxis editor were written in Visual C++. This was featured in SOTD 100. The links broke with the migration to XenForo, but I had saved them locally:

Spoiler :

Firaxis_Editor_Development_Shot_1.jpg


Firaxis_Editor_Development_Shot_2.jpg



This is probably as open as the original Firaxis code will ever be. But despite its brevity, it's still a somewhat fascinating glimpse.
 
I've been impressed by the number of successful open source clones out there: OpenTTD, Open Imperium Galactica, Freespace 2 SCP, OpenRA, just to name a few others.

Oz, thanks for those links! The Freeciv site is quite extensive and I haven't dug far into it yet.

I can confirm that Civ3 and the Firaxis editor were written in Visual C++. This was featured in SOTD 100. The links broke with the migration to XenForo, but I had saved them locally:

oof, I have 2 immediate reactions to seeing those images:
1. I don't know how people tolerated programming large projects at VGA resolution
2. Whoever used that Windows color scheme is a sociopath
 
Hey, it could be worse. At least Mike had two monitors for Civ development. The combined 2048x768 resolution is better than what my work-issued laptop from 2020 has - 1366x768.

I don't know what the thinking was on the color scheme. I'm actually okay with the Windows one, other than the green titlebars - it reminds me one I set up on Windows 98. But the CodeWright one? Totally overdone.
 
Last edited:
I'm having a PTSD flashback: I once had an extraordinary programmer working for me - who was 100% color blind. His hi-res monitor was always set to the highest contrast color combos possible: I'll let your imaginations take it from there.
 
... More significantly, "Freeciv," in particular, offers textbook-quality examples of how game play elements directly reflect data structures, and vice versa.

Furthermore, the "Rule Sets" are meticulously documented (HERE are the ones for Civ2civ3: "The main purpose is to get a gameplay more similar to civ3, keeping the combat system from civ2.") and the "Coding Roadmap", in particular, caught my attention.
 
Last edited:
I like Ruby. I just never found a compelling reason to use it over another option. I had to learn it when learning Opscode Chef. It's one of those languages that just clicked with me, but outside of Chef none of my platforms included Ruby by default, and again there just wasn't a compelling reason to install it rather than use another option.

But now I have a Mac, and it's installed by default there. I still don't use it much, but I can see how a Mac user might gravitate to it over Python just as Python. So I guess it doesn't surprise me that someone might try to make a passion project out of it.

I guess the killer features of Ruby were Ruby on Rails and its object-relational database support. But I have plenty of other app server options and have always looked side-eye over object-relational data; SQL and noSQL both work well for me.

It has the same issues as Python as an app language, though: it's interpreted and not really meant to be bundled into native executables.
 
I know that this is over half a year later, but the evil forces of DMCA have taken down the reverse-engineered GTAs from github.
 
I found a pretty good overview of that in this article (not my first choice of sources, but it has a lot more detail than the GamesOnLinux article I found first). It will be interesting to see how it plays out in court. Based on my understanding of the law (IANAL), I'm not sure TakeTwo actually has a legitimate claim. Most such cases end right away because the defendant doesn't want to/can't afford to mount a legal defense.

Still, it's a good reminder to follow clean-room practices when figuring out how mechanics work (if you are going to contribute to the code, do not examine the binaries to figure out how things work; figure it out by modifying a BIQ/SAV file and seeing what that changes, instead. Or use a "close enough" approximation).

It's also a good reason to keep the direction as being compatible, but not a pure clone. OpenOffice is compatible with Microsoft Office, can read Microsoft Office files, and take some inspiration from it, but is not a clone of it.
 
Last edited:
I've just read that. Interesting. On the GTA side of things, I'd download it just to thumb my nose at TakeTwo and also to see whether it works, and I still have discs bought over a decade ago and run all GTA III-era games natively on PC. Perhaps their interest is simply on shutting down anybody who can make a working version of their games? :rolleyes:

Which takes me to a more serious legal point: SLAPPs (strategic lawsuits against legal participation) are a thing. Especially with the US' weird procedural legislation that imposes all costs on the defence, the current (and long-standing) imbalances in purchasing power mean that you can overwhelm the enemy with pre-emptive meritless lawsuits simply because they cannot afford to mount a defence and thus are forced to yield, regardless of who is right as a matter of fact and/or (substantive) law. And given the crazy workings of copyright laws, they are sometimes even forced to keep up with prosecuting anyone who even comes close to their copyrighted intellectual property because otherwise it will implicitly set precedent for when somebody really tries to steal it and then alleges that earlier non-enforcement of their IP rights constitutes abandonment of the franchise or who know what other legal word salad. tl;dr they are constantly on the deffensive and, as a Civ advisor says, attack is the best defence…

And, finally, about direction, yes! Compatible with but not a clone, which shouldn't be too hard because it wouldn't be a mere expansion/bug fix (i.e. a civ that doesn't crash if resources aren't a power of two), but, say, adding more than one level of terrain or being able to script events into it (e.g. a few tiles changing from impassable to passable to enable contact between two previously separate areas), or multi-party diplomacy would very much make it not-civ and outside the reach of any lawsuit. It'd be cheap at double the price, I'd say.
 
Still, it's a good reminder to follow clean-room practices when figuring out how mechanics work (if you are going to contribute to the code, do not examine the binaries to figure out how things work; figure it out by modifying a BIQ/SAV file and seeing what that changes, instead. Or use a "close enough" approximation).
Sorry about the pedantry but what you're calling "clean room" is actually "black box" reverse engineering. Clean room practices, in the context of reverse engineering software, are where you have one team that analyzes the program by any means, including decompilation, to produce a non-code specification that's then handed off to another team for reimplementation. The purpose of clean room RE is to head off legal challenges. It solves the problem that copyright extends from a program to cover any of its decompilations and code derived from them. It does not extend to cover non-code descriptions of the program so by basing the reimplementation on a description instead of decompiled code it breaks the chain of copyright. In theory a heavily mutated version of decompiled code could be different enough to break the chain of copyright but it's much easier to argue in court that the re-implementers never saw the copyrighted code so their new implementation isn't, legally speaking, derived from it.

We've already done a bit of clean room RE when I gave you (Quintillus) that description of how the game selects large vs small forest sprites, which I read from the decompiled code. Going forward we should make that sort of thing a habit. Any time I look at the decompiled executable to see how exactly the original game works, I'll write it up and and hand it off to one of you guys to reimplement.

The way I see it C7 is more likely to face other kinds of legal problems, assuming it faces any legal problems at all: (1) Firaxis, 2K, Take Two, or someone owns the copyright to the design of Civ 3 itself as a game, including the rules. Unlike word processors and so forth, sets of game rules are themselves copyrightable so we might be in violation simply for producing a game that plays the same way as Civ 3 even if it's not based on the original code in any way. It's like how we wouldn't be allowed to produce a board game that plays exactly the same as Monopoly even if it doesn't use the original art, pieces, etc. (2) Like Takhisis said, a legal attacker can claim whatever they want when filing a lawsuit, even if it's a lie or totally bogus, and win provided no one is willing to spend tens of thousands of dollars and months/years of time to defend against their claims.
 
Thanks for the clarifications! My terminology understanding is definitely Wikipedia-level, not having done a lot of reverse engineering, and not having done any with a team. I agree on making the large vs small forest sprite separation of duties a habit going forward, should there be future cases where trying to emulate specifics of how the original game works is warranted.

It's also an interesting point about sets of game rules. I wonder where the distinction between word processors and their ilk, and game rules, comes from? Is it that Monopoly, for example, is in its fundamental form a set of rules, whereas a word processor is a tool for document creation that incidentally also includes sets of rules?

All in all, this discussion has pushed me more towards the direction of, "we should have our own set of default rules sooner rather than later." It distinguishes C7 from Civ, and it also helps ensure we'll have the flexibility to support the types of user modifications that will be desired. It's also an opportunity for non-technical modders to be involved, for example creating a unit roster, building lists, a technology tree (where we could even support "or" prerequisites), etc.
 
It's not pedantic at all when we're trying to make a videogame and not get sent to jail for it.
If people got away with making a game that even includes the name ‘civ’, i.e. FreeCiv, then this game should work as well.

What you say about processors is a valid question. Game rules are a bit complicated because how do you copyright a chess app when chess is a public-domain game created at some point that for copyright purposes is lost in time?
But if you make it a game that is obviously-not-civ then they cannot come at you!
It's like Wesnoth, which has scripting and some key commands (Ctrl+G for displaying grid, holding down shift for accelerated display of unit movements) that are very much civ2, plus some stuff people say comes from Warlords, and then is a game of its own with its own community of fans and modders and testers.

For another game like this look at 0 AD.

Also, Super Tux Kart is a lot like other ‘Kart’ games (most obviously Mario Kart) and stands as a game on its own.


I think that one threshold is simply making it different enough that the company will look at the very bad press they'd get off suing somebody and the potential costs of that outweighing those of moronic pre-emptive copyright enforcements by enough that they'll stay away for both their benefit and ours.
 
It's also an interesting point about sets of game rules. I wonder where the distinction between word processors and their ilk, and game rules, comes from? Is it that Monopoly, for example, is in its fundamental form a set of rules, whereas a word processor is a tool for document creation that incidentally also includes sets of rules?
I believe the difference is due to the fact that copyright is intended to cover creative works while tools, processes, and things like that can only be protected by patent if anything. Naturally a design for a game is considered a creative work. Meanwhile there are parts of a word processor that would be copyrightable like its appearance and help text, tooltips, etc., but its actual functionality is not.
If people got away with making a game that even includes the name ‘civ’, i.e. FreeCiv, then this game should work as well.
FreeCiv shows that this sort of project can work, they even have an optional ruleset that mimics Civ 2. If we were really worried about legal trouble, one thing we could do is develop C7 as a generic isometric 4X engine with an separate, optional mod that mimics Civ 3. That way in case the Civ 3 mimicking mod gets attacked on copyright grounds, the rest of the project can survive.
 
I believe the difference is due to the fact that copyright is intended to cover creative works while tools, processes, and things like that can only be protected by patent if anything. Naturally a design for a game is considered a creative work. Meanwhile there are parts of a word processor that would be copyrightable like its appearance and help text, tooltips, etc., but its actual functionality is not.
Notice that patents expire by design because they are supposed to be inventions that benefit humanity. Which is why e.g. Coca-Cola is a ‘secret’ formula, but not patented - the merits of Coca-cola we can discuss elsewhere ;), whereas copyright effectively lasts for as long as you enforce it, even if enforcement comes in the way of the Walt Disney Company lobbying legislatures to extend their copyright yet again.
Flintlock said:
FreeCiv shows that this sort of project can work, they even have an optional ruleset that mimics Civ 2. If we were really worried about legal trouble, one thing we could do is develop C7 as a generic isometric 4X engine with an separate, optional mod that mimics Civ 3. That way in case the Civ 3 mimicking mod gets attacked on copyright grounds, the rest of the project can survive.
The thing there is that you cannot ban people from doing something that will read your files.
Doom™ remains a copyrighted game. Freedoom is not and freely distributed.
(note that Doom has been ported to everything and will one day run on my analog bedside alarm clock, and that it can be freely run as an online browser game legally)
 
I'm just including this so that you see how copyright trolling ‘works’:

Eric Clapton successfully sues 55-year-old German widow for listing bootleg CD on eBay for $11
The woman – referred to in filings as Gabriele P. – will have to pay court costs for both herself and Clapton, reportedly totaling almost $4,000

A 55-year-old German widow – named in reports as Gabriele P. – has reportedly been mandated to pay for court costs for both herself and Eric Clapton, after the electric guitar player successfully sued her over the sale of a live bootleg CD on eBay.

Spoiler :
According to the German newspaper Bild, the bootleg, Live USA, was purchased by the defendant's late husband at a department store more than 30 years ago. Gabriele then went on to list the album on eBay for €9.95 (~$11) in July, after which Clapton – citing the illegal nature of the album – sent the court an affidavit.

The Düsseldorf Regional Court ruled in Clapton's favor, and yesterday (December 15) rejected Gabriele P's appeal on the initial ruling, saying that the facts that she neither bought the CD herself initially nor knew, at the time she listed it on eBay, that it was a bootleg, were immaterial.

Gabriele P. now reportedly faces either a €250,000 fine or six-month prison sentence if she continues her efforts to sell the album.

It's not the first time in recent months that Slowhand has found himself in the news for reasons other than his music.

Blues guitar veteran Robert Cray told The Washington Post back in November that he ended his 35-year friendship with Clapton over the latter's likening of COVID-19-related lockdowns to slavery in the 2020 song he recorded with Van Morrison, Stand And Deliver.

“I’d just rather not associate with somebody who’s on the extreme and being so selfish,” Cray said. “We started playing a music that wasn’t particularly popular to start off with at the time we started playing. We’ve gained some notoriety, and I’m fine with that, but I surely don’t need to hang out with Eric Clapton for that to continue.”

It's insane, but thus it works.
 
I'm just including this so that you see how copyright trolling ‘works’:

Eric Clapton successfully sues 55-year-old German widow for listing bootleg CD on eBay for $11
The woman – referred to in filings as Gabriele P. – will have to pay court costs for both herself and Clapton, reportedly totaling almost $4,000

A 55-year-old German widow – named in reports as Gabriele P. – has reportedly been mandated to pay for court costs for both herself and Eric Clapton, after the electric guitar player successfully sued her over the sale of a live bootleg CD on eBay.

Spoiler :
According to the German newspaper Bild, the bootleg, Live USA, was purchased by the defendant's late husband at a department store more than 30 years ago. Gabriele then went on to list the album on eBay for €9.95 (~$11) in July, after which Clapton – citing the illegal nature of the album – sent the court an affidavit.

The Düsseldorf Regional Court ruled in Clapton's favor, and yesterday (December 15) rejected Gabriele P's appeal on the initial ruling, saying that the facts that she neither bought the CD herself initially nor knew, at the time she listed it on eBay, that it was a bootleg, were immaterial.

Gabriele P. now reportedly faces either a €250,000 fine or six-month prison sentence if she continues her efforts to sell the album.

It's not the first time in recent months that Slowhand has found himself in the news for reasons other than his music.

Blues guitar veteran Robert Cray told The Washington Post back in November that he ended his 35-year friendship with Clapton over the latter's likening of COVID-19-related lockdowns to slavery in the 2020 song he recorded with Van Morrison, Stand And Deliver.

“I’d just rather not associate with somebody who’s on the extreme and being so selfish,” Cray said. “We started playing a music that wasn’t particularly popular to start off with at the time we started playing. We’ve gained some notoriety, and I’m fine with that, but I surely don’t need to hang out with Eric Clapton for that to continue.”

It's insane, but thus it works.

Hardly insane - for years, now, there has been a "downward push" to make almost all online content, "commodities" (services like, Amazon Music, and market manipulations - again, Amazon - setting prices for self-published books.) Having spent many years working on Wall Street, I can assure you that one attribute of a commodity - with limitless sourcing, like wheat before Ukraine - is for its price to approach zero, over time.

Throughout most of the world, there are also significant distinctions between patents & copyrights (I'm in the midst of drawing up a software patent) and, "patent trolls" are the true lepers.
 
Last edited:
Yes, I know what patent trolls are. One of so many things to make one despair of modern society.
And yes, the commoditisation of content is something I'm also aware of (read above).

*sigh*
 
Top Bottom