like-ya-made-first-irigr-1

How I made my first game

It will be an atypical long to create a game, I will start from the very beginning. The first thing you need to know, that I never developed games.

Why unity?

Well, let’s start with the fact that YouTube is simply clogged with lessons, both in Russian and in English. Therefore, the study of the program at the initial stage is quite simple.

You may ask me: “But what about C#?»And he is unless complicated? The whole code that will be used at the initial stage is on the Internet. The main thing is to understand what he does.

“But there is Unreal” – the young Hater may object, but where did you see an indie developer who alone creates games? And you do not need to be given as an example of a Korean who ends the next game while you sleep.

As for me, Unity will be much easier at the initial stage, since from the very beginning they teach to do 2D games on it.

Motivation

Of course money! I went to Head Hunter and looked at the vacancies. And the worse I am? In general, various Game JAM videos can be good motivation. There are on yutyub in bulk, you can watch without stopping.

Education

So, I looked at the videos. What’s next? And then – watching training rollers! Suitable for any quality, the main thing is that you understand, the truth from the local code can become bad.

I started with a course by LoftBlog. Not only did the code have not been a normal readable structure, so he still did not transfer the IF-Else operator to the trace of a line!

I was enough for five lessons, so I decided to create a new project and do everything in a non-marine.

Concept

I have no experience in Unity, so I need to make a game that will be simple, but with one interesting mechanics. Thinking, I decided that I will have a character who moves forward and jumps over obstacles. But then, I changed obstacles to special “balls”, when eating which the character increases and decreases.

It looks pretty simple, now it remains to draw graphics, animations, menu, and so on. It sounds quite simple.

Graphics

To draw pixel art I used Aseprite. The program is simple, though I wanted to use photoshop. Unfortunately, the program lags when the pixel grid is turned on.

Further in the search engine we look at the pictures, I had a slime (mucus). Of course, you can’t imagine anything original here, so I decided to add a little cute.

As a result, I got such a set:

Pixel pictures settings. Learn that Pixels per unit is the size of your picture. I have 16 × 16.

Prefabs

In Unity, it is possible to draw with pells through Grid. I threw objects to Prefab and created a palette there in a new grid. Now we open a new palette in the editor and throw the springs from the prefab to the editor.

To arrange objects evenly, you need to use Box Collider 2D. Then use to draw Gameobjectbrush. Here is a detailed video.

For a grid, I use the following settings:

Bounce

The jump is implemented quite simply, but taking into account gravity. You can read in more detail here.

Sounds

I took sounds for the game from the site, the rest by keywords.

Post -Processing

For the game I used post -proceedings. It is quite simple to add it, you need to add two components and create a profile.

For Post-Process Layer, you need to create a new layer.

Canvas

I have several canvas in the project. To create the onClick function, you need to move the Convas itself to the button so that the methods that you have to appear.

“Paralax” made taking into account the position of the camera https://nonukcasinosites.co.uk/casinos-not-on-gamstop/ and the speed of the player.

Camera

The game uses plugin Cinemachine, Therefore, you need to specify the method of updating the camera. In my case Last Update.

Assembly

When the three levels were ready, I started collecting the project. Here I ran into one problem – I have a game. I could not understand what the problem was, but then found out that in Project SettingsPhysics 2D costs Fixed Update, And I have all the challenges of movement through Update, Therefore, the game laged, but not only.

It was also turned on Vsync, Although after switching to Physics 2D The game began to work fine, but I still turned it off.

It is very important when assembling to set the minimum resolution and operating mode of the application – in the window. Otherwise, the game will start on a full screen T is inconvenient. The minimum resolution in which the project was launched – it is 1280 × 720

Icon

I made the icon in Midjourney. It took about 20 generations, and then the pictures became crypt. Then I focused so that it was more suitable in color, and also removed the background.

Assembly for Linux

I always wanted to make games for Linux, so I collected the assembly without difficulty. Then installed Ubuntu 22.10 On the virtual machine (Virtual Box).

In the settings I set the overall folder.

To open a folder without a ROOT, you will need to lead a command, then restart the system:

To start the game, open the folder through the terminal and run (the file must be executed.)

Chmod +X ./File games- Makes the file executable.

./File games- Launching the game.

Productivity is so -so, given the amount of memory, but you can check the launch.

Rumle – This is the Platformer Ranner consisting of 5 races. Jump and collect coins. The game is completely free.

The best comments

I have several canvas in the project. To create the onClick function, you need to move the Convas itself to the button so that the methods that you have to appear.

Emmmmm … what? OnClick in Button’a allows you to cause public methods of fed -fed Object’a. This does not have to be canvas. And in general, ideally, you need to subscribe and unsubscribe directly in the code. Then if something falls off in the game, it will be possible to quickly find the place of the occurrence of a bug, t.To. Subscriptions and unsubscribes will be in one place, and will not be scattered by buttons.

Here I ran into one problem – I have a game. I could not understand what the problem was, but then I found out that the Project Settings – Physics 2D is Fixed Update, and I have all the challenges of movements through Update, so the game lagal, but not only.

It is quite strange that because of this the game lag. But to change because of this Fixedupdate on Update in Physics2d … In general, all the miscalculations of physics, movements, including in Fixedupdate, so that the simulation does not depend on FPS. Fixedupdate, unlike Update, is caused by a fixed amount of times per second and because of this physics is calculated adequately. Moving to Update should not cause fps drawdown, probably the matter is something else. If I watched the whole code, I could have imagined why the game lagon.

VOID update ()
IF (Cameratransform.POSITION.x> = 0)
Transform.Translate (Vector2.Right * Speed ​​* Time.deltatime);
>

That is, the parallax layer will only move if the original position of the camera is “x” more than 0 and the player’s speed != 0? I did not play the game, but as I understood – the game Ranner, where the character runs automatically. You can turn on the “tracking” of parallax after the player at the beginning of the level and turn off at the end, or when losing. If the levels are small, then you can stupidly switch the display mode of the back of the backdrop to the “thed” and stretch over the entire length of the level. Then you will not have to follow at all.

A little according to the style of code. The names of classes, public fields, which ideally should not be, the property, methods, etc. should be called with the title letter. Private members should begin with “_” (for example, “_movementSpeed”).

Well, at the end, subjective taste. Bounce. Personally, it seems strange to touch gravity in the calculations of the jump. It is much more convenient to manually calculate Velocity in Rigidbody. For example, like this:

Private Async Unitask Updateasync
While (token.ISCANCELTIONRECEQUESSTED == FALSE)
if (_rigidbody.Velocity.And < 0)
_Rigidbody.Velocity -= _gravityVector * constants.Fall_Multiplier * Time.FixedDeltatime;
>
Else if (_Rigidbody.Velocity.y> 0)
_Rigidbody.Velocity *= constants.Linear_Velocity_SlowDown_Speed;
>

And what is the result? As a result, congratulations on the first completed project. Slime looks cute, most popular unity vidos should look with skepticism, do not stop trying and study and soon you will start amazing projects. Good luck)

Well, what can I say as the only one, probably who played and went through this game at all)
1) kapets how he rinses with such a camera system when jumping, and in general too close

2) you need to allow you to press the buttons both with the mouse and the keyboard, otherwise you have the start of the game

3) on the escape you need to click at least 3-4 times to go out)

4) too large collider on gg, coins disappear even before it touched

5) Could give more lives, like while they are – a restart from the beginning of the current lvl, when they ended – the restart from the very first

6) Coins in fact are not needed, if only a glass of collection progress for all levels and at the end would give out the result – cool, you collected * number * coins

7) in vain disconnected a vertical, my swinging logo was a bit torn

8) The game on the full screen shows that the springs are shitty apskay and everything looks dull, well, or you set it up not minimal resolution of the game, but fixed it in 720r, judging by the soap logo of the unity

9) if you jump, the buttons disappear and you can not change the mode (full-foam)

I absolutely do not understand anything in programming, therefore I won’t even try to shower. It was extremely interesting to read this text and not so much as Long_blog (you bent with Long, of course), but rather like a personal diary of a novice developer. Even a little motivation caught. I always wanted to create my own small game in order to bother the corresponding Achivka in my race. Well, I moved away from the topic.
Let the game-who are in the code of the gam-deelopers criticize and lead. I will put my Lucas for a simple, concise and entertaining text.

> As a professional software developer

In general, in Gamdev there is money. As a professional game developer with 10 years of experience, I say.

Not at all. Not only is the terrible “Enterpraise.”This is a factory for the production of guardians of one line and other ultra-assigned specialists, so there are also not many jobs.

And to just play the coder, just an indie-gamdev is well suitable. Or web. And then the person himself will figure out what he wants from all this.

Handsome. The beginning of a good hobby is laid.

Thanks for the blog! It turned out very cool. I’m trying to study # and do projects in Yunka myself. I wish you good luck in the future.

It looks very good

It looks pretty. But a lot of work is ahead. =) I would also suggest laying out a web version on the page, so more players will be launched. Not everyone wants to download, unpack, start (just laziness will be or someone will say “what if the viruses?”, And t.p.). Good luck! =)

Why not goodot? It is better for me for 2d games

I have several canvas in the project. To create the onClick function, you need to move the Convas itself to the button so that the methods that you have to appear.

Canvas should be on the window, not on the end. It is better to subscribe to the AWAKE Monobeh button.

“But there is unreal” – it is true and it is much simpler and more convenient than Unity ^_ ^
And if you want it very simple for 2D games, then do not bother your brains, youth, but use Game Maker or Constructor 2 – 3.

Well … how would you tell you? 🙂 To begin with, you do not know how the word “hunter” is written.

In general, it is better not to go for money in Gamdev. There is no money in Gamdev. As a professional software developer with many years of experience and certificates, I say. For money, you need to in the henterrase. Learn to Java or Python, and go to some Sber. I’m not sure that at least some normal programmatic offices remain in Russia, for initial rolling into the profession and Sber will do.

Leave a Reply

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