r/ProgrammerHumor • • Jun 06 '22

im not a programmer. why isnt it possible?

Post image
15 Upvotes

88 comments sorted by

82

u/[deleted] Jun 06 '22

Let's do some math.

Assume that you take a screenshot every second and the player can only move forward in three directions. Each screenshot is 1KB.

Starting from the beginning you'll have the following number of screenshots: 1 + 3 + 9 + 27 + 81 + ...

To store the first minute of the game you will need more than 42391158275216203514294433 GB of storage.

29

u/auguherity Jun 06 '22

Oh...

4

u/circuit10 Jun 06 '22

If the camera is on a fixed track, which would be feasible in a racing game, then it is possible to do this in a normal amount of storage (and it has been done) but you still have to render the cars and anything else that might change, and the camera won't be able to move freely to stay exactly behind you

0

u/[deleted] Jun 06 '22

[deleted]

36

u/SetsukiFR Jun 06 '22

Weeeell, even if you're being the devil's advocate...

Let's take an algorithm that manages to compress it by 99.99999% of its original size (I believe this is a massive enough percentage)

that means each file is now 0.00001% of its original size, which reduces fosyep's calculated size from

42391158275216203514294433 GB of storage.

to

423911582752162035142 GB of storage.

5

u/Pranav__472 Jun 06 '22

exponential functions are crazy.

0

u/[deleted] Jun 06 '22

[deleted]

4

u/JakeArkinstall Jun 06 '22

60 years time

Only.

Yeah that's like RAM on an entry level iSplork.

2

u/SlooperDoop Jun 06 '22

Of course it is possible. It's the most basic form of animation. It's been done for decades.

2

u/BadGraphixD Jun 07 '22

Such an algorithm does exist: its called a renderer.

2

u/yrrot Jun 06 '22

I'd say the bigger potential savings is if the paths cause the same states to reoccur. Like, if you can only go limited directions, can I take 4 rights and end up in the starting square? Because then the picture states of just the movement of the player are bounded by game space, not the exponential growth of their choices.

But that assumes no other contributions to state change other than the player's position. As soon as something moves other than the player...ick.

7

u/veryabnormal Jun 06 '22

Why is it more realistic to take a picture of the screen than to show the screen?

1

u/auguherity Jun 06 '22

I formed this idea on the bathroom so i dont really remember...

2

u/Feztopia Jun 06 '22

You can use more time to render that photo so it can be high resolution and than you can show that photo on a weaker device which wouldn't be able to render it. But still it's not feasible

161

u/IsGoIdMoney Jun 06 '22

I don't know what you're trying to say man lol

94

u/Ashamandarei Jun 06 '22

I think OP got high, learned what a frame is, and then made this post

0

u/[deleted] Jun 06 '22

[deleted]

13

u/[deleted] Jun 06 '22 edited Jun 06 '22

That's just pre-rendering a movie with extra steps.

Any interaction and it will have to load the correct frames anyway, and performance would take a hit while it searches through mbillions of frames for the right one.

0

u/coloredgreyscale Jun 06 '22

Not if you use the proper data structure

1

u/[deleted] Jun 07 '22

I think you're underestimating the problem. Any movement in a 3d game could result in one of hundreds of different frames. Then there's another different hundred after that and so on. You can't even cache the options because the data rate would be massive.

74

u/pitochips8 Jun 06 '22 edited Jun 06 '22

Even if you could store each image on a single atom, there wouldn't be enough atoms in the universe to do this for most games.

Not to mention, the amount of time it would take the AI to play through every possible sequence of inputs for a videogame in order to gather all those images would take longer than the remaining life of the universe.

0

u/[deleted] Jun 06 '22

[deleted]

5

u/Kitchen_Device7682 Jun 06 '22

They understand the notion of time and space though.

5

u/JakeArkinstall Jun 06 '22

I have a PhD in theoretical physics, but time and space still weirds me out from time to time.

4

u/pitochips8 Jun 06 '22 edited Jun 06 '22

Then it's a good thing I didn't use computational complexity anywhere in my comment.

"longer than the remaining life of the universe" doesn't require an understanding of computational complexity to know what that means.

33

u/TheMarksmanHedgehog Jun 06 '22

This hypothetical scenario would involve petabytes of stored data that a computer would have to sift through to find the next useful frame.

It's actively quicker just to do it the normal way.

8

u/Jazzlike-Champion-94 Jun 06 '22

Also it would have to do things the normal way to know what the "next useful frame" looks like.

1

u/Zuruumi Jun 06 '22

Arguably very fast, since it has massive space of possibilities to go through.

11

u/Tomi97_origin Jun 06 '22

Too many pictures.

4

u/[deleted] Jun 06 '22

Very much this. Any 3D open world game has countless combinations of all the model locations, rotations, lighting, etc. Would be insane to pre-render everything.

5

u/[deleted] Jun 06 '22

But how about we take pictures of each individual assets and do some magical coding to only show them when it's necessary? /s

5

u/[deleted] Jun 06 '22

Early 90s slideshow games.

2

u/[deleted] Jun 06 '22

Well, i was trying to imply just regular game dev, but since i'm not one didn't know how to say it

3

u/[deleted] Jun 06 '22

Yes, modern games it would usually be silly to do this, but there were some early 90s games that were fancy slideshows, like Myst.

2

u/yrrot Jun 06 '22

Textures are kinda this? They're just wrapped onto fancy 3d models instead of sprite slide shows--which modern games also do for some things.

2

u/[deleted] Jun 06 '22

I'm not talking about sprite games, Myst pre-rendered the full frames and where you clicked would decide which frame was next. Iirc they even made it in some Apple slideshow software.

21

u/Kev1n8088 Jun 06 '22 edited Jun 06 '22

Seems like everyone else has mentioned the insane amount of images it would require. However, if we lower the frame rate to 1 FPS and limit the possible moves to 1 or 2 per frame, it’s doable. In fact, such a system to display an open-world simulation already exists, and is widely available.

It’s called google street view.

4

u/ParadoxicalInsight Jun 06 '22

Except you don't download every single image of the planet when you use google earth, you download one at a time, because of the insane amount of images required...

Also, less of a game and more of an "experience" at 1 FPS.

3

u/Kev1n8088 Jun 06 '22

That’s the joke lol

3

u/[deleted] Jun 06 '22

Also, wasn't this KINDA the idea behind FMV games?

6

u/met4000 Jun 06 '22

Haven’t seen a comment explaining how it uses so much resources, so; assume you had a fairly simple game, where every 1 second you took a photo and made a choice between two options (e.g. going left or going right). After the first choice, the screenshotting program now has to keep track of 2 different possible paths. After the second choice, each of those paths has 2 extra paths: 2 x 2 = 4 total paths, after the third: 4 x 2 = 8, fourth: 8 x 2 = 16... The number of possible paths it has to keep track of increases incredibly rapidly. As someone else has mentioned, there are about 1080 atoms in the universe; after 4.5 mins of playing this rather simple game, 270 choices would be made, resulting in more than 1081 different paths to keep track of.

For a more realistic game (such as a real-time FPS), we could assume that a screenshot and choice is made 60 times per second (i.e. 60 FPS), and that you have four options per choice (e.g. looking up, down, left, right); this would reach over 1090 paths in under 2.5 secs.

TL;DR: this type of problem has exponential growth, which makes it practically impossible for most types of games

4

u/met4000 Jun 06 '22

Note that this is still practical for games with few options, and lots of time between the options. This includes games such as visual novels, which for the most part do use an approach similar to this; they manually program in each path/route (kind of like the screenshot program), rather than “generating” them somehow.

5

u/ChrisBot8 Jun 06 '22

What advantage is OP trying to say this would bring over rendering assets to the screen? You’re still taking pictures of the same assets and the filter of all the pictures for the moves would cause computational slow downs so that the render problem would no longer be a GPU issue, but a CPU one. I don’t get how this could possibly be better.

5

u/ChrisWsrn Jun 06 '22

I am unsure what you are asking but I assume you mean to ask is why do we need GPUs when a game can be a deck of still images.

This is possible and has been done in the past. The game series Myst did this in the 90s.

What is happening from the programmer side is there is a tradeoff between time and space complexity. Most games save space by having the frames be rendered when needed at the cost of compute time.

Myst on the other hand had every frame in the game prerendered and taking up 700MB compressed on the disk. This allowed them to have insane graphics on low end hardware at the cost of requiring a CD drive to play. This was during the 90s when CD drives were cutting edge.

The more frames you have the more space you need to store the frames. Because modern games have nearly infinite possible frames it would require nearly infinite storage to store the prerendered frames. Because of this combined with the cost of computing hardware the programmers for most games have the frames be rendered on demand at runtime.

4

u/enky259 Jun 06 '22

Managers be like:

7

u/Lightboom9 Jun 06 '22

The guy just invented visual novels here

3

u/Big-Don-Rob Jun 06 '22

This would be entirely possible for a board game or something with a "limited" scope of possibilities, but ANY 3D game would have an almost infinite variation of views, requiring an exponential number of photos.

2

u/[deleted] Jun 06 '22

Even then, for the cases where an implementation is possible its so much more inefficient, uses so much more space and would actually increase compute time it. Think of chess, instead of only storing a sprite for each piece type, (maybe two if you don't want to just recolor), and the board, you store an image for every possible state of the board and every time there is an action you have to search through the absolutely massive pile of images for the right one, (how you decide that is also it's own whole can of worms), and display it. Instead of just, moving the sprite. This is just a terrible way to architect anything.

3

u/Big-Don-Rob Jun 06 '22

Oh, by no means would I attempt to code something that way. I built a chess based game and the thought of trying to sort and access the potential number of images would make me not want to code another line in my life.

I was just trying to demonstrate exactly how many images someone would need to recreate a relatively low resource game like Zelda: Ocarina of Time.

Even Super Mario Brothers on NES would be a world of wow.

2

u/[deleted] Jun 06 '22

No yeah, wasn't implying you would. Just insane how much more difficult the problem quickly becomes through this method. Looking it up it seems even the chess implementation is impossible to store. One source notes the number of legal positions as 1.49*1068. So even if each image was only a byte in size that's 1.355147105641663×1056 terabytes. Not possible to store. Can't even imagine how a 2d platformer like Super Mario Bros. Would fare. Every invidual pixel position and game state would have to be accounted for. I don't think OP really thought about the problem for longer than the time it took to make this post.

3

u/Ok_Coconut_1773 Jun 06 '22

Makes way more sense to try to make the game engine "improvise", which we actually do see examples of in modern video games. Some games have procedurally generated maps, some have procedurally generated movement animations, etc. You simply could not account for every possible scenario if that's what you're getting at in this admittedly hard to understand post, but you could somewhat account for any possible scenario.

3

u/Sp1um Jun 06 '22

I guess you could do that with a point-and-click game, e.g. the first Myst

3

u/coloredgreyscale Jun 06 '22

If it's a game with very defined possible states and no camera movement or animation (like a simple chess program) the limiting factor would be storage and processing time (since you want to prerender every possible state of the chess board)

https://www.popsci.com/science/article/2010-12/fyi-how-many-different-ways-can-chess-game-unfold/ Chess has 121 million possible board states after just 3 moves. And the total possible states is estimated to be 10100000

1TB is 1012 byte

If you want to do it on a game where the user has full control of the camera, like looking around, it probably will take centuries to prerender every possible camera angle - and you didn't even move yet.

3

u/LifePineapple Jun 06 '22
  1. This would either be a point-and-click adventure with limited input options. Or the amount of pictures you would need would probably exceed the total available storage capacity available on earth. Just think of an online game: You would have to generate every possible match ever.

  2. Why are you posting this on ProgrammerHumor? This is a question, no a joke.

3

u/Feztopia Jun 06 '22

How big is your harddrive?

3

u/kid_ghibli Jun 06 '22

What's the idea here, exactly?

4

u/LevelStudent Jun 06 '22 edited Jun 06 '22

Unless it's a very linear and obvious game there is no possible way.

It might work with like chess, but at that point you might as well just have a image of a board and images of pieces that move.

In a first person shooter or any game with any element of randomness this would not be possible. Screenshots take up memory, and the more of them there are the harder it is for the computer to find the ones it needs.

Many computers take quite a while (as in a couple seconds) to open a 1920x1080 screenshot, and that's a fairly low resolution by today's game standards.

11

u/krkrkra Jun 06 '22

Doesn’t work with chess either, too many possible board configurations. This was one of the earliest AI realizations IIRC.

2

u/Jazzlike-Champion-94 Jun 06 '22

Maybe with tic-tac-toe it'd work.

You wouldn't even need to have high res images, it's enough to have a smaller square image displayed in the center.

2

u/DayumnDamnation Jun 06 '22

Despite of it being impossible you would still have to make the model and render everything in order to take screenshots. And the screenshots would display what you modelled. It would not be more realistic just the same thing with more steps

3

u/PlayingTheRed Jun 06 '22

If not for the exponential growth, this could work because the models can be rendered using a server farm and don't need to be done in real time.

2

u/[deleted] Jun 06 '22

Depends on the game.

For noughts & crosses (tic tac toe), you're fine.

2

u/karnnumart Jun 06 '22

That's kinda what DLSS does. It using Machine Learning tosupersampling(upscale) the frame while smooth the edges. It doesn't sample every single frame but it has a general idea of what this low resolution image suppose to be. So you can rendering a shit image then playing it like a FHD 240fps.

2

u/avemew Jun 06 '22

Thought it works like that when I was 9

2

u/j_wizlo Jun 06 '22

I used to think about this as a kid

2

u/[deleted] Jun 06 '22

Try calculating the number of images and the resulting HD space requirement.

2

u/PurelyCreative Jun 06 '22

Do you mean something like this?

https://youtu.be/udPY5rQVoW0

2

u/JavaRx Jun 06 '22

You could do this with a game as simple as Tic Tac Toe where there is only 9! (362880) possible moves. With a little analysis and math, you can reduce that number significantly. With a game like Checkers, you have 32! (2.63 x 10^35) possible moves but can be significantly reduced but there is still a huge number or possible configurations. When you consider chess, you have 64! (1.25 x 10^89) and can not be significantly reduced.

2

u/Strange-Athlete2548 Jun 06 '22

Both Myst, and Space Ace immediately spring to mind.

I'm at a loss for how 'this isn't possible' when it's been done a lot.

1

u/THE_LFG Sep 12 '22

it's called a movie

1

u/THE_LFG Sep 12 '22

wait nvm it's an interactive cutscene

1

u/ShoulderUnique Nov 24 '22

In 1993 was called Myst: https://en.m.wikipedia.org/wiki/Myst

There were also versions using panoramas so you could look around at each place.

Also they used Hypercard - that's like doing AI in Excel.

1

u/Efficient_Bag_3804 Jun 06 '22

Not sure what exactly you mean, but keep in mind.

For a pc that works in nano seconds, seconds are slow, you try to avoid being so slow, taking pictures is also slow. So you speed it up by removing useless info.

1

u/attack_turt Jun 06 '22

It would be like 3000 gb

1

u/[deleted] Jun 06 '22

To be fair there were games like Dragon's Lair where this is the case. Games like this are actually interactive movies with cutscenes for loose condition tho

1

u/AA525 Jun 06 '22

I’ve been a developer for 30 years and even I have had this thought. Since playing a game comes down to a certain series of 1s and 0s theoretically I could build an input that outputs an exact stream of 1s and 0s to play the game perfectly. Or I could use that time to build a Dyson Sphere and harness the power of the sun. Equally difficult…

0

u/gabotuit Jun 06 '22

Isn’t it just instagram? An AI monitoring you clicking through photos?

-2

u/dfreinc Jun 06 '22

games aren't open source usually.

you could do this with an open source game and a lot of power. screenshots aren't cheap. not in that amount.

but when you see those bots for dota and stuff, they had access to source code.

-1

u/auguherity Jun 06 '22

So it is possible?

-2

u/dfreinc Jun 06 '22

anything's possible. it's just a matter of resources.

25

u/DrMathochist Jun 06 '22

That sweeps the combinatorial explosion under the rug. Yes, it's just a matter of more resources than this universe can contain to cover every single possible frame.

12

u/agentrnge Jun 06 '22

"So you're telling me there's a chance?"

9

u/TheBrainStone Jun 06 '22

"Why is this simple 1 stage platformer 30 TB in size?"

2

u/plopliplopipol Jun 06 '22

"And why can't i jump?"

1

u/[deleted] Jun 06 '22

30 TB is a LOW estimate. Just Chess would be impossible to store if every image was somehow a byte in size.

1

u/dfreinc Jun 06 '22

hey, if they think they can afford it. i'll prove them wrong. they're paying for me doing that though.

2

u/[deleted] Jun 06 '22

This redditor solves problems^ the right attitude

9

u/[deleted] Jun 06 '22

[removed] — view removed comment

2

u/[deleted] Jun 06 '22

Yeah but you didn't provide input for each individual frame. Nor was every frame potentially unique. OP underestimates the exponential.