A Closer Look at the Super NES Doom Source Code Release [video]
youtube.com
youtube.com
I don't say that to reduce his contributions (hell, I did my share bit of porting code to more exotic platforms, and a proper port is tons of work), but to give credits to original authors who did most of heavy lifting of writing actual emulators.
Don’t get wrong, I love MVG’s content, and I’m not a big gamer or even much of a YouTube viewer.
Bleemcast on a 200MHz CPU is more impressive.
I owned a laptop shortly after that which was somewhere in the 200mhz-400mhz range that played PS games at full speed.
Yeah, I actually owned Bleem even though I had a PlayStation. I think I still have the CD.
The MAME guys are adding in netlist bits to get rid of those wav files they have used for years for sounds. They had to go back and re-model the circuits component by component which is obviously not great on CPU. Which is how much of it was able to run on older computers. They took massive shortcuts. If something took 500ms on the actual hardware they would do it in 30 and give the time up to something else that needed it. Whereas maybe some very oddball bit of software would rely on that 500ms. The funny thing is most dont. The other way holds true too. Those circuits emus they are adding in eat massive amounts of CPU time to calculate. But on the real hardware finish nearly instantly.
I still am amazed some of this software works. For some bits of software you do need that deep understanding. But so much of it just blts junk from one area to another and polls on the controls. When you get to those weird effect where the developer was squeezing the console/computer on scanlines and store/load boundaries you need that but so much of it just works...
Do you figure out all the constraints of the target system, fork the original, adjust, and compile? Is it an involved process? Do the original dev's (Carmack in this case) get involved or is it "second tier" sort of work?
For most games, yes, but this particular game was written in assembler (as were virtually all games on that system), while the original game was written in C (probably with some x86 assembler as well, also incompatible with the console). So it had to be essentially a complete rewrite.
And in the case of SNES Doom, Randy didn't see any of the Doom source code. He found an online guide describing the Doom WAD files and then wrote a Doom prototype from scratch, on an Amiga using his own tool set. Insanely talented guy.
There are many options. A few points:
- Some "ports" are done by running the original game in an emulator.
- If you don't have source code or it can't be compiled for the target platform, you may have to rewrite from scratch (as was done in the case of SNES Doom apparently).
- Depending on how different the programming environments are (e.g. operating system, threading primitives, graphics/sound APIs, memory - consoles often have exotic memory layouts), significant rewriting may be needed in order to get the game running on the target platform at all.
- Once you have something that runs, it may perform like dog crap. In this case the porting job turns into an optimization and re-tuning exercise. This may involve not only optimising code, but also changing the quality of graphical/sound assets (artist work may be needed!), chopping off parts of the game (the SNES Doom does not have all levels, textures or animations for example, as the video says).
- Many bugs may crop up with the rewrite, or bugs in the original game may be exposed by running it on a different platform. General debugging skills are very likely to be required.
All but the simplest ports are likely to be an involved process, unless the two systems are very similar: for example, porting a game from Windows PC to Linux PC is likely to be relatively simple, compared to porting a game from PC to a primitive console.
1) import the whole thing into Visual Studio solution
2) Add the desired target platform
3) hit build
4) keep resolving compilation errors until the game builds.
5) keep resolving linking errors until the game links
6) try running the game until it starts on the target system and doesn't crash immediately.
7) congrats, now you have something that most likely runs without any video, sound or input
8) spend X amount of time re-writing the renderer for the target system, add input support, add sound. This step can take any amount of time
9) congrats, now you have a game that "runs". It probably runs like absolute garbage right now. Now spend time understanding how all subsystems work - how is the data loaded? If it was a PS1 game, it was probably optimized for loading from the disc - can we now change it to have a more straightforward loading sequence. Can we just load the whole thing into ram on startup and be done with it?
9) do as many tweaks and optimizations as the time and budget allow - make sure it renders in 4K, supports 3D audio, rumble for controllers etc etc etc etc.
Again, step 9 can take any amount of time, depends what your production allows.
We were lucky in that the original programmers who worked on these games 20+ years ago still work at the same company - so it was quite fun for them to revisit that old code. But yeah, don't expect people to remember the code they wrote 20 years ago, you end up ripping out entire sections still marked as "fixme before launch(date: 12/1998)".
As for porting between current platforms(like a game simultaneously launching on Xbox and Playstation) - it's usually built for both from the start. In the rare cases where a platform gets added later, it's basically the same process as above - add the target, try building and running until it does. People who have experience doing it can progress much faster than people who don't - same as everything.
But many home computer ports and early console ports weren’t so fortunate. You might have access to an arcade machine, or maybe just a video recording of a play through.
It was up to the developer to mimic what they saw. Of course, the target system would limit what you could do.
1. Doom was released on the Super NES. (I enjoyed the DOS version but never played it on the SNES).
2. the Super NES supported multiplayer for some games (including DOOM) via the XBAND modem.
some more info:
https://doomwiki.org/wiki/Super_NES#:~:text=Doom%20for%20the....
You probably know about SNES banking already, but if not, see [2]
[0] https://en.m.wikipedia.org/wiki/Teleplay_Modem
[1] https://en.m.wikipedia.org/wiki/Family_Computer_Network_Syst...
[2] https://boingboing.net/2016/07/14/online-banking-for-nintend...
https://en.wikipedia.org/wiki/GameFan
http://www.hardcoregaming101.net/gamefan/GameFAN.htm
https://archive.org/search.php?query=GameFan
https://www.polygon.com/2014/9/29/6867993/egm-electronic-gam...
http://alifewellwasted.com/2009/01/23/episode-one-the-death-...
For example, the way they got games that weren't built for laggy multiplayer to work was unbelievable: they recognized the cartridge and patched the code. Yes, that means every game that worked was a result of a custom built patching of that game's code at run time!
https://www.youtube.com/c/codingsecrets/videos
And his original Game Hut channel. https://www.youtube.com/channel/UCfVFSjHQ57zyxajhhRc7i0g
And of course, even though this is Playstation the extended interview with Andy Gavin is fascinating. https://www.youtube.com/watch?v=pSHj5UKSylk