Live data from Hacker News

Original Age of Empires 2 dev talks about its usage of assembly code

old.reddit.com

1–10 of 113 posts

Re: Original Age of Empires 2 dev talks about its usage of assembly code

#4
I worked on port of a Konami game from PSX to PC, that was 1999-2000 - the code (C) had lots of #ifdefs like where inline assembly was placed, and the original "C" code was kept. It seemed all done by one specific programmer, and what really saved us (in porting) the game was the originallly kept "C" code. My mips knowledge was never as good as x86.

So yes, it was the norm back then. My second job (1998), was working on a team that was going to do some software for Intel for the upcoming back then Katmai processor (Pentium I was it). It had all the new fancy SIMD instructions. The software was supposed to be something like media composer - you slap images, rotate them, etc all in realtime using software rendering (GPUs were still relatively expensive).

I wrote a bilinear and bicubic texture mapper with marching squares for transparent areas. It was all in assembly, and I spent lots of time optimizing it. Back then we used Intel's VTune, and it was super-precise (for the processors back then) - how they are going to pipeline, how much (supposedly) instructions cycles would take, waits, etc. That helped a lot!

But the real lesson was, that me and my manager - both claiming to be super good at assembly (after our recent achievements), rewrote the sphere mapping code for a game another team was writting in assembly, but alas our assembly (but no katmai instructions) code was slower than what the compiler did ;) - TBH, if we did proper mipmapping and texture swizzling we would've fared both ways, but hey, demo coders were not always to be found so they had to rely on regular programmers like us!

flipcode keeps a lot of good articles, with lots of good assembly for that - https://www.flipcode.com/archives/articles.shtml - there were even better materials from earlier years, but can't find them.

Turbo/Borland Pascal were so awesome, because they allowed for very easy of inline assembly use (somehow) than C/C++ - though you had to know which registers you can touch or not.

Re: Original Age of Empires 2 dev talks about its usage of assembly code

#5
post #2

>The use of assembly in the drawing core resulting in a ~10x sprite drawing speed improvement over the C++ Wow that's a chunky improvement over an already fast lang

This was in 1999. C++ compilers have come a long ways since then. While there are still opportunities for hand-written asm to go and order of magnitude faster than C++, they're mostly around manual vectorization where the auto-vectorizer fails.

Re: Original Age of Empires 2 dev talks about its usage of assembly code

#6
post #4

I worked on port of a Konami game from PSX to PC, that was 1999-2000 - the code (C) had lots of #ifdefs like where inline assembly was placed, and the original "C" code was kept. It seemed all done by one specific programmer, and what really saved us (in porting) the game was the originallly kept "C" code. My mips knowledge was never as good as x86. So yes, it was the norm back then. My second job (1998), was working…

Are there any good resources on using mipmapping and swizzling effectively?

Re: Original Age of Empires 2 dev talks about its usage of assembly code

#7
> A key speedup technique AoE used was realized during discussions I had with iD software programmer and optimization guru Michael Abrash over lunch at Tia's Mexican Restaurant in Mesquite, TX.

How many freeform interactions like this did we lose because of the Internet's illusion of being connected?

Re: Original Age of Empires 2 dev talks about its usage of assembly code

#8
post #7

> A key speedup technique AoE used was realized during discussions I had with iD software programmer and optimization guru Michael Abrash over lunch at Tia's Mexican Restaurant in Mesquite, TX. How many freeform interactions like this did we lose because of the Internet's illusion of being connected?

We've gained many. Chatting in a discord is similar to this.

Re: Original Age of Empires 2 dev talks about its usage of assembly code

#9
post #4

I worked on port of a Konami game from PSX to PC, that was 1999-2000 - the code (C) had lots of #ifdefs like where inline assembly was placed, and the original "C" code was kept. It seemed all done by one specific programmer, and what really saved us (in porting) the game was the originallly kept "C" code. My mips knowledge was never as good as x86. So yes, it was the norm back then. My second job (1998), was working…

This was a nice read, thanks for writing.

Re: Original Age of Empires 2 dev talks about its usage of assembly code

#10
post #8
post #7

> A key speedup technique AoE used was realized during discussions I had with iD software programmer and optimization guru Michael Abrash over lunch at Tia's Mexican Restaurant in Mesquite, TX. How many freeform interactions like this did we lose because of the Internet's illusion of being connected?

We've gained many. Chatting in a discord is similar to this.

And IRC was even better at it.
Post reply on HN