[HN Gopher] Prince of Persia open-source port based on the DOS v...
___________________________________________________________________
Prince of Persia open-source port based on the DOS version
disassembly
Author : teruakohatu
Score : 226 points
Date : 2021-11-23 09:31 UTC (13 hours ago)
(HTM) web link (github.com)
(TXT) w3m dump (github.com)
| Andrew_nenakhov wrote:
| When i was 11, Prince of Persia was a brutally challenging game
| and I called could hardly get to level 5.
|
| But sometime later in 2000 I came to possess and old 386 HP
| desktop, and I tried running Prince on it, and I was surprised
| how easy it was: I have beaten it easily on the first try and
| later learned to run through it without dying at all.
| nolok wrote:
| Another awesome game that gives this feeling is Another World.
| ahartmetz wrote:
| I am hoping for a similar result (also didn't finish Prince of
| Persia at the time). I mean - in the meantime, I got pretty far
| in Super Meat Boy. Prince of Persia looks like a walk in the
| park in comparison.
| Andrew_nenakhov wrote:
| I think, beating Aladdin (1993) on PC did help a lot: it was
| a more challenging game that required getting used to precise
| controlling the character. Prince of Persia has rather slow
| animations, and thus you don't even need a quick reflexes to
| beat it, just learn the levels and know where you need to
| move in a certain way.
| nolok wrote:
| Super Meat Boy is super responsive. Not once do you think "I
| pressed jump and it didn't jump".
|
| PoP by comparison can be very stiff at time, it's all part of
| the fun.
| ahartmetz wrote:
| Maybe such controls were necessary for animation reasons.
| You can't jump while both feet are in the air from running,
| and you can't make doing that look realistic.
| [deleted]
| TonyTrapp wrote:
| Also of interest: The Apple II version was open-sourced
| officially: https://github.com/jmechner/Prince-of-Persia-Apple-II
| cxr wrote:
| Not open source, merely available--or, using the terminology of
| US copyright laws, it changed status from being an unpublished
| work to a published work. Mechner's warning from the linked
| repo:
|
| > _As the author and copyright holder of this source code, I
| personally have no problem with anyone studying it, modifying
| it, attempting to run it, etc. Please understand that this does
| NOT constitute a grant of rights of any kind in Prince of
| Persia, which is an ongoing Ubisoft game franchise. Ubisoft
| alone has the right to make and distribute Prince of Persia
| games._
| Semaphor wrote:
| It seems it is open source by the wording, he just makes it
| clear, that you can't distribute it under that name because
| while he owns the rights to the code, Ubisoft owns the
| trademark(s). So any distribution would be required to remove
| the name completely from the game.
|
| But that's just my total layperson reading.
| cxr wrote:
| That's not clear at all. There is no reason to believe that
| Mechner's warning is narrowly referring to the trademark
| rights, rather than, you know, "rights _of any kind_ ".
| teddyh wrote:
| No, "open source" has a specific definition. Also, he
| specifically says that you can't distribute it, only
| Ubisoft can.
| zamadatix wrote:
| Ironically the specific definition of what open source is
| is not universally agreed on hence why you have likely
| seen the acronyms FOSS and FLOSS used explicitly. E.g. if
| you ask someone of the FSF group what "open source" means
| and they'll say the obvious meaning is you can look at
| the source code which is what makes "open source"
| different than FLOSS (which includes rights to use/modify
| the source). On the other hand if you ask the open source
| initiative what "open source" means and they'd likely
| link you to the OSD which includes most of the things a
| FSF would consider part of the separate FLOSS definition.
|
| Usually the definition of open source isn't what matters
| for all things legal though it's about what rights you
| were assigned and what those let you do as you point out.
| All the "what does open source mean" debate is just
| debate on the terminology of being able to view the
| source.
| cxr wrote:
| Is there a school or a correspondence course where people
| enroll in order to learn how to make up stuff about the
| FSF when posting online, instead of just familiarizing
| oneself with what the FSF actually has to say about a
| given topic?
|
| > if you ask someone of the FSF group what "open source"
| means and they'll say the obvious meaning is you can look
| at the source code
|
| Extremely inaccurate. FSF's definition of open source
| matches the OSI's. Here are some words that are not the
| product of my imagination--what FSF actually has to say
| about the relationship between the two: " _Among all
| programs that are open source, only a minuscule fraction
| are not free_ ".
| fps_doug wrote:
| Very cool, gonna check it out at home!
|
| I've always wanted to learn some reverse engineering and
| eventually do this with a game. Unfortunately the ones I'd like
| to target are all written in C or C++, so I guess translating the
| disassembly would be even more meticulous than it already is with
| games originally written in assembly.
| madmoose wrote:
| Disassembled code from a C or C++ compiler is generally better
| structured than hand written assembly.
|
| I reverse engineered major parts of Westwood's Blade Runner for
| ScummVM. It was compiled with the Borland C++ compiler in 1997
| and a lot of it was relatively easy to decompile. The most
| difficult parts were video decoding and character rendering.
| The video decoder was older Westwood code, clearly hand
| optimized, and the character renderer was also very optimized.
|
| Currently I'm working on Cryo's Dune which is all hand-written
| assembly code. The code jumps all over the place, parameters
| are passed in arbitrary registers and have to be traced over
| several calls. I've seen a function that, instead of using ret
| to return, jumped to the ret-instruction of a different
| function.
|
| Code generated by an older compiler that doesn't do too much
| optimization is vastly preferable.
| sumtechguy wrote:
| I have been toying with doing this to simtower for awhile.
| The disassemblers are a bit all over the place with respect
| to Win16 NE code though. Bit annoying to do though as it uses
| a decent amount of the win16 API so those bits have to be
| done too sometimes to figure out what is going on. Though it
| is fairly decently documented so you can block off the game
| bits from the win16 bits and just skip past the crazy way
| win16 loads dlls up.
| duskwuff wrote:
| Keep in mind that there was also a MacOS version of
| SimTower. 68k assembly is pretty easy to follow...
| sumtechguy wrote:
| hmm good point. Assuming they started with a similar code
| base it could be useful too.
| mike_hock wrote:
| > instead of using ret to return, jumped to the ret-
| instruction of a different function
|
| ... wat
| nathell wrote:
| GPLv3. But given that it's a port of the disassembly, isn't it
| also a derivative work of the original PoP?
| Hamuko wrote:
| Probably. I'm not sure if this exact scenario has been tested
| in courts, but Take-Two is going to test it at the very least.
|
| https://torrentfreak.com/take-two-sues-enthusiasts-behind-gt...
| gspr wrote:
| Yeah, the author's "Copyright (C) 2013-2021 David Nagy" seems
| ridiculous and meaningless. I can see the appeal of a project
| like this, but the author's pretending that that copyright and
| the GPL licensing mean anything isn't helpful.
| rob74 wrote:
| IANAL either, but I suppose the situation here is similar as
| with "abandonware": as long as the original
| publisher/copyright holder doesn't protest, old software is
| made available on various download sites. Of course, with a
| project like this, if the copyright holder would intervene, a
| lot more work would go down the drain, and claiming your own
| copyright without explicitly mentioning the original
| copyright is definitely not helping...
| hermitdev wrote:
| > but I suppose the situation here is similar as with
| "abandonware"
|
| I don't know if this would hold up. Prince of Persia IP is
| far from dead or abandoned. I know it's not exhaustive, but
| a quick search on IMDB [0] shows a movie in 2010, and a
| video game as recently as 2008. Just because this
| particular game is old, doesn't mean the IP/Trademark is
| dead. Personally, I'd be wary of a legal battle, even
| though I think the project is pretty interesting.
|
| [0]
| https://www.imdb.com/find?q=prince+of+persia&ref_=nv_sr_sm
| rob74 wrote:
| Again, IANAL, but that's not really relevant. The old
| Super Mario games for Game Boy and SNES can be downloaded
| from various abandonware sites, while the Mario franchise
| is still ongoing. As long as Nintendo is Ok with that,
| that's not a problem. The original Prince of Persia is
| also available as "abandonware" and can even be played in
| the browser
| (https://www.retrogames.cz/play_102-DOS.php?language=EN)
| pulse7 wrote:
| Microsoft would not be happy if somebody would create an "open-
| source port based on the Windows machine/assembly code"...
| fsflover wrote:
| https://reactos.org
| kwhitefoot wrote:
| As far as I know the ReactOS team does not disassemble
| Windows.
|
| "Is ReactOS legal?
|
| Yes. ReactOS is fully legal.
|
| Developers (devs) have not looked at Microsoft Windows(tm)
| source code. They have used the public documentation of
| Microsoft Windows OSes. They have made several tests to
| understand how Microsoft Windows works. In fact, ReactOS
| does the same things that Windows does but it does it
| differently as we don't have the same source code and it is
| all programmed by different developers. All code in ReactOS
| is released under the GNU GPL (General Public License). Is
| ReactOS based on Microsoft Windows(tm) original source
| code?
|
| No! ReactOS consists only of clean-room engineered GNU GPL
| (General Public License) and GPL compatible licensed source
| code. "
|
| https://reactos.org/wiki/ReactOS_FAQ#Is_ReactOS_legal.3F
| nathell wrote:
| ReactOS isn't based on disassembly of the original Windows
| code. It's based on publicly available documentation of
| Windows APIs (and reverse engineering those that aren't
| documented, but that's a whole different beast from
| disassembling).
|
| In fact, ReactOS maintains a policy to prevent proprietary
| Windows source code (whether leaked or otherwise) from
| making its way to the ReactOS codebase [0]. When Windows
| source code leaked, in 2006, ReactOS did a complete
| codebase audit to ensure that it was not tainted.
|
| [0]: https://reactos.org/intellectual-property-guideline/
| selfhoster11 wrote:
| It's not based on any Windows binary code, or the project
| would be forever poisoned with respect to copyright. They
| actively prevent anyone who has seen the Windows source
| code from working on the project.
| edgyquant wrote:
| React OS has come under fire before, and been audited,
| for including windows code[2]. Also the project would not
| be poisoned with respect to copyright, according to US
| law.
|
| > Clean room design is usually employed as best practice,
| but not strictly required by law. In NEC Corp. v Intel
| Corp. (1990), NEC sought declaratory judgment against
| Intel's charges that NEC's engineers simply copied the
| microcode of the 8086 processor in their NEC V20 clone. A
| US judge ruled that while the early, internal revisions
| of NEC's microcode were indeed a copyright violation, the
| later one, which actually went into NEC's product,
| although derived from the former, were sufficiently
| different from the Intel microcode it could be considered
| free of copyright violations.[1]
|
| 1. https://en.wikipedia.org/wiki/Clean_room_design
|
| 2. https://www.linux.com/news/reactos-suspends-
| development-sour...
| wk_end wrote:
| ReactOS has not "been audited" because they came "under
| fire" for including Windows code as your post implies -
| they _chose to audit themselves_ to ensure that they were
| free of Windows code (they were), to be safe, and for the
| optics: so that observers see that they 're serious about
| being safe.
| edgyquant wrote:
| ReactOS was audited, it doesn't matter if they agreed to
| it. The fact is that an engineer claimed it had copied
| windows code and it had an assembly function believed to
| be taken directly from windows. The reason I mention it
| is that this thread has been claiming it's illegal to
| study and rewrite disassembled code but that isn't the
| case. It's illegal to copy it but clean room
| implementations depend on disassembling code and
| documenting it allowing for another person to then do the
| implementation.
|
| Im definitely not taking shots at ReactOS here, I'm on
| their side and am fascinated with the project. You're
| right I should have been clear that they shut down and
| has themselves audited instead of risking a court battle
| but I don't think the difference matters much, either way
| they were gonna have a code audit to disprove these
| allegations. But in regards to them, there's a lot of
| wrong information floating around this thread.
|
| > claim was made on 17 January 2006 by _developer Hartmut
| Birr on the ReactOS developers mailing list (ros-dev)
| that ReactOS contained code derived from disassembling
| Microsoft Windows_.[25] The code that Birr disputed
| involved the _function BadStack in syscall.S,_ [26] as
| well as other unspecified items.[27] _Comparing this
| function to disassembled binaries from Windows XP_ , Birr
| argued that the BadStack function was simply copy-pasted
| from Windows XP, given that they were identical. Alex
| Ionescu, the author of the code, _asserted that while the
| Windows XP binary in question was indeed disassembled and
| studied, the code was not merely copy-pasted_ , but
| reimplemented; the reason why the functions were
| identical, Ionescu claimed, was because there was only
| one possible way to implement the function
|
| https://marc.info/?l=ros-dev&m=118775346131654&w=2
|
| https://en.wikipedia.org/wiki/ReactOS#Internal_audit
| throwawaylinux wrote:
| No, but it's possible to write a specification based on the
| disassembly, and then write an implementation based on the
| specification.
|
| https://en.wikipedia.org/wiki/Clean_room_design
|
| Apparently that may not be strictly required either, but it
| gives a good defense. I think I could disassemble a blob to
| figure out what the possible behaviors of a WinAPI call and
| then write my own implementation of those things.
|
| Microsoft might bankrupt me before I won a court case, but
| there is nothing in copyright law as far as I know that says
| reading a copyright work forever contaminates your mind such
| that you would be incapable of creating a vaguely similar
| thing without infringing on it.
| dotancohen wrote:
| > No, but it's possible to write a specification based on
| the > disassembly, and then write an implementation
| based on the specification.
|
| Critically, the disassembly and spec should be done by one
| person, and the implementation by another.
| skywal_l wrote:
| Yes, that's what they mean by "clean room"
| implementation. The implementer should not be "polluted"
| by the previous implementation. This is what Microsoft
| did when they revert engineered CPM and created DOS.
| lodovic wrote:
| I think you mean Compaq who created a clean-room
| implementation of the IBM PC BIOS.
| teddyh wrote:
| > _This is what Microsoft did when they revert engineered
| CPM and created DOS._
|
| Um, Microsoft bought (what was then called) 86-DOS
| outright from another company, and ported it to the 8088
| CPU used by the original IBM PC.
| illys wrote:
| Right... But there is nearly (no?) work to port from 8086
| to 8088. The work was to adapt to the underlying IBM
| system calls (BIOS) and to the specific wired electronics
| (video card, DMA, mass-storage media, clock,
| keyboard...).
| drran wrote:
| M$ is happy to copilot open-source code into their codebase.
| cube00 wrote:
| Rules for thee but not for me.
| Liquid_Fire wrote:
| IANAL but I agree, I can't see how this doesn't violate the
| copyright of the original.
|
| Same with OpenRCT2, which I've heard is also based on the
| disassembled original, yet people seem to turn a blind eye.
| me_me_me wrote:
| Based on, but as far I remember it was rewritten rather then
| copied.
|
| To be honest, the should claim same with PoP and I don't see
| any solicitor suing them, as it would be too much hustle to
| prove its a code copy instead of inspired by.
|
| Wow that is really sad, we live in the world where this is
| even a discussion. Where a love project that will not be
| commercialized has to think about this bs :(
| duncanspumpkin wrote:
| For OpenRCT2 I just used a debugger Ollydbg to be precise. As
| it was hand written assembly disassemblers produced nonsense
| output.
| aaron695 wrote:
| The sad state of GPL, zero respect for software licensing.
|
| What do we expect when GPL gets reduced to a tool to
| maliciously attack people politically.
| CannisterFlux wrote:
| It's a mess of copyright for sure. I doubt you could really
| exercise your rights as a 3rd party with the GPLv3 there. e.g.
| if Debian or Ubuntu were to include the game then they would be
| on shakey ground for redistributing copyrighted stuff.
| Presumably the original graphics are in there too, not just the
| "re-imagined" code.
|
| It reminds me of the old New Kind - Oolite - Elite shenanigans
| from years ago. Somehow Oolite powered through and stuck
| around, despite using most of the New Kind code originally
| (they translated the C game logic to Objective C if memory
| serves me), while New Kind was shut down by Braben for
| copyright infringement. The New Kind author - Christian Pinder
| I think was his name - did all the disassembly work originally.
| I don't think it was ever a big legal challenge there, more
| like "hey! take that down" and the author complied because he
| was a nice guy.
| vadfa wrote:
| It's not "a mess of copyright", it is simply illegal, in the
| same way that reverse engineering Windows to reimplement
| stuff in Wine would be illegal.
| edgyquant wrote:
| This isn't illegal though? You can do clean room
| reimplementations
| matheusmoreira wrote:
| > reverse engineering Windows to reimplement stuff in Wine
| would be illegal
|
| That's legal though. Stuff like that is the whole purpose
| of reverse engineering. You can't copy the code but you can
| learn how it works so you can do it yourself.
| belltaco wrote:
| >but you can learn how it works so you can do it yourself
|
| This part is definitely illegal. You can learn how it
| works but you cannot write the code yourself, you have to
| write the specs for someone else to do it, who hasn't
| done the reverse engineering.
| matheusmoreira wrote:
| That's clean room reverse engineering, a rigorous method
| to make absolutely sure that the results are legal so it
| can't be questioned later. It's not a legal requirement
| and it does not prevent lawsuits. It just makes it more
| likely that the legal battle will be won.
| phendrenad2 wrote:
| I think GP is referring to the DMCA, which forbids
| reverse-engineering unless it's to understand how to
| _interface_ your own code with something (although I 'm
| not a lawyer).
| matheusmoreira wrote:
| Yes, even under the DMCA it's totally legal to reverse
| engineer for the purposes of interoperability. Wine was
| created to make Windows applications work on Linux. I
| reverse engineered my laptop's crappy manufacturer
| software in order to make a Linux version.
| [deleted]
| LocalH wrote:
| Reverse engineering isn't illegal, friend.
| 83457 wrote:
| Prince of Persia animation (rotoscoping)
|
| https://youtu.be/ZW_eExHpTZI
| tibu wrote:
| As soon as I saw the guy moving and jumping I immediately
| recognized the Prince!
| grafelic wrote:
| Compiled on Linux without issue. Works. Awesome.
| tibu wrote:
| Oh, now I will have to check whether I still have the QBasic code
| somewhere which I wrote to generate a savegame so I can start on
| any of the levels and I could set unlimited lives.
| rambojazz wrote:
| Where are the screeeenshoooooots!!! (or videos)
| finchisko wrote:
| Wondering if there is possibility having wasm port running game
| in the browser would be great.
| newaccount74 wrote:
| Why the DOS version? It had atrocious graphics compared to the
| original Mac version....
|
| EDIT: I googled for screenshots and I never knew how many
| different versions of the game there were! Every platform had
| completely different artwork! Pretty amazing.
|
| https://www.oldgames.sk/en/game/prince-of-persia/pictures/
| codesnik wrote:
| and supposedly all of them were based on original rotoscoped
| animation
| the_af wrote:
| No "supposedly" about it, but actually ;) Google the original
| videos, they are fun!
| nickt wrote:
| That's interesting. It must be one of the most ported games
| ever.
|
| https://en.m.wikipedia.org/wiki/Prince_of_Persia_(1989_video...
| Someone wrote:
| I would guess something really old such as Colossal Cave
| Adventure
| (https://en.wikipedia.org/wiki/Colossal_Cave_Adventure), Star
| Trek
| (https://en.wikipedia.org/wiki/Star_Trek_(1971_video_game)),
| or Hunt the Wumpus
| (https://en.wikipedia.org/wiki/Hunt_the_Wumpus) or a computer
| version of hangman
| (https://en.wikipedia.org/wiki/Hangman_(game)) takes that
| crown. There were a lot more platforms to port to in the
| early days.
| whoopdedo wrote:
| I think that title goes to Pac-Man[1]. It helps being older,
| not to mention one of the most recognizable games ever made.
| As well as the 80's being a time when many unique platforms
| rose and fell.
|
| And honorable mention goes to Lode Runner[2] which doesn't
| have quite the fame as Pac-Man but has still managed to
| create a lasting legacy (pun intended).
|
| [1] https://www.mobygames.com/game/pac-man
|
| [2] https://en.wikipedia.org/wiki/Lode_Runner
| gh02t wrote:
| What about Tetris? Though the line gets blurry about
| "official" ports of Tetris, I'd wager that the core game
| concept is one of the most ported of all time.
| skeeter2020 wrote:
| Give it time but watch out for Attack of the PETSCII
| Robots!
| entropicdrifter wrote:
| Pretty sure Adventure beat out Pac-Man for being the first
| ported game, being that it was ported back in '77, before
| Pac-Man first went to arcades.
|
| https://en.wikipedia.org/wiki/Colossal_Cave_Adventure
|
| Note that Pong and Space War were both ported before Pac-
| Man, as well, though Space War didn't get a home version
| before Pac-Man to my knowledge, it did get ported from
| mainframe hardware to an arcade cabinet before Pac-Man
| existed.
| kaetemi wrote:
| I'd guess the DOS version is the one that stuck around the
| longest.
| the_af wrote:
| I don't like the Mac version very much; it looks like a
| complete redesign in a style I don't enjoy (looks closer to
| PoP2 than to the original PoP).
| thomastjeffery wrote:
| That link is missing the GameCube version that is an Easter egg
| in Sands of Time.
| illys wrote:
| The DOS CGA, EGA and Hercules versions are missing too. EGA
| was rather pleasant.
|
| https://www.reddit.com/r/dosgaming/comments/57egq3/prince_of.
| ..
|
| In the binaries I have, CGA and EGA are bundled together, VGA
| is separated.
| bananamerica wrote:
| Nostalgia?
| EvanAnderson wrote:
| The original version was written for the Apple II.
| salamandersauce wrote:
| And the DOS port came out years before the Mac port. No
| wonder it looks worse. I always thought the DOS version was
| the first port but apparently the PC-98 version beat it by a
| few months.
| [deleted]
| teddyh wrote:
| I actually prefer the PC VGA version; it has very nice
| graphics, but still in the same style as the original Apple II
| version, not a complete redraw in a different style and tone,
| like many of the ports.
| anibalin wrote:
| So many memories...thanks for this.
| catskul2 wrote:
| It boggles the mind that they didn't think to include screenshots
| in the repo github front page.
| cies wrote:
| Not the version of the code linked to, but playable from the
| browser:
|
| https://www.retrogames.cz/play_102-DOS.php?language=EN
|
| https://classicreload.com/prince-of-persia.html (this page
| explains what keys and key combo's to use)
|
| For anyone who got their appetite up for actual playing.
| speeder wrote:
| Great to see this here!
|
| Some ancient years ago, before I was an adult, I tried to help
| with this, even had MSN Messenger contact of Ecalot (he was
| leading the charge on such projects). And tried to contribute to
| a new map editor with integrated SDL-based engine, had to learn a
| lot back then, it was my first time seeing GAWK, and my first
| time seeing GDK, among other things.
|
| Now people on this thread have some questions, I think I can
| answer, being involved in the community for a while.
|
| 1. Why?
|
| PrincEd, the site mentioned there, is a map editor, after someone
| released that "Prince 4D" mod for the DOS version, PoP fans
| basically were amazed by it and it created a cool modding
| community, but the engine is seriously limited, a lot of things
| can't be done, thus people kept wanting a new updated engine,
| specially if we could port the graphics of the other versions to
| PC.
|
| 2. Why the DOS?
|
| Probably because the first mod was Prince 4D for DOS, and all
| mods are for that version.
|
| 3. Won't Ubisoft be mad?
|
| As far as I know this never been an issue, I believe as long we
| don't get tangled with the fourth-game and onwards that is the
| games made AFTER they bought the IP, seemly they don't care.
| em3rgent0rdr wrote:
| Is the sound created with FM synthesis?
| em3rgent0rdr wrote:
| I ask because a lot of the early DOS games generated sound via
| a sound card, and most of those used FM synthesis at the time.
| And so if really want to recreate the original sound then FM
| synthesis should be used.
| em3rgent0rdr wrote:
| listening over to different versions[1] and it is amazing how
| different the game sounded on different systems (sometimes
| with completely different soundtrackks). The Apple II sounds
| like it uses two square waves only. While Amiga, DOS, PC-98,
| Sharp x68000 and Sega Genesis sound like FM synth, FM Towns
| and SNES sound like wavetable synth, Gameboy is two squares,
| NES is two squares and a triangle plus noise.
|
| [1] https://www.youtube.com/watch?v=0q_6tOpnquI
| skeeter2020 wrote:
| Jordan's diary from the period making this (and the Karateka one)
| are fun, easy reads that really give you insight into a young kid
| making video games in the 80's that became hugely popular.
___________________________________________________________________
(page generated 2021-11-23 23:01 UTC)