Live data from Hacker News

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

old.reddit.com

61–70 of 113 posts

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

#61
AoE2DE still ships with hand-written assembly, though not part of the game code itself. The executable is initially encrypted by an executable packer. It unpacks the game code at runtime - some functions even on-demand.

Not sure why they do this, but this even leaves all code as RWX (readable, writable and executable) which is highly insecure.

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

#62
post #28
post #5

Earlier quoted context omitted.

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.

Yes, younger devs grown up on the myth of C and C++ being always fast, have missed the days when inline Assembly was a higher count than pure C and C++ code. I have seen applications for MS-DOS, effectively using C as a Macro Assembler, only the data structures and high level logic was C as if Macro Assembler macros.

I was there, 3000 years ago, when C was considered bloated and slow. Times are a changing.

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

#63
post #21

Earlier quoted context omitted.

Thanks!!! Yes it was MGS - the deal was with our studio to do the port from PSX -> PC and since Microsoft was the publisher, part of the deal was for Konami to port Age Of Empires (1? 2?) to PSX.

It was Age Of Empires 2, I had a EU copy. I bet there are some interesting stories regarding that port, too. AFAIK the user interface for the win9x version was drawn using native GDI windows library, and yet the PS2 version, using a completely different rendering framework and architecture, sported the very same appearance, font glitches and all. I wonder if they actually wrote an emulation layer around that.

The AoE2 PS2 version actually had half-decent USB keyboard and mouse support. Back then USB keyboard/mice were very uncommon (it was all PS/2) but when we tried it, it actually worked.

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

#64

Those were also the days when, according to a famous interview with the same devs: > The general argument is that if you know you are going to need to release a patch, then you shouldn't be shipping the game in the first place.

This quote shall be summoned every time I open Steam and note there is yet another 22GB 'rebalancing patch' for a certain game.

Well, in certain online games the balancing can't just stay static. But update sizes really are quite insane. One Baldur's Gate 3 update had 100GB and of course that required 100GB additional free space. At that point it was easier to just reinstall the whole game.

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

#65
For those interested, the competitive AoE2 scene is alive and well with one of its biggest tournaments, NAC5, going on now, an in-person LAN in Berlin.

https://liquipedia.net/ageofempires/Nili%27s_Apartment_Cup/5

https://www.twitch.tv/nili_aoe

https://www.youtube.com/channel/UCXeY7zz-1LsyZdnpFbffdqA

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

#66

Earlier quoted context omitted.

Functionality should have been provided by directx though

I think AOE was using DirectX, so I assume that was one level up the stack, ie figuring out which sprites are visible to which extent by walking different data structures and then just throwing stuff at directdraw.

DirectDraw wasn't really meant as a drawing toolkit; you _did_ have blits, but they were not hardware accelerated AFAIK and not nearly flexible enough for what the article suggests (mirror, stiple, probably other stuff). In general, what DirectDraw gave you was a rectangle you could draw pixels into, and a way to get those pixels efficiently to the screen. In other words, more like a clean abstraction over the display driver.

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

#67
post #10

Earlier quoted context omitted.

And IRC was even better at it.

I don't think so. I know everybody loves to say that IRC is better than [insert commercial chat application] but in this particular use case discord is superior to irc imo because of the voice/video chat features and greater convenience.

It's the structure/topology.

Discord has a million deserted "servers" with redundant general channels. Peak IRC had a dozen or so large networks that often bundled a lot of e.g. adjacent FOSS projects. The chances of running into someone interesting a la the article anecdote was just higher.

Discord is a massive net negative for chatting on the internet because of this flaw imho.

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

#68
post #28

Earlier quoted context omitted.

Yes, younger devs grown up on the myth of C and C++ being always fast, have missed the days when inline Assembly was a higher count than pure C and C++ code. I have seen applications for MS-DOS, effectively using C as a Macro Assembler, only the data structures and high level logic was C as if Macro Assembler macros.

I was there, 3000 years ago, when C was considered bloated and slow. Times are a changing.

Unfortunately much of those optimizations are thanks to taking UB to full throttle.

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

#69
post #41

Earlier quoted context omitted.

Do you mean the VLC media player? Just curious is there any reason modern compilers don't beat assemblies or is that simply a legacy issue?

Compilers beat hand written Assembly for the general use cases. Now beating special use cases, like using vector instructions to parallel process video decoding streams is another matter. It is no accident that after all the efforts improving Java and .NET JITs for auto-vectorization across various vendors, both platforms now expose SIMD intrinsics as well.

The choices and resulting codegen are fairly different. Only one of them works "properly" as of today. Though I'm open to be proven wrong once Panama vectors get stable in the Java land.

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

#70

Earlier quoted context omitted.

This quote shall be summoned every time I open Steam and note there is yet another 22GB 'rebalancing patch' for a certain game.

Well, in certain online games the balancing can't just stay static. But update sizes really are quite insane. One Baldur's Gate 3 update had 100GB and of course that required 100GB additional free space. At that point it was easier to just reinstall the whole game.

The balancing in AoE2:DE can't stay static either - and the pathing seems to have a different bug every other patch. Still a fun game though.
Post reply on HN