Atomic I/O letters column #136

Originally published 2012, in Atomic: Maximum Power Computing
Reprinted here December 20, 2012
Last modified 17-Jan-2013.
 

Multum in parvo, IN SPACE!

As a person with a friend that is very much into the "Indie" side of gaming, I've managed to see some very interesting things from time to time. Most recently, this same friend of mine has brought one of the more recent, more interesting titles on Steam to my attention, a game by the name of "Evochron Mercenary". Overall, it's a decent "Space Sim" game. The same old formula is there: trade commodities for money, save money for bigger ships, trade MORE commodities, Save MORE money, get Giant-Ship-O-Death™, kill people for money, etc.

The most interesting aspect of it is the sheer scale of the play-field. There are multiple star systems to explore, and they all FEEL like entire star systems. Asteroid clusters shift about, ships move in and out of systems, planets can be landed on with transitioning from space to planet surface, travel distances are frustratingly large, and it has all of it without even a loading screen to be found.

So, I see this game and I can't help but think that this marvel of gaming just HAS to be absolutely enormous to install! What with all the planets and systems, the shiny graphics on display, it must be well into the multiples of gigabytes!

So, I purchase it off Steam, start up the install, and it tells me that this game requires a whopping chunk of my HD: 257 Mb.

MEGA-bytes.

My mind has been blown before, but this takes the cake. How is it possible for something this large to take up less than half the install space for Half-Life ONE?

Jake

Amiga Elite screenshot
Amiga Elite screenshot
Elite. Eight galaxies, 2048 planets. And even this Amiga version was less than half a megabyte.

Answer:
Welcome to the world of "procedural generation"!

What's happening here is, the game code generates a long string of pseudo-random numbers, and uses those numbers to determine star locations and characteristics, planet locations and characteristics, et cetera. To simplify, wherever you go, the game looks at the portion of its long and deterministically repeatable number string that corresponds to where you are, and uses those numbers to create the nearby environment for you.

Procedural generation has a very long history with space-sim games. The grand-daddy of all 3D space-sims is Elite, first released in 1984, when 128 kilobytes was a lot of memory.

(In 1984, it was also exciting and futuristic to get home-computer games on floppy disk, instead of the incredibly slow-loading cassette tapes that many people with less money were still using.)

Elite had 3D graphics (wireframe on most computers, filled on later versions of the game for higher-powered machines like the Amiga and Atari ST), and eight galaxies, each containing 256 planets. Each planet had its own appearance and colourfully-described inhabitants, and local prices for various commodities.

Elite came on cassette and floppy disk for various platforms. The biggest versions took up a few hundred kilobytes; the original versions were down around the 20-kilobyte mark.

(You can still get Elite disk images for use with emulators, or with actual old computers, today.)

Procedural generation survives today in many games. Space-sims like the Evochron games, Minecraft, Dwarf Fortress, umpteen "roguelikes" and their real-time descendents like Diablo, and the list goes on.

Many games today have a mutated version of the idea - terrain or dungeons that were procedurally generated as part of the development process, then refined by humans, and stored conventionally as the large amount of data you expected to see in the Evochron installer. (This explains why you can find the occasional levitating shrub or see-through boulder in Bethesda games from Oblivion to Skyrim, and why the roads do strange things in some parts of Fuel's vast map. It's possible that a human level designer directly caused the geometry to be wrong in these spots, but it's more likely that some algorithm plunked the features down incorrectly, and the humans meant to fix such problems missed a few.

Even Elite had human curation of its algorithmically-generated universe, to keep rude words out of the planet names!

 

Ding-ding-ding-ding-ding-ding...

I've always wondered, why does the sound loop when software, usually a game, crashes?

It doesn't always happen, but it often does - the picture freezes, and whatever audio was playing is now about a half-second loop. I sort of feel like the image should loop too.

June

Answer:
Behold the circular, or ring, buffer.

Buffers are pieces of memory that hold data of some sort between the time when some software has created it (or read it from somewhere else), and the time when it's meant to be delivered to the screen, speakers, printer or what-have-you.

A simple buffer, a basic video buffer for instance, has data written into it, and then when that's finished the data can be read back out. Things get more complex if reading and writing are both happening at the same time to the same buffer; the video card displaying the contents of a buffer as they change is what causes "tearing" of the image on the screen. Tearing goes away when vertical sync is on, because then the buffer's back to the simpler mode of operation.

A circular buffer is a simple linear fixed-sized buffer, but with the end connected to the beginning, hence the name. The data source writes data to addresses zero through whatever-the-end-address-is, then continues writing at zero again. The data receiver reads from the buffer the same way, round and round. But if the data source stops for whatever reason - a crash, network congestion, whatever - and the data receiver keeps on reading, the receiver will now go round and round the unchanging buffer, reading the same data over and over, forever. Hence, looping sound.

Circular buffers can be used for video, too; they're well suited to use with streaming data of various kinds. So you can indeed get a Max Headroom scratch mix of both video and audio if the source of a video-and-audio stream stops streaming, but the receiver decides to keep on trucking, rather than just saying "buffering...". Game video doesn't use circular buffers, though, so if the writing side fails but the read-and-display side keeps going, you usually just get a still image to go with your looping sound.

 

Mysterious lights

I just came across a slightly odd interaction - or at least it seemed odd to me. Maybe it's normal?

Basically, a PC wouldn't boot up, or come out of hybrid sleep, when a specific powered USB hub was attached. Upon investigation, it appeared that the USB hub was providing enough power back to the motherboard that the motherboard power light was still lit, even when the PC was completely disconnected from the mains. I replicated this problem on a second PC, which had similar symptoms (both running Asus motherboards, but different models).

If I unpower the USB hub by pulling the wall wart, everything works fine (even the hub and the devices plugged into it). Should USB hubs really be providing power out of their type B (upstream) connectors, or is this a design fault? If a fault, is it common? This was a cheap-ish (about 15), no-name hub, but with a fairly comprehensive wall of positive reviews on Amazon, and it works fine unpowered.

Tim

Glowing motherboard buttons
Motherboard LEDs. Often useful, sometimes beautiful.

Answer:
There are meant to be two sources of five-volt power in a modern PC.

The first one is the main +5V rail from the power supply, which may be split into separate rails each feeding its own collection of power plugs for drives and so on, or which may be just one rail for every red wire coming out of the PSU. This 5V rail is not meant to be energised when the PSU is off, but still plugged in. (And it obviously won't be energised if the PSU isn't plugged in, or if the PSU has a hardware power switch that's turned off.)

The second 5V source is the "5VSB", five-volt standby, rail. This has a much lower current rating than the main 5V rail or rails, and it is supposed to be energised when the computer is off but the PSU is still plugged in (to a wall socket that's turned on, of course).

The basic purpose of the 5VSB power is to energise the teeny bit of motherboard that monitors whether the two pins of the power-switch connector on the mobo have been connected together, by a case's power button, or by your car key, if you're fiddling with a naked motherboard on the kitchen table.

5VSB also energises various other components, including USB, keyboard and mouse ports. Otherwise, you couldn't wake a computer from sleep mode with keyboard input, and Wake-On-LAN would also be impossible.

All of these ports - PS/2 keyboard and mouse, the ancient AT keyboard connector, and USB - have a five-volt power rail. So it's easy to run them all from 5VSB; you can just directly connect all of these power rails to 5VSB on the mobo.

So what the computer you're looking at has, is a USB 5V rail that's connected to the 5VSB rail, with no circuitry to prevent the one powering the other. The hub you've got completes the picture. Powered USB hubs are meant to be able to run in unpowered-hub mode from a computer, or from their own plugpack, but I'm pretty sure the spec says they're not meant to pass five volts back upstream when both a computer and the plugpack are connected. But this one clearly does, as I think do a lot of other cheap hubs.

So 5V comes into the computer via the hub, and lights the standby LED on the mobo.

(Different motherboards have different built-in annunciator gizmoes. A single LED to indicate 5VSB is energised is common, and there may be an LED indicating "full" power as well.)

I'm not sure whether the ATX specifications forbids this, but the USB and ATX specs are widely disobeyed. (The current ATX spec mandates splitting the 12V rail into at least two independent ones, but not every PSU does that. The USB spec forbids, among other things, extension cables.)

As a practical matter, this ignoring of the spec - and more severe versions; on some mobos the CPU fan will keep spinning if the computer's off but there's a cheap powered USB hub connected! - isn't very important, and probably isn't dangerous either. A malfunctioning USB hub or peripheral that shorts its 5V supply to ground could in theory pop a fuse on a motherboard that was connected directly to it, but this is unlikely.

If the mobo's got a load of stuff that'll run from incoming USB power if possible then it could be a bad situation, like starting the engine of a manual-transmission car while it's in gear and forcing the little starter motor to move the whole car. This could overload the hub's power supply, and failure of that power supply or some other glitch could damage the motherboard's USB controller, especially if there's a little spark when you plug in the hub or its plugpack. But, again, I don't think it's a major risk.

In your case, somehow this back-fed power from the USB hub is preventing the computer's PSU from going into full-on mode. If I had to guess, I'd say it was doing this because the powered hub is somewhere south of the mandated 5.0 volts, especially after resistance losses from mobo traces, cables and connectors, and the extra load of whatever motherboard bits the USB hub is accidentally powering. If this manages to hold the 5VSB rail far enough below five volts, the PSU could think there's something wrong with itself and refuse to go into full-power mode. Or the USB voltage itself could be below spec, but connected to and also hauling down the voltage on the "Power Good" pin on the motherboard power connector, which is meant to be fed 5V by the power supply when it's satisfied that it's starting up properly. This'd make the motherboard think there's something wrong, and again you get no turn-on.

(Just to make everything even more confusing, a possible failure mode for both motherboards and PSUs is loss of calibration of their voltage sensors - so everything can be A-OK and all 5V rails can be 5.00 volts precisely, but because a sensor thinks that's 4.2 volts or 6.5 or something, the computer doesn't work.)

A way more expensive brand-name powered hub might cure this problem, but there's no guarantee a branded peripheral will actually stick to the spec any better than a $3 eBay special. You could also probably solve the problem by cutting the (probably red) +5V wire in the cable going from the computer to the hub, which would of course make the hub not work at all when its plugpack isn't connected. Or, more ingeniously, you could tap a non-standby-5V wire from the PSU and power the hub from that, instead of from its plugpack.

Or, of course, you could just unplug the hub when you want to do the things it's stopping you from doing.

This is all a bit of a long walk for that to be my final advice, but I spent this much time thinking about it, so I feel I must make you suffer as well.

 

This is a reprint of a column originally published in Atomic: Maximum Power Computing magazine here in Australia. The e-mail address for the I/O column is io@atomicmpc.com.au, but I can't answer all of the letters I get.

If you're not an Atomic reader, then sending mail to their letters address is somewhat perverse. Use this alternative instead.

Other letters columns

I/O #1
I/O #2
I/O #3
I/O #4
I/O #5
I/O #6
I/O #7
I/O #8
I/O #9
I/O #10
I/O #11
I/O #12
I/O #13
I/O #14
I/O #15
I/O #16
I/O #17
I/O #18
I/O #19
I/O #20
I/O #21
I/O #22
I/O #23
I/O #24
I/O #25
I/O #26
I/O #27
I/O #28
I/O #29
I/O #30
I/O #31
I/O #32
I/O #33
I/O #34
I/O #35
I/O #36
I/O #37
I/O #38
I/O #39
I/O #40
I/O #41
I/O #42
I/O #43
I/O #44
I/O #45
I/O #46
I/O #47
I/O #48
I/O #49
I/O #50
I/O #51
I/O #52
I/O #53
I/O #54
I/O #55
I/O #56
I/O #57
I/O #58
I/O #59
I/O #60
I/O #61
I/O #62
I/O #63
I/O #64
I/O #65
I/O #66
I/O #67
I/O #68
I/O #69
I/O #70
I/O #71
I/O #72
I/O #73
I/O #74
I/O #75
I/O #76
I/O #77
I/O #78
I/O #79
I/O #80
I/O #81
I/O #82
I/O #83
I/O #84
I/O #85
I/O #86
I/O #87
I/O #88
I/O #89
I/O #90
I/O #91
I/O #92
I/O #93
I/O #94
I/O #95
I/O #96
I/O #97
I/O #98
I/O #99
I/O #100
I/O #101
I/O #102
I/O #103
I/O #104
I/O #105
I/O #106
I/O #107
I/O #108
I/O #109
I/O #109
I/O #110
I/O #111
I/O #112
I/O #113
I/O #114
I/O #115
I/O #116
I/O #117
I/O #118
I/O #119
I/O #120
I/O #121
I/O #122
I/O #123
I/O #124
I/O #125
I/O #126
I/O #127
I/O #128
I/O #129
I/O #130
I/O #131
I/O #132
I/O #133
I/O #134
I/O #135
I/O #136
I/O #137
I/O #138
I/O #139
I/O #140
I/O #141
I/O #142
I/O #143
I/O #144
I/O #145
I/O #146
I/O #147
I/O #148
Dan's Data letters #1
Dan's Data letters #2
Dan's Data letters #3
Dan's Data letters #4
Dan's Data letters #5
Dan's Data letters #6
Dan's Data letters #7
Dan's Data letters #8
Dan's Data letters #9
Dan's Data letters #10
Dan's Data letters #11
Dan's Data letters #12
Dan's Data letters #13
Dan's Data letters #14
Dan's Data letters #15
Dan's Data letters #16
Dan's Data letters #17
Dan's Data letters #18
Dan's Data letters #19
Dan's Data letters #20
Dan's Data letters #21
Dan's Data letters #22
Dan's Data letters #23
Dan's Data letters #24
Dan's Data letters #25
Dan's Data letters #26
Dan's Data letters #27
Dan's Data letters #28
Dan's Data letters #29
Dan's Data letters #30
Dan's Data letters #31
Dan's Data letters #32
Dan's Data letters #33
Dan's Data letters #34
Dan's Data letters #35
Dan's Data letters #36
Dan's Data letters #37
Dan's Data letters #38
Dan's Data letters #39
Dan's Data letters #40
Dan's Data letters #41
Dan's Data letters #42
Dan's Data letters #43
Dan's Data letters #44
Dan's Data letters #45
Dan's Data letters #46
Dan's Data letters #47
Dan's Data letters #48
Dan's Data letters #49
Dan's Data letters #50
Dan's Data letters #51
Dan's Data letters #52
Dan's Data letters #53
Dan's Data letters #54
Dan's Data letters #55
Dan's Data letters #56
Dan's Data letters #57
Dan's Data letters #58
Dan's Data letters #59
Dan's Data letters #60
Dan's Data letters #61
Dan's Data letters #62
Dan's Data letters #63
Dan's Data letters #64
Dan's Data letters #65
Dan's Data letters #66
Dan's Data letters #67
Dan's Data letters #68
Dan's Data letters #69
Dan's Data letters #70
Dan's Data letters #71
Dan's Data letters #72
Dan's Data letters #73
Dan's Data letters #74
Dan's Data letters #75
Dan's Data letters #76
Dan's Data letters #77
Dan's Data letters #78
Dan's Data letters #79
Dan's Data letters #80
Dan's Data letters #81
Dan's Data letters #82
Dan's Data letters #83
Dan's Data letters #84
Dan's Data letters #85
Dan's Data letters #86
Dan's Data letters #87
Dan's Data letters #88
Dan's Data letters #89
Dan's Data letters #90
Dan's Data letters #91
Dan's Data letters #92
Dan's Data letters #93
Dan's Data letters #94
Dan's Data letters #95
Dan's Data letters #96
Dan's Data letters #97
Dan's Data letters #98
Dan's Data letters #99
Dan's Data letters #100
Dan's Data letters #101
Dan's Data letters #102
Dan's Data letters #103
Dan's Data letters #104
Dan's Data letters #105
Dan's Data letters #106
Dan's Data letters #107
Dan's Data letters #108
Dan's Data letters #109
Dan's Data letters #110
Dan's Data letters #111
Dan's Data letters #112
Dan's Data letters #113
Dan's Data letters #114
Dan's Data letters #115
Dan's Data letters #116
Dan's Data letters #117
Dan's Data letters #118
Dan's Data letters #119
Dan's Data letters #120
Dan's Data letters #121
Dan's Data letters #122
Dan's Data letters #123
Dan's Data letters #124
Dan's Data letters #125
Dan's Data letters #126
Dan's Data letters #127
Dan's Data letters #128
Dan's Data letters #129
Dan's Data letters #130
Dan's Data letters #131
Dan's Data letters #132
Dan's Data letters #133
Dan's Data letters #134
Dan's Data letters #135
Dan's Data letters #136
Dan's Data letters #137
Dan's Data letters #138
Dan's Data letters #139
Dan's Data letters #140
Dan's Data letters #141
Dan's Data letters #142
Dan's Data letters #143
Dan's Data letters #144
Dan's Data letters #145
Dan's Data letters #146
Dan's Data letters #147
Dan's Data letters #148
Dan's Data letters #149
Dan's Data letters #150
Dan's Data letters #151
Dan's Data letters #152
Dan's Data letters #153
Dan's Data letters #154
Dan's Data letters #155
Dan's Data letters #156
Dan's Data letters #157
Dan's Data letters #158
Dan's Data letters #159
Dan's Data letters #160
Dan's Data letters #161
Dan's Data letters #162
Dan's Data letters #163
Dan's Data letters #164
Dan's Data letters #165
Dan's Data letters #166
Dan's Data letters #167
Dan's Data letters #168
Dan's Data letters #169
Dan's Data letters #170
Dan's Data letters #171
Dan's Data letters #172
Dan's Data letters #173
Dan's Data letters #174
Dan's Data letters #175
Dan's Data letters #176
Dan's Data letters #177
Dan's Data letters #178
Dan's Data letters #179
Dan's Data letters #180
Dan's Data letters #181
Dan's Data letters #182
Dan's Data letters #183
Dan's Data letters #184
Dan's Data letters #185
Dan's Data letters #186
Dan's Data letters #187
Dan's Data letters #188
Dan's Data letters #189
Dan's Data letters #190
Dan's Data letters #191
Dan's Data letters #192
Dan's Data letters #193
Dan's Data letters #194
Dan's Data letters #195
Dan's Data letters #196
Dan's Data letters #197
Dan's Data letters #198
Dan's Data letters #199
Dan's Data letters #200
Dan's Data letters #201
Dan's Data letters #202
Dan's Data letters #203
Dan's Data letters #204
Dan's Data letters #205
Dan's Data letters #206
Dan's Data letters #207
Dan's Data letters #208
Dan's Data letters #209
Dan's Data letters #210



Give Dan some money!
(and no-one gets hurt)