Saturday, April 23, 2016

Why AMD/Radeon is Increasingly Dead To Me

Historically, I've been a fan of AMD. They make good, cheap processors. Their motherboard chipsets are pretty solid. In 2006, AMD bought out ATI technologies, and started selling graphics cards.

When I built my latest system, I dropped a nice efficient Radeon R7 in there. I've had persistent problems with the machine, even after changing the motherboard, PSU, hard drives, OS, and cooling. The machine stability seems to wax and wane with the release of the AMD Catalyst drivers.

I thought it was just me, but a friend recently put together a machine with the latest and greatest in AMD/Radeon R9 tech to drive a pair of 4K monitors, and her problems are even worse. There was a time it was stable, but drivers changed, and now the machine won't stay up for more than 20 minutes. Trying to run Elite Dangerous is an instant hard crash now. Maximizing the browser window will crash the machine 50% of the time.

And it's not just us. The anger-boards are filled with similar stories. There are rumors several Games companies threatened to write their own Radeon driver set, because their customers were having so much trouble.

The core problem has been ATI's historic secrecy, born from a time when graphics cards could be nice and proprietary, so long as you'd done the driver deal with Microsoft. Patent litigation abounded, as everyone tried to produce a 'better' anti-aliasing or MIP-mapping algorithm and sued everyone else for pushing pixels in near-identical ways. It was toxic.

Since then, graphics cards have become commodity items. No-one cares, or even wants, non-standard bells and whistles.  What we really, really need is direct access to the inside guts of the graphics card so we can use it for 'GPU compute' operations, to blat textured polygons onto the screen as fast as possible, and to write "shader programs" in a generic way that works on all computers.

No-one wants "Tesselation" or "PhysX" because those are over-specific features that only do one thing, aren't standard, and can be replicated (often better) with general compute.

NVIDIA has been a leader here with their 'CUDA' architecture. For years, they've allowed people to get up all inside their GPU and know exactly how all the blocks fit together, with no surprises. They figured out that in order for people to get best use out of your product, they have to know how it works.

AMD Graphics also seems to use the necessity to install their OS drivers as a way to get "shovelware" onto the users machine. That's a dangerous trend, because it means they're now also in the business of selling their customers. Not just selling _to_ them. That creates a tension, that leads to 300-400 megabyte "driver downloads" filled with all kinds of crap.

300Mb for a graphics card driver? 
You cannot be serious.

Not only that, it's pretty obvious that AMD Graphics are doing deals with the publishers of software and games to "tune" the performance of their applications.

How do I know this? My graphics card crashed again this morning, (not the whole machine, just the card dropped and re-installed) and because I hunt down the causes of these things, I noticed the system log entry

Process C:\Windows\System32\SET645.tmp (process ID:3660) reset policy scheme from [hex block]

Since I'm not fond of anonymous ".tmp" executables changing my system settings, I had a look at the files. (There were several) They contain strings like:

" ReleaseVersion  Catalyst_Version"
"AMD PMP-PE CB Code Signer v201504130" I'm guessing they're automatic updates downloaded by Catalyst. If you look carefully at some of the files, you notice lists of executable names for games and other programs. Some games I've never had installed on my system. Some apps (like DirectX and Chrome) we all have.

I'll include just a small sample of that list: (sorry about the UTF16 spaces)

5 C O D   -   B l a c k   O p s   B l a c k O p s . e x e         B l a c k O p s M P . e x e     S k y r i m     T E S V . e x e         S t a r C r a f t   2   S C 2 * . e x e         3 D M a r k   N E X T   3 D M a r k I C F D e m o . e x e       3 D M a r k I C F W o r k l o a d . e x e       3 D M a r k . e x e     3 D M a r k C m d . e x e       M a s s E f f e c t   3         M a s s E f f e c t 3 * . e x e         W h i t e   L i s t   A p p     U n i g i n e . e x e   S a n c t u a r y . e x e       L e o _ D 3 D 1 1 . e x e       M e c h a _ D 3 D 1 1 . e x e   L a d y b u g _ D 3 D 1 1 . e x e       C o r e T e c h 2 _ X 6 4 _ 1 0 . e x e         C o r e T e c h 2 _ X 6 4 _ 1 1 . e x e         C o r e T e c h 2 _ X 8 6 _ 1 0 . e x e         C o r e T e c h 2 _ X 8 6 _ 1 1 . e x e         B a t m a n A C . e x e         h n g . e x e   R e n e g a d e O p s . e x e   S a i n t s R o w T h e T h i r d _ D X 1 1 . e x e     G a m e C l i e n t . e x e     A n n o 4 . e x e       f c 3 _ b l o o d d r a g o n _ d 3 d 1 1 . e x e       f c 3 _ b l o o d d r a g o n _ p _ d 3 d 1 1 . e x e   f c 3 _ b l o o d d r a g o n _ r _ d 3 d 1 1 . e x e   f c 3 _ b l o o d d r a g o n _ r t _ d 3 d 1 1 . e x e         N Z A . e x e   a r m a 3 . e x e       z a t . e x e   M a d M a x . e x e     3 D M a r k   S k y D i v e r   3 D M a r k S k y D i v e r . e x e     T a l o s . e x e       T a l o s _ U n r e s t r i c t e d . e x e     T a l o _ D e m o . e x e       M u r d e r e d   S o u l   S u s p e c t       F a t e G a m e - W i n 6 4 - T e s t . e x e   M u r d e r e d . e x e         H i t m a n   A b s o l u t i o n       H M A . e x e   F i f a   O n l i n e   2       F F 2 C l i e n t . e x e       D i a b l o   I I I     D i a b l o   I I I . e x e     D i r t   S h o w d o w n       s h o w d o w n . e x e         s h o w d o w n _ a v x . e x e         s h o w d o w n _ d e m o . e x e       s h o w d o w n _ d e m o _ a v x . e x e       K r a t e r     K r a t e r . e x e     M a x   P a y n e   3   M a x P a y n e 3 . e x e       T J 3   T J 3 . e x e

You'll note they have special detection of the 3DMark _benchmarks_. That's a worry by itself. How do you trust a video card driver that auto-detects benchmark software? (and presumably switches on specific settings just for that case)

What's more concerning - if getting an entry like this is how you gain 'top performance' for your software (because apparently the basic video card drivers aren't up to the job by themselves) then how exactly does your company gets its optimal settings into this list? Does monetary compensation change hands? How much? Can Indie developers afford it?

I'm sure there are nice excuses for this behavior, (like enabling new graphics modes for legacy games) but it also enables a whole class of dodgy practices for AMD and un-obvious behavior for the user. The AMD graphics drivers don't really do what you ask... they do it "better!", according to the latest update.

What's amusing is - if the auto-update system didn't keep crashing and properly cleaned up it's temp files, I might never have seen this list in such obvious plain-text.

So, I'm sick of this crap. For my next graphics cards, I'm going back to NVIDIA, to get me some of that sweet CUDA lovin' and stability. If that means changing the rest of my machine to Intel, well, so be it.

Thursday, April 14, 2016

Astromech - Hex Editor Preview

Here's tonight's screenshot from Astromech: A very early preview of the new "Hex" Editor.

It doesn't edit hexadecimal code -it edits dependency trees. I'm sure at first the whole thing looks a little hand-drawn, a bit too good, but in fact all of the connection lines are auto-routed by Dijkstra's algorithm on a hexagonal grid - which I find gives more pleasing results than square grids, assuming you can handle the math.

This is a "first preview" of what's going to be the cap-stone of Astromech before I finally push it out the door - the integrated script editor needed to tie together all the other parts.

I'm trying to do an end-run around all the problems of text, keyboards, languages and localization, and comp.sci jargon in general - by having another tilt at one of the big windmills of computer science - Visual Code Editing. Representing code graphically, rather than as text.

Many before have tried and failed. I'd probably be doomed to fail if I also tried to create a 'generic' programming language, but I have a very specific set of needs that isn't fully Turing complete - mostly I just need to connect up predefined modules into processing chains which have well-behaved startup and shutdown semantics.

These scripts will be hidden inside every Astromech item and level, responding to clicks and collisions and requests to add new 3D models into the visible scene. They're already there, but large chunks of JSON are a pain to edit. I need something better.

This might be it.

Sunday, April 10, 2016

I just got waved to from VR

This is one of those "the future is here" moments. The first 'tv show' transmitted from VR.

The Foo Show - Firewatch Tower Tour Episode

It's clunky, their arms don't move properly because the inverse kinematics forgot to include shoulders, and in terms of content - it's a bunch of people wandering around a small room looking intensely at every-day objects like teenagers on their first acid trip.

But it's also groundbreaking. Will's completely right about how little it takes before you anthropomorphise their chunky avatars into "real people". Ten minutes in and I forgot they were polygons.

And at the end, they wave goodbye. Such a simple, utterly human gesture. The first time anyone has waved to me from VR. is in early days still. The resolution will improve, structured motion systems will replace the polygons with photogrammetry, the inverse kinematics will get better, and the "virtual sets" will evolve and explore the limits of what's visually possible.

But they got first post. And that's what matters.

I've been expectantly waiting for this day for over 20 years, and pushing the technology and art behind it. This concept is as old as Gibson's "Neuromancer", or Simmon's "Hyperion". Now it's real. We finally get to explore not just the idea, but it's consequences.

Well done, Will Smith. I tip my hat to you, sir. 

Wednesday, April 6, 2016

Inventory Management in Online Games

Inventories! They've been in every RPG and MMO for the entire history of computer games. Type 'invent' into 'advent' if you don't believe me.

So, you'd think the finer points of "inventory management theory" would have been long hashed out by the games development community, and you'd be wrong.

Gamasutra has two articles; one in 2010 and then another in 2015. That's the opposite of a hot topic.

"Inventory Management Sucks!" is a short reminder on what the player probably expects out of their inventory system. Too short.

"Loot Quest: From Ruminations to Release" gets much more into the issue, from the point of view of the choices one makes building the inventory system, and how it affects the game mechanics. Those guys make explicit and careful choices, because "a streamlined inventory was seen as one of the highest priorities" for their "heroes-with-equipment premise".

Elegant Simplicity

There's also "Designing an RPG Inventory System That Fits: Preliminary Steps" which is a good overview of the historical 'categories' of inventory management, and reviews the major systems seen in games over the last decade.

Of course, you can't discuss inventory systems without referring to the grand-daddy of the genre, World of Warcraft. Although more as a cautionary tale, many would say.

Loot Porn. 

Something that's taken for granted with all these 'Inventory' systems is that items are scarce. They are games, after all. Items in games are intended to be rewards, and often consumable. This can lead to entire 'virtual economies' for 'goods' that are really just one entry in a database table somewhere, linking a pre-defined 'item' object into your inventory space.

When you 'craft' an item in these MMOs, what you're doing is collecting a bunch of predefined database tokens which you exchange (via server calls) for another predefined database token. You're not making anything new. Even though it can sometimes feel 'unique' because stats are randomly rolled or cute names are chosen from a big list.

Remember how innovative it seemed when, in Diablo II, you got access to the ability to name one item? With your own name, but still. That mechanic alone resulted in entire generations of characters being created with names that looked good on a sword.

And yet, the amount of time and effort trading these game items has been incredible. Big companies like Blizzard have had to face the question of whether allowing characters to transfer items in-game will create an entire secondary 'trading markets' and whether they allow that. (Or, since you can't stop it, whether they banhammer the players they catch, or try to set up their own market and get a slice of that pie.)

As you might know, I'm writing a game-ish VR environment thingy called "Astromech". Think of it as a level designer. You place geometry, define what the sky looks like, etc.

I found I was building an "Asset Manager" for all the content that goes into a level. And because Astromech is a 'world builder', I like the concept of just picking up 'items' in one level, putting them in your 'inventory', and then dropping them into others.

That means that, in astromech, Items don't come out of a predefined set. They start as directories of asset files, from which visible things in the level are instanced. They are 'program scripts'.

That makes "item crafting" in Astromech a whole new thing. For a start, items can be created by just dragging a filesystem directory into the inventory screen. The directory is rifled through for metadata and assets, and you get a new inventory item! Want a different item, then edit the files and go again! Want to change the icon or title or comment, then do!

The beginnings of Inventory Management in Astromech.
Damn, where did I leave that dataset of all known asteroids in the solar system?

That's a concept most games go to extreme lengths to avoid. Because in a competitive system, you don't want other people arbitrarily increasing their power by modifying their tools. But in a co-operative system about building "virtual machines" to solve real-world problems, you actually want the other "players" to be all that they can be.

Because if they build some incredible item that detects bird-song in audio streams, or reconstructs 3D scenes from multiple photos, (using the DSP 'components' that Astromech provides) then that becomes something they can share. Something not originally programmed into the 'game' by me.

How? Just walk up to their avatar in VR and open their 'shop' of public items. All the tropes of inventory trading in MMOs are just the accountancy of database management dressed up in a pikachu suit.

This allows other niceties, such as users storing the items in their own local machines, and doing direct peer-to-peer sharing without central servers. "Duping items" is assumed. Some are just URLs.

There's a LOT of little details to work out, but the paradigm of item sharing in MMOs is far more friendly than file sharing systems like dropbox. I've prototyped the issues now, and I can see where it's all going.

Minecraft introduced "item transforming items" like furnaces and workbenches. I'm going a step further, to "item compilers" which effectively craft unique pieces of functional 'software' from source components. That's what an Astromech item is.

 Astromech's real job is to create a space where all these "virtual devices" can play together in a shared 3D environment, and connect with each other, while protecting the user's browser from malicious code, and devices from each other. (Because, this is all in a web page!)

Remember, the secret is to bang the rocks together, guys.

Possibly the closest equivalent available today is in Steam's VR demo "The Lab". 

Towards the end, after the Tested team has played most of the mini-games, the table in the hub room fills up with devices they've 'collected' from the various games. Balloon inflaters, bows and arrows... and they begin to delight in the way these tools can be played with and combined, just for their own sakes. And unlike most games, the tools aren't purely destructive.