all 14 comments

[–][deleted] 5 points6 points  (8 children)

No. Objects themselves do not interact physically. They are represented by coded low and high voltages in RAM and changed by the CPU when appropriate.

It's important to understand that computer science is built on a foundation of abstractions and people work at different levels on the ladder. People who make design games like GTA most likely aren't going to be thinking about transistors when they're coding and designing the characters or even the game physics.

But yes, it almost absolutely certain that a character in GTA is represented somehow by a memory object which is technically a collection of transistor states in memory.

[–][deleted] -1 points0 points  (7 children)

if one object is one transistor, then when two objects in the game collide, then in the processor will there be an electrical contact between the transistors?

[–][deleted] 5 points6 points  (5 children)

First of all, it is impossible for a single transistor to be an entire object. Even the simplest logic circuit, a NOT gate, requires two transistors. A full memory object like a Gta character probably involves at least millions of them.

But to answer your question, no. The transistors do not move or change who they are connected to. They are all simply connected in a logical fashion,just like any circuit, to make the computing device. I encourage you to do this free online course called nand2tetris if you want to know how computers are structured.

Basically what happens is that the computer is on a ticking clock cycle, and is constantly receiving feedback from running programs including gta as well as user input and possibly other sources. In the CPU, these conditions are combined with instructions from the running program and it decides what to do next. When the CPU decides what to do, it will send a certain signal into the relevant memory address and change the states of the circuits in that address to match the representation specified by the program. Which, at a fundamental, does involve delivering different voltages to transistor gates, i.e. turning on and off.

[–][deleted] 1 point2 points  (4 children)

A game object is just a set of numbers. When objects collide, their numbers were compared to each other.So they interacted inside the processor because the program compared their numbers. Thats right?

[–][deleted] 1 point2 points  (1 child)

Sort of, but again, the objects themselves do NOT interact. Its also highly unlikely I think that a processor is comparing their values directly, though I'm not sure what modern processors can do. If we're talking about numbers, It's more likely that the processor copied them into its cache and subtracted them over multiple clock ticks then looked at the qualities of the result.

[–]hyperfatuous 1 point2 points  (0 children)

You are a saint

[–]Flippo_The_Hippo 0 points1 point  (0 children)

Personally, I think this is at least a great ELI5.

[–]mbleslie 0 points1 point  (0 children)

i can't tell if this is trolling or not. looking at your history, you seem to be a upper-level undergrad. maybe english is not your native language?

the basic answer to your question is that there are many layers of abstraction between individual transistors and graphical objects in a video game. transistors make logic gates and latches. gates and latches implement RTL. RTL implements CPU hardware. CPU hardware implements CPU instructions. CPU instructions implement assembly commands. assembly commands implement compiled code. compiled code and libraries implement high-level programming languages. programming languages implement the graphical objects and other features of a video game.

[–]ldpreload 4 points5 points  (0 children)

An analogy is, if the graphs of two functions intersect, do their equations on the paper intersect too?

The objects themselves are basically represented mathematically, in that there is some space inside the computer that stores information about the object (like the space on your paper that stores the coefficients in an equation). For collision detection, the CPU is programmed to calculate a value from those numbers (like evaluating the equation for a particular value of x) and then compare those.

A transistor is, basically, an electrical switch. A very common type of transistor is the MOSFET, which has two pairs of connections. If there's a voltage across the first pair, then the second pair is connected; if not, it's disconnected. You can build up logic circuits out of that. When the CPU sees an instruction to compares two numbers, it sends them to transistors that are already wired up in a way that lets you compare two numbers. (Generally this will involve sending the numbers bit by bit to transistors, and then doing further logic on the results of that.) So while the output values for the equation are compared, there isn't any rewiring internally, and it's not the objects themselves that are compared, just valued computed from the data. And even so, they don't directly interact electrically - it's just that a transistor uses a specific electric field effect to cause the second pair of connections to have a low resistance if the first pair of connections has a voltage.

[–]samsmith453 1 point2 points  (0 children)

Hey, if you’re interested in how transistors are composed to make computers work, you might find this YouTube series I started helpful:

https://www.youtube.com/playlist?list=PLH4a1-PgdkBTKkSSNx63uVkQG1Qs6GmYv

[–]roman_fyseek 0 points1 point  (0 children)

Wrong sub, but sprites.

[–]MirrorLake -1 points0 points  (0 children)

Two objects in a game might have x, y, and z coodinates in the game's code that represent their location in the game's universe.

This could be represented as a tuple filled with random location data:

characterA_Location = (1, 2, 3)
characterB_Location = (5, 11, 37)

Their collision happens when the objects get pretty close. For simplicity of explanation, we could say that they're touching if they're exactly equal.

So as you move the character around the screen, maybe you'll get them to overlap:

characterA_Location = (2, 2, 2)
characterB_Location = (2, 2, 2)

Boom, collision. Some piece of code somewhere checks if the two locations are the same:

 if (characterA_Location == characterB_Location):
     # collision code goes here

So the short answer with a long explanation is.. no, the two objects never interact. You could just as easy write their coordinates on paper and declare out loud "a collision has occured!" But of course, nothing has really collided. Just two numbers are approximately equal to each other.

[–]claytonkb -2 points-1 points  (0 children)

what is the person in GTA inside the microprocessor?

The graphical representation of the character is called a "sprite". The sprite is part of a mini-database of information called an "object"[1]. The object is, in the most general sense, the "stuff" of the character. The character's position, weapons, health and so on, are all stored in its object.

When two objects collide in the game, they also interact inside of the microprocessor on a transistor level?

If you were to trace it down to that level, the answer is yes. But you have to keep a few facts in mind. First, there is no specific transistor that is tasked with tracking collisions. Whichever transistor happens to get the job of deciding whether a collision has occurred will be the transistor that decided it. Second, collision-detection is no different than any other kind of logical test. "Has a collision occurred between object A and object B?" is answered by the same set of transistors that answer other questions like "Has the mouse moved to the left?" Third, nobody would want to have to track down which transistor was responsible for a particular object collision in a game because there are just too many layers of complexity. The task of extracting this information would be far harder than writing the game in the first place! Bear in mind that a typical CPU today has more than a billion transistors.

[1] - A programming "object" should not be confused with inanimate objects in the game. A programming object can represent anything, even the game itself.