Friday, May 13, 2016

Continuous logic

Boolean operations where 0 is false and 1 is true can be extended to real numbers between 0 and 1.
Lets take two independent variables x and y.

and their ven diagram of all possibilities

The space of all possibilities adds up to one (because 1 is true),
We can avoid mentioning a, b, c, and d and just work with arithmetic operations on x and y.

not x = (1 - x)
x and y = (x*y)
x or y = (x + y - x*y)
x xor y = (x + y - 2xy)


DeMorgan's laws

x and y = not (not x or not y)
x or y = not (not y and not x)

There is one bug, "x and not x" should be 0 because not x is true only to the degree that x is false, however our formula gives us "x and not x = x - x*x".
Similarly "x or not x" should be always true because "x" and "not x" are exactly complementary. But when we plug it in we get "1 - x + x*x".

The solution is is to disallow higher powers, whenever we see something like x^2 or "x*x" we replace it with just plain x. This works because information from the source x should only be counted once, even if we receive it through two different paths.

examples

x xor y = (x or y) and not (x and y) = x + y - 2x*y
if we allowed higher powers we would have the incorrect result of x xor y = x + y - x*y - x*x*y - x*y*y + x*x*y*y

it works just as well when the two variables are not independent

w = 1/3x + 2/3y
z = 3/4x + 1/4y
w or z = 10/12x + 9/12y - 7/12y*x

Wednesday, May 11, 2016

words vs understanding



The other day me and my girlfriend were in a store buying a lightbulb for an old fluorescent lamp we'd found.  We both knew nothing about fluorescent lamps so we handed it to the clerk and asked him to find the right kind of bulb. When he found the right bulb (a standard 5 watt one)  he remarked that because the lamp was old it was very noisy.  I asked him if it was a ballast problem (when a fluorescent light had flickered and buzzed my dad had said it had bad ballast) he immediately brightened up and explained that it wasn't a problem with the ballast but simply the fact that the old style of ballast was noisier than the new style. After we left my girlfriend was indignant that I knew no more about fluorescent lights than she did but by saying the right words I could make everyone think I did.

Hillary Putnam pointed out that people can talk about things without knowing the details of what those words denote. His example was beach tree. He doesn't know what they look like, and he couldn't pick one out of a police lineup, but he has the verbal distinction and when someone tells him that beech nuts are edible he can pass that knowledge on, even though it has no grounding in his own experience.

From this perspective money serves a similar function in the economy, without money debt is grounded as a specific relationship between people, with money debts can be bought and sold and travel far beyond their original context.
Similarly there are two ways of doing algebra, one is to think about the objects and what operations would make sense on them, another is to move symbols around according to symbol manipulation rules.

Many facts about the world can appear in a languages as rules about how to combine words so that someone can then speak coherently about things they don't understand. There is a fuzzy boundary between pragmatics and grammar.

Citations
Putnam, H. (1975/1985) The meaning of 'meaning' . In Philosophical Papers, Vol. 2: Mind, Language and Reality. Cambridge University Press.

Sunday, December 22, 2013

Challenge curve with glitchy weapons

My old apartment had a facet that always leaked unless the handle was all the way to the left.  My mom's car requires you to jiggle the handle to get it open.  My girlfriend's computer only charges if you press upwards on the connection. Every day we enact the little procedures necessary to get the things around us to work.

Ideally a game gets harder as you progress so it remains fun even with your higher skill level.  Just doubling the numbers doesn't do it, we need to create situations that require deeper tactics to overcome
One way first person shooters achieve this is by starting you off with a weak weapon that requires nothing fancy; you just point and shoot.  Later weapons have limited ammo, slow bullets, cooldowns, short range, ect.  This allows for tactical complexity because the player has to adopt new behaviors to deal with these limitations. But to achieve this they introduce a steady power creep to get the player to move on from the old weapons to the new.

However we can get all the effect of increased complexity without requiring the player to switch weapons if we make items start off easy to use, but accumulate glitches over time.
Imagine the player thinking: "If I circle to the south I can use my wand of  lightening that is stuck on north, but if I dash to that pool of water I can use the wand of fireball that always singes me.  My teleport talisman only work every other try, so if I get in trouble, I need to remember to bail out earlier than usual"

The overall effect will be to gradually build up a more and more complicated system of tricks and usage details until each play-through has a unique set of weapons.  The limits of the player ability would be tested as they try and eke a little more use out of each barely functional item.  And we would not have to have levels or power curves to have increasing challenge.

Saturday, September 8, 2012

substituting skill for stats


In some games the difference between an ax and a sword is statistics; a sword hits for 7 damage every time, while the ax varies from 3 to 10 damage.  As the character gains experience they get a +1 bonus to their chosen weapon.

That is boring.

Instead of axes having different stats than swords, we can make them act differently.  If axes hit enemies on all sides of you when you attack, while swords automatically strikes enemies as you pass by, a skilled axman will learn very different tactics from a skilled swordsman.  This both makes the game more interesting, and gives you skill progression without having to program it into the game.

Games are a process of learning, so any stat that increases over time can be instead given to the player as something to learn.

We don't even need to have the character level up explicitly;  if each run through the game is full of idiosyncratic items that we never see again, then the player quite skilled in the tactics of one play-through, can be a beginner in the tactics of another play-through.  Unidentified items are the traditional way of doing this, but we can also add lots of unusual conditions on items: like a wand of fireballs that fires left of where you point, or an amulet of speed that only works when you are standing in water, and so on.

This may be a confusing post but what I'm trying to say is that the player is constantly learning and getting better at the game, so we might as well take advantage of this by taking things that used to be modeled within the game and giving them for the player to learn instead.

Friday, March 2, 2012

Effects

A lot of the fun in a roguelike comes from new abilities adding tactical complexity. One example is a staff of blinking. In Brogue it allows you to jump to another tile in the unobstructed line of sight. But because monsters obstruct this jump it's not an item that you can forget about and then use at the last minute, instead it adds another tactical consideration that you want to keep at least one line of sight free so you can escape if you need to.
Similarly fire is a great tool, it inflicts severe damage to creatures over several turns and you can light things on fire from a fair distance away. But because some of the terrain is flammable, if you use it at the wrong time you can light yourself on fire, it has limitations that make it more tactically interesting.

For my game I have the self imposed limitation that all items must sensibly fit into the ecosystem. Because of that, some interesting effects are going to be provided by berries.
Here are some that I have so far.
  • Fire seeds: when activated start a flame at that tile.
  • Bomb berries: count down 3 turns and then explode, destroying rock walls and damaging creatures. Good for changing the terrain but if you want to damage a creature you have to plan ahead.
  • Mist spores: creates vision blocking mist to protect you from ranged enemies. Based on summon butterflies from Dungeon Crawl.
  • Gourd: when you first use it it copies an adjacent creature. When you next use it, it releases that creature into the wild. It doesn't allow you to defeat an enemy but it does allow you to change the species in the ecosystem.
  • Healing fruit: It takes the natural healing you would have for the next 50 turns and gives you it all now. If you take 2 in a row the second will not do much because the first already gave you the healing from the next 50 turns and so there is not much left for the second one.
  • Frost berries: freezes a tile of terrain. Creatures skate across frozen terrain in one turn without changing direction.
Some abilities that are too useful to depend on, so the play always has the ability to dig and fill holes and also to mine away dirt walls.

Thursday, February 2, 2012

Farming without grinding

I read an excellent thread on the roguelike development newsgroup titled exploitation and evasion. As one poster says "we can model players as attempting to maximize the probability of winning even when it does not maximize fun." therefore I have a duty to make optimal play fun.
Optimal players are only willing to go to the next level if the reward per risk, on that level is greater than the level they are currently on; even if the rewards on this level are tiny, the greater risk of the next level may not be worth it.
Naturally I want each level of the game to be more difficult than the last and at the same time I want the player to explore the whole game rather then staying on the first level forever.

Since my game is centered on farming, the time spent on a level can be spent growing the resources to make the next level less risky. To prevent a player from camping on that level and farming forever, plants will exhaust the soil, making it necessary to venture further and collect nutrient sources or farm in a new area. A cycle of seasons would further encourage exploration by making times when you cannot gain anything by staying still.

But still, I do not enjoy games where I already know the one thing to do, and the only obstacle is frustration with doing the same thing over and over. Growing things should require at least a little improvisation. The simple way to do this is with pests. Say you are growing some bomb plants and some swarms of beetles keep eating off all the flowers. You can fight off a couple of these beetles at a time, but if you want to grow more than one bomb plant you have to try something different. There are poisonous plants deeper in the dungeon that you could plant around the bomb plants to repel these beetles.

So as production increases in both scale and time there will be decreasing marginal gains. The one remaining temptation for grinding is to collect infinite resources. To prevent this I will have only 26 slots in their inventory, the remaining items will have to be left in stashes. Items not in someone's inventory will be slowly decomposed by microscopic creatures therefore a player cannot spend all their time gaining resources and have to progress in the game at some point.

Saturday, January 28, 2012

Ecologies

Species naturally organize into associations that somewhat resist invasion. This is obviously because species that do not resist invasion do not stick around. An interesting system of ecologys for the game would be ones that are relatively stable until the player disturbs them.

An example of this is this fire based grassland.
The &s are highly flammable bushes
the ;s are dry grass and the ,s are young grass
Gs are grazers that survive on the grass. Not seen are predators that survive on the grazers
Ts are trees slowly invading the grassland.
Because of the presence of the highly flammable bushes, fire keeps the grassland free of trees. But when the bushes are removed grassland turns to forest. Introducing creatures that eat the bushes would create this forest, if not for the high population of predators (due to the grazers) and relative scarcity of bushes. So this system is both naturally stable and disturbable with work by the player.


Slightly different uses of a resource can allow the coexistence of similar organisms.
All four of these species grow inside of walls any only one can live in a wall at a time.
# lichen: spreads by placing seeds onto adjacent walkable tiles which can then spread into walls.
# moss: can only survive in a wall with a face flat to the air. Spreads to adjacent tiles.
$ slime: Wanders orthogonally within the walls until it touches air. When it touches are it spreads into tiles that do not.
# algae: Only spreads in tiles that do not touch air. Doesn't like touching more than two other algae at once.

Moss and algae always win when they fight a different organism for a tile which is how they survive in their more specialized niches. Lichen always loses and compensates by it's ability to spread across air gaps. As I said in my last post, the layout of walls effects the balance between these four organisms which then really changes the resulting ecologies of the species that eat them.