V
V
Vitaly2017-01-20 14:01:32
Project management
Vitaly, 2017-01-20 14:01:32

How are resources associated with code?

Greetings. The question is informative, I apologize if it turns out to be blurry due to lack of experience. Purpose: not necessarily to learn how to do, but to understand the general principle and the direction of further study. Example: creating a 3D game.
Designers make models and decorate them with materials, create animations, place models and a camera on the stage. Programmers describe the information model and logic for processing user actions.
Now: how to link products of design and programming work? Those. bind model properties to class properties and launch animations to method calls, get the ability to duplicate objects and switch the scene or active camera.
Don't suggest engines like Unity: I'm trying to understand their "under the hood" arrangement.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
D
Dmitry Alexandrov, 2017-01-20
@jamakasi666

Everything is a little easier here.
Programmers write a set of utilities. Program or plugin for export-import of models/animations/particles/sounds/textures.
Next, programmers describe the level format and the editor for it.
All this makes a kind of "bridge" between programmers and everyone else.
Programmers continue to load levels using well-known resource formats and describe the logic of everything in the game, and very often many parameters are taken out into configs or scripts. Next Already again, designers / modelers, etc. they begin to select parameters, for example, the dimensions of certain models, their physical properties, health level, running speed, etc.

Those. bind model properties to class properties and launch animations to method calls, get the ability to duplicate objects and switch the scene or active camera.
Here you also have a slightly misunderstanding. It is not the code that is bound to the properties of the models. Any content is just a visual part that is controlled by the code. Any property is a digital value, where this value will be taken from is completely unimportant. The same model, in general terms, is just an array of points in space. A separate file for it can be a skeleton in which, again, a point is a bone that has a weight (roughly speaking, the radius along which it can move neighboring points in space). Another file can be an animation which is also already an array of bone points in a time interval. Another file can describe a texture unwrapping over triangles built from an array of model points, describing each triangle as coordinates on a 2d texture. All this can be packed in 1 file or in a bunch of different ones.
Later, the programmer takes all these files and implements, for example, animation switching, which in fact will simply assign the desired file with animation (the one mentioned above).
PS In general, the question is very abstract and without live examples that will be just huge difficult to give a simple answer "that's how it happens."

D
Daniil Basmanov, 2017-01-20
@BasmanovDaniil

But in vain you refuse to study engines, it is easier to understand the internal structure using a living example.
In the general case, all game resources are provided with an identifier and some kind of description during integration, this can happen automatically or manually. When assembling the application, they are packed into an archive or put into a folder in their pure form. Thus, the engine has an organized storage, from which it can get textures, models, animations, sounds, etc. by ID.
Programmatically, there may be a Player class, with which the Model class is associated, which has a Material property. When creating a player, the engine looks at what identifier is used for the model, loads it from storage into memory. Further, he knows that the model should be displayed by some kind of shader, again, by identifier, this shader is loaded along with textures and parameters. Parameters and relationships of engine objects with specific resources are configured using the game editor and serialization.
Importing resources, serializing settings, developing and maintaining an editor - these are all non-trivial and time-consuming tasks, so nowadays no one bothers with the development of their engine anymore.

F
Fat Lorrie, 2017-01-20
@Free_ze

  • Static (included in the compiled binary itself or by platform-dependent means)
  • loaded dynamically (from separate files).

X
x67, 2017-01-20
@x67

When studying, it is better to simplify the object of study as much as possible:
Take the simplest open-source 2D engine in your favorite language and understand its structure.
Challenge yourself to make ping pong in 2d. Create the necessary logic - movement, collisions. Create a visualizer for all of this. I don’t know how it is now with all sorts of javascripts and other high-level languages ​​​​and dialects, but at one time this task in delphi took me a lot of lines of code. More than 1000 for sure (although I was 14 then and I didn’t know how to program well then and wouldn’t be able to). When you are convinced from your own experience that this did not frighten you and you thoroughly understood everything, proceed to 3d. There will appear such keywords as OpenGL, DirectX. Most likely you will hear about them while you are still drawing ping pong in 2D, but when you switch to 3D, you will understand that without ready-made engines, one more dimension increases the amount of code by an integer degree and will definitely not fit in the answer on the Toaster)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question