PC vs Console: Machine/Assembly code

Recommended Videos

MaxFF7

New member
Oct 25, 2010
9
0
0
I've read a number of threads that have debates over whether PCs are better than consoles. A common argument is that PCs are better because the consoles use the same hardware for several years and PCs are constantly upgrading. I'm in college for software engineering, so this post will be more about software than hardware. It's time to learn about machine code.

When writing games or any software really, it's common to use some sort of high level programming language like C++, Java, Python, or whatever. The CPU can't understand Java or any of these languages. It can only understand machine code. It's possible to program in machine code but usually it's done in assembly code. Basically, machine code is binary, and assembly are instructions based on English words. While a high level language like C or Java would need several machine instructions for each line of code, there is a one to one equivalence between assembly and machine code.

So why would people use machine/assembly code? Well when a programming in a high level language it often gets compiled into inefficient machine code. The reason for this is that different processors have different instruction sets. In order to run software on any PC it has to use generalized and inefficient instructions that all processors have. A processor might have multiple instructions for loading memory into CPU registers, or multiple add instructions or multiple compare instructions. These instructions take up fewer clock cycles than the generalized form, but can only be used in certain circumstances. However in order for software to run on multiple processors it must use the generalized form of the instruction.

Consoles have one crucial advantage over PCs. Every single PS3 has the same processor, hence same instruction set. Evey single Xbox 360 has the same processor etc. Same for Wii. When making a console exclusive it's possible to use any of the time saving and processor specific instructions because every console of that type will have those instructions available.

Not really trying to takes sides, because I enjoy PC and console games but the next time you think that better hardware makes PC games better, consider that it's possible to run better software on worse hardware by using more efficient machine code.
 

daltonlaffs

New member
Nov 17, 2009
104
0
0
If you had made this argument when PC gaming was in its infancy, yes, you would have a point.

However, most game-related functions are now performed in the GPU, not the CPU. Sure, GPUs can also have varied features, but the differences in most consumer models are negligible, other than power and speed.

Besides, it's not like anyone even codes in assembly anymore. Nobody making a blockbuster game has the time for anything lower-level than a compiled language, optimized or not, so that doesn't really matter either.

There's a slight difference, but I don't think it's anywhere near enough to say that consoles can ever outperform a computer with even slightly higher specs.
 

loc978

New member
Sep 18, 2010
4,900
0
0
This is why developers have been pushing consoles recently. They're easier to develop for... but what PC gaming lacks in that department, it makes up for in flexibility, ease of modding, and superior hardware.
Another note on modding: when making a tool for modding on a console, one is limited by said console's operating system, input devices, and proprietary code. One more advantage of requiring flexible software in order to work with a wide range of hardware and operating systems.
 

MaxFF7

New member
Oct 25, 2010
9
0
0
Okay I know wikipedia is necessarily the best source for information but, http://en.wikipedia.org/wiki/Game_programming

under the heading tools, and the subheading programming languages it says, "Assembly language is necessary for some video game console programming and in some routines that need to be as fast as possible, or require very little overhead."

Obviously programming an entire game in assembly is ridiculous, but there are tools available that allow programs to be written in C++ and other languages and compile into assembly and tweak the assembly for optimization. In functions that are called a lot it would be wise to make the machine instructions as efficient as possible. They don't need to optimize the entire game necessarily.
 

More Fun To Compute

New member
Nov 18, 2008
4,061
0
0
I don't really see any console versions of games out performing my current PC, to be honest. Unless it's a particularly bad port of a specific game.

Consoles might have an advantage in that they can optimise for known amounts of memory but I don't see a huge advantage in optimising for a certain CPU or using machine code to call OpenGL. It seems to me that thread management would be a bigger problem than optimising for a specific instruction set and I'm not sure that machine code is a big help there.