Archive for the 'Computers' Category

Minecraft: Silent Dropper Item Elevator

Sunday, May 22nd, 2016

This is an older design of a silent dropper item elevator. It’s not initially by me, but it could be that I modified it. Still, I think it’s one of the best designs, because:

  • silent
  • items can be inserted at any level
  • Either has a footprint of 2×9 or can be arranged in an L-shape.
Silent Dropper Item Elevators, Front

Silent Dropper Item Elevators, Front

Silent Dropper Item Elevators, Back

Silent Dropper Item Elevators, Back

It does have a problem, and that is that sometimes the dropper(s) that get fed with items can get filled up and stuck.

Anyway, here’s the schematic:

Windows Unity-Games on Linux

Wednesday, January 13th, 2016

The fact is, beginning with Unity 4, just about all games run on Linux as well. Unless they’re buggy, explicitly check for the platform or use plugins not available on Linux.

I found this Howto in Russian on how to fix an incomplete Unity runtime so it runs on Linux, could reproduce the effects, and so here’s the writeup in English on how it’s done.

This is how the minimal Unity-runtime for Linux looks:

├── player_Data
│   ├── Mono
│   │   ├── etc
│   │   ├── x86
│   │   │   └── libmono.so
│   │   └── x86_64
│   │   . └── libmono.so
│   ├── Plugins
│   │   ├── x86
│   │   │   └── ScreenSelector.so
│   │   └── x86_64
│   │   . └── ScreenSelector.so
├── player.x86
└── player.x86_64

The word “player” is replaced by the actual name of the game. Note that these files are the same for every game that uses the same Unity version.

Find Version

Within the existing player_Data directory, you’ll find a file named mainData. This contains the Unity version, and you will need to add the correct version of the Linux runtime, so you’ll first need to extract that version:

head mainData | strings | head -1

if this doesn’t get you the version, the game uses a very old Unity, which has the version information towards the end of the file, but for which no Linux support exists anyway.

Get runtime

Now you need to find the correct runtime. You can check mainData of Unity games supported on Linux, and copy the respective files over. Something like this:

find . -name mainData -print0 | xargs --null grep --with-filename "4.5.5f1"

of course, some people already have collections of runtimes, like this: https://cloud.mail.ru/public/6SdA/BBgyg3kjy

if the runtime you need isn’t available on your system, you can extract it from the official releases with 7z. The not-so-nice part is, every release comes as a huge .exe with a size of 1GB or more. And there are a lot of releases:

The useful files within the extracted release are below linuxstandalonesupport/Variations/ you’ll need the files libmono.so, ScreenSelector.so and LinuxPlayer per 32bit/64bit environment.

Find Plugins

After you have all the files from the runtime in the right places, and have renamed them accordingly, you might have noticed, that there are some dll-files in the Plugins directory. You’ll need to add Linux versions for most of these.

Luckily, there are some very well known plugins, they are used all over the place, and some come with the source as well:

The .unitypackage-files can be extracted with tar xvaf, but they consist of a salad of directories. file */asset can tell you what is what, the corresponding filenames are in */pathname.

Fix .unitypackage files

The .unitypackage-files a lot of plugins are delivered in can be extracted with tar xvaf, but they consist of a salad of directories. file */asset can tell you what is what, the corresponding filenames are in */pathname.

This here makes a directory tree from the pathname files:
for i in *; do mkdir -p `dirname $(head -1 $i/pathname)` ; done
And this here moves the assets into it and renames them:
for i in *; do mv $i/asset $(head -1 $i/pathname) ; done

Cosmetics

You now can do some cosmetics. Fix the ScreenSelector background:
convert ScreenSelector.bmp ScreenSelector.png
And the Icon:
wrestool -x --type=14 Game.exe | convert ico:-[6] Game_Data/Resources/UnityPlayer.png

Testing

Start the game with a logfile parameter to get warnings about missing libraries and other problems:
player.x86 -logfile out.log
As mentioned before, “player” needs to be replaced with the actual name of the game, and the binaries named accordingly.

Results

I basically went over my whole collection of not-yet-available for Linux Unity games I have on steam. I annotated the runtime version and troubles they might have.

Working Games

  • 1954 Alcatraz (4.0.1f2)
  • Coldfire Keep (4.3.4f1)
  • Dead Bits (4.1.3f3)
  • DeadEffect (4.6.0f3)
  • Depths of Fear Knossos (4.6.1f1)
  • Final Dusk (4.6.1f1)
  • Gravi (4.5.5f1)
  • Huntsman The Orphanage (4.2.2f1 needs LD_LIBRARY_PATH for libsteam.api.so)
  • Last Inua (4.2.2f1)
  • Lifeless Planet (4.6.7f1)
  • Once Bitten, Twice Dead! (4.6.1f1)
  • Overcast – Walden and the Werewolf (4.1.3f3)
  • PaperSorcerer (4.1.5f1)
  • Red Lake (4.3.4f1)
  • StickItToTheMan (4.3.2f1)
  • The Dead Linger (4.6.0b20 Some black textures)
  • The Hat Man Shadow Ward (4.3.4f1)
  • Train Town (4.5.0f6)
  • Urja (4.5.4f1)
  • YearWalk (4.5.5f1)

Games Having Trouble

Most of these run, but are also unplayable. Some are playable, but not enjoyable because of missing textures or missing sound.

  • Air Buccaneer (4.2.0f4 can’t connect to network?)
  • BridgeProject (4.5.3f3 x86 crashes, x86_64 does not accept input)
  • Dead Island Epidemic (4.6.1f1 libs missing, among them http://www.squaretangle.com/FMODUnity.html)
  • Deus Ex The Fall (4.3.4f1 needs LD_LIBRARY_PATH for libsteam.api.so; Wwise sound engine wrong version, playable)
  • Empyrion – Galactic Survival (5.2.3f1 hanging?)
  • Joe Dever’s Lone Wolf (4.5.4f1 self-written plugins)
  • Melissa K and the Heart of Gold (4.5.3f3 hanging?)
  • Might & Magic X – Legacy (4.2.2f1 hanging?)
  • realMyst Masterpiece Edition (4.5.5p4 broken menu, needs uWebKit)
  • Slender – The Arrival (4.5.1p3 Texture problems, playable)

Shader Problems

The following games all have shader problems. Which basically means you would need to decompile Managed/Assembly-CSharp.dll and replace the shaders to use there, or to extract the .asset-files and create them anew. Some of these games are playable as they are, but certain things will show up pink.

  • Astral Terra (5.1.2f1 Shader Problems)
  • Avenging Angel (5.1.0f3 Shader problems)
  • Godus Wars (5.2.2f1 Shader problems)
  • GunsNZombies (5.2.2f1 Shader problems, crashes)
  • Reign Of Kings (5.1.1p2 Shader problems, needs LD_LIBRARY_PATH for libsteam.api.so)
  • StarForge (4.5.5f1 Shader problems, needs LD_LIBRARY_PATH for libsteam.api.so)
  • The Forest (5.1.3p3 Shader problems)
  • The Tower (5.1.2f1 Shader problems)
  • Treeker – The Lost Glasses (5.1.2f1 Shader problems, playable)

Broken on Purpose

  • BlockStory (4.6.8f1 Steam-Error: “Not available on your current platform”)
  • Magnetic Cage Closed (4.3.4f1 Steam-Error: “Not available on your current platform”)
  • Republique (5.2.2p4 Steam-Error: “Not available on your current platform”)
  • Stranded Deep (5.2.2f1 Steam-Error: “Not available on your current platform”)
  • Subnautica (5.2.3f1 Steam-Error: “Not available on your current platform”)

Unsupported

  • Blackguards (3.5.6f4)
  • Cognition (3.5.7f6)
  • Commander Jack (3.5.7f6)
  • creavures (3.4.2f2)
  • Dementium 2 (3.5.7f6)
  • Dungeonland (3.5.6f4)
  • DysanTheShapeshifter (3.4.2f2)
  • Seamulator 2009 (2.1.0f5)
  • ShadO (3.5.2f2)
  • Shelter (3.5.7f6)
  • Theatre Of The Absurd (3.5.0f5)
  • Them – The Summoning (3.4.2f2)
  • The Witcher Enhanced Edition (3.5.2f2)
  • Truffle Saga (3.5.7f6)
  • UnearthedEpisode1 (3.5.7b1)

Minecraft: Most Efficient Branch Mining Technique

Sunday, November 1st, 2015

There are a lot of hearsay and rumours on what is the most efficient mining technique in minecraft. I decided to test them.

Setup

The setup consists of 4 chunks, adding to 64×64 blocks, with a height of 16, from the bottom of the world up. I tried with one chunk only, but the results were inconclusive, since I managed to stumble upon chunks that did not contain certain resources at all. Since diamonds happen to be the most sought-after resource, and they only appear on height-levels 16 and below, I capped the setup there. These 4 chunks were then copied with mcedit, it’s resources counted with the “analyze” function of mcedit and then mined according to specific patterns. After this, I used mcedit again to count the new remaining totals.

The chunks were chosen more or less randomly, but so that they did not contain any lava or air. The setup has 65536 blocks in total, of which are 12222 bedrock, resulting in 53314 mineable blocks.

Efficiency is determined by the most resource-blocks mined for the least amount of blocks mined in total. It is completely irrelevant whether the chunks still contain resources after mining, as the minecraft world is infinite.

The Patterns

The patterns were aligned so that they cover as much of the height up to 16 blocks and down to bedrock; they were also aligned so that bedrock wouldn’t disturb the mining too much, so only the pattern with peekholes actually has tunnels within the uppermost layer where bedrock can occur, because since there are very few tunnels, this was deemed acceptable.

The green blocks signify visible blocks, red invisible ones. The bottom is left red because it consists mainly of bedrock.

Tunnels separated by two blocks, vertically aligned

 Tunnels separated by two blocks, vertically aligned

Theoretical amount of tunnel air-blocks is 11264, visible are 27136 other blocks, per tunnel air-block are 2.41 blocks visible. Coverage of mineable blocks is 72%.

Usually this is chosen by inexperienced players, who think they do have to get every resource within a certain space.

Tunnels separated by two blocks, vertically diagonally aligned

 Tunnels separated by two blocks, vertically diagonally aligned

Theoretical amount of tunnel air-blocks is 11008, visible are 32704 other blocks, per tunnel air-block are 2.97 blocks visible. Coverage of mineable blocks is 82%.

This makes it immediately clear that this option is much better than the first version. For about the same amount of blocks mined, the ratio to visible blocks and the overall coverage is much bigger. Actually, depending on how the two patterns are aligned to each other, it is possible that both need exactly the same amount of tunnel air-blocks; and this pattern covers 20% more space.

So if you still think you need to get every resource within a certain space, this is still much better a pattern than the above.

Tunnels separated by three blocks, diagonally aligned, one space

Tunnels separated by three blocks, diagonally aligned, one space

Theoretical amount of tunnel air-blocks is 8192, visible are 23552 other blocks, per tunnel air-block are 2.875 blocks visible. Coverage of mineable blocks is 59%.

The theory behind this is, that ores usually appear in veins, consisting of 2 to 20 blocks within some three.dimensional space. Thus the chance to stumble upon ore should not be greatly diminished by the added space.

Tunnels separated by three blocks, diagonally aligned, two spaces

Tunnels separated by three blocks, diagonally aligned, two spaces

Theoretical amount of tunnel air-blocks is 6144, visible are 18432 other blocks, per tunnel air-block are 3 blocks visible. Coverage of mineable blocks is 46%.

The same as above, but with one space added in the vertical direction.

Tunnels, separated by ten blocks, with peekholes every two blocks

Tunnels, separated by ten blocks, with peekholes

Theoretical amount of tunnel air-blocks is 7944, visible are 23704 other blocks, per tunnel air-block are 2.97 blocks visible. Coverage of mineable blocks is 59%.

This also relies on the fact that ores rarely only occupy one block in a certain axis. Also, the use of peekholes instead of tunnels leads to less tunneling that needs to be done, for very similar numbers as the tunnels separated by three blocks, diagonally aligned with one space. This one also has the added benefit that mobs cannot spawn in the peekholes.

Tests

From the above, one could easily conclude that the pattern with the biggest visibility per tunnel-block or the pattern with the biggest coverage would be the most efficient. But this would only be the case if resource were distributed uniformly; instead they’re distributed random, and in bunches. Since we don’t have any numbers or mathematical model on that, we test instead.

Mined was every block needed for digging the tunnels, and every visible resource block from there. If mining that resource block turned another resource block visible, that one was mined too. Sometimes another block was mined as well, if that was needed to get to a visible resource block.

Baseline is our setup, which 53314 mineable blocks, of which we have:

Uninteresting Blocks 51518
Gold Ore                47
Iron Ore               382
Coal Ore               818
Lapis Ore               40 
Diamond Ore             38
Redstone Ore           471

And these are the results of the first two tests done. I will refrain from testing the 2 rectangular pattern, since its obviously inferior to the 2 diagonal one. I might do the other two pattern as I find time. Numbers are what’s left in the ground after mining:

                     2 Diagonal    Peekhole
Uninteresting Blocks 40613          43531
Air (Tunneled out)   12497           9710
Gold Ore                 4              8
Iron Ore                48             46
Coal Ore                89             83
Lapis Ore                4              1
Diamond Ore              5              4
Redstone Ore            56            111

These are very similar, except the first version needed a lot more tunneling for the same amount of resources. And the first version covers a whopping 82% of the whole space, while the second one covers only 59%; which makes it quite obvious there is something going on with ore bunching.

This makes the pattern with peekholes roughly 128% as efficient, and just as thorough, as the tunnels separated by two blocks arranged diagonally.

Minecraft: 1891 Fruit Co. Fully Automatic Farm

Monday, July 6th, 2015

This is the reviced version of my Semi-Automatic Farm (which was called 1890 Fruit Co.) for Minecraft.

1891 Fruit Co. Building 1891 Fruit Co. Building

it’s gotten much smaller, less than half the volume

1891 Fruit Co. Front Front

And it produces much more different fruit

1891 Fruit Co. Entrance Entrance

1891 Fruit Co. Reception View Reception View

It produces patatoes, carrots, wheat, bread, seeds, pumpkins, melons, cactus, sugar cane, poppies, dandelions, peonies, roses, lilacs and sunflowers. And other flowers in low quanties.

1891 Fruit Co. Output Produce

All you need to do by hand is feeding in copious amounts of bonemeal. Everything es is automated (and the produce gets sorted; except the less common flowers). The farms for patatoes, carrots, wheat and bread will work without bonemeal, albeit very slowly. The flower farms won’t.

1891 Fruit Co. Factory Floor Right Factory Floor Right

1891 Fruit Co. Factory Floor Left Factory Floor Left

The schematic

The license of these files and my screenshots is the OPL 1.0 or CC-by-sa.

Minecraft: Baroque Windmill

Monday, May 11th, 2015

This has been lying about on my disk, so here’s just a quick post with it:

To make my Minecraft world a bit more lively, I did an 18th Century windmill to place into it:

18th Century Windmill

And another view, at sunset:

18th Century Windmill

It’s based upon an english windmill of around 1750. The interior isn’t exactly as it should be, with minecraft lacking round things. I just did an approximation of it with placeholders. And of course, here’s the schematic for mcedit.py:

18thCenturyWindmill.schematic.

The license of these files and my screenshots is the OPL 1.0 (which is about the same as CC-by-sa).

Minecraft: Castle Good Hope Construction Site

Tuesday, November 18th, 2014

I somehow lost interest in this (more on that later), so it’s basically a construction site, but I thought I write up how I constructed it.

I was looking around for some more baroque things I could build, maybe a small fortified city or something like that. Initially I came upon the Peter & Paul Fortress in St. Petersburg, but I could not find any useful plan or schematic.

And then I found this: Castle Of Good Hope, Overview. It has a scale, measures around 240×240 meters, and the layout looks gorgeous. The picture has around 2 pixel per meter, so that can be scaled easily. This star-shaped fortress was built between 1666 and 1682 by the Dutch East India Company (VOC).

I loaded the layout into gimp, fiddled around with the colours so that the black pixels were blacker and thicker, and the colours deeper. Then I made a custom palette with five coulors: black, white, orange, blue, green, and converted the image from RGB to indexed with that palette, replaced white with alpha, and rotated it 60 degrees counterclockwise (because I wanted the walls of the building in the middle to be straight). Finally I scaled it to 50%. Which gave me this: GoodHope

This image I then converted to an mcedit-schematic. There’s some free online-tools which can do this, some standalone programs and even some mcedit filters. Which gave me this: Floorplan Schematic which of course is not very precise. This I placed on the ground with mcedit, and then I started building up, while interpolating and correcting.

This is how it looks right now, from a bit up the ground

CastleGoodHopeView

And from above:

CastleGoodHopeFromAbove

Including the woollen plan beneath it, and with various sandstone blocks to mark where buildings should go.

Now, if you take a close look (or look at a View of Castle Good Hope or a Closeup of the Gate of Castle Good Hope) you realize what this consists of: Basically (granite) cobblestone topped off by red brick! Ugh!. That was the moment I slowly started to decide that I would not finish this.

Add to this that I could not find an elevation-plan of it (only of the earlier square-shaped fortress) and various details remained opaque (although google map view of Castle Good Hope helped a bit; you can see where stairs are), I decided to leave it after I’ve brought into some kind of shape.

So if anyone wants to continue this (perhaps someone frome cape town?) I publish it here. License is public domain, you can do whatever you wish with it. It’s in 1:1 scale, as accurate as possible. The walls are maybe 70% done, although I don’t know if I’ve got the height right, and the topping-off is a bit higher, since I wanted to have half-slabs on top to stop spawning. Also, there’s only grass where It didn’t interfere with the rest of the walls. The Oranje and Leerdam bastions have their gun emplacements, Buuren only two of the five it should have; the rest none yet. And I’m not quite happy with how they look. The entrance lacks everything. The buildings are somewhat staked out, some with approximate height.

The world save is just what you can see in the pictures, the schematic however is the walls only, so you can put it into your world and fill in the rest with whatever you want.

Here they are

On Ebooks and pricing

Monday, November 17th, 2014

I’m an avid reader. And I’ve got quite a collection of books. But apart from some pdfs I bought at rpgnow and some I’ve got from humblebundle, I bought exactly one ebook on the internet.

One reason for this is DRM. I can’t stand it, and I vote with my boots. I will never support such a completely consumer-hostile scheme, not with my money, and I even try to boycott the most egregious abusers of it by not buying their other products as well. Amazon for instance. There are of course some other abuses producers can indulge in which might want me to boycott them, like lobbying for extensions of copyright or ripping of the academic communities with journals and other such rent-seeking activities. But I won’t go into detail here; if buying a book is not as easy as can be or the book has antifeatures like DRM, you can stop right now, you’ve already lost.

Another reason is price. I’m very well aware that producing an ebook has a lot of the same fixed costs as one on paper has, but still, ebooks are much, much too expensive. The one thing that most people seem to forget, is that while ebooks have the same fixed costs (basically the writer and the editor; see Charlie Stross‘ Blog for details) there are practically no costs associated with the individual file you sell. So that base price of the individual unit which came beforehand from printing, stock and distribution, falls away, what remains is the amount for writer, editor, marketing, etc. which can be spread out over as how many units you like.

The question is, where actually is the “right” price for ebooks (and movies, by the way, which also seem to be much too expensive)?

The facts to keep in mind are: Budget and time are constrained on the buyers side. For most books, the things that tell stories are the immediate competition: Movies and computer games, But basically everything else that entertains people is competing with books, like forums and blogs and other places of discourse on the internet. And the public domain will also compete with newer books. Also, while people can (and will, no matter of copyright) share books with their friends they can’t actually resell them and recoup some of the money they spent. So the price needs to be rather low, to compete with all the other offerings, with public domain books, and with used books on paper.

Now, I’ve noticed from my behaviour regarding computer games, that I actually bought a lot of games I already had again, at gog.com or steam. Why? Mostly because they were cheap. With some autumn- summer- and christmas-sales, I’ve just about re-bought all the computer games I’ve already had.

This leads me to the conclusion of what the “sweet price” for ebooks is: The price where I can re-buy all the books I’ve ever had on paper or ever read within the space of maybe a year or two. In my case, that’s probably around 2000 books, some of which I’ve gotten for SFR 1 at garage sales, some I lent out from libraries, some I bought at retail price. The price for all of them should probably be below SFR 10’000; and with the SFR 1 paper ones as measuring stick, probably not a lot more than that. Say between SFR 1 and 4 (one swiss franc, by the way, is slightly more than a dollar nowadays).

Of course, you won’t want to make every book this price; you might want to put prices of popular ones more towards SFR 4 and unpopular ones more towards SFR 1, and of course, for new releases you want to have prices rather towards the prices of the paper version, SFR 15 maybe. Still, even new releases should have prices markedly lower than the paper version, since you really don’t have to take any logistics into account. Plus, you might want to have sales with huge discounts, and bundles, like “all the works of Isaac Asimov for SFR 30”. Take a look at steampowered.com around christmas, and you’ll see what I mean.

Exactly the same thinking can of course be applied to other digital goods, like movies and television series. I suspect the prices there could be a bit higher, maybe something around SFR 3-10 for movies, and maybe SFR 1-4 for single episodes, or SFR 10-20 for whole series. And again, newer ones priced above that, And bundles (“all the James Bond movies for SFR 50”).

The main point here is: There is a price that is so low, people will buy these things just to have them (or even fear that “it will cost more after this sale”), regardless of whether they even get around on reading or watching them. Just for the sake of collecting. Because they remember them, or because they’ve heard about that author and plan on reading something of him some time in the future. It doesn’t even matter if they already have gotten that book from a friend, for free. And, most importantly, it doesn’t matter if they will even find the time to read it; or even expect to find the time.

Questions for game-system rule makers

Sunday, November 2nd, 2014

As I’ve been playing some computer RPGs, and read some of the changelogs and wishlists, I noticed some issues relating to history and physics which I will address here, in the hopes it might help game designers to achieve more believable game-(or mostly combat-)systems.

Q: Does a weapon which has the whole mass distributed along its length do more damage on impact than one that centres it on the top?

A: A two-handed sword distributes its maybe 2.5kg along the say 160cm of the blade, with actually its centre of gravity near the hilt. A pole arm has a lot of its 2.5kg near the top of its 240cm. Its clear that the momentum of the pole arm upon hitting will be much higher than that of the sword, and thus the damage it can inflict. On stabbing motions however, both weapon will inflict similar damage as this is mostly dependent on the user. The advantage of the sword is of course control, which is much better with the centre of gravity near the users hand.

Of course, this is something a lot of games get wrong.

Q: Heavy is bad?

A: For armour, yes. You want the maximum protection at the least weight. Or maybe the weight you can wear in battle, which is around 20-40kg, depending on your size. Heavier armour than that was only worn for tournaments, and there only on horse.

So don’t make your full suits of armour heavier than that. If your game considers size, have it influence the weight of the armour (and the fun of having the player find armour which just doesn’t fit), otherwise make it 30kg (or less for especially good armour…)

For weapons, you want something rather heavy that you can still control with ease, which brings us to…

Q: How much mass and momentum on an elongated hitting device can you control with one hand or with two hands?

A: This depends a bit on the length and centre of gravity, but it’s about 1kg for a 1 meter long thing, and 2.5kg for a 2.5 meter long thing. Which is nicely supported by historical evidence: One-handed weapons tend to have a weight around 1kg with 1 meter length, and all pole arms weigh around 2.5kg with a length of 2.5m. Two-handed swords also tend to weigh 2.5kg with a length of 150cm (with shorter ones being lighter).

Of course this may vary a bit depending on who made it and who wants to wield it, but usually history shows weapons to be much lighter than their equivalents in game systems (It’s gotten a bit better. D&D, 1st ed. shows a one-handed sword at 6lbs and a halberd at 15lbs, D&D, 5th ed. shows them at 3lbs and 6lbs).

Q: Why do you think there are flat wide arrowheads used for hunting and tetragonal ones for war?

A: It’s about damage to flesh versus armour-piercing. This can be very much generalised: A pointy bit used for stabbing that’s broad and flat will probably do more damage to flesh but its chance to penetrate armour will be lower than one that’s square.

This means, with thrusting, damage will depend on that, and mostly on one other factor: whether the weapon was used two- or one-handed or what device was used to launch the thrust.

Q: What’s the difference between a blade and a pointy extrusion?

A: Pick or axe? As far as the pointy versus cutty is concerned, this again is a question of damage to armour versus damage to flesh.

As I already answered the case of where the stabbing bit is at the end of something and is used to thrust. But this is a bit different, since we’re actually hitting, not thrusting. And the momentum will vary a lot depending on how long this thing is and whether its used with both hands or not; and also, the momentum will usually be much bigger than with a straight thrust.

A lot of pole arms will allow you to choose whether you want to hit your opponent with a blade or a pick, depending on what kind of armour he wears.

Q: What’s the difference between a rounded blade and a straight blade?

A: The question is, do we have a cutting or hitting edge. This is also a question about the armour worn on the other side. The difference between round and straight edges will probably be small, with the straight edge transferring more energy to the target, whereas the round edge will convert some of that energy into a lateral motion (cutting). The cutting will be rather useless against things it can’t cut, so it’s probably less useful against things like chain mail, whereas the damage might be bigger against things it can cut (leather, skin, flesh).

The other thing of course is the question what happens if the whole thing is curved, and there the answer is that with curved blades you can stab around something, making stabs more difficult to parry.

All in all, if you don’t have mechanisms to take these two issues into consideration, just treat them as equal.

Q: Why would you want to ditch a shield for a two-handed weapon?

A: Because if you’ve got two hands to use on the weapon, you’ve got more control, can use longer weapons, have more momentum and inflict more damage. And since you need something to take care of incoming projectiles, you have armour to take care of that.

You’ll notice that shields vanish from the battlefields with the advent of late middle ages plate armour. Made of steel, getting more and more hardened with time. Because that’s the thing that stops most projectiles. You also notice that Romans also had some kind of “plate” armour but still carried shields. That’s because it’s made of iron (or even bronze), not steel, and can be rather easily penetrated by arrows.

Q: Why wouldn’t you want to ditch a shield for a second weapon?

A: If it’s about parrying, the bigger the thing you use to parry is, the bigger the chance of not getting hit. If it’s about projectiles, a second weapon won’t help you, but a shield will. And lastly: You can’t hit somebody with two weapons at the same time. So you’ll use one two bind the others weapon (parry) and attack with the other one. And where’s the advantage in that? You could do it with a shield as well.

Of course, if your opponent only has a one-handed weapon and no shield, you will have an advantage (or no disadvantage, if the other also uses a second weapon).

Dual wielding is inferior to anything but single-handedly wielding only one weapon.

Q: If I had a blade on the other end of the weapon could I hit the enemy with it?

A: Yes, as long as the blades are short (or just a pointy bit), and the stick is long, it makes perfectly sense. If not, the blade on the other end makes it impossible to fight with others alongside you, and it makes you loose momentum and control because of the counterweight.

So these things that are basically two swords attached to a hilt in opposite direction are completely useless. Unwise.

Q: What about the difference between a longsword and a broadsword?

Actually, “longsword” does not exist. “long sword” does, and it refers to a small late medieval two-handed sword, with the size about what you can still carry on the hip. In the 19th century misnamed as “bastard sword” or “one-and-a-half-hander”.

But the broadsword is a term used to distinguish it from the smallsword in the 17th century. Both broadsword and smallsword have about the same length (around 1 meter) and the same weight (around 1 kg). The blade of a broadsword is just so much broader and thinner. It probably has some implications regarding bigger wounds inflicted versus reduced capability of piercing armour compared to the smallsword.

Unless your setting incorporates smallswords, forget about broadswords.

Q: How do you carry a weapon?

A: On the hip. And if its too long, on the shoulder. Yes, that’s it. Apart from small weapons in you boot, throwing knifes on your arms or chest and other things like that, you carry it on your hip. Even quivers, unless you’re a native American. And you don’t carry weapons on your back you intend to use, because you wouldn’t be able to draw them.

Yes, you could draw some short sword or machete from your back, but then, while you’re drawing it, you’re wide open to attack. There’s a reason nobody ever did that in history.

Q: How are quality differences in arms and armour expressed?

A: Basically, it varies with a) the materials and b) the techniques used to process these materials, and both tend to get better with time (unless suddenly constrained by financial or logistical questions).

Useable materials for weapons are wood (sharpened stick, hardened in fire), flint, copper (yes, there was actually a “copper age”) bronze, iron and steel, plus maybe some mythical metals such as mithril. For armour it’s leather, wood, copper, bronze, paper, cloth, iron, steel (with leather and copper so bad, you don’t want it).

The general mechanics is this: It must be workable; it should not break; it should be able to have an edge; it should keep an edge, it should not bend and stay bent, it must have the right weight. You can’t really have a sword of a material that has a totally different weight unless you make it smaller or more massive. Since weight and possible damage are mostly fixed by the form the product takes, you need to differentiate mostly on durability. Which of course is more interesting for armour, because there it also impacts the protection it offers.

Usually the one that matters is iron and steel.

And there’s a huge variance between different things made of steel. Depending on the techniques used (and whether the ore found already contained the right traces of other elements and carbon) you get from rather soft (Roman lorica segmentata) to incredibly hard and resilient (gothic plate armour).

So rather than invent a plethora of new materials, just add techniques (look for “damascene steel”, “crucible steel” and “wootz”) or flowery names of where the steel (or even the product) should come from. It was even common to refer to the workshop. So a “Helmschmied breast plate” or an “Ulfberht sword” might be rather exquisite.

With armour, you could also conflate several layers of armour that was worn above each other at various times: tunic and unriveted chain mail, tunic and riveted chain mail, tunic and lorica segmentata, gambeson and chain mail, gambeson and chain mail and coat-of-plate, light gambeson and chain mail and brigantine, light gambeson and chain mail and (soft) full plate, arming doublet and (hardened) full plate. You get the picture.

Q: But a bronze weapon will cause less damage than a steel weapon?

A: No. Bronze is soft and can be ground to an extremely sharp edge in a very short time. Which it will also loose rather fast. It tends to bend and can’t be worked into very long shapes, which is why bronze axes are more interesting than swords. But against flesh, the effect of a bronze weapon is the same as if it was iron or steel.

The thing changes very much when it comes to armour. A bronze edged weapon goes through leather like butter, has troubles against bronze armour and can’t do anything against anything made of iron (except battering; which incidentally works also extremely well against bronze armour, nicely against iron and soft steel, and not at all against hardened steel).

Q: Leather armour is bad?

A: Well, it’s not armour in most cases, since even stone weapons cut through it nicely, let alone bronze weapons or even medieval eating knives (yes, I rammed an eating knife through 1cm so-called cuir-boilli with ease). It’s one of these fantasy roleplaying-game myths.

Leather was used within armour, though, as carrier for riveting on small metal plates for instance, and sometimes also to cover these up (leading to something which looks like leather with rivets on it).

Just don’t use it; if you need light armour, go with gambesons or other armour made of layers of cloth, or with only parts of armour. A gothic breast plate and an open helmet don’t inhibit any movement, do not make noise (even less than leather would) and they weigh about 4kg, respectively 2.5kg, but they protect your vitals.

Q: Can I swim with armour?

A: Basically, no. Wearing chain mail, you’re 8-20kg heavier than otherwise, and most people can swim only 2-4 meters with that. Plus there’s probably some gambeson beneath your chain mail. With gambesons alone, in the league from 4-8kg, your chances are better, you might get some 50 meters until any trapped air has gone out and the whole thing starts sucking up water.

The useful thing to do is to get rid of armour while you’re sinking, which actually might be possible with chain mail or gambeson (although you need to loose your belt), or some parts of plate armour (neither shoulder nor arms and legs probably).

Pictures from the late middle ages show soldiers swimming for an attack in their underpants, shoes (they’re rather light: my reconstruction half-high boots are 480g each) and hats, with their pikes(!).

Swisscom Peering Policy Perversions

Wednesday, May 21st, 2014

Was ist ein Peering?

Wenn man von einem Internetprovider Daten zu einem anderen schicken will, dann geht das an erster Stelle über einen Upstream, einen grösseren Internetprovider an dem andere Internetprovider angehängt sind. Diesen Upstream bezahlt man.

Ein Peering ist nun, wenn man eine direkte Leitung zum anderen ISP einrichtet, und allen Traffic vom und zu diesem ISP (aber nur den) direkt darüber leitet. Dies geht relativ kostengünstig wenn man bereits im selben Datacenter Infrastruktur hat, und es gibt Vereine, hier die SwissIX welche die gemeinsame Infrastruktur (die Switches) in diesen Datacentern betreiben.

Mit einem Peering sparen nun beide Seiten Upstream-Kosten, und die Kunden profitieren von kürzen Pfaden, also schnellerem Zugriff. Es ist also in den meisten Fällen eine Win-Win Situation.

Es gibt vereinzelt Fälle wo der eine Partner mehr profitiert als der andere, typischerweise profitiert dann der der mehr Daten saugt als er liefert.

Swisscom saugt

Die Swisscom ist einer der grössten Endkunden-Provider der Schweiz, und damit auch einer der grössten Empfänger von Daten. Man würde nun erwarten dass die Swisscom ein sehr grosses Interesse daran hat zu peeren, speziell mit Providern deren Kunden bei Swisscom-Kunden beliebte Seiten anbieten.

Stattdessen verlangt die Swisscom eine monatliche Miete. Mit anderen Worten, die Swisscom spart Upstream-Kosten, die Kunden der Swisscom haben besseren Zugriff auf Webseiten, und die Swisscom lässt sich das auch noch bezahlen.

Der andere ISP spart etwas Upstream-Kosten, und drückt dann stattdessen gleich wieder Geld an die Swisscom ab. Finanziell kann das nur bei sehr grossem eingespartem Datenvolumen funktionieren; wenn die Einsparungen grösser sind als die monatliche Rente an die Swisscom.

Der einzige Grund weshalb das funktionieren kann, ist dass die Kunden anderer ISPs, die Webseiten anbieten, ein Interesse daran haben dass ihre Seiten schnell bei den Swisscom-Kunden ankommen. Und dieses Interesse haben sie, weil die Swisscom einen Grossteil aller Endkunden bei sich angehängt haben. Ein sehr deutlicher Missbrauch einer marktbeherrschenden Stellung.

Tatsächlich haben sich auch schon Provider in der Schweiz dagegen gewehrt, z.b. hat Init7 einen Teilsieg gegen die Swisscom errungen. Aber dass die Swisscom immer noch für Peerings Geld verlangen kann, zeigt deutlich dass da von Wettbewerb keine Spur vorhanden ist, und die Swisscom nach wie vor bereit ist ihre Kunden, und die Qualität deren Internetverbindung, gegen kleinere Internetprovider auszuspielen.

Die Verlierer dieser Monopolrentenpolitik der Swisscom sind die anderen Internetprovider, deren Service anbietende Kunden, und die Kunden der Swisscom.

A Guide to Movie Encoding

Saturday, April 26th, 2014

This is a guide to encoding and recoding movies, mostly on Linux, and also partly a rant against the most egregious practices.

I’m talking of encoding here, but actually, just about all the sources you can get movies will already be encoded, be it DVDs, bluerays, modern cameras or files. Very rarely you will get an unencoded stream, e.g. from a VHS. So all this applies actually mostly to re-encoding.

Also, being on Linux, one of the main requirements is that all the formats are supported by open source software. I don’t care about any possible patent-violations, because those would involve software patents, and these would haven been granted illegally anyway.

The tools used and denoted by fixed font are Linux commands or Debian/Ubuntu packages; but most of the software is available on other platforms as well.

Use the source

The quality of the encoding relies most heavily on the quality of the source you have. The more artifacts — no matter where from, be it from the actual film, dust, scratches, the projector, the camera, the VHS-drive, or the more modern electronic encoding-artifacts — the bigger the encoding will get to retain the same quality as the source. Some of the worst things I’ve seen are early black and white movies with loads of dust, scratches and grain.

Basically, artifacts increase the entropy, and the more entropy the less compression is possible.

  • Use the best source available. Usually blueray, unless the producer just interpolated from a DVD, in which case adjust the resolution back down to the DVD level, usually 720 wide (but 704 or 352 is possible).
  • Codecs matter. Some are notoriously efficient at encoding artifacts, that any re-encode will actually increase the file size. DIV3 is one such.
  • Otherwise you might gain from 20% to 50% by re-encoding DIVX, XVID, DX50 with a better codec, with no loss in visible quality. And of course, with MPEG2 from DVDs you can gain around 80-90% space, and with MPEG-4 AVC or VC-1 from bluerays, around 50-80%, depending on your quality needs.
  • Generally, a 500MB file encoded from a blueray will look much better than the same 500MB file encoded from a DVD, at the same resolution. Actually, you might even get a better resolution from the blueray, at the same file size.

Acquiring target

For the target, there are basically three factors that matter in the overall quality: container, codec and encoder. Apart from resolution, of course, but there the maximum is dictated by the source.

  • Container is easy: It must support multiple audio streams, multiple subtitles, preferrably in textual format (e.g. srt or ssa), and metadata, preferrably also cover images. This Comparison of container formats makes clear this is Matroska, probably followed by MP4.
  • Codec is a bit more tricky. But basically, you want one of the newer ones, they’re offering consistently better quality at lower file size. Which about leaves H.264 and VP9. You probably want H.264, Bluerays already mostly come in it, so do youtube-videos nowadays.
  • Stop using DIV3, DIVX, XVID, DX50 right now. They’re vastly inferior compared to what modern codecs deliver in half the filesize.
  • Audio codecs don’t have a large influence on file size, But as AC3 can’t do VBR, you don’t want that, and MP3 can’t do more than 2 channels. That leaves AAC and Opus as viable options, which happen to be the defaults to go with H.264 and VP9 respectively. Don’t use AC3, and don’t use DTS, both are obsolete.
  • Fortunately, handbrake-gtk already comes with H.264 and AAC as defaults, you only need to set the container to Matroska, and you’re good. A quality factor RF of 20 is usually good; 25 is still acceptable everything more is visually bad.
  • If you’ve already got a load of MP4-files encoded with H.264 and AAC, mmg (from mkvtoolnix-gui) can rewrite the container of the file to Matroska without re-encoding. And it also supports adding more audio-tracks, subtitles and image-attachements.
  • If you want to reduce the dimensions of the movie in order to reduce filesize, don’t go below a width of 720, Actually, rather reduce the quality somewhat before reducing dimensions, the visual impact is less noticeable.
  • Don’t ever go for a “filesize of 700MB”, that’s just stupid. Nobody wants to put a movie on a CD (and actually most people wouldn’t, even 15 years ago).
  • But be careful about filesize. Sadly, there’s still VFAT filesystems out there, which can’t contain files bigger than 2GB. some of them used by todays “Smart” TVs.

Dub stands for Dumb

There is only one reason for dubbing a movie — making it available to children who haven’t learned to read yet, and to the illiterate.

  • Whoever, ever had and has the idea to voice-over instead of just leaving the original language alone and subtitle it, is a total moron. And so is everyone encoding a movie with such an audio track. However, it is acceptable to voice-over parts with foreign speakers in documentaries (but not the whole documentary!).
  • If you still want to encode a dubbed audio track, make sure to also include the original language track. If it’s not possible with your container format, you’re using the wrong one.
  • Since not everyone is expected to read every language, include all available subtitles. Again, if your container doesn’t allow that, you’re using the wrong one
  • Hardcoded subtitles (within the movie stream itself) probably means you’re either a moron or using the wrong software. It’s only acceptable if the source had them too.
  • Those pesky vobsub-files, which are actually (mpeg-)streams, can be OCR’d to textfiles (srt, ssa) with vobsub2srt. Whatever vobsub2srt cannot recognize can be OCRd with SubRip (works with wine), for instance, but it will require heavy work. So you would be better off either to get them from opensubtitles.org or just include the vobsub.
  • Subtitles that are out of sync can be fixed with subtitleeditor. If they just start late or early, you can also just set an offset within mmg (from mkvtoolnix-gui)

Finishing Touches

After having a decent file, you might want to add metadata and (if applicable) cover-images.

  • The minimum metadata you need to provide is title, year and director (yes, there are at least two movies with the same name, published the same year).
  • If the movie is a known published one, can fetch the metadata, and my nfo2xml can convert it into a Matroska meta-data xml which can be muxed in with mmg.