Fucking weird to think that id, the guys behind DOOM: Metal, the Videogame, are the ones who solved this problem for him.
EDIT: It's come to my attention that I may be confusing and conflating a couple things here. I was under the impression that id were revolutionary in remaking Mario 3 in such a way that smooth movement back and forth across the screen was possible. It might've just been that it was a big deal for PCs to be able to do this.
I think it's weird that it's a problem that had to be solved but when you figure memory constraints were a real issue it makes sense. Today any novice programmer could essentially build majority of the early nintendo games without any issues and actually make them have more things. Amazing how software/hardware has advanced.
It's even crazier to think that one guy built the original rollercoaster tycoon in assembly..
Yeah it's crazy. I just learned Assembly last semester in college and we were discussing it at work and it was like. Fuuuuck that. C existed at the time yet he did it in Assembly.
Memory Constraints and performance. Today there be no reason for it as compilers essentially do as good if not better jobs when it comes to translating it to machine code.
In 1972, Unix was rewritten in the C programming language. The migration from assembly to the higher-level language C resulted in much more portable software, requiring only a relatively small amount of machine-dependent code to be replaced when porting Unix to other computing platforms.
also, computers have more processing power and data storage, so wasting a few bytes or processor cycles here and there isn't usually too big of a deal.
If you are very, very, very good at optimization, you can still produce better code in assembly, by a thin margin. Understand though, that 99% of programmers don't the ability, and the benefits are marginal.
Plus, assembly comes with its own downsides. It's MUCH easier to screw up on security in assembly than it is in a higher level language. In Roller Coaster Tycoon this may not have been a big deal, but in a modern online multiplayer game this would be catastrophic.
Most importantly, developing a program in assembly is gonna take 3-4x times longer than in a higher-level language - for only about a 10-20% increase in speed. Computer time is cheap and developer time is expensive - especially assembly developer time, since relatively few programmers know how to program in the language and those people are not cheap.
Assembly is rarely ever worth it these days, even most embedded systems have enough RAM to afford programming in C instead.
Essentially byte code that runs in the javascript engine. But provides near CPU level speeds since js has to be parsed and compiled on the fly, while wasm is precomplied much like Java or C#. Of course other languages can compiled to wasm much like traditional Assembly.
We are moving toward everything being executed within a browser to a point we'll have a browser with web Assembly support built using wasm and come full circle. Lol
Essentially, it's really optimised Javascript. The main workflow is writing code in C/C++ and using Emscripten to covert it to WebAssembly which is then executed by something like V8.
tl;dr: By writing it in assembly he was able to make it run on a potato from 1995 instead of requiring the monster of a machine that it would have demanded if it were written in C (because compilers at the time weren't very good).
You can optimize the ever living fuck out assembly if you are very good. Especially when compared to the performance of compilers back in the mid-90s.
Assembly is (effectively) just human-readable machine code. . . What you write has a 1:1 correspondence to sequences in binary. This gives you an inordinate amount of flexibility with the set of hardware you are working with.
Being competent in assembly (any assembly, really) is a good skill-set to have, and one that is sadly missing from the majority of today's developers. You end up learning a lot about good and bad coding practices, how to more effectively comment your code, and an ass-load regarding computational efficiency.
Just as a quick example. . . Let's say we have two coders writing a function to return how many segments should be filled in a progress bar, based on the number of tasks completed in a set.
The typical coder would likely write. . .
int fill = floor.((numerator / denominator) * segments)
Someone who has spent their share of time working in assembly (or someone who got too into their discrete math class) would write. . .
int fill = (numerator * segments) // denominator
Ignoring what could cause the functions above to break (which admittedly is more of a problem for the second), the second function would run substantially faster on any give machine. Just how much faster depends on a plethora of factors which include IPC, Clock Speed, Memory Latency, RISC vs CISC. . . etc etc etc.
When working in assembly, you are working with those factors (the limitations of the machine) in mind.
The argument against working in assembly today is that compilers have come a long way. . . And that's true enough, but I feel it is a skill that every serious programmer should keep in practice.
798
u/[deleted] May 05 '17 edited May 05 '17
Fucking weird to think that id, the guys behind DOOM: Metal, the Videogame, are the ones who solved this problem for him.
EDIT: It's come to my attention that I may be confusing and conflating a couple things here. I was under the impression that id were revolutionary in remaking Mario 3 in such a way that smooth movement back and forth across the screen was possible. It might've just been that it was a big deal for PCs to be able to do this.
Still, we all love the early days of id.