Cloning the Lode Runner game from the first PC in the USSR “BK-0010” plus a few words about game programming in the late 80s


    Recently, I found myself in an unusual situation for myself of forced idleness. After fooling around for a couple of weeks, I began to feel that this wasn’t such a fun activity, which, moreover, began to turn into boredom. And I had to occupy myself with something relatively useful. Previously, I periodically had the idea of ​​bringing back to life some old game from the time of my youth. But I always drove such ideas away, because I realized that " now nobody needs it ." But now I had free time and, most importantly, had a desire. As a result, for cloning, I chose one of the options for the Lode Runner game , which I once played on the first personal computer of the late USSR , which was called BK-0010. I don’t think that many people remember him, since the world of hardware has changed a lot since then. However, the Lode Runner itself from this BK-0010 was quite unique in its rules among other Lode Runners of the same name . This version of the game was my favorite, it seems to me, for objective reasons, although ... maybe it's just a matter of nostalgia. As a result, I managed to motivate myself by saying that “ to me personally, ” and possibly “to the whole world, ” this game may be interesting, and it is worth the time to restore it ( link to the result ).

    First, take a look at the original with BK-0010 (praise the Internet, where you can find almost everything):
    image

    The rules of the game are quite simple. It is necessary to collect all the treasures in the maze, then a “door” will appear, through which you can go to the next level. But the evil guards who pursue the defenseless protagonist interfere with this noble task. Although ... our hero has one secret weapon - you can punch holes in the brick floor, making traps for the guards. The guard falls into this hole and is considered caught for some time. In this short period of time, the main character can run to the guard on the head.

    A distinctive feature of the version of the game on BK-0010 was that the protagonist was making holes in bricks strictly under him, and not on the right or left, as happened, for example, on Lode Runner from a ZX-Spectrum computer. As a result, it was possible to run forward, leaving behind a perforated floor where the pursuers fell. And this feature just stood out for me this Lode Runner from all the other games of the same name.

    With full cloning, there are pros and cons in development. An undoubted advantage is that it is possible to clearly imagine the goal in advance, you can also use game levels, which are already in the version for BK-0010 . The downsides are that the behavior of the protagonist and the guards should be realized as close as possible to the original. And if everything is more or less clear with the main character, then the guards have something like AI, which has a lot of small features that require repetition in my code. Critical deviations in the behavior of the guards can make levels with BK-0010 uninteresting or even impassable. And that kills the whole point of cloning.

    I started by finding on the Internet someone already reworked a version of Lode Runner with the BK-0010. However, having played him a little, I realized that he was only similar in appearance. Despite the external similarity, in my opinion, the author did not give himself the trouble to work on the behavior of the guards, so they did not move as they did in the original. And when I "walled up" one of the guards in the bricks, the game went astray. But in this version there was an important plus for me - there was a level editor here, and these levels were also carefully redrawn from the original. And I just needed these levels very much.

    Despite the fact that the game was unpretentious by modern standards, it required that it have some kind of user interface , i.e. the same menu buttons should have functioned somehow. I also had an obsessionthat the game was easily portable to different platforms. Fortunately for me, I already made a similar shell for my classic RTS Onimode Earth (an article on how I did it can be found here ). This shell has an important feature - it does not communicate with the OS directly, but only through virtual functions, which can be relatively easily replaced. Also, the shell has a fairly advanced GUI , which in appearance may not differ much from the Windows interface :

    image

    Writing / reading files, file streams, working with the mouse and keyboard, playing sound, displaying graphics and controlling screen modes - all this was also provided in my shell. Therefore, I went exactly this way - I decided to program a small game to the shell.

    More information on this shell can be found in my last article .

    The game did not require any serious computing power, so I decided not to bother and draw graphics with the processor. The logic here is very simple. Create a surface in memory, print the image there with a processor, then copy this surface to a DirectX or OpenGL texturein video memory and this texture is already displayed on the monitor. This approach is good in that it greatly simplifies the transfer between different platforms. And since I don’t have to fight for speed, I considered this path to be the only right one, especially since the shell is currently building its image with a processor.

    I usually tell everyone that if you make a game from scratch, then you need to start with the resource editor. Such an editor, in practice, should allow you to collect a character from sprites and visually prescribe all its characteristics. However, in this case, the characters were arranged too simply, and therefore I moved away from my own rules, going straight to the level editor. In my case, it all looks like this:

    image

    Here you can select the level for editing, create a new one or delete the annoying one. Editing the level itself also looks very simple, since the maze consists of only a few details.

    image

    Naturally, in the beginning I didn’t have any graphics - I pulled some icons from the Internet and turned them into “temporary graphics”. At the beginning, living objects in me were also static pictures, which, in the literal sense, smoothly drove along the level. But this approach allowed me to program almost the entire logic of the game without resorting to the help of an artist. The artist, by the way, was my old friend Konstantin Ivanov, who had not done anything like this for a long time, since he currently spends his life creating advertising videos in a Kazan company. And these videos he already tired of the order. Therefore, to my surprise, he quite actively took up the design of my obviously non-commercial venture. As a result, we made all the design for 2 nights in combination with the destruction of alcoholic beverages. Here it’s necessary to clarify

    Since in the original version of the game the characters were something slurred due to the small number of pixels per level cell, we decided to change them. Ghosts were quite suitable for the role of guards, in addition, they had a great advantage - they do not need to move their legs during the move, which simplifies drawing. But with the main character it just didn’t work out that way. The first option that Konstantin gave me definitely reminded me of the "liquid Terminator" in miniature. And it was obvious that he needed not to run away from ghosts, but to hunt for them. However, the plot of the game required another. As a result, I gave Konstantin a book by Nikolai Kozlov, “ The True Truth or a Psychologist’s Textbook on Life, ” and there are a bunch of illustrations of the following type:

    image

    And after a few minutes he gave me our “bunny lady”imagewhich we sent as a result in search of treasures. Just in case, I clarify that Konstantin painted her “pens”, not “ears”, but visually this is not entirely obvious.

    Then we carefully transferred all the levels from the original to our game. I opened them in the not-so-successful version that I mentioned earlier, then clicked PRINTSCREEN , dropped it in Photoshop and printed from there on a printer. Yes ... before printing, I also did the inversion of the image so as not to force the printer to print a lot of black. And, looking at this sheet, I just drew the same thing in my level editor. After all 26 levels have been moved, we are happy to finish some of our own.

    Personally, my biggest difficulties were due to the need to almost exactly repeat the guards' behavior algorithm. In practice, I had to play and look through my eyes in some rare situations for the inadequacy of the actions of the “special labyrinth service”. And it was not so difficult to correct these situations as it was difficult to detect them. But I really wanted to make the behavior similar to what was in the original, and I hope that I succeeded.

    There was once at the end of the existence of the USSR such a cartoon, which was called " Barefoot Scientist ." There, one, well, a very clever oriental thinker went to the market for new shoes. And there he saw that some artist was selling paintings that depict all living creatures, in particular, there were roosters. And the thinker tells the artist:
    “You have a talent.” Why are you wasting it on drawing cocks? I would better draw something great, such as God.
    And the artist answers him:
    “It is too simple to draw God, so I am not interested.
    - Do you really think that it is easier to draw a god than a rooster there? (the thinker was indignant)
    - Of course, it is easier (the artist answers). No one saw God. I draw it with horns or without a head - no one will say that I painted it wrong. But if I draw the rooster wrong, then everyone will immediately say that I can’t draw.

    (told from memory - he watched the cartoon for a long time, but this thought definitely seemed sensible to me)

    In general, I mastered the game in about a week, but then added graphics and sound, drew levels and, most importantly, I decided to play cross-platform . Until that moment, I had never written applications for Linux or Mac OS (although I’m lying ... for Mac OS , iOS , Android and WinPhone, I did examples of my special effects engine , but these were separate projects, and now I had to port the same one product is everywhere).

    I found that the world of Linux / Unixvery diverse and very different in the details, despite the general rules. To find out with this variety, I thought it was unthinkable for myself, but I really wanted to port it. Therefore, I took the SDL engine , which, fortunately, takes care of all these subtleties of various Unix-like operating systems . For porting to Linux, I installed Fedora-64 on the virtual machine and installed the Code :: Blocks environment on it . I added new classes to my shell that through virtual functions would access this SDL . Created objects of these classes, instead of class objects that interacted with Windowsand ... that's all. To my surprise, the virtual machine fully reproduced the game in real time, except that the sounds were a little late.

    Mac OS resisted longer than Linux , since I was too lazy to port the project to Xcode and installed the same Code :: Blocks on Mac OS . And then I found that the debugger wasn’t working. I understood that the whole thing was a trifle, because after Linux the project on Mac OS even got together right away, but I still didn't have the opportunity to run the debugger, although I tried to install GDB. (It is possible that I have a terribly ancient Lion OS on my Mac, and the problems with the debugger come from here). As a result, I just began to display messages in the console. It turned out that the problem was in the paths to the folder with the game and to the folder for saving data. As soon as I fixed these functions, the game started.

    A separate time was taken away from me by the task of opening links in the browser. How to do this in Windows , of course, I knew:

    void GPlatformWindows::OpenLink(const char* link)
    {
    	ShellExecute(NULL, _T("open"), link, NULL, NULL, SW_MAXIMIZE);
    }

    But Linux shook my nerves with these links. As a result, I did this:
    void GPlatformUnix::OpenLink(const char* link)
    {
    	ToIconic(); // сворачиваем окно с игрой
    	#ifdef __APPLE__
    	// для MAC OS
    	CMagicString param="open ";
    	param+=link;
    	system(param);
    	#else
    	// для Linux
    	CMagicString param="xdg-open ";
    	param+=link;
    	param+=" &";
    	system(param);
    	#endif
    }

    I'm not sure if this is the best solution, but in my case it works quite well.

    Results:
    The results I was quite satisfied with. I myself played with pleasure in my creation and I think that the quality of this clone is quite acceptable. In addition, I very rarely undertake projects that are very small in scope. A small amount of work brings a quick result and, accordingly, the feeling of a “new star on the wing”. In addition, small projects are completed faster than they have time to get bored.

    If there are those who wish to " check out " this work, then I recorded a short video on the topic of how to play my Lode Runner correctly :

    Advice on the game: to make a hole in the floor it is better to keep a space, and not to drum on it.

    Developers:
    - Programming: Alexey Sedov (aka Odin_KG , aka Astralax studio )
    - Graphics: Konstantin Ivanov
    Platforms: Windows , Linux , Mac OS
    Link to the game page: Lode Runner

    About programming games in ancient times (lyric section)


    I began to become interested in programming almost at the same time that these first games appeared on the first computers available to the common population of the USSR. And these first games made a much greater impression on me than any modern high-tech commercial game with a huge budget and powerful PR. And here everything is very clear. I first saw a computer game at the very moment when I first learned about the existence of computers. Those. just imagine the following: a person knows about the radio, television and vacuum cleaner, but he generally has no idea that in the world there is such a thing as a computer. I found out in the “computer games salon”, where all my friends from the common yard went to look at this curiosity. (At that time, the first cooperatives began to appear in the country, and computer game salons soon became a regular business). And in this salon were the very BK-0010 with black and white small televisions.

    To play this miracle was then worth 1 rub / hour. And the first thing I saw looked like this:

    image

    This is the Land game , which showed me that the image on the TV, it turns out, can be controlled. And all this is called "COMPUTER". Looking back now, I assume that I was approximately 13 years old then.

    I don’t know how my life would have developed if I hadn’t met computer games like this in my time. But then, of course, I could not even dream that I could someday take it and easily create a computer game myself. I was able to proceed to this stage only after a couple of years, when I had the first specialist home-made computer . And here he is, by the way:

    image

    Then there were several options for the ZX-Spectrum, ATM-turbo was the maximum in tricked out , but it all stretched out over time for several years. I could only afford ATM-turbo when I was in my second year (I saved 10 scholarships to buy radio components). By education, I, by the way, am a chemical technologist, and I am very glad that I did not go to study as a programmer at one time - the academic model of training, in my opinion, develops in the student a severe aversion to gaining knowledge in this area.

    Despite the fact that now games like Lode Runner look primitive, once they were not. And to the author of the original (as far as I know, his name is A. Markov) it was not as easy as me with my cloning. At that time, the development was carried out by completely different methods than now. This will become clear if we just recall the technical specifications of the same BK-0010 .
    Processor: K1801VM1 (schestnadtsatirazryadny) with a frequency of 3 MHz
    RAM: 16 Kbytes
    memory: 16 kilobytes (actually a separate video memory did not exist - it is part of the same RAM, which is constantly displayed on the monitor)
    ROM: 32 Kbytes (there are Basic or Focal, as well as all sorts of system functions)
    Information storage device: household tape recorder and cassettes(download speed about 10 kilobytes per minute)
    Display device: TV (in rare cases, a monitor)

    Visually, the BK-0010 was a thick keyboard, inside of which was everything at once.

    image

    The cost was 650 rubles (with an engineer salary of 120 rubles, a milling machine operator of 200 rubles, and a boss of 300 rubles)

    I myself have never programmed this BK-0010 (it was too expensive and, in my opinion, not perfect), but, in fact, I started at about the same time. And, I understand that then the developer needed, oh, how to try to create something worthwhile on such hardware and, most importantly, with the available software tools. And the processor itself was physically very weak - the programmer usually counted the clock cycles for which this or that command was executed in order to optimize the code. In my opinion, on the BC-0010 were also some problems with the assembler , as one friend of mine programmed on the BC-0010 easy " in the codes". In fact, this means that you clog the memory with numbers that mean something to the processor, but visually say little to the person. (By the way, I also did this at the beginning, until I found out what assembler was and typed by handles in the form of a list of bytes from one log.) For example, the number 06 meant for the processor a command to copy the contents of register B to register A, which could be written in assembler in a more human-readable form as MOV A, B (for the processor КР580ВА80 ) or LD A, B (for Z-80 processor) But it was still somehow possible to remember, but things with referrals were even worse. When programming in codes, you need to enter a direct address or an offset from the current address to where the program should jump. And if you had to insert changes into the code, then the addresses were shifted and it was necessary to place all the transition addresses again. Some for these purposes inserted a lot of NOP assembler commands (code 00) into the code , which simply does nothing - such commands could then be replaced with something else without touching the address.

    By the way, there was no place to draw graphics either. For example, at that time I marked pencil points on graph paper, and then converted these points into bytes and entered these bytes into the computer with pens. And I don’t think that the author of the original Lode RunnerThere were some very different opportunities from mine.

    I’m all of this to the fact that I was often surprised by the often neglect of these old games. It was extremely difficult to do all of this, and there was no one to ask for advice, since only a few knew about it, and the Internet wasn’t even planned at that time. The only plus that, in my opinion, was present then was the interest in this work on the part of the players. There were few people with computers, but they were, let’s say, grateful users - the appearance of a new game aroused interest and the game quickly dispersed in the same salons of computer games. And I don’t remember anyone once saying disgusting things like “what a crappy game” or something like that. In short, there was no oversaturation of the market, which is now, which for me personally has always called into question the need to create new games.

    Also, I’m not sure that before the creation of games brought some tangible profit to their creators - I think that it was pure creativity, which is now almost destroyed by commercial relations in society. Quietly, both amateur radio and interest in a music school and in general everything that involves doing something for the sake of net profit have died.

    I would like to end with words of gratitude to the developers of that era (it was a question of the length of time: the end of the 80x - the beginning of the 90s). And also personally to Comrade Markov, with whom I am not familiar, but nevertheless, his game made a great impression on me at the age of 13-14. Like it or not, it was these enthusiasts who stood at the origins of the Russian game-building. But most importantly, they have generated interest in the topic of programming among those who "followed them." And I, unlike many, understand how much it then required strength and patience.

    Thank you for attention!
    Alexey Sedov

    Also popular now: