11 ms·
Prince of Persia open-source port based on the DOS version disassembly
- skeeter2020 5y agoJordan'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.
- fps_doug 5y agoVery 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 5y agoDisassembled 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 5y agoI 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 5y agoKeep in mind that there was also a MacOS version of SimTower. 68k assembly is pretty easy to follow...
- sumtechguy 5y agohmm good point. Assuming they started with a similar code base it could be useful too.
- mike_hock 5y ago> instead of using ret to return, jumped to the ret-instruction of a different function ... wat
- fps_doug 5y agoThanks for the insight. I've assumed hand written assembly, except for those parts where you try to squeeze out the last bit of performance, would be structured more like a human would think, but alas I might be wrong. :-) But then again the two games I tried were compiled with Watcom, which according to mmy research was pretty advanced when it comes to optimizations, for its time at least. The biggest turnoff for me was finding the right tooling though. It's not like there are many tutorials for reverse engineering, and those that exist mostly aimed at security research or cracking, targeting modern software. I found that Ghidra was unable to even load a Watcom binary, it crashed. A year later there was a patch for that, but then Ghidra didn't understand the Watcom calling convention. Found some incomplete plugin for this, but it was just blindly marking all functions as Watcom calling convention. Then I gave up. It might not be the best idea to start learning RE with a full blown game, but at the same time, if you wanna do this "for fun", it actually has to have a fun goal.
- nathell 5y agoGPLv3. But given that it’s a port of the disassembly, isn’t it also a derivative work of the original PoP?
- aaron695 5y agoThe 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.
- gspr 5y agoYeah, the author's "Copyright (C) 2013-2021 Dávid 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 5y agoIANAL 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 5y ago> 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 https://www.imdb.com/find?q=prince+of+persia&ref_=nv_sr_sm
- 5y ago
- rambojazz 5y agoWhere are the screeeenshoooooots!!! (or videos)
- anibalin 5y agoSo many memories...thanks for this.
- TonyTrapp 5y agoAlso of interest: The Apple II version was open-sourced officially: https://github.com/jmechner/Prince-of-Persia-Apple-II https://github.com/jmechner/Prince-of-Persia-Apple-II
- cxr 5y agoNot 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 5y agoIt 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.
- teddyh 5y agoNo, “open source” has a specific definition. Also, he specifically says that you can’t distribute it, only Ubisoft can.
- zamadatix 5y agoIronically 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.
- grafelic 5y agoCompiled on Linux without issue. Works. Awesome.
- newaccount74 5y agoWhy 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/ https://www.oldgames.sk/en/game/prince-of-persia/pictures/
- EvanAnderson 5y agoThe original version was written for the Apple II.
- salamandersauce 5y agoAnd 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 5y ago[deleted]
- nickt 5y agoThat’s interesting. It must be one of the most ported games ever. https://en.m.wikipedia.org/wiki/Prince_of_Persia_(1989_video_game)#Ports https://en.m.wikipedia.org/wiki/Prince_of_Persia_(1989_video...
- whoopdedo 5y agoI 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 https://www.mobygames.com/game/pac-man [2] https://en.wikipedia.org/wiki/Lode_Runner https://en.wikipedia.org/wiki/Lode_Runner
- 83457 5y agoPrince of Persia animation (rotoscoping) https://youtu.be/ZW_eExHpTZI https://youtu.be/ZW_eExHpTZI
- tibu 5y agoAs soon as I saw the guy moving and jumping I immediately recognized the Prince!
- Andrew_nenakhov 5y agoWhen 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.
- ahartmetz 5y agoI 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.
- nolok 5y agoSuper 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 5y agoMaybe 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.
- Andrew_nenakhov 5y agoI 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 5y agoAnother awesome game that gives this feeling is Another World.
- deleted 5y ago
- finchisko 5y agoWondering if there is possibility having wasm port running game in the browser would be great.
- cies 5y agoNot the version of the code linked to, but playable from the browser: https://www.retrogames.cz/play_102-DOS.php?language=EN https://www.retrogames.cz/play_102-DOS.php?language=EN https://classicreload.com/prince-of-persia.html 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.
- jfrej 5y agoAlso available in the Internet Archive: https://archive.org/details/msdos_Prince_of_Persia_1990 https://archive.org/details/msdos_Prince_of_Persia_1990 (as well as many many other games).
- tibu 5y agoOh, 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.
- speeder 5y agoGreat 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.
- catskul2 5y agoIt boggles the mind that they didn't think to include screenshots in the repo github front page.
- em3rgent0rdr 5y agoIs the sound created with FM synthesis?
- em3rgent0rdr 5y agoI 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 5y agolistening 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 https://www.youtube.com/watch?v=0q_6tOpnquI
- rasz 5y agoI think its both, opl music and sample based effects. https://github.com/NagyD/SDLPoP/blob/8a07f11bd5952b5e1b9558c334bfbcd8f8f254bd/src/seg000.c#L2154 https://github.com/NagyD/SDLPoP/blob/8a07f11bd5952b5e1b9558c...
- TedShiller 5y agoawesome! macOS Catalina support?