Fantasy! OSG Weapons and Armors House Rules

Note: I own Fantasy! OSG 3.0 in Swedish. I write this article in English. I may use the wrong terms/translations in English.

I got the Fantasy! Old School Gaming roleplaying game. I have not tried it yet, but I can immediately see that there are things (about combat) that I don’t like: Armors and Shields are way too good!

Too good for what? I see Fantasy! as a simple, fast to play, fun game that does not attempt to be realistic but rather a simple framework for roleplaying. Thus, I think the rules should stay in the background. I think

  1. experience (the character) should matter more than the equipment
  2. equipment should rather be part of the story than subject to optimization

Suggested House Rules

Each champion has two pools of dice in combat:

  • Attack dice: Strength + Weapon Skills
  • Defence dice: Dexterity + Dodge Skill

Just as in the original rules Attack Dice can be used defensively (I think there are dedicated defensive dice, like the dodge skill, in the original rules).

These things reduce Defense dice (to a minimum of zero):

  • Armor Abs
  • Weapon Damage above +1

So, for example, with Abs=2, and Damage=2, number of defence dice are reduced by 3 (to a minimum of zero).

Armors gives Abs as:

  • 1: partial leather armor
  • 2: Partial metal armor
  • 2: Full leather armor and helmet
  • 3: Full metal armor and helmet

Weapons give damage as:

  • 1D : Unarmed
  • 1D+1: Small weapon (dagger)
  • 1D+2: One handed weapon
  • 1D+3: Two handed weapon

There is opportunity for weapon variants:

  • A long sword that can be used either with 1 or 2 hands
  • A monk may be agile with his staff and use it either as +1 or +2

A Shield gives extra 1D defence, to a minimum of 1D.

Two weapons (with the skill) gives the choice between +1 damage or 1D defence.

Analysis of Original Rules

How unbalanced are the original rules really? Assume we have two simple characters in a duel:

  • Strength: 4
  • Sword +2 (this is from Fantasy 3.0!)
  • Dice: 7
  • Damage: 1D+2
  • HP: 9
  • Armor Abs: 0

It can not get more normal or ordinary than this. I programmed a simple simulator (link) and found that in the above case:

  • 13% chance of ending in a draw (both dies / reaches 0 HP)
  • 43% for each champion to win

Lets equip one champion with armor (+2):

  • Armor: 77% win, 8% draw, 14% lose
  • Shield: 70% win, 13% draw, 17% lose
  • Armor + Shield: 89% win, 5% draw, 6% lose
  • Armor + Helmet + Shield: 93% win, 3% draw, 3% lose

The champion without armor and shield can have no use of his free hand or the fact that he is not encumbered by an armor.

I don’t know what it is like to fight in a real armor. But I know what this does to storytelling and roleplaying: if combat is fairly common in your campaign, everyone will look more or less like knights quite soon. Perhaps in a larger group a ranger with a bow can survive.

There is no room for agile monks, barbarians or rouges who avoid being hit (there is a skill Dodge, which can be used regardless of armor, and regardless of your Dexterity ability).

Reasoning behind house rules

I would rather see a combat system where

  • Skill of champion matters the most
  • Equipment is mostly a matter of risk/reward, not just better/worse
  • Light armor also works

So, I want to simplify and balance equipment (armor, shield, weapon) for Fantasy!. Let us go back to the case above, without any bonus. Our champions have:

  • Strength: 4
  • Dice: 5 (unarmed Boxer)
  • Damage: 1D
  • Armor: 0
  • HP: 9

This gives each champion a 46% chance of winning. Fair enough.

If one of the champions receive bonuses, how does that changes his chance of winning:

+1+2+3
Dice617179
Damage546164
Armor Abs586980
Dice + Damage688188
Dice + Armor Abs718694

The conclusion is that Dice and Armor ABS are more important than Damage. Armor is better than weapons, and armor diversity is larger than weapon diversity (0-4 vs 0-3). A shield is very good.

As a side note, if you equip one champion with +1/+2/+3 damage, and the other with +1/+2/+3 armor, they have the same chance of winning (!).

As another side note: if you have two (or three) opponents Armor Abs will protect against every attack, but your dice need to divided and you can only deal damage once per round.

This table shows what happens to our two sword fighters in the example above as we equip one of them better. Both of them have Dexterity 2 to 4.

Standard RulesHouse Rules
Dex 2
House Rules
Dex 3
House Rules
Dex 4
Armor 277/8/1447/12/2137/14/4938/10/51
Shield70/13/1755/12/3353/14/3253/13/33
Armor 2 + Shield89/5/661/11/2849/11/4050/12/38
Armor 3 + Shield93/3/371/7/2160/7/3348/8/44

With the standard rules, the better equipped champion could expect to win 77-93% of the fights, depending on equipment.

With the house rules, if both champions have a low Dexterity (2) armor and shield is quite helpful. However, Armor 2 completely negates all defensive dice for a champion with Dexterity 3 (the one handed sword negates the last die) and this becomes a particularly bad choice. For champions with high Dexterity (4) the benefit of armor is even less.

This is probably far from perfect, but there is a risk-reward element to it, which I like. Being agile (high Dexterity) is now very valuable (compared to the standard rules). If you are very agile you can kind of do without armor. However, if you are not agile an armor can compensate quite well.

Finally, I can say that my simulator is not perfect and there may be strategical choices to make. Perhaps with Armor Abs 3 you would choose to roll as few defensive dice as possible?

Conclusion

I am arrogant enough to conclude that I don’t even want to try the original Fantasy! combat rules with real players in a real game.

I know the rules of Fantasy! clearly says that the game is not balanced. Fair enough. It is a simple system. But not being balanced is one thing – being tilted and scewed, rigged, is another thing.

I can not imagine that my suggested house rules are worse than the original rules.

Todo

These house rules make some characters weaker (those wo relied on heavy armor and shield) and some stronger (those with high dexterity). Perhaps monsters, beasts and encounters need to be checked and balanced.

I think it is often quite unclear in the rules what happens if skills are raised belong level 1. I could imagine that skill levels above 1 in for example Fencing could give either 1D or +1 damage.

The rules for multiple opponents are dangerous for the lonely champion. In non-combat coooperation lets one character add half the dice from another character. But in combat each champion makes a full attack against the same target, who has to divide his defence dice in three pools.

The number of dice gets quite high for no particular purpose. Each champion rolling 5-6 dice just to see if he gets a better result than someone else rolling even more dice… it makes not so much sense. I could imagine that if both champions have many dice, the dice are distributed over several rounds. Instaead of 7vs9 twice, it could be 3vs4 and 4vs5. That could add a tactical element as well (spending dice fast for an all out attack, for example).

Perhaps my thoughts about multiple opponents and multiple rounds could be combined.

Fantasy! 3.0 Errata?

Jag fick Fantasy! 3.0 i julklapp och det verkar vara ett charmigt rollspel! Jag har läst igenom reglerna och har några frågor som jag inte direkt hittar svar på.

Eventuellt finns vissa svar i de äldre, startreglerna.

(s17) Vandrande Riddare har totalt 17 egenskapspoäng (alla andra har 15). Vad är rätt egenskaper (eller ska det vara 17 av någon anledning)?

(s24) Smyga – är det verkligen ett Fysikslag?
(startreglerna säger också Fysikslag s23, men Smidighet finns inte alls)

(s26) Rollpersonskonstruktion, står att man får 20 egenskapaspoäng att fördela (alla andra har 15).

(s34-35) Ska man slå initiativslag bara i början av striden, eller varje runda?
(startreglerna, s26-27, antyder att det bara är i början av striden)

(s41) Stora vapen: Alla yxor och svärd ger +2. Men ett stort vapen ger bara +1 i litet utrymme. Och ett stort vapen kan inte användas tillsammans med sköld eller ett annat vapen. Finns det någon fördel med att inte bara ha en liten handyxa eller ett litet kortsvärd?
(startreglerna s33 ger svärd och yxa +3, men fortfarande ingen skillnad på en tvåhandsvariant)
(svar på frågan i en tråd jag hittade på ett forum)

(s43) Rustningar absorberar skada, men sköldar ger stridstärningar. Men på s293 står det om dvärgrustningar att de ger 3 tärningar på försvarsslaget. Ger rustningar tärningar, eller har de ABS, eller både ock?
(startreglerna s34 säger att rustningar ger extra tärningar och ABS).

Generellt är det svårt att förstå vad som händer om man har mer än Nivå=1 i en Förmåga. Ex Två Vapen: gör man dubbel extra skada? Får man två försvartärningar?

Recension Stridssystemet

Först ska jag säga att jag skrev ihop alternativa husregler för strid (länk).

Sedan ska jag medge att det är något arrogant av mig att recensera ett stridssystem utan att ha spelat spelet. Men jag har en del erfarenhet, jag vet vad jag gillar och jag vet vad jag inte gillar.

Närstrid, 1 mot 1, följande parametrar är väsentliga:

  • Antal stridstärningar (som kan fördelas som anfall eller försvar)
  • Skada
  • Rustning (ABS, som dras ifrån skada när man träffas)
  • KP (hur mycket skada man kan ta innan man blir medvetslös eller dör.

Jag har skrivit en liten simulator (länk) för strider.

Exempelvis en ULV har ST 9, SK 1T+3, R 2, KP 11

Säg att vi har en rollperson med Fysik 4, Stridsvana, Fäktning och ett svärd:

  • RP 1: ST 8, SK 1T+2, R 0, KP 9

Enligt min simulering har RP1 11% chans att vinna (nu bortser vi från Mana, TKP och ET – de kan vara förbrukade)

Låt oss ger RP 1 en ringbrynja (+2), eller ringbrynja och sköld. Då har vi

  • RP 2: ST 10, SK 1T+2, R 2, KP 9 (ca 30% chans att överleva ULVen)
  • RP 3: ST 13, SK 1T+2, R 2, KP 9 (ca 49% chans)

Hjälm och benskydd ger:

  • RP 4: ST 15, SK 1T+2, R4, KP 9 (ca 79% chans)

Så? Rustning och sköld hjälper? Vadå? Det är väl inte konstigt?

Jo, jag tycker det, jag förstår inte alls hur det är tänkt:

  1. Skillnaden på vapen är väsentligen 0 stridstärningar och 1T för obeväpnad, mot +2 stridstärningar och 1T+2 för rejäla vapen. Skillnaden mellan olika beväpning är alltså 2 tärningar och två skada.
    Skillnaden mellan ingen rustning, och full rustning och sköld, är +7 stridstärningar och 4 i ABS.
    Det spelar alltså mycket större roll vad man har för rustning (och sköld) än vad man har för vapen.
  2. Det finns inga fördelar med ett 2H-vapen istället för en sköld. Ev ska reglerna tolkas som att 2H-vapen har +3 (utom i trånga utrymmen). Så, den som har ett kortsvärd vill nyttja andra handen får alltid 1 extra stridstärning, men med
    2H-vapen: +1 skada
    Sköld: +2 stridstärningar
    Sköld är helt överlägset.
  3. Det finns inga som helst regler om att det är något dåligt med sköld eller rustning.
  4. Den som inte har en tung rustning får inga fördelar alls. Förmågan Ducka är inte villkorad till lätt/ingen rustning. En smidig person kan inte undvika attacker på något vis.
  5. Inte heller med förmågan 2 vapen, är ett vapen i den andra handen på något vis lika bra som en sköld.

Jag tycker att skillnaden på vapen är rimligt liten. Rollfigurens skicklighet är överordnat, utrustningen underordad. Men rustning och sköld!?!

Den spelare som gör en jägare eller tjuv, i sällskap med krigare eller riddare, kommer snart lära sig att sköld och rustning är hela skillnaden, och tröttna eller dö snabbt. Även den som försöker göra en sexig barbar kommer köpa en helrustning till barbaren så fort som möjligt.

Jag tycker detta är det tråkigaste felet med Drakar och Demoner: sköld och rustning betyder allt. I Fantasy! är skillnaden ännu större.

I Dungeons & Dragons (5e) ger sköld +2AC (marginellt, och jämförbart med mer skada på ett större vapen). Hög Dexterity ger AC på samma sätt som en rustning, men hög Dexterity kan inte kombineras med en tung rustning.

Stridssystemet i Fantasy! duger bara om alla spelarna vill spela ungefär samma typ av karaktär, eller om några verkligen accepterar (och dessutom slipper) att bli indragna i närstrid.

Tankar och förslag

Jag måste säga att jag tvekar lite att alls försöka lösa detta. Och jag undrar om någon speltestat med en blandad grupp. Och även om jägare/tjuvar accepterar att hålla sig i bakgrunden, och ingen vill vara halvnaken barbar… på vilket sätt är detta roligt?

Men, spontana tankar:

  • Låt rustningar bara Absorbera, inge extra tärningar
  • Låt hög Smidighet ge extra defensiva försvarstärningar, fast inte i kombination med rustning
  • Nerfa sköld
  • Ta bort hjälm och benskydd (låt dem möjligvis ha något specialskydd mot kritisk skada, eller när man blir medvetslös/död eller nåt)

Men det finns nästan ingenting kvar av stridssystemet efter detta.

Slutsats

Genom att bara läsa reglerna får jag lite blandade känslor inför det här spelet.

Jag kan bara (tyvärr) konstatera att de enkla reglerna verkar ha förändrats från startreglerna till 3.0, utan att ändringarna varken gjorts så tydliga eller passerat korrekturläsningen korrekt.

En del saker verkar verkligen inte speltestat. Eller så ligger det i Old School Gaming att det är upp till spelledaren att bestämma vad som händer när någon får Nivå 2 i Två Vapen. Jag tycker det är konstigt.

Jag är förvånad att man gjort ett spel där rustning och sköld är ännu mer viktigt än i Drakar och Demoner.

Jag förstår att Fantasy! är ett enkelt spel. Det är inte meningen att man ska simulera och optimera. Men då är det inte meningen att man ska behöva göra det heller. Inte balancerat? Nej, ok. Men det behöver ju inte vara uppenbart obalancerat heller.

Earth as a fantasy RPG setting

This post is about using our Earth as a fantasy setting for roleplaying games like D&D or Fantasy!.

The appeal

The appeal with using Earth is that everyone already knows things. Egyptians, the Atlantic Ocean, Samurais, the Church and many other things are already there. If you play in a culture that your group is already familiar with there are symbols that can be used immediately for a feeling of authenticity.

The problems

The most obvious problems are the absence of supernatural fantasy things, and WHEN to set the campaign. I have seen the division of campaigns into Historical, Epic or Fantasy. I want to go for fantasy: there will be dragons, magic, and orcs.

The problem of WHEN is that in the history of Earth, civilizations are emerging and disappearing. And as some empires grew large, nature was also tamed and less land was truly wild and unexplored.

Another problem is unfortunately that there are people who are offended or triggered when something they care about is being depicted in a way they don’t approve with.

The solution (in principle)

We obviously need to rewrite history. Let us say the year is about 1000, but many civilizations and empires remained – smaller than at their peak – and they are now technologically mostly equal. Between these civilizations (and underground) there is wilderness, chaos and evil.

I suppose you need to cherry pick what remains and what was never there, based on what is meaningful and interesting to your group. I live in Sweden and I and my players (sadly) know nothing about the history of Belarus. So I can do what I want with that spot on the map (maybe it is an ancient empire of elves, or goblins). But you may be Polish or Ukrainian and want to center your campaign there, and Belarus has lots of references to you that you care about. Sweden on the other hand can be a land of viking barbarian orcs to you.

Europe Centric A-Z

Here follows short descriptions of countries and civilizations that can coexist. The exact borders matters little to me at this point.

Note that most nations consist largely of wilderness and that both internal and external borders can be quite fluid.

This is Europe centric because it is what I and my group know best. There is nothing right and wrong here – I am just trying to be practical.

The Alps

The naturally protected alps are home to dvarves in the mountains and elves and halflings in the valleys. There are well protected and profitable trade routes going through (and under) the mountains. However, other humanoids and dragons also dwell here.

Arabic Caliphate

Under Islamic leadership and with its political center in Mekka, the Arabic Caliphate is spreading from Southern spain, most of Sahara and northern Africa, around the Red Sea and over Arabic peninsula to the Persian gulf. These are arid, warm lands and its people are mostly fast moving nomads on camels, waging wars on many fronts. Egypt and many fertile settlements on the on the Mediteranean south coast are being proteced and held by the Roman Empire (and Christian allies and mercenaries).

Babylon

Babylon, being one of oldest great settlements, remains on the banks of Euphrates. The persians, romans, ottomans and arabs have all tried to lay hands on this desert jewel but ancient sourcery and powerful allies have kept Babylon an independent city state (effectively ruling the fertile lands around it). This is a melting pot yet an ancient place where culture, traditions, rituals and worship has survived for centuries.

Baltic Nations

The three Baltic Nations are officially duchys of Russia. However, in practice they participate in the Hansa League, and often see themselves raided by barbarians and vikings.

Byzantine Empire

The Byzantine Empire covers Balkans and Bulgaria. It is home to Orthodox Christianty and a remaining part of the once huge Roman empire. On one hand the Byzantine Empire profits from being the crossroads of trade between east and west, on the other hand it struggles to protect all its boarders.

Catalonia

Catalonia has liberated itself from Muslim occupation and since then acted as an independent state.

Denmark

Denmark is a viking monarchy, often at wars with its neighbors. It is a strong agriculture and trading nation and Christianity has made little progress here.

Egypt

The ancient religous nation of Egypt was under control of the Roman Empire for long. However, it regained independence and is strongly allied with Rome against the Muslim campaigns and domination in northern Africa. Egypt is a religous dictatorship ruled by a divine Pharao, with some cities (mostly Alexandria) being open to foreigners and more international and multicultural.

England

England is a Kingdom of wealth and struggle, often at war with its neighbors. The Christian Anglican church dominates, but there are conflicts with other christian groups, pagans, druids and even vikings.

Finland

Finland is the land of Elves in northern Europe. Some towns along the coast have a significant human population and manage trade with Hansa.

France

France is a Christian kingdom, engaged in holy wars far from its own borders, while struggling to stay safe from Saxons, Germanic tribes, and Muslim onslaught in the south.

Germanic Tribes

The lands of Germany and Poland are largely wilderness, inhabited by barbaric tribes (and other humanoids). However, there are smaller kingdoms in these lands, and trade routes going through them.

Greece

Greece, the cradle of democracy, remains. Athens being the cultural and political center and Sparta being the home of the military that has defened the ancient nation countless times. Christianity is tolerated side by side with the old gods of Greece. Greece is also largely a nation of islands with a significant trade and military fleet.

Hansa Trade League

Towns and lands around southern Baltic sea form the Hansa Trade League. This is an economic, but also military alliance, with influence far beyond its member towns.

Holy Lands

Between the Ottoman empire, Egypt, the Persian Empire and the Arabic Caliphat lies the Holy Lands. Christians and Muslims struggle for control of the holy sites, especially Jerusalem. There is obviously room for a jewish aspect, or not, depending on your preferences. Apart from Jerusalem, there are desert city states like Palmyra here.

Iceland

Iceland, populated with outcasts and refugees from Scandinavia and the British isles, is a viking meritocracy and democracy. The Icelandic’s have settlements also in Greenland and Newfoundland.

Ireland

Ireland is a rural and pagan country dominated by druids. In some towns along the south east coast there are many Christians and they serve as intellectual melting pots. Both halflings and elves are common in Ireland.

Italy and the Roman Empire

Northern Italy consists of free city states, advanced in trade, culture and freedom of expression, and melting pots in the crossroads of Europe.

Southern Italy is the core of what remains of the West Roman Empire. There is decadence and arrogance but the empire is rich and with a strong military. However much wealth comes from lands in northern Africa which are part of the empire but now at war with Muslim forces.

Many Romans worship the old gods of the empire, however at the same time the Vatican and Pope in Rome are the head of Christians.

Normandy

The ambitious Normands managed to forge their own kingdom, aspiring to expand over the English channel.

Norway

Norway, the coastal areas, are lands of vikings making a living plundering, trading and fishing. There is not much central government (although attempts are being made). The vast mountains hosts dvarves and monsters.

Ottoman Empire

The Ottoman Empire has internal religious power struggles between different religons groups (both Christian and Muslim). It is a vast country with untamed dangerous wilderness and ambitous rulers struggle to maintain the borders even though they occationally engage in foreign campaigns.

Persian Empire

The Persian empire is ancient vast and complex. Islam is growing more influential.

Portugal

Portugal is a Christian kingdom mostly looking westward doing trade and some warfare in South America. Portugal has a strong fleet and is a strong trade nation.

Romania (Transylvania)

Romania has been part of both the old Roman Empire, the Byzantian Empire and the Ottaman empire. However, dark forces are moving here and Romania now consists of city states and smaller independent nations. However it is well established that sourcerors, vampires and perhaps even priests in unholy alliances rule these lands.

Russian Empire

The huge Russian empire has few borders. This nation upholds civilization in unlikely places. Officially the Tsar rules with an iron hand, but in practice power is given to local lords and the empire is losely kept together.

Chistianity dominates among the elite and in the large cities.

Saxony

Saxons are an old people with a young nation located south of the English Channels. Saxons have been influential in England and they have been at war with all their neighbors.

Scotland

Southern Scotland is a kingdom (Scotland), often at war with England, and often allied to France. Christianity is dominant in Scotland.

Northern Scotland is inhabited by barbarian clans.

Spain

Spain is a Christian kingdom at war with Muslims occupying the southern parts of the nations since over a century. The kingdom has family and political relations to the kingdoms of France, Normandy, England and Scotland but because of the wars within its own borders it has lost position to England and France.

Catalonia has declared independence from the weakened kingdom, yet stands against the Muslims.

Sudan

Sudan and Khartoum are centres of trade between Africa, Europe (via Egypt) and the middle east. Slaves is one of the most important goods.

Sweden

Southern Sweden is a quite rural pagan evolving feudal monarchy. This is a land of mostly wilderness and civilization is centered around some towns. Norse gods are still worshiped but Christianity is growing.

Gotland and the southeast of Sweden belongs to the Hansa trade league, and is a bit more advanced.

Northern parts of Sweden lack government and consists of vikings, barbarians, nomads (samis), dwarves, and other humanoids.

Wales

Wales is druid land, opposing monarchy and Christianity.

Beyond and other Continents

China and India deserves the same complexity, diversity and depths as all of Europe and if you choose to locate your campaign here you probably know what to do. I think of China as en ancient empire, struggling with being united and shattered over and over again.

North America is probably home to elves and native tribes (druids and rangers), and some viking settlements.

South America has its own militaristic empires, and som portuguese settlements.

Africa south of Sahara is a rich land of kingdoms and perhaps even empires of its own.

Japan is an advanced monarcy, quite isolated, but not unknown.

Antarctica has huge potential with ancient elven kingdoms under the ice, and lurking horrors.

Islands

Islands are great opportunities for things more outside the norm on Earth. Svalbard, Corse, Sicily, Crete, Canary Islands and the Hebrides all provide opportunity for extra spicy things.

Monsters and Beasts

Europe can seem crowded. But Africa and Siberia can host wild creatures and dragons that occationally visit Europe and even settle there. Evil humanoids (goblins and orcs) live in forests, mountains and underground.

Religion

I think religion is one of the best reasons to place your campaign on Earth. Apart from the world religions you also have old Norse, Greek, Roman and Egyptian gods, as well as druids and nature worshipping. It is all quite consistent and familiar, with lots of useful references and symbology.

Languages

Not being able to talk to anyone is rarely useful for good roleplaying experience. Latin comes in handy, perhaps in combination with a “common-anglo-germanic” language.

Historic People

I have avoided making references to historic people. I think Buddha, Jesus and Mohammed are needed. I can imagine the french making references to Charlemagne (as former or current king) and why not make references to Ceasar as well?

History

The exact passing of history was, and is, not known to most people or even most historians. You don’t need to know. They players don’t need to know. You can use “I am a direct decendent of Saladin, liberator of Jerusalem” in your game, and the players can believe what they want. Or you can make reference to the 100-year-war-between-babylon-and-persia, if you need to.

Hyborian Age

Was this Fantasy Earth following the Hyborian Age as in Howards stories about Conan? If you want to, it can be a soure of references: ancient artifacts, lost underground cities and Set the snake god.

JavaScript: Fast Numeric String Testing

Sometimes I have strings that (should) contain numbers (like ‘31415’) but I want/need to test them before I use them. If this happens in a loop I could start asking myself questions about performance. And if it is a long loop an a Node.js server the performance may actually matter.

For the purpose of this post I have worked with positives (1,2,3,…), and I have written code that finds the largest valid positive in an array. Lets say there are a few obvious options:

// Parse it and test it
const nv = +nc;
pos = Number.isInteger(nv) && 0 < nv;

// A regular expression
pos = /^[1-9][0-9]*$/.test(nc);

// A custom function
const strIsPositive = (x) => {
   if ( 'string' !== typeof x || '' === x ) return false;
   const min = 48; // 0
   const max = 57; // 9
   let   cc  = x.charCodeAt(0);
   if ( cc <= min || max < cc ) return false;
   for ( let i=1 ; i<x.length ; i++ ) {
     cc = x.charCodeAt(i);
     if ( cc < min || max < cc ) return false;
   }
   return true;
 }
pos = strIsPositive(nc);

Well, I wrote some benchmark code and ran it in Node.js, and there are some quite predictable findings.

It is no huge difference between the alternatives above, but there are differences (1ms for 10000 validations, on a 4th generation i5).

There is no silver bullet, the optimal solution depends on.

If all you want is validation, it is wasteful to convert (+nc). A Regular expression is faster, but you can easily beat a Regular expression with a simple loop.

If most numbers are valid, converting to number (+nc) makes more sense. It is expensive to parse invalid values to NaN.

If you are going to use the number, converting to number (+nc) makes sense (if you convert only once).

The fastest solution, both for valid and invalid numbers, is to never convert to number (but use the custom function above to validate) and find the max using string compare.

if ( strIsPositive(nc) &&
     ( max.length < nc.length ) || ( max.length === nc.length && max < nc )
   )
  max = nc; 

This is obviously not a generally good advice.

Other numeric formats

My above findings are for strings containing positives. I have tested both code that only validates, and code that use the value by comparing it.

You may not have positives but:

  • Naturals, including 0, which creates a nastier regular expression but an easier loop.
  • Integers, including negative values, which creates even nastier regular expressions.
  • Ranged integers, like [-256,255], which probably means you want to parse (+nc) right away.
  • Decimal values
  • Non standard formats (with , instead of . for decimal point, or with delimiters like spaces to improve readability)
  • Hex, scientific formats, whatever

In the end readability is usually more important than performance.

Stress testing with Raspberry Pi

I have a system – a micro service architecture platform – built on Node.js. It can run on a single computer or distributed. It is a quite small system but quite critical that it works correctly.

Under what circumstances would the system fail to work correctly? How much load can it handle? How does it behave under too heavy load?

Stress testing is difficult, and expensive. Ideally you have plenty of test clients simulating realistic usage. It can be done, but often not easily. A simple and cheap option is to run the system on less resources.

My system used to run perfectly on a Raspberry Pi. The tests work fine. I have also kept the integrationtests working (although there have been timing issues). However, the other day I tried to restore production data to the Raspberry Pi, and it failed to run properly. Problems were

  • High latency and timeouts
  • Heavy swapping
  • Escallating retries, making the situation worse

The last point is particularly interesting. Error handling is designed for stability and recovery, but it risks increasing the total load, making the system even more unstable.

I did make the system work on a RPi again, and in doing so I leant about real problems, and fixed them. It is an interesting excersise in finding problems in systems that don’t work properly, and it is a practical way to “measure first, optimize second”.

Does your system work, with a reasonable amount of production data, on a Raspberry Pi?

Old and new Glenfiddich

I was given an old Glenfiddich miniature. It is probably from the 1960s and it has been stored dark and cold.

I bought a kit with the current Glenfiddich line of standard whiskies and made a little tasting. This is what I find about the old miniature.

The color is more pale, which is reasonable given that it the label says it was 8 years old when bottled, and there is no reason it should get darker being stored in a bottle.

A few minutes in the air made the aroma more pleasant. It was still a light, fruity (almost like white wine) aroma – not very different from the 12 YO.

Both on the nose and in the mouth I found the dominant thing to be “jerusalem artichoke”. I occationally find that in whiskies, never in Glenfiddich before, but sometimes in old whiskies.

All the modern Glenfiddich are partly stored on Sherry casks. I think the miniature was not, and I think that makes it taste a bit different.

I think most people would have prefered the 15/18YO to the miniature. But it is a matter of taste. It had not turned bad. If the difference between the miniature and the 12YO is mostly because of different production methods, or 50 years on a bottle, I can not tell.

I doubt this miniature had been a major success if it was sold. Everything was not better in the past, and storing whisky for half a century on a bottle is hardly a silver bullet to fanstatic whisky. Perhaps it give a taste that is hard to find otherwhise.

Linux on Hades Canyon

About a year ago I got a Hades Canyon NUC for Windows and Gaming. I have been happy enough with it to buy another one for running Linux, Xubuntu.

Basically Xubuntu 19.10 works perfectly on the Hades Canyon NUC. It was all smooth, except:

  • HDMI audio is low quality – for me it is acceptable to use the 3.5mm plug instead, but if you want HDMI audio this is bad for you

I think with NUCs Intel has managed to produce computers that are very good, and I don’t really see myself buying any other desktop computers. Why are there no AMD computers in this segment?

Keeping open Whisky bottles

So, you open a bottle of whisky, drink a little now and then, and years later you wonder if it still tastes the same?

Here are my empiric notes:

Deanston 12: One of the bottles is opened since perhaps 2 years, and has been almost empty for months. Head to head, initially, I slightly prefer the old bottle on the nose. But tasting, going back and forth, it is the same whisky.

Famous Grouse: I have a plastic bottle of Famous Grouse with very little left in it. It has probably been open for 10 years. It actually tastes significantly worse – more burning and chemical – than a fresh bottle.

Lagavulin 1984: This bottle has been opened for almost 20 years and there is not much left. When it was newly opened I compared it to a standard Lagavulin 16. Then my experience was that 1984 and 16YO was very similar, but 1984 was a little extra. Today I opened a new Lagavulin 16 and compared to the 1984. The 1984 is much softer, I guess the ABV is lower, and both aroma and taste has a clear jerusalem artichoke element to it. My conclusion is that 1984 is definitely changed, not necessarily for the better, but it is not much worse either. It is still enjoyable (some people would probably prefer it for being softer), it is still a Lagavulin, but it is not exactly the same.

Glenmorangie 10: One bottle has been opened for perhaps 20 years and one is quite recently opened. On the nose, the young one has more of bourbon- and vanilla sweetness, while the old one has more synthetic candy character. The young one is soft in flavour and the old one is rather acrid. Well, the old one still has quality (compared it to a Chivas Regal 12) but it has degenerated a bit (unless Glenmorangie produced in 2000 was rather different from today).

Longrow: One bottle has been open a few years, now with very little left, the other one is just opened for the occation. Color is the same. The new bottle has a more peated aroma, the old bottle is more subtle. Same is true for taste. The difference is very marginal. In the end I am not quite sure there is any real difference, but it seems plausible that the old bottle lost a percent or two, got a bit softer, and lost a little peat.

Simple Vegetable Oil Lamp

WARNING: The lamp prototypes suggested below may not be safe for general use: especially not around children, left unattended, or close to anything flamable.

Oil Lamps

I got a beautiful Oil lamp that I use much.

Oil Lamp

This lamp uses Lamp Oil (kerosene, paraffin oil). When I bought that I was a little chocked with two thing:

  1. The price (compared to vegetable oil)
  2. How seriously poisonous it is (to the point I dont like to handle it, and I wonder if I want it at home at all)

However this “real” Oil lamp does not run well on vegetable oil (I have tried canola oil). It runs for a while but I think the problem is that the viscosity is too high so the oil does not flow properly upwards through the wick as required.

Vegetable Oil

I can buy canola oil for 25% of the price of lamp oil. And it is obviously not dangerous (since it is for cooking). However it is thicker and has a higher flash point. It is also supposed to not burn cleanly (leaving smoke and smell). So I was curious if I could design a simple practical and not too ugly oil lamp for simple (unused) cooking oil.

Skipping the failed designs here are the ones that kind of work.

A can lamp

What you see in the picture are five components:

  1. a metal can
  2. canola oil
  3. a few candlewicks
  4. a metal washer (the flat metal ring with a small hole in it)
  5. a metal “bridge”

placed inside a fireplace. This burns well: no smoke, no smell, burns for hours. I have read that vegetable oil consumes the wick faster than lamp oil. Perhaps that is true, but nevertheless the wick lasts much longer than it would have in a normal candle.

A little bottle lamp

How about moving the metal washer with the wick to a small bottle?

This is a very simple design and as you can see in the (somewhat unsharp) picture it burns nicely. But it only burns nicely for about 60min, and then it burns barely for another 60 minutes and then it dies.

Only the canola oil in the bottleneck is consumed. After that it appears the height difference between the oil level and the washer/fire prevents the oil from ascending the wick (fast enough).

A used candle jar

I tried filling an old candle jar with about 1cm of canola oil, and used a wick and a metal thing for this result.

This burns nicely! The sides of the candle jar does not get very hot, and the bottom of and the oil remains quite cool. The metal thing from a hardware store is obviously designed for another use.

The good thing with this design is that it is simple (jar+metal thing+wick) and that not so much oil goes into the lamp. You can easily reuse pretty candle jars that are already designed for the purpose.

Spirit Burner

I would not guess that most spirit burners (or oil lamps) work well. But SPIRI-1 from Böhm Stirling-Technik works perfectly with canola oil. The good thing is that it is (roughly) the size of a tealight so you could replace your disposable tealights. The bad thing is that it is quite expensive.

Conclusions

First I think vegetable (canola) oil is underestimated for decorative light at home. However I can see that tealights can be sold and managed in a safe way and are easier to use.

It often requires two matches to light the canola, because the flash point is very high. However I think the high flashpoint is also good for safety.

Cheap candles and tealights are made of petroleum and they don’t necessarily burn cleanly without leaving unhealthy particles in the air. I can not guarantee that the canola oil also does not leave any particles in the air, but the oil itself is not toxic at all.

Force Vue Update ($forceUpdate)

Occationally you want to force some part of your Vue application to update. One situation is that I have a “big” web application not written in Vue, and somewhere I add a Vue component. Something in the world around it changes but it is not aware of it, so I want to force it to update.

It seems, the vm.$forceUpdate method is just updating the component itself, and children with slots. I didn’t use slots, and $forceUpdate was useless.

So, if you do myVue.$forceUpdate() without success, try:

    myVue.$children.forEach(c => c.$forceUpdate());

It might do what you want. It did for me.