When I was a kid, I wrote a flight simulator

Hi all!
I would like to start by saying that I was very pleased to read the comments to the article How I Became Who knows who, in which some Habr users shared their opinions and short stories from their careers.

Replying to one of the comments, I said that my path to development began in the 10th grade. And at that moment, a wave of childhood flashbacks washed over me and I began digging through my removable media in search of the very project that started it all. Suddenly, I found it and thought I would share the story of its creation with you.

For ease of reading, the story is divided into several parts, the first two of which are presented in this article.

Part 1. Prehistory

It was April 2011, I was finishing 10th grade. By that time I had been studying Pascal for 8 months, coding in Turbo Pascal and doing this as part of my preparation for the Unified State Exam. I think it was a normal school day, when suddenly my computer science tutor called me and the following conversation took place:
– Hi, would you like to take part in the city conference on computer science?
– What is it?
– Well, it's a conference for schoolchildren, where kids present their projects, including programming ones. Do you want to participate?
– Yes, of course! But I can't even imagine what to write for the conference.
– Anything. If you don't have an idea, then at least write a calculator. And then you can see what projects the guys are coming up with. You should be interested.
– Well-l-l-l-l… Okay, I'll try.

A couple of days later I remembered that somewhere at home among a pile of disks I saw a box from Borland Delphi 7, and decided to see what it was. After unpacking, installing and viewing examples, to my happiness I discovered that Delphi syntax was like Pascal. Then I began to master the new IDE.

After spending a few days getting to know the development environment, I started writing a calculator that looked very similar to the standard calculator from Windows XP.

This is the version with advanced mathematical functions that I tried to implement.

This is the version with advanced mathematical functions that I tried to implement.

It allowed data entry from interface elements and the keyboard. Happy and satisfied after a few days of development, I shared the news with my classmate that I had written a calculator for a conference.
– Oh, let me test your program! – he said. – I'll enter all sorts of wrong symbols, make the program work incorrectly. Just stupidly press all the keys in a row. Well, what do you say? Shake on it?
– Deal!

I agreed, not even suspecting what was waiting for me. I gave him the binary program on a flash drive and by the end of the week I received an answer: a Word document of one and a half pages with a list of errors and the program's behavior! One and a half pages in 12-point Times New Roman, Karl!!! I was shocked! But there was little time left. The conference was to take place on Thursday of the following week, and there was no time left to correct it.

The conference was held in one of the city schools. The conference room was a typical math or physics classroom at the time: a teacher's desk with a computer and a projector and rows of desks. There were several sections: programming, web design, multimedia (Photoshop skills, etc.). There were only three people in my section and they decided to look at my project first. It was a real 5 minutes of shame: I presented my calculator, performed several operations in it and one of the jury members asked me to enter letters instead of numbers. Naturally, when trying to get the result of the expression, the program displayed an error message and urgently terminated. The presentation was over, I moved in the spectator's chair I sat down at my desk and then the most interesting part began for me.

Two other contenders presented (unexpectedly) web browsers. It was very strange, but after these presentations the jury members said, you didn't write a browser engine from scratch, show something else! (Later I was convinced that in the same Borland Delphi 7 the browser is a ready-made element). The guys showed games. One had fifteen, and the other had tanks. Almost like that very Battle City, only the graphics are already better. To say that I was shocked by the tanks is to say nothing. The jury was also delighted and this project received first place.

And then I set myself a goal: at the next conference I must take first place. And to do this I need:
Create your own game!

Part 2 – Making Your First Game

For several days in a row I was under the impression of the conference and the idea of ​​writing a game was spinning in my head all this time. I started searching.

To be honest, I didn't even know what and how to search for, I acted purely on intuition. After several iterations of searching, I started looking for game implementations in Delphi and subsequently found a lot of cool examples. In addition, they were normally assembled and launched. I think I looked through about two dozen different games. Using step-by-step debugging and breakpoints, I watched how their various elements worked. At that time, it was very educational for me.

But what was even more informative was that I found the project of those very tanks. The design was exactly the same as those I saw at the conference. But let's not talk about plagiarism, that's a topic for another article not from this series.

This is approximately what those tanks looked like

This is approximately what those tanks looked like

Project examples are cool, of course, but they were just examples. I still had no idea what kind of game to write. I think I thought about it for about a month until I remembered one flight simulator that I played in my distant childhood. It had a first-person view, flights were mainly over water, and for me, a kid at the time, the gameplay was still difficult. “Well, that's it!”, I thought, “I've found an idea – I'll make a flight simulator!” As they say, I see the goal – I see no obstacles.

I decided to make the game in 2D graphics right away, because I thought that I had no time to study 3D yet. And in order not to bother with graphics, I decided to make it even simpler – just move pictures on the screen, a kind of sprite animation. For the player character, it was a projection of the MiG-29, rear view. For the enemy bot – a projection of the Su-25, front view. Unfortunately, there were no pictures of shells and explosions, so I got by as best I could: I drew two pictures in Paint for explosions (for the player and the bot), and two squares as shells – yellow for the player, red for the bot. The screen was divided into two parts: the ground below with a green background, the sky above – blue. Well, actually the main menu of the game:

Main menu and game help

Main menu and game help

The controls were a bit of a pain to work with, because it wasn't clear how to capture keyboard presses at first. So in the very first version of the game, these were keys inside the game itself 🙂 Well, that is, you had to click on them with the mouse.

Gameplay of the game MiG-29: The First v.1.0

Gameplay of the game MiG-29: The First v.1.0

However, it quickly became clear that such management was no good, and my classmates helped me with this understanding. I actively used my computer science lessons to present my handicrafts: in my free time I called the right guys, launched my game in front of them and asked them to play it. You could say that this is how I got an alpha testing team 🙂

Soon I released a couple of updates to the game. The first one fixed the display of models, i.e. the background of sprites was not displayed and when they overlapped, only “useful information” was displayed. However, there was still a problem with going beyond the boundaries of polygons:

Gameplay of the game MiG-29: The First v.1.1

Gameplay of the game MiG-29: The First v.1.1

In the latest update, the controls became familiar: movement was carried out using the keyboard keys “up”, “down”, “right”, “left” and fire on the “space”. Well, because the control was transferred to the keyboard, there was no need to display the keys on the screen:

Gameplay of the game MiG-29: The First v.1.2

Gameplay of the game MiG-29: The First v.1.2

Of course, it wasn't a triumph yet, but it was something. After some time, I realized that it was impossible to present the game in this form, since the graphics were too primitive, the gameplay wasn't engaging, and the game's image wasn't interesting to look at in principle.

So soon I found examples of working with graphic primitives in Delphi and spent about a week learning how to operate them in real time. As I remember now, it was “Korablik” that demonstrated the base point method.

Boat from the example

Boat from the example

All this was needed for only one thing:
Creating that very game that will give me victory in the conference!

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *