SuperIndustry – Dev log #2 – Welcome to the dark forest
– Where can I get pictures?
– Interaction between mechanisms
– In the next issue
Hello friends! In this series of articles, I will talk in as much detail as possible about the process of developing a game at UE – SuperIndustry. You can use my example to learn the process of developing a 3D game on UE. Briefly about the game: Imagine a hybrid of Oxygen not included and Satisfactory, in the distant future and on a specific exo planet. The game will have a simple plot, which will be narrated through a kind of diary. The main goal is to fly away from the planet (to stop there) or to continue communication with the Supreme Being and find out what will happen next.
Previous part: https://habr.com/en/post/710516/
First part: https://habr.com/en/post/704636/
It will be based on moral choice and a higher Being.
Plot Plot: In 2930, the development of warp drives began, allowing movement faster than the speed of light. After a series of tests in 2990, a highly unstable star mysteriously appeared 5 light years from the solar system, which is constantly becoming more massive and periodically emits gamma rays of increasing intensity. How it appeared, the cause of instability and where it takes energy can be found out a little later after the start of the game. After 5 years in 2995, the deadly rays became comparable in power to quasars and their appearance became extremely frequent. One of these rays flew towards the Earth. The beam is predicted to reach Earth by the year 3000. People need to find an exo planet to resettle. For this, the player is sent to a potential candidate (planet) at 20 St. years from the solar system.
Upon arrival, the character begins to have mental problems. Random sounds, hallucinations, artifacts appear on the player’s screen. As the character begins to go insane, they are contacted by a higher being named Sin. Xing can change the events that are about to happen. Who is hiding under this name and where such abilities come from, it will be possible to find out as the game progresses. Sin will be able to talk to the character with notes of emotions. For example, instead of “Don’t do this,” Xing will say “denial.” The dialogue can be conducted either after the event/selection or before. The original goal is to save humanity, but during the game it can change; at the request of the player.
Various situations will occur during the game. For example, the choice: save the rich / save everyone / save no one. Or: talk about hallucinations and Xing / say nothing. The player will have to make a decision according to their moral principles and character. If the wrong choice is made several times, Sin may become disillusioned with the character and the game will end on a bad ending. The game will give a 2 chance, but if you fail it, then the save will be deleted. The player’s choices affect the character’s personality. The answers at key points in the plot depend on his character.
About Sin. It will help the character discover paradoxical technologies, understand himself and change the course of events in especially important situations. To achieve results, the character needs to strive for it; believed in himself; was unshakable; was selfless and grateful for the help of Xing (Sing will be able to help influence current events and change future ones). All these qualities must be brought up in the character by the player. Character, morale, mood, sediment from recent events – all this will be reflected in the answer options when communicating with Sin. Depending on the answers chosen, the character’s goals, principles, and character will change. The character’s goal is to find a planet to resettle and report it, and the player’s goal is to let it happen (or not). It is the player who controls the character, changes his character, and is responsible for the consequences. Communication will take place not by ordinary dialogue, but by notes of emotions. The character will have to report not what he thinks, but what he feels.
Where to get pictures?
Each item in the game needs a picture that the player will see in the inventory cell. To complicate the test, I will not take ready-made ones, but I will do it myself. (or not quite =) )
My main assistant will be Stable diffusion. This is a neural network for generating pictures according to a text description, adding ready-made pictures, and much more. I’m going to draw the outline of the subject, and then bring it to the ideal through the neural network.
Now we need to install the neural network. Initially, it was created for Linux and Nvidia video cards, but a little later after the release, a way to run on Windows and AMD video cards appeared. To run a neural network on AMD, you need to convert it to Onnx. I originally wanted to install the optimized version from basujindalbut it does not support conversion to Onnx, so I decided to install this version along with UI from azuritecoin.
Let’s start with a portrait of Sin. I generated ~30 portraits of girls via txt2img, then settled on this picture.
Now you need to change the drawing so that it matches the idea.
As the game progresses, Xing’s portrait will become more and more clear.
Now next in line are icons for fossils. While there will be 4 of them: for iron, copper, tin ore and coal. Of the 74 generated images, none matched the ore. You need to make your own icon.
To do this, I took this picture here and turned it into a “texture”.
Now we need to find a stone model and apply our “texture”. This one will do.
By recoloring the picture, you can make a texture for copper, tin, etc. ores. And for a change, you can rotate the texture along different axes in the 3D editor.
With the texture of tin, everything turned out to be somewhat more complicated. Tin ore is chrome, so you can’t just apply a recolored iron ore texture.
For the transfusion effect, you need to adjust the material in the blender.
This result did not suit me. You can try using Matcap materials. In a nutshell, Matcap is a way of simulating the material and ambient lighting settings in a scene with just one image.
Among them, there is just one suitable for the tin ore icon.
The icon for coal remained. It can be done in the same way.
We will immediately make icons for ingots. Everything was much easier with them. Using img2img, it was not difficult to get such an ingot from a sketch.
Now, using a graphical editor, you need to make icons for the copper and tin ingots. To do this, we will simply change the color palette of this picture.
We are done with the icons, it’s time to make inventory.
The article is named after him.
Let’s start with the drill inventory. I have no idea how to implement it ¯\_(ツ)_/¯
Watching part of the series tutorialsI made such a scheme
According to this scheme, we implement inventory.
Inventory, slot and item files created. Now let’s add inventory to the mechanism.
Let’s add an inventory to the C++ pocket drill class. To do this, I created a C++ inventory file and added it in the same way as the widget (Blueprint inventory file cannot be added to a C++ class). Next, it was necessary to add a table with all the items, it also had to be implemented in C ++. And here is a dead end. It is impossible to isolate Cyrillic from a C++ file (experience from the previous release).
Let’s try to add inventory to the blueprint file of the mechanism. I did not do this initially, because I did not understand how to interact with it later. The revelation came very soon. By modifying the mechanics to interact with the mechanism, it became possible to obtain information from the blueprint with the mechanism. This mod unlocked everything. Now you do not need to write getters (functions for obtaining information) in C ++ classes of mechanisms and heaps of casts in blueprints. It is enough to declare a variable in the blueprint of the mechanism. Now you can display the names of mechanisms in Cyrillic, as well as add inventory.
Let’s start by implementing the inventory component. A component in the Unreal engine is a feature that can be written once and then added to various objects (For example, a character or a mechanism).
During its creation, nothing interesting happened.
Now let’s add this component to the mechanism and create a cell widget. The cell will display an item from the item table.
This is what the item table looks like:
It contains all the items in the game. When added to inventory, item data will be retrieved from this table.
Now you need to add the ores mined in the quarry to the character’s inventory. That is, add an inventory component to the character and make the character’s inventory UI. And also, depending on the rarity of the item – change the color of the frame.
Fundamental – objects from which other objects / mechanisms are created.
Composite – simple mechanisms.
Complex-structural – complex mechanisms (requiring adjustment). For example, a nuclear reactor.
Incomprehensible – Extremely complex mechanisms or their parts. For example, warp drive.
Paradoxical – Mystical gears/items only available in endgyem. For example, the creator of wormholes / generator on a black hole.
Now we need to complete the basic functions of the inventory – division of items, quick movement from inventory to inventory, and displaying information about an item when hovering over it.
Basic inventory functions completed.
Since the inventory is not unlimited, additional storage for items is needed. Let’s add a new mechanism and inventory for it.
To add an inventory, you just need to add its component to the blueprint and configure the widgets.
Building inventory took a very long time. There were many moments that could not be resolved immediately. At the moment, this is the most complex mechanic in the game. Inventory functionality will expand as needed with new mechanisms.
Interaction between mechanisms
Let’s start with the transmission and reception of energy. Let’s create 2 functions for this. The most interesting is the energy transfer function. At the input, it will be given a list of all mechanisms connected to the network. The task is to distribute the accumulated energy between them.
All mechanisms run on energy. When the mechanisms have learned to receive energy, it must be learned how to spend it. To do this, we will create a work function. If the mechanism is turned on, then some action must be performed and energy must be reduced.
These 3 steps will apply to any mechanism. As new mechanisms are added, new features will appear. (For example, transmission of gas, liquid)
In the next release, we will implement a work function for each mechanism, namely: replenishing the character’s cylinders for an oxygen filler, mining ore for a quarry, energy consumption at the storage.
Mini storage. Has 30 slots.
The pocket drill has been renamed to “mini quarry”.
In the next issue
The work of mechanisms, the mechanics of the plot.