• Forum
  • Lounge
  • interface\design relation with code (Not

 
interface\design relation with code (Not C++ Q')

please, I don't understand this,
I see in the market such a beautiful applications and games, so interactive
everything pops and dance and moves and squishy and jumps
everything is changing form (and everything is made of pixels? for real?),
what is the relation to code to all of these,
I seem to not grasp the separated parts of art and code? when they connect and interact and how?, can someone put some light in my head, I'm very confused, is that happend to you? or everything is just crystal clear to you.. for some reason..
hope the question clear enough.
hope its the appropriate place to ask
(you some how interpret in a magical way beautiful pictures into logic?)
Sorry, your question is pretty open-ended.

You seem to be confused on the difference between a representation of something to the user, and how that something is actually implemented underneath. To the user, everything inevitably becomes represented as pixels on a computer. But this does not mean the actual code's logic cares about what color pixel (100, 200) is.

For example, a game might have a 3D ball in it. This ball has a center point, and a color. The programmer tells a graphics library to draw the ball from a certain perspective. The programmer does not (directly) tell the graphics processor to draw pixel (100, 200) red; this is done by the graphics processor when it internally rasterizes the data.

I seem to not grasp the separated parts of art and code?

Yes, the art used and the logic it interacts with should be separated as much as possible. This is known as separating the "Model" (the underlying data and logic) from the "View" (what the end user sees). For example, an interactive game might have a physics gravity simulation. The user might see a red duck falling due to gravity. But the actual gravity logic in the code should have no idea what color the duck it; it is immaterial to the actual logic of moving the duck object.

In other words, the logic behind gravity should work even if we couldn't actually see anything on the screen.

you some how interpret in a magical way beautiful pictures into logic?

Not sure what you mean.

______________________________________

If you're interested in programming graphics and animations in C++, I suggest learning a simple graphics library, such as SFML.
https://www.sfml-dev.org/

If you want to get into the nitty-gritty aspects of the graphics pipeline, look into OpenGL or Vulkan.
https://en.wikipedia.org/wiki/Graphics_pipeline
http://www.opengl-tutorial.org/

If you want full-blow animation and other complex graphical logic, there are engines that exist that can do things like this, but can't really point to a good one specifically. Maybe others could suggest one.
Unity3D has some animation feature built-in, so many check that out. There's also 3D graphics libraries like Ogre3D, Irrlicht engine, and others.
Last edited on
so animation is made by premade animations the code just turns it on and off?
but how they got the animation done, via program? so we back to code?
this is oversimplified, I see for example in games all kinds of effects, how that happen is this code or art? I don't understand what I see, what are the stages from emptiness to this full blown features and stuff, but you helped a little, I need more light if someone or even you can elaborate more about the subject :) really appreciated, thanks!
but how they got the animation done, via program?
It depends.

Some animations are specifically coded. Generally these will be simple animations, such as the swing of a pendulum, a bouncing ball, or just a constant motion from A to B.
An exceptionally complex example is the animations for the sims in the first Sims game. Those were all hand-coded.
Another complex example is the lip-syncing in Half-Life 2. The script files contain textual phonetic transcriptions of the dialog for the character models to follow.

Some animations are never designed explicitly; they're generated procedurally from a more general program of behaviors. For example, a physics engine might decide at every frame of a simulation where a bouncing cube should be and how it should be oriented based on its shape, it's physical properties (e.g. elasticity, hardness), what its velocity was in the previous frame, and the shape of the room it's in. Another common example is the behavior of cars in most racing games.

Other animations, either because they would be too complex to generate any other way, or because they would look unnatural, are motion-captured from real objects.

I see for example in games all kinds of effects, how that happen is this code or art?
That's kind of a strange question. What do you mean by "art"? Are you asking if the effects are the result of a deliberate effort to create it, or are you asking something more abstract?

I don't understand what I see, what are the stages from emptiness to this full blown features and stuff
You need to understand that a lot of games are created by medium-to-large groups of people over many months. If a game takes 20 people a year of development, that's 20 man-years of effort. Meaning, if you by yourself tried to do everything it would take you 20 years, assuming you had the combined know-how of those 20 people.
Also, you only ever see the final product. You never see what the game looked like at very earliest stages of development. It's natural that you can't imagine how to go from an empty source file to a final product if you've never done anything even remotely like that, and you've never seen the progress of development of a game, but rest assured that it's a very gradual process, like anything else.
thanks, great answer, I'm very curious to know how stuff made so impressive, also not only in games but in applications like synthesizers, but games really with all the 3D environment and physics just amaze me, and all of these go through the CPU and GPU?!, very hard to grasp or imagine , thanks @helios and @Ganado.
btw I'm asking just because I can't find a lot by search, maybe you know what I need to look for in a search to enhance my knowledge about what really happen in a game or other complex interactive UI software, seems like C++ books just talk about syntax, maybe a little more, but where all the guts of software goes? I just question myself all the time very basic questions of how things done, for one thing I'm sure its pretty low level probably...
also
a game takes 20 people a year of development, that's 20 man-years of effort.
I wonder how they work all together on the same piece of code, they split the work? but some parts must work with others, so how they do it? this is related to git somehow? who says what each need to do? this is related to scrum somehow? I really want to know, where all these stuff is written? how do they know it? or it all just experience of programming?
Last edited on
and all of these go through the CPU and GPU?!
Why is it amazing that software designed to work with a particular piece of hardware works with that piece of hardware? Would you find it more mundane if graphics software worked on matchboxes and glass shards but not GPUs?

seems like C++ books just talk about syntax
Well, a book about a language will cover only that language. You will never find a book about C++ that will cover all disciplines where C++ might be used.

I wonder how they work all together on the same piece of code
If 20 people work on a game, I would estimate probably 10-15 of those people are not programmers, at most 3 are engine programmers, and a few are script programmers.
Regardless, obviously it's impossible for two people to work on exactly the same piece of code at the same time, unless they're sitting at the same workstation.

they split the work? but some parts must work with others, so how they do it?
Coordination. Design by contract.

who says what each need to do?
The PM does.

I really want to know, where all these stuff is written?
"Where"? There isn't a video game factory somewhere in the world where all games come from. There are video game companies all over the world.

how do they know it? or it all just experience of programming?
It depends on who we're talking about specifically. The career path of an engine programmer is different from that of a script programmer.
But generally people learn how to do a job by doing it.
coordination? design by contract? what is that? please elaborate, I googled didn't find much
so if I want to make a software I need to find more people to work with, alone is very hard and time consuming? is that what you suggesting?
ok thanks
so if I want to make a software I need to find more people to work with, alone is very hard and time consuming? is that what you suggesting?
No, that's not what I'm saying. I'm not saying anything. You asked some questions and I gave some answers. There's no overall theme to my answers, except that imposed by your questions. Your questions were mostly about game development, and most games are developed by groups of people.

But it's true that software development is very time-consuming, be it solo or in a group.
and all of these go through the CPU and GPU?!
Efficient transfer of data from the CPU to the GPU can be a bottleneck if you're not careful, but these days GPU connections can have very high throughput. For example, loading the dozens of textures that a room in a game has must be done at the proper times as to not make the game feel choppy. Back in the '90s and '00s, ( for example, the door-opening animation in Resident Evil, https://www.youtube.com/watch?v=lJK6QeDFncI ). These days, the loading of wait-scenes like that is much rarer.

I'm asking just because I can't find a lot by search
I feel you, it can be difficult to search for concepts like this when you're not sure how to express them.

I wonder how they work all together on the same piece of code, they split the work?
They don't all work together on the same piece of code. That's the beauty of it. They work on the same overall project, but a good project takes a lot of planning and design time. Code is broken up into different, mostly independent parts that different developers are more knowledgeable in than others. For example, the guy scripting a quest ideally shouldn't have to worry about what version your graphics card is, or what animation the character does when he jumps. Also, large projects have documentation, testing, and most importantly, source control. Source control is part of Software Configuration Management (SCM), and allows you to, for example, see who made changes to a file, and what changes were made, line by line. This helps track down any future bugs or features.

what I need to look for in a search
First, search for a library to do <search term here>. I suggest a multimedia graphics library. It will take care of the a lots of the boring "guts", like window context and low-level functionality. Then, try to get the simplest thing you can to compile and run. For example, simply show a red square in the middle of the screen. Then, have the red square move around randomly or something.

One thing is you could look up the source code of open-source projects (GitHub, GitLab, https://en.wikipedia.org/wiki/Comparison_of_source_code_hosting_facilities etc.) This can in itself be very overwhelming if you're not used to looking at a large codebase, but everything is there for you to see.

If you want to see what happens at a most basic level for a GUI window, look into the source code of a Window class in GLFW or SFML. You'll eventually get into OS-specific code, and you'll see what Windows API or Linux API functions are called. That's basically as low as you can go for the CPU side of how a graphical window is made.

On the GPU side, it can take a few hundred lines of code just to get sometimes as simple as a red triangle to show up on the screen. That's pretty much as low-level as you'll ever need to go unless you are planning on developing hardware.

As helios said, you learn by doing. My advice is to start small -- so many people first try to make a game (or something similar), and get overwhelmed by the complexity of it. Just start small, and keep adding on. During this process, you'll figure out how to better organize your code, and you'll learn from your mistakes.

Edit: No, you don't need to work in a team. If you have an idea of something you want to do, just start doing it. Just be aware that very complex, commercial-grade projects are usually made in teams, but they certainly don't have to be.
Last edited on
Hi,

Try these:

https://www.unrealengine.com/en-US/what-is-unreal-engine-4
https://stackoverflow.com/questions/21820851/good-c-game-engines-for-a-beginne

You can do quite a bit without writing any code, IIRC it is still possible to get at the code for what the GUI allows one to create. There would be quite a lot to do to achieve something fancy, but it's a start :+)

Good Luck !!
Topic archived. No new replies allowed.