The need for assembler...

phil52scott
phil52scott used Ask the Experts™
on
I've got the 8086 basic instruction set pretty much figured but now the processor extensions and optimisation rules are looming and I'm wondering whether it's sensible to continue or whether it is leaving the scope of game programming.

I intend to be working in a windows environment and would like to be involved in the 3D graphics side of game development. How much of a future does assembly language have in computer games (I won't be finishing my degree till 2006) My main concern was the need to use the SSE2 extensions but that appears to be provided by C++ constructs with the Intel compiler. And, from what I've read, the Intel compiler can perform many optimisations which would be impractical for an assembly language programmer to imitate. I have also heard that if you feed the correct C code to a compiler it can produce code as good as that written by a good assembly programmer. Is this true?

I am hearing mixed views on the subject and wanted the views of somebody in the games industry. Is there still much call for assembler and will there continue to be in the future or are compilers getting so efficient now that it is becoming obsolete even for getting the high performance requirements of computer games? I am needing to know whether my time would be better spent on the many other areas of study required for game development.

Thanks loads.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
There is no doubt that knowing assembler can be very useful, especially in the area of game development. There are times when every tick counts and being able to squeeze a few more out when required can a big advantage...but... I suspect that many modern games use very little assembler code. Here is my list of reasons why:

1. Even the largest project is going to have very little code period. If your game is going to require 100,000 lines of C++, then writing chunks in assembler is going to take far too long. Better to have a real game than a 1/10th finished one

2. C and C++ produce pretty fine code in most circumstances. The languages (if you ignore some of the higher lever C++isms) translate to assembly instructions pretty well and the code produced, although not absoutely optimal is good enough 99 times out of a 100.

3. There are two main areas that take CPU power: graphics and AI. Graphics load is being given mostly to the graphics card now and so assembler for 'it' is irrelevent. AI is so complex you DO NOT want to write it in assemlber!


If I was you I would look into getting proficiant at C++ and learning a major API (OpenGL or Direct3d).

Good luck
Commented:
If you are interested in 3D graphics, you don't need 80x86 assembly, but there are another assembly languages for programming modern graphic cards (like Geforce and Radeon), and if you are going to learn this, it is propably an advantage to be familiar with another assembly language, because then it will be easier to learn.

But before you try to learn the assembly languages of the graphic chips, you should begin with easier topics in the 3D graphic domain. Have a look at www.opengl.org and www.gamedev.net, there are a lot of good tutorials and discussion boards.

Another advantage of knowing 80x86 assembly is that you know how the computer works and how complicated the different features of C/C++ are in terms of speed or memory usage. Sometimes a single C/C++ line can produce many instructions while many lines can be collapsed to only a few instructions.

If you are able to write a simple function in 80x86 assembler, for example bubble sort, then you already know enough about assembly and it is time to move on to other areas. You will NEVER need the advanced features like 3DNOW or SSE unless you are going into driver development, operating system development or something similar. There are libraries for integrating these into C/C++.

And don't miss the most important point for game development: Learn how to design! Most people are excellent programmers and want to make a game, but they don't succeed because they start programming without a proper design.

I hope my comment was helpful
Good luck

Overmind

Commented:
I have to agree with what has been said so far. Writing x86 assembly code is absolutely rare, almost extinct these days. Usually, a good C++ compiler will beat your handwritten assembly, since it knows *all* optimization rules and can figure out what's the fastest sequence of instructions with unsurpassed accuracy.

I'm not saying that knowledge about assembly is obsolete. Quite the contrary, if you didn't know assembly you could never judge your higher-level code from a look at the compiler output. I would still suggest, that you get proficient with C++ as it is one of the most widely used programming languages, especially in the entertainment industry. While C is still living happily due to bad compiler support for consoles, it will probably have faded away by the time you finish college.

.f
Exploring SQL Server 2016: Fundamentals

Learn the fundamentals of Microsoft SQL Server, a relational database management system that stores and retrieves data when requested by other software applications.

Commented:
A short note on Overmind's comment: There ARE situations when you *need* to actually write assembly code -- not all features are available through libraries. I used MMX instructions for shadow calculations in my last engine, and it couldn't have been done with a 3rd party lib.

.f
> I used MMX instructions for shadow calculations in my last engine, and it couldn't have been done with a 3rd party lib

Cool! You got some piccies?

Commented:
Nope, sorry, all of the published material is still of a somewhat aged prototype not encorporating any of this 'eye-candy'. It's nothing spectacular, though -- merely a fast implementation of geometric calculations. It could have been done with the standard fpu approach, only 4 times slower. It was only the first thing that came to my mind. There are areas, where you should not go without thorough understanding of SSE and comparable extensions, basically anything that profits from vectorization.

.f

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial