Making PC game together
Making PC game together

Полная версия

Making PC game together

Язык: Английский
Год издания: 2026
Добавлена:
Настройки чтения
Размер шрифта
Высота строк
Поля
На страницу:
1 из 3

Making PC game together


Gennady Guryanov

Cover designer Gennady Guryanov

Illustrator Gennady Guryanov


© Gennady Guryanov, 2026

© Gennady Guryanov, cover design, 2026

© Gennady Guryanov, illustrations, 2026


ISBN 978-5-0070-1552-3

Created with Ridero smart publishing system

Making a PC Game Together

About the book

The book tells about the creation of the software core of a single-player 3D computer game in the adventure genre, a first-person quest-puzzle in the Unity3d development environment for a personal computer.

The full cycle of creation from scratch to a working version of the game is presented, without graphic content. The book is addressed to schoolchildren, beginners and enthusiasts.

The author of the book has been a developer of computer games since 2006, he has a large number of released projects under his belt, including those made alone, for example, computer games in the adventure and quest genre AA-class (double A) «Secret Doctrine» and «Fish».


From the author

Dear reader!

Modern computer technologies have opened up previously unseen opportunities for the implementation of creative ideas with bright artistic and semantic possibilities. You now have the opportunity to create beauty, exciting kind stories, fantastic colorful antics and foggy thoughtfulness!

Being the creator of several games for a personal computer made alone — 4 small and 2 very large, I, the author of this book, will show you the way to the daily joy of creativity and your success. Create your worlds, give them to people, sow in people’s souls the trembling of your heart and kind stories…

Friends! I warn you against making different games-surrogates such: «horror stories», «horrors», violence, gloom and stupidity.

Take responsibility boldly for those ideas that your heart tells you! Welcome to the world of creativity!

Let’s learn how to create a computer game together!

1. What are we doing?

The structure of this book is made in such a way that it is suggested to read it without skipping chapters. The chapters in this book are made speculatively and to a certain extent conditional.

In the book we will make the basis of a computer game with puzzles, a walker in three-dimensional space, a game for a personal computer, for one player. That is, this game will not be with flat objects — «flats», but just like in the real world — 3d — with three-dimensional ones. In such a game, events develop by solving puzzles, riddles. The abbreviation 3d means «3 dimensional», i.e. 3-dimensional space. This is a space in which there are 3 dimensions: length, height and width, for example, the one in which you and I live in real life. This also means that in such a game you can walk, run, jump and even fly like in real life. All other games that are called 2d mean that their game space is flat or two-dimensional, it has only length and height or vice versa: length and width, or even height and width. For example, a flat 2d space is a piece of paper.

How does a computer game work? It can be conceptually divided into two parts: the visual part — everything that the player sees (pictures, artistic design, animations, objects, the player’s location, etc.) and the program code part (what events are in the game and how they happen). These two parts can work independently of each other. For example, if we have a certain number of 3D models, we can arrange them in a certain way — beautifully, and such a three-dimensional scene can already please the eye in itself. And vice versa, having a program code, you can, to put it cheerfully, hang almost any visual part on it, from a stylized cubes to detailed objects and the environment.

2. «What’s the big deal?»

The development environment or, as people call it, the «engine» acts as a pot in which the soup is cooked during the game creation process. This «stock pot» has certain dimensions, the material it is made of, and it holds all the soup. Having different products for the soup (cabbage, carrots, potatoes, onions), you can put them in «stock pot» of different shapes and sizes, and even in very small ones, but the essence of the «soup» will not change. Today, the most popular «stock pots» are on everyone’s lips: Unreal Engine and Unity3d Engine. This book tells about creating a game in the Unity3d environment. There is an opinion that the Unity3d development environment is simplified and created for developing primitive phone games. This is not true. If we know what we want to get, then in Unity3d we can achieve the highest graphic results. It is also widely believed that only the Unreal Engine development environment can produce «photorealistic» results for games and programs. This is a misconception based on competitive advertising, nothing more. As for the most important aspect — the convenience of creating a game, Unity3d is undoubtedly the best choice for a creative person. The deepest intuitiveness of Unity3d and its simple logic allows you to create what you want almost immediately, just on the fly, without even knowing the program. What does this intuitiveness mean? It means that if an idea arises: «what if I try to do it this way, connect it, rotate it?», then you can immediately do it as logic, idea, thought suggests, and «this» will have the status — «you can». No other actions from the category «to rotate it, you must first add such an object and set the rotation point» are needed. For example, if you have a 3D model of an excavator with several parts, say, with a cabin, tracks, a bucket, then in Unity3d we can instantly, right in the scene, with one drag of the mouse, bind one part to another, in any order, for example, a cabin to a bucket, and a bucket to tracks, and this fantastic design is ready for use in this form from that moment, preserving the hierarchy of the changes made. The example, of course, is not very practical, but it shows that in Unity3d the game creator has almost complete creative freedom and intuitive understanding. Because design, assembly on the fly, an idea that has arisen, which can be immediately implemented, all this is the foundation of creativity and joy. On the contrary, in Unreal all of the above and much more is a continuous «headache» and restrictions: «first you need to do this, then like this, after that another trick…". And there is no need to talk about intuitive design creation and free assembly of elements directly in the scene in Unreal. Without going into additional details, we can say poetically: if working on Unity3d can be compared to the work of an artist’s elegant brush, then working on Unreal can be compared to the work of a log in your hands, with which you are trying to draw something. The statement that the Unreal development environment is suitable for projects created somewhere outside (in an external 3D modeling program, for example, in 3ds Max), given the capabilities of today’s software, does not stand up to criticism. And it is even more impossible to talk about creativity and intuition in this case.

3. Deep Dive

To have a good understanding of how the game being created will work, it is necessary to understand that any computer program (a video game is primarily a computer program) on any computer on Earth is executed by the processor from top to bottom sequentially, command after command (we will not consider multithreading and several processor cores). A computer program is a set of notes in a notebook, in lines from top to bottom, just like a school notebook on the English language with an essay on the theme of Rabindranath Tagore’s poems. Only instead of the artistic text of the essay, the programmer writes down commands for the processor in the notebook in the selected programming language. After launching such a program, the processor executes it, as I already said, from top to bottom, sequentially, command after command. In the last decades, concepts have appeared in programming: objects, instances, methods, etc., however, the essence of program execution has not changed — from top to bottom, sequentially.

The Unity3d development environment gives the creator the opportunity to make his game by placing objects and events as if separately: here you can put a character with a separate control program (in Unity3d this is called a script or scenario), here a grocery store with a separate program, and here a door leading to another level with its own program for transferring to the level. It is necessary to remember that this is done only for the convenience of the game creator, and in fact all these «separate» programs are executed by the processor in order one after another, line by line.

How does this execution happen? The computer’s microprocessor executes the program in cycles. Let’s say there are 10 lines of code in the program. It is executed from top to bottom just like you read the text of this book. Moreover, until the depths of the processor and the computer’s memory have finished calculating, for example, the third line of code, all the remaining lines from the fourth to the tenth will never be executed. All these seemingly simple nuances are extremely important as a basis. Knowing such nuances, you will be able to focus on creativity, on inventing «what can be implemented in the game», and not think «how can I do this, will there be an error and the game freeze?». So, when the execution ends after the tenth line, the cycle is repeated again from the first, and so on ad infinitum, until some other events occur, for example, the player simply exits the game.

Let’s continue. The endless cycles just described are repeated every frame during the game. The more of these cycles the microprocessor manages to calculate in one second, the better and faster the game works. If the processor manages to calculate, for example, 60 such cycles in 1 second, then the game works at a speed of 60 FPS (from English Frames Per Seconds — frames per second) and the appearance of the game on the player’s monitor changes 60 times in 1 second, i.e. 60 frames per second. Such a game is perceived by the player’s eye pleasantly, smoothly, without jerks and slowdowns. And vice versa, the fewer cycles per second the processor performs, the lower the FPS of the game and the quality of its work. It is also necessary to keep in mind that the processor is assisted in these calculations by the video card. We can say that this is the second processor of the computer, but designed only for graphics processing, in other words, only for drawing all the pictures and 3D objects of the game.

I want to note that there is no need to chase high FPS rates when developing a game, since today computer processors are able to cope with different loads equally successfully. Focus on creativity and on creating what you have in mind, and do not waste time on unnecessary searches for «salvation» of an additional 10 frames per second. In the end, computer technologies are developing so dynamically that in a period of 2—3 years, what works a little slowly today, tomorrow will work completely normally. Think about creativity, not about FPS.

4. C#

When creating the program code for our game, we will use the C# programming language (pronounced «see sharp»). This is a very convenient and flexible programming language. Its huge advantage is that it is strictly typed, i.e. in most cases it simply will not allow you to make a mistake when creating a program. For example, in this language you cannot simply say that a string of text is the same as a number. In other programming languages, this is possible, which in the process of creating a program can lead to the occurrence of implicit errors that lead to unpredictable consequences, and what is worse, the place where such an error occurred in the code is very difficult to find. To write programs in C#, we will need Microsoft Visual Studio. You can download it via Google, select the Community section, this option is free to download.

Very often, when writing game code, it is necessary to repeat the same program instructions many times. For this, there are methods or another name — functions. A method is a set of commands no different from other lines of code, which can be launched as a separate subroutine. In Unity3d, there are several fundamental methods that are responsible for almost all of the game’s work. The first of them is the Update () method. This method is launched infinitely every frame of the game. The more often the processor can execute this method, the higher the FPS of the game will be. Almost all of the code of our future game will be executed through this method. This code is usually called the game logic. The next fundamental method is called Start (), which is executed only once when the game starts. It is needed to prepare the necessary parameters for work — to initialize them. Moreover, in our game scene there can be many Start () and Update () methods at once: on the door of the transition to the level, on the character, on the grocery store, etc. How do they interact with each other? It is important to understand and remember that when the game is launched, all game objects that have a Start () method are executed first, and after that, all objects with an Update () method are executed. For example, if there are 100 objects in a running game scene, and each has an Update () method, this means that in 1 frame (mentioned above), the computer processor will execute all 100 Update () methods. For additional understanding, you can imagine that one Update () method is divided into 100 methods that must be executed during one frame of the game. In general, strictly speaking, from a performance point of view, such a large number of Update () methods in one scene is not very good. But such a division of one method into different objects is one of the great features of Unity3d. Thanks to this division, the process of creating a game becomes very convenient and understandable: here is a floor fan, it appears at the beginning of the game and while it is on, its Update () method is launched to rotate the blades of its propeller.

5. «to Rotate slowly!»

The introduction is over, now we can start to make. Let’s start with preparing the project. A project is the entire conglomerate of code, objects, textures, templates, etc., located as files in a single folder that Unity3d uses. To create a clean new project, you need to run the Unity Hub program, it is used to organize projects, create and install different versions of Unity3d. Create a new project (New Project button) using any version of Unity3d starting from 6000. To download Hub, enter the words Unity hub in Google search. The first entry in the search is exactly what you need. When you launch Unity Hub, activate the license — Personal, it does not require payment for using the Unity3d editor.

To create our game, we will use a rendering pipeline called HDRP. Unity3d has 3 rendering pipelines: built-in, called BIP, universal URP and HDRP. A rendering pipeline is a structure that describes the necessary procedures to converting your 3D scene into an image on the computer screen. We can say briefly and clearly that the differences between them are in their graphical capabilities. BIP and URP pipelines provide mediocre graphics capabilities and are focused on creating games for mobile platforms (for phones) and virtual reality (VR). The coolest of all three is HDRP, it allows you to achieve the highest graphics quality, i.e. get the most beautiful picture of the game, the most realistic 3D scenes. This pipeline is designed to create games that run on a personal computer (PC) and on consoles (like «Sony PlayStation»). We will use it.

After opening the created empty project, click Window> Package Manager. The Package Manager window will open. In this window, you need to switch the button at the top to see Unity Registry is displayed. This means that all packages available for download from the manufacturer Unity3d will be displayed. You need to find High Definition RP in this list, click on this inscription and in the right part of the window, click Install.

Dear reader, you can use the HDRP template from Unity Hub or the Render Pipeline Wizard at your discretion, but I intentionally describe how to create an HDRP project from scratch, so to speak, at the lowest level. The main reason is that from version to version in Unity3d, styles, settings, windows, etc. are changed, constantly being reworked by the Unity3d development team. All this tinsel can confuse a novice game creator. In addition, when using templates and «setup wizards», an empty project is very often created with «manufacturer’s errors» (red messages in the console), which is additionally confusing, annoying and frustrating. The «low-level» method I describe allows you to install everything correctly on any version of the program without errors and — for sure.

We have just installed the rendering pipeline itself in our project, i.e. poured water into the stock pot for our «soup». Now we need to turn on the pipeline so that it can start working — «light the gas under the pot». To do this, in the Project window, right-click — Create> Rendering> HDRP Asset. We have created a global object that controls the visualization of our new project. Now we need to «turn it on», to do this, click Edit> Project Settings> Graphics> Default Render Pipeline — drag the newly created HDRP asset into this empty slot. That’s it, now the project is in the HDRP state and ready to work. The last step that needs to be done is to check that Visual Studio, which we downloaded and installed earlier, is used by default in our project. To do this, click Edit> Preferences> External Tools> External Script Editor and select Visual Studio from the drop-down list.

6. Here we go!

So, now let’s get down filigree to the programs of our future game. Since there will be a lot of these programs or as they are also called «scripts», then in order not to get confused, you need to create a separate folder for them and call it Scripts. To do this, in the Project window, right-click on the Assets folder, Create> Folder, and call it Scripts. I suggest you take on board the idea that you need to delete and rename folders and project files in the Unity3d editor itself, but not through «Windows Explorer’, since all Unity3d project files are linked by metadata, which in some cases is very capricious with all the ensuing negative consequences for the joy of creativity.

Try to do everything exactly as described below in the text so that there is no confusion and misunderstanding.

Let’s create a player. The player is a game object with a camera, which is the main character of the entire game. The camera is an object that shows everything the player sees on the screen. In general, everything that is in a Unity3d scene or level is a game object — «GameObject’, and all of them are located in the virtual space of our scene, so any object in Unity3d always exists with a «Transform’ component, which sets the position and size of the object in space. Logic suggests that without this component, the object cannot exist, so the «Transform’ component cannot be removed from the object.

So, the player. Let’s create a program for the player, for this we right-click in the «Project’ window in the «Scripts’ folder that we created — Create> Scripting> Empty C# Script, we’ll call it «FPCharacter’. Double-click on this file to open the «Visual Studio’ editor. We’ll see the following lines of code:

using UnityEngine;

public class FPCharacter

{

}

Let’s take a quick look at them. The line ’using UnityEngine’ means that this program or script will use (English: using) the base classes of the Unity3d Engine development environment.

The line ’public class FPCharacter’ means that this scenario is a class (a class is the basic data type of a programming language) called FPCharacter, and this class is publicly accessible thanks to the ’public’ keyword, i.e. it can be accessed by any code in the project.

It is also necessary to keep in mind that all game logic scenarios in Unity3d are, so to speak, derived from the base class «MonoBehaviour’. Therefore, in order for our game scenario to work, it is always necessary to add a colon and MonoBehaviour to the class name. Now this same code should look like this:

using UnityEngine;

public class FPCharacter: MonoBehaviour

{

}

Now we have created the ’skeleton’ of our first program. Now we need to fill it with data and operations. All the content of the class or its «body» should be written between curly brackets.

Let’s specify or declare variables. A variable is a piece of your computer’s memory that has a type, i.e. who it is, a name — what its name is, and stores some values. Let’s write:

public float speed = 2.0f;

public float speedfast = 50.0f;

public float gravity = -9.8f;

The first line means that a variable called ’speed’ is declared, has a value equal to 2.0, is public and has a type — ’float’, i.e. a numeric type with a floating point. For example, in C# there is an ’int’ type, i.e. an integer type, into which you can enter the value 1, 2, 3, etc., but you cannot write 1.4 or 2.3. It is into the ’float’ type that you can enter the values 2.3 or 1.4. Also, according to the rules of the C# language, when declaring a variable of the ’float’ type, you need to put the letter ’f’ in the value indication to separate the variable from another type called ’double’. Also, at the end of an instruction or variable declaration, you must always put a semicolon. When transferring our code to machine instructions for the processor (run our program), a semicolon indicates that this instruction or variable declaration is finished and processor can move on to the next steps.

Now the three variables we have created will help us control the program, i.e. the player we are making. The variables are ’speed’, ’speedfast’ and ’gravity’. The program now looks like this:

using UnityEngine;

public class FPCharacter: MonoBehaviour

{

public float speed = 2.0f;

public float speedfast = 50.0f;

public float gravity = -9.8f;

}

Press Ctrl + S to save our script. To move consistently and not get confused, return to the Unity3d editor in our project and create the player game object itself. Right-click in the «Hierarchy’ window> Create Empty. Let’s immediately name this game object «Player’. And now just drag and drop our created «FPCharacter’ script on it (You can drag and drop the script onto the object in the «Hierarchy’ window or in the «Inspector’ window). The «Inspector’ window is the most frequently used window in Unity3d, it displays almost all the properties and parameters of the objects of the future game.

Now we see our «FPCharacter’ script attached on the «Player’ object as its component, just like the «Transform’ described above. And we see all three variables of our script with their values set. Note that if you remove the ’public’ keywords, the variables will disappear from the «Inspector’ and their setting in the Unity3d editor will become impossible.


На страницу:
1 из 3