eli5 They say that in programming a game, removing some arbitrary asset will inexplicably cause random bugs to pop up. Why?

302 views

Is it that during compilation, the compiler tries to compress and optimize the code in such a way that it “grows roots” into the assets (or vice versa) that if the asset is removed without proper care, the whole thing will collapse into itself? Like, the compiler realized that part of the binary code in one part of the program coincidentally is the same as a snippet of binary code in a nearby asset, so it chops code out to save space?

In: 0

7 Answers

Anonymous 0 Comments

There’s no single cause for this, because if there was, a solution to avoid it would have been found by now.

Generally, a program can be thought of as a hilariously complex list of instructions that the computer repeatedly goes through. In the ideal world, every instruction on the list would be preceded by instructions that do everything required for that instruction to work correctly. Programs are made by human beings though, and so are inevitably flawed in one way or another.

Maybe the programmer forgot a particular instruction that another instruction depends on, but it works anyway because coincidentally another programmer put the forgotten instruction in an earlier part of the list for totally unrelated reasons. Or maybe it used to be in both places, but a third programmer tried to speed up the program by making the list smaller and realised that it didn’t crash when he removed the instruction from the second part. In both cases the program now contains two parts that are both dependent on an instruction being run in the first part. If you swap the order the parts are being done in, or remove the first part entirely, the instruction in the latter part will now fail.

The same can hold true for assets, if the program is not very good at managing them. Maybe it assumes that something in particular it needs is located in Memory at a certain point from the start of the program’s memory allocation, because the preceding parts of it were always filled with assets of a fixed size by the point it got to that instruction. Remove one of those assets and everything is suddenly shifted around in ways that the code did not expect.

These are just some abstract examples. There are countless specific ways that removing seemingly inconsequential bits of complex programs can cause problems.

Anonymous 0 Comments

No, it doesn’t work like that. Generally removing assets is completely normal and part of the process, but some care is required.

The same asset may be used for multiple different purposes as a placeholder or as a decor. So some asset that looks like a ventilation pipe in one level might be some small railing in another level. Though game engines should easily detect these things and warn game designers that the asset is actually still used.

This part of things doesn’t necessarily even involve any dedicated code related to that asset. It is just config and level files for the game engine that handles placement of the static assets.

Some assets might be used by the actual code base to do stuff or as placeholders. Like before graphic designers create some rocket assets, developers might just create a simple cube and make launchers shoot those in meanwhile. It is then later replaced with proper assets. This is quite a normal thing during development.

Anonymous 0 Comments

Phew, I was worried my game of Pong was going to break if I removed a pixel. Thanks for clearing that up!

Anonymous 0 Comments

NOTHING is random inside a game programming, not even random number generators.

Things like this happen simply because of poor programming or software architecture/compile/build management. Too many components are reused in multiple parts of the system due to cost/performance reasons and their dependencies are not properly tracked or documented. Any one of them could be critical to game compilation/build or proper functioning when running.

In the end it’s just bad engineering, or good engineering prioritizing cost/performance over ease of maintenance.

Anonymous 0 Comments

An “asset” generally refers to either a piece of art (a car model, texture etc.) or a fully-defined object that can be placed into the game world which might have its own coding (e.g. a fully-functional car the player can get in and drive).

The impact of improperly deleting an asset really depends on what the asset is and how the engine/game is programmed.

For example, the level might have an event where the player has to blow up a generator to open a door in order to progress. The level will have a trigger defined that only opens the door once the generator is destroyed.

Deleting the generator asset itself could cause the game to crash if the level tries to refer to an asset that no longer exists, or it is hopefully programmed to check for such a situation and handle it gracefully. In that situation, the generator is missing and the player cannot progress and is soft-locked. The game might even detect the missing asset and kick you back to the main menu with an error asking you to verify your game files or something.

Similarly, deleting the generator *model* but not the functional generator asset could crash the game, mean the generator works fine but is invisible, or could mean the generator is invisible AND has no collision so the player can’t damage it any more.

It could also just lead to situations where a missing rock opens a void in the map the player can fall into.

In short, deleting an asset could do anything from nothing to crashing the game to making it unplayable depending on what the asset is, how it is used in-game and how well the engine can handle stuff it expects to have access to suddenly disappearing.

Anonymous 0 Comments

OK so say some person designs a drainpipe in a game and then works the code allowing for the drain pipe to be climbed, the drain pipe is used in several locations and then someone else decides to use the base drainpipe code and adapt it for a wooden ladder which is now used in a great many places and is essential to get to some key locations. If at a later date someone dislikes the drainpipes and wants to delete them they have to do it in such a way as the ladders aren’t impacted or you have ruined the game.

Anonymous 0 Comments

Removing an asset is basically the same thing as removing a file. So imagine you removed some critical file that’s require to boot your computer, then your pc will crash at boot.