
Introduction
“In my time the games were better. They were more interesting because the gameplay was considered more important than the graphics. ”
- Gamers born in any decade
Whatever “your time” may be, I think you agree with this opinion to a certain extent. For me, it was from the mid-80s to the mid-90s, when I spent countless hours with
Sir Fred ,
Atic Atac ,
Airborne Ranger ,
Monkey Island ,
Twilight: 2000 ,
Stunts ,
Gunship 2000 ,
Twinsen's Adventure ,
Dark Sun ,
Challenge for Ancient Empires , the
X-Wing series and so many other games.
')
Sometimes we experience nostalgia and we want to play one of those games again. In this case, we have several options to choose from.
Play the remastered version . Some games are so awesome and have built a fan base so loyal that the official “new edition” is released. This is exactly the same game, but with modern graphics. A great example of such games can be the wonderful
Monkey Island Special Edition .
This is the perfect option. Unfortunately, only
very few games are being reworked, the reason for this is the cost, the lost source code of the original or even insufficient interest in the case of relatively little-known games.
Games in which the source code is open are a similar category, for example, first-person shooters from id. There are projects that create new graphic resources for these games, but they are rare, and few developers open the source code of their games.
Play a remake . Some games are so awesome and put together a so loyal fan base that someone decides to rewrite the game from scratch, usually without the least support from the original authors. If you manage to find a good remake, then you get an almost original game, but with modern graphics.
This is a good alternative, but again, not many games have remakes. This happened because remakes are usually created by fans, and the task is incredibly difficult - as complex as creating the game again, and this adds the difficulty of how to accurately reproduce the original gameplay. The only way to achieve a high degree of accuracy is to disassemble the original code and recreate its logic.
Run the emulator . You can always use DOSBox and special solutions for some games, such as ScummVM. It works well, but let's be honest, the graphics of most games are not like wine, which gets better over time. Nevertheless, you still play the original game.
Total
If the game you want to play has a remastered version, then that's great! But for the vast majority of games that do not have remasters, there are only two options: use an emulator (it is widely available, provides the perfect gameplay and outdated graphics) or hope that someone will create a remake (relatively rare, imperfect gameplay, modern graphics ).
New approach
But what if we can run unchanged binary code, only with improved graphics?
Suppose you run the game in an emulator. You do not have the source code, but you can be sure that somewhere in the binary code the
“draw sprite” method is hidden. Or the
"deduce character" method. Or the
“play sound effect” method. Or the
"render polygon" method.
What if you can use the debugger / disassembler integrated with the emulator to find the input points of these methods? What if we figure out which registers which parameters contain, or their order in the stack?
What if we can program the emulator to call an arbitrary C ++ method, when these input points need to be executed, retrieve the state of the registers at this moment, and execute our own sprite rendering code? Or the rendering code for the TrueType font? Or MP3 play code? Or a few OpenGL calls?
If we manage to replace all these methods with C ++ implementations, then as a result we will get a game, exactly the following logic of the original, but looking modern. We will get an emulated remake with accurately reproduced gameplay, which can be gradually completed, and for this, a very superficial understanding of the disassembled code is enough.
I researched the question a bit and it turned out that this is a fairly fresh idea. Why hasn't anyone tried this before?
Will this work?
Concept check
I decided to check out this crazy idea. I wrote an 8086 + CGA emulator with only 44 implemented opcodes, which are barely enough to launch the Goody screen saver screen:
I wrote two tools - a disassembler and a launcher with a gdb-like interface that allow you to step through the code, set breakpoints, and so on.
How do we find interesting features without complete disassembling? I used a variety of methods - setting checkpoints and studying registers, executing code on small fragments, randomly filling in the contents of a simulated video memory to see what would be displayed, patching the code to skip some calls, to see what stopped working, and studying the disassembled code, to add helpful comments for me.
Thanks to these techniques, I managed to find some interesting "functions":
I added a C ++ interceptor to do my own drawing in a separate window:
I added some rough graphics, crossed my fingers, and ...
... and see, I have a "remake"! Look, the “old” window runs next to the “new” window; This is not a static image, but a new graphic, driven by the original X86 code!
See for yourself
The full demo (x86 emulator / disassembler / debugger, Goody interceptors and draft graphics) is available on
GitHub . It works on Linux and Mac; SDL2 and C ++ 0x compiler are required.
The source code is released under the
Whatever / Credit license:
you can do whatever you like with the code; If you create something cool, I will be grateful for the indication of my authorship . If anything, the code is not even alpha-quality - this is the quality of the “concept check / works on my machine”.
The repository contains the
original game (
goody.com
) - I received the unofficial blessing of one of the authors of the original Gonzo Suarez on its distribution, besides, it is easy to find on any site with outdated software; if someone is against, I will remove the game from the repository.
I sketched the
graphics using my horrible Gimp skills and resources in the public domain or with a Creative Commons license from
OpenGameArt :
1 ,
2 ,
3 ,
4 ,
5 . If the artist reading this article wants to share the original graphics for this demo, I will be very grateful.
Answers to Expected Questions
Q: You are aware that there is an excellent Goody remake?Oh yeah. But I chose Goody to test the concept, because I liked this game most of all from the CGA era, because it is contained in the COM file, that is, it does not need the EXE loader, and because it is obviously based on tiles, that is, I thought that it will be enough to simply work with it
Q: Why didn't you use any available x86 emulators or even DOSBox?A: Because writing an x86 emulator is an interesting task. After the concept verification phase, I intend to fully accommodate DOSBox for this.
Thoughts in conclusion
Is the system scalable?
Can I use these techniques for more complex games? I see no obstacles. You can always start with DOSBox and replace, say, the sound. This will be the beginning of a partial remake.
Another question is where to draw the line - at what level of abstraction to add interceptors. To some extent, you can create interceptors at the lowest level in DOSBox — by drawing individual pixels. My concept check performs interception at the level of
“tile drawing” and
“glyph drawing” . But take, for example, fonts. Drawing a glyph behind a glyph is quite suitable for aspects such as money and life counters, but for text instructions on the main screen, you can think of something better, for example, an interceptor at the
“line draw” level, and use FreeType to get a proportional font with beautiful kerning .
Similar reasoning applies to 3D games with software rendering such as X-Wing or Stunts. Maybe it will be possible to intercept the
“render triangle” function, in which case very low poly models will be rendered in the video processor, or intercept the
“render model” function and use new 3D models. Or you can take the original Wing Commander, which does not even use 3D-models - instead of them there are bit images of ships of higher resolution, and actually render 3D-ships.
Another example is sound. You can intercept the programmable timer and speaker I / O ports to generate corresponding waves on the fly (assuming that DOSBox does this), or intercept the
“play sound effect” function and play MP3 files instead of sounds.
What about frame rates? Animation death Goody takes two frames and lasts about a second. Even with beautiful resources, the animation will still look ragged. I think that solving this type of problem would be a smarter state rendering processing - ideally, you could write a completely new renderer based on the game state read from memory without having to directly intercept any rendering methods.
Applicability beyond games
This idea can be applied not only in games. Some systems use very old software, because over the years so many details of business logic have been added that it is impossible or impractical to rewrite such systems from scratch. But thanks to these techniques, it will be possible to perform the logic without changes and replace the I / O / database code with something more modern.
Legality
Although
this is not legal advice, because I am not a lawyer , I cannot think of any reasons why the technique itself may be illegal, because the original binary data of the game is not supplied as a “remake” (only if the game itself is not distributed free of charge).
With graphics, everything is more complicated. In the remake there can be no original resources; artists and musicians will have to redo them from scratch. But even then, I'm not sure whether the creation of, say, a 3D model of X-Wing or the image of Darth Vader is legitimate. Perhaps they can be considered fan art?
Additional reading
If you like reverse engineering, old games, or both, then you should explore
Fabien Sanglar's website .
Summarize
The concept check confirms the viability of the idea; in the end, it turned out that she was not so insane. Remakes can be done by connecting the modern rendering code / sound / network data transfer to the emulator / virtual machine, in which the original game is running.
Will this revolutionary change the way you create remakes? I really hope so! I would love to play games of the past with modern graphics and original gameplay.