📜 ⬆️ ⬇️

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


Recently, I found myself in an unusual situation of forced idleness. After a couple of weeks of fooling around, I began to feel that this was not such a fun activity, which also began to turn into boredom. And I had to do something relatively useful for myself. Previously, I occasionally had the idea of ​​bringing some old game back to life from the time of my youth. But I always drove such ideas away, because I understood that " now it is not necessary for anyone ." But now I had free time and, most importantly, there was a desire. As a result, for cloning, I chose one of the variants of the Lode Runner game, which I once played on the first personal computer of the late USSR , which was called BK-0010 . I do not think that many people remember him, since the world of "iron" has changed very much since that time. However, Lode Runner itself from this BK-0010 was quite unique in its rules among other Lode Runner of the same name. This version of the game was my favorite, as it seems to me, for objective reasons, although ... maybe it’s just nostalgia. As a result, I managed to motivate myself by the fact that “ I personally ”, and, perhaps, “the whole world ”, this game can be interesting, and it is worth spending time to restore it ( link to the result ).

First, take a look at the original from the BK-0010 (praise to 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 labyrinth, then a “door” will appear, through which you can go to the next level. But the execution of this noble task is hindered by evil guards, who pursue the defenseless protagonist. Although ... our hero has one secret weapon - you can pierce holes in the brick floor, making traps for the guards. The guard falls into such a hole and for some time is considered caught. In this small period of time, the protagonist can run around the guard on the head.
')
A distinctive feature of the version of the game on the BK-0010 was that the protagonist holed the bricks strictly under him, not right or left, as happened, for example, on Lode Runner from the 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 distinguished for me this Lode Runner from all the other games of the same name.

With full cloning in development there are both pros and cons. The undoubted advantage is that it is possible to clearly imagine a goal in advance, you can also use game levels that already exist in the version for BK-0010 . The disadvantages are that the behavior of the main character and the guards should be implemented 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 still has a lot of minor features that need to be repeated in my code. Critical deviations in the behavior of guards can make the levels with the BK-0010 uninteresting or generally impassable. And that kills the whole point of cloning.

I started by finding on the Internet that someone already converted the Lode Runner variant with BK-0010 . However, having played a little bit at him, I realized that he was only alike in appearance. Despite the external similarity, in my opinion, the author did not take 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 got off. But in this version was an important plus for me - the level editor was present here, and these levels were also diligently redrawn from the original. And I really needed these levels.

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 had to function somehow. I also had the obsession that the game was easily portable to different platforms. Fortunately for me, I have already made a similar shell for my classic RTS Earth onimods (an article about 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 that 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 the sound, displaying graphics and controlling the screen modes - all this was also provided for in my shell. Therefore, I went 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, display the image there with a processor, then copy this surface onto a DirectX or OpenGL texture in video memory and display this texture on the monitor. This approach is good because it simplifies the transfer between different platforms as much as possible. And since I don’t have to fight for speed, I considered this path the only correct one, especially since the shell is currently also building its image as a processor.

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

image

Here you can select the level to edit, create a new one or delete the annoying one. The level editing itself also looks very simple, since the maze consists of just 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”. I also had living objects in the beginning were static pictures, which, in the literal sense, smoothly drove through the level. But this approach allowed me to program almost all the logic of the game without the help of an artist. The artist, by the way, was made by my old friend Konstantin Ivanov, who hadn’t been doing anything like this for a long time, since he is currently wasting his life creating advertising videos in a Kazan company. And these videos he already rather tired. Therefore, to my surprise, he quite actively took up the design of my clearly non-commercial venture. As a result, all the clearance was done by us for 2 nights in combination in the destruction of alcoholic beverages. Here it is necessary to clarify that I myself didn’t do anything on schedule - I only offered and criticized, and I drew Konstantin.

Since in the original version of the game the characters were something vague due to the small number of pixels per level cell, we decided to change them. Ghosts were quite suitable for the role of guards, besides, they had a great dignity - they do not need to move their legs during the move, which simplifies drawing. But with the main character so simply did not work. The first variant, which Konstantin gave me, definitely reminded me of a “liquid Terminator” in miniature. And it was obvious that he needed not to run away from the ghosts, but to hunt them. However, the plot of the game required another. As a result, I gave Konstantin the book by Nikolay Kozlov “ True truth or a psychologist’s textbook on life ”, and there are a lot of illustrations of this type:

image

And after a few minutes, he gave me our "Kolobchikha" image , which we as a result and sent in search of treasure. Just in case, I clarify that Konstantin painted her “pens” and not “ears”, but visually this is not entirely obvious.

Then we carefully transferred all levels from the original to our game. I opened them in the not the most successful version, which I mentioned earlier, then clicked PRINTSCREEN , threw it in Photoshop and printed on it from there. Yes ... before printing, I also did an image inversion in order not to force the printer to print many, many black colors. And looking at this sheet, I just drew the same thing in my level editor. After all 26 levels have been transferred, we are happy to draw a few of our own.

Personally, my greatest difficulties were due to the need to almost exactly repeat the algorithm of the behavior of the guards. Practically, one had to play and, in some rare situations, to seek out the inadequacy of the actions of the “special service of the labyrinth”. 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.

At one time, at the end of the USSR, there was such a cartoon called the " Barefoot scientist ". There, one, well, very clever oriental thinker went to the market for new shoes. And there he saw that some artist was selling paintings in which all living creatures were painted, in particular, there were also roosters. And the thinker says to the artist:
- You have the same talent. Why do you spend it on drawing roosters? Would rather draw something great, such as a god.
And the artist answers him:
- God is too easy to draw, so I am not interested.
- Do you really think that it is easier to draw a god than a rooster? (the thinker was indignant)
- Of course, easier (responsible artist). Nobody saw God. I draw it with horns or without a head - no one will say that I drew it wrong. But if I draw the wrong rooster, then everyone will immediately say that I do not know how to draw.

(told from memory - I watched a cartoon for a long time, but this thought definitely seemed to be a good one)

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

I found that the Linux / Unix world is very diverse and very different in the details, despite the general rules. I considered it unimaginable for myself to deal with this variety, but I still wanted to port it. Therefore, I took the SDL engine, which, fortunately, assumes all these subtleties of the work of different Unicom OS . To port to Linux, I installed Fedora-64 on a virtual machine and installed the Code :: Blocks environment in it. I added new classes to my shell that would access this SDL through virtual functions. Created objects of these classes, instead of objects of classes that interacted with Windows and ... everything. To my surprise, the virtual machine completely reproduced the game in real time, except that the sounds were a bit late.

Mac OS resisted longer than Linux , since I was too lazy to transfer the project to XCode and installed the same Code :: Blocks on Mac OS . And then I discovered that the debugger is not working. I understood that it was all a trifle, because after Linux, the project on Mac OS even got ready 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 old Lion OS on my Mac , and this is where the problems with the debugger result). 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 from me by the task of opening links in the browser. How to do it in Windows , of course, I knew:

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

Linux . :
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
}

, , .

:
. , . , , . , , « ». , , .

«» , , Lode Runner:
: , .

:
— : ( Odin_KG, Astralax)
— :
: Windows, Linux, Mac OS
: Lode Runner

( )


, , . , - . . , . .. : , , , . « », , . ( , ). -0010 - .

1 /. , :

image

Land, , , , . «». , , , 13 .

, . , , , - . , . , :

image

ZX-Spectrum, ATM-turbo, . ATM-turbo ( 10 , ). , , , -, , — , , .

, Lode Runner , - . ( .) . . , -0010.
: 18011 () 3
: 16
: 16 ( — , )
: 32 ( , )
: ( 10 )
: ( )

-0010 , .

image

650 ( 120 , 200 , 300 )

-0010 ( , , ), , , . , , , , , , , , - . — , , . -, -0010 - , -0010 " ". , , , - , . ( , , , , ). , 06 B A, MOV A,B ( 58080) LD A,B ( Z-80). - , . , . , . NOP ( 00), — - .

, , . , , , . , Lode Runner- - .

, . , , , . , , , — . , , , — . , - - « » - . , , , . , .

, - — , , , , . . , - .

( : 80x — 90). . , , 13-14 . , . , , « ». , , , .

!

Source: https://habr.com/ru/post/335968/


All Articles