If you have't seen the Fallout 3 train hack in the Broken Steel DLC, then here's a quick primer.
This? This is how you add trains to a game with no vehicle system to deal with them:
As explained in the original post: "The player is equipped with an armor piece that makes their view look like a train. Then the player has a special camera animation played that moves the first person camera forward along a specific track".
Crucially, as explained by Trainwiz "these kinds of solutions make up the bulk of game development. It's a clever, bug free solution that works brilliantly. It's not like they're gonna waste time coding up a big system for running trains."
And as it turns out, games are full of these hacks. Like this one:
Another fun fact: all Skyrim's NPCs have a hidden chest under the map where their inventory lives.
The thing to remember here is that this isn't cheating, or bad coding - it's using the tools you have to avoid creating a complex single use system. Things in games don't exist in the usual sense. It's just code, maths and pictures put together to create illusions.
Whenever you're listening to an in-game radio or watching an in-game video, chances are there's a character or object out of view acting it all out in real time. In Call of Cthulhu: Dark Corners of the Earth, for example, there's a mirror you can see yourself in, that's actually a whole second room flipped on the other side of a hole in the wall. In Half-life, the lifts have no audio objects attached, so the beep of buttons being pressed is actually coming from the character pressing them.
Another example, in Fallout 3's Mothership Zeta DLC, why create an elaborate robot claw entity when you can just equip a NPC with a really odd weapon and make him float past? Both things that already exist and who'll know the difference?
It's all about being cleverly economical with what you have: the large wind turbine in Perfect Dark is actually a rotating sentry turret with giant blades stuck on. Why bother creating a whole new thing when you already have something that does the job?
Bulletstorm and The Vanishing of Ethan Carter creator Adrian Chmielarz had this to say about the whole practice:
How vehicles work in #Fallout3/NV. One of the most spectacular examples of the hacks that game developers do. pic.twitter.com/biw3c3ASJZJuly 21, 2015
He also added his own hack to the pile:
Bulletstorm has its dirty secrets too. To look "normal", the cars chasing after you are 5x size of the core model. https://t.co/0tANroZU0yJuly 21, 2015
So, bear that all in mind next time you play a game. It's not the Matrix, perfectly simulating the world around you, it's a finite set of systems recreating the appearance of a world around you. And in some cases, those systems are working overtime.
Plus, there are huge time constraints to getting millions of lines of code to work in time for release. Sometimes, it's easier to fake it and not tell anyone. Famously Donkey Kong 64 shipped with a free memory expansion because they couldn't find the bug that made the game crash without it (about 2m40 in. Watch out, its sweary). Another classic is to look out for oddly placed objects on corners in games - that's an easy way to hack past an AI pathfinding bug when you haven't got time to fix it.
To finish, I'm going to tell you the greatest video gaming lie ever: there's no code in space invaders to speed the action up. The 1979 tech is simply maxed out trying to move all the sprites, play music and deal with collisions when you start playing. As you kill aliens you simply give the program less to do and it speeds up as a result.
[Drops smoke bomb and is gone.]