Sign in to follow this  
Dolf

assembly language in game programming

Recommended Posts

Dolf    100
Hi, Does the assembly language have any place in game development ? Would it be a good idea for me to start picking it up ?

Share this post


Link to post
Share on other sites
mpipe    104
Quote:
Original post by Dolf
Hi,

Does the assembly language have any place in game development ?
Would it be a good idea for me to start picking it up ?


I think you mean game programming with assembly.

Share this post


Link to post
Share on other sites
losethos    100
I've never made a professional game. It'd guess you shouldn't use assembly. You can only be an expert on so many things -- can't hope to be a professional artist and game programmer. Even in game programming, there are specialties. Therefore, assembly will probably spread you too thin.

Share this post


Link to post
Share on other sites
pinacolada    834
No, almost no one uses it. It's not a marketable skill.

But, any knowledge is good. If you learn assembly, you'll probably have a better idea of what your C compiler is doing, and you'll write better C.

Share this post


Link to post
Share on other sites
jyk    2094
Quote:
Original post by Dolf
Hi,

Does the assembly language have any place in game development ?
Would it be a good idea for me to start picking it up ?
Is the question actually 'does assembly language have any place in game development?', or is it really 'would learning assembly language be a good use of my time at this point?'.

The second question is probably the more interesting one, but to answer that we need to know more about your background and your goals. What kinds of games do you want to write? What platforms do you want to target? And what is your programming background?

Share this post


Link to post
Share on other sites
lollan    144

Quote:

Original post by losethos
Do you program for fun. Assembly is fun.


That is kind of cool ^^

Quote:

Original post by Dolf
Hi,

Does the assembly language have any place in game development ?
Would it be a good idea for me to start picking it up ?


Well I'm no expert at all but the more you know the better it seems to be in game development however is Assembly (talking about x86 assembly here) used in game development ? Probably but not widely from what I know. It might be used only for high optimisation.

Losethos is right here just do it ^^

Share this post


Link to post
Share on other sites
Dolf    100
Ofcourse I'm going to do it for fun, but would it be practical in game programming (read: optimisation)?

Edit: I know assembly is faster than C++, but are there actually engines that are partionally optimised in assembly? Is it practical?

Share this post


Link to post
Share on other sites
jyk    2094
Quote:
...but would it be practical in game programming (read: optimisation)?
The answer is probably 'no'.

However, you should really answer the questions I posed earlier (target platforms and programming experience in particular). That will make it easier for us to provide a useful answer.

Share this post


Link to post
Share on other sites
losethos    100
This is kinda sad, but I think aspiring to game programming professionally might be like getting into professional sports. Ask yourself... am I that good? Otherwise, your dreams might not pan-out.

Every programmer wants to do games and very few do.

I wrote an operating system for amateur games. (All people without professional artists in their team are amateur.) It has crappy resolution, but you weren't hoping to twiddle pixels all day anyway.

You can use programming skills for other stuff, so no harm, but being a game programmer is pretty ambitious.

You might check-out LoseThos, my operating system. You can learn a lot--assembly if you wish-- but it not all that directly relevant to standard graphics libraries. Might find you like operating system programming. I like operating system stuff more than games, believe it or not. I used to like games... doesn't thrill me anymore.

LoseThos

Share this post


Link to post
Share on other sites
scratt    102
Quote:
Original post by pinacolada
No, almost no one uses it. It's not a marketable skill.


Well that's not strictly true. I use it on a daily basis. And there is still commercial game work which requires it.

Assembly still has a lot of applications in many fields, and is certainly a way to earn serious money. I know. I earn serious money from it month in month out. I consider it payback for all those gazillionaires who stuck with *spits* COBOL when the rest of us ran screaming for the hills.

I also use that knowledge to check up on my compilers code and re-write the C / C++ to be more efficient.
I blogged about that a few weeks ago, where simply re-ordering 3 lines of code in a very innocuous function garners a 30% speed increase from gcc. If you are serious about getting things to run smoothly on any architecture having a background in assembly and therefore a much better understanding of what goes on inside the silicon then you will write better code.

And if you want to use some of the more architecture specific functions of any processor (CPU or GPU) then an understanding of low level programming is also a massive advantage. I am referring here to fast maths pipelining and until recently a fair amount of shader code.



Share this post


Link to post
Share on other sites
Dolf    100
jyk, I sent you a private message.

losethos, that is quite off topic whether I can be a professional game programmer or not.
I want to know about the role of assembly and assembly programmers in game programming.

Share this post


Link to post
Share on other sites
losethos    100
Who here has a clue what professionals do? Everybody is full of **** if they think they know. It's possible professionals make propriatary assembly engines with pipelining and stuff. Your question cannot be answered because nobody here is a professional game programmer.

Share this post


Link to post
Share on other sites
losethos    100
I however have programmed many times professionally in assembly. I worked on Ticketmaster's VAX 100% assembly language operating system. I've programmed professionally in 68000 asm, 8051 asm, PIC micro asm, 0x86 asm, ARM asm... more I can't remember, all while getting paid. I can answer asm questions. What do you want to know? Actually, not good at MMX pipling stuff and Virtual machine stuff.

Asm is tedious, that much I'll tell you. You should definetly do it as little as possible.

The good news is there is fun besides games.

Share this post


Link to post
Share on other sites
jyk    2094
Quote:
Your question cannot be answered because nobody here is a professional game programmer.
Do you mean on this forum, or just in this thread?

If you mean the forums, there are quite a few professional game developers who post here.

Share this post


Link to post
Share on other sites
Telastyn    3777
Quote:
Original post by losethos
Your question cannot be answered because nobody here is a professional game programmer.


Umm, there's quite a few professional game devs here.

Share this post


Link to post
Share on other sites
losethos    100
Okay, you professionals be straight with this guy and tell him his odds of being a pro? Interview him now and assess his potential and save him heartbreak, though, maybe there are future pros here too ;-)

Share this post


Link to post
Share on other sites
losethos    100
Asm will make you a better programmer, but I doubt most game programmers do asm, but I'll bet they know asm. I know multicore... sort-of. LoseThos is 64-bit and unusually good for learning multicore, sort of. Multicore is probabaly at least as important as asm in the future, at least for PC programming. Use LoseThos to learn Multicore.

Share this post


Link to post
Share on other sites
Hi!

I worked in the video game industry as junior game programmer. Most things I did where coding the logic and doing menu stuff, though. But I had a look into their framework and there are some parts where assemby is used. But this is often only around 1% of the game code. Shader routines and some hardware routines were coded in assembly. The most C / C++ compilers are good enough to optimize your code. In C++ use the inline statement where speed is required. Use bit shifting for simple multiplication or divisions.
Only 2 of 10 programmers know the assembly language in the studio, though...
Learn C++, buy the book "Effective C++ programming" written by Scott Meyers and published by Addision Wesley. Read it. Understand it. Try to use, what you've learned.

The most studios buy an game engine and modify it for their behaves. Only a few studios develop a engine up from the scratch!

By the way. I worked in Hannover in a game studio and the salary there was pretty sad. 2500€ taxes and stuff inclusive got the lead programmer, though.

I asked him, if the salary is everywhere so sad and he answered that this is the normal salary in Germany in the game buisiness...

I am just programming small video games for fun. If money talks to you, use your programming skills in other companies else develop a small video game and look for game studios around your place and look at their websites for jobs.

I had luck and it was not a big step to get into it. The company is closed now, though...

Cheers
BR4iNL355 D35iGN5

Share this post


Link to post
Share on other sites
Dolf    100
Thanks "brainless",

I do know how to use inline and bit shifting but C++ optimisation is a level higher than assembler. I am aware of the "top-down" approach and I'm actually also reading the Effective C++ book.

It's good to hear there has been assembly work done in that framework that you used, could you be a bit more specific with "hardware routines"?

And, were you developing for a console or a pc? Because I'm also worried about compatibility with pc's and assembly.

Would you say that it's not required to learn assembly because C++ is fast enough?
I can inmagine in a game engine that you would want any gain possible, right? It increases the potential to sell it.

Share this post


Link to post
Share on other sites
_the_phantom_    11250
Quote:
Original post by losethos
Okay, you professionals be straight with this guy and tell him his odds of being a pro? Interview him now and assess his potential and save him heartbreak, though, maybe there are future pros here too ;-)


To be fair, quite high. Believe it or not you don't have to be gods gift to programming to get a job in the games industry, if anything is it probably one of the easier ones to get into. Get yourself a degree, show you can program and you'll more than likely get a break.

As for assembly, it is used but not all that much. The majority of the code I've seen has been in C++ in the last 7 months (which is over two platforms and two projects), with assembly being pulled out for functions which need to explote certain bits of hardware or need to be 'fast'. (Even then myself and another code who were new to the tech found times when the compiler could put out code which was better/faster than the handrolled assembly.)

Which brings us back to is it worth learning, well maybe in the long run, it really depends how much you know now. If you are just starting out then no, leave it, deal with learning the higher level concepts. If you've been at it for some time and it intrests you then go for it. Is it a 100% requirement for entry into the game industry; hell no.

Share this post


Link to post
Share on other sites
DevFred    840
Quote:
Original post by Dolf
I know assembly is faster than C++

Who gave you that idea? Nowadays, C++ compilers are VERY smart.
Most programmers can't write assembler code that is more efficient than what a C++ compiler produces.

Share this post


Link to post
Share on other sites
_the_phantom_    11250
Quote:
Original post by Dolf
I can inmagine in a game engine that you would want any gain possible, right? It increases the potential to sell it.


Not really because you run into issue that you are only as fast as your slowest path. Pre-optimising things which aren't hit often won't matter, if your slowest path can't get any faster then the rest of the code might as well stay 'as is'.

Many things in the game industry are down to is it fast enough, which is why so little assembly gets done now a days.

Share this post


Link to post
Share on other sites
I agree to phantom. It's not required for getting into the games industry. It's nice if you know assembly. On the pc platform, there are only some things where assembly could be a benefit for speeding things up - don't ask me for what...

At other platforms like the nintendo ds or cellphones, you got much more benefit, if you know assembly, cause you got no directx which supports directly the hardware. I coded a little framework for the gameboy advance and it is possible to manipulate the registers with C / C++ but in some cases ASM offers more speed. If you working with registers and stuff, it is no big step to do the special thing in assembly.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this