Posts

Scroll for yourself

Image
Many of the apps we are enticed to use have a feature of scrolling down a feed. It's an almost mindless activity which due to the intermittent variable rewards principle is addictive in nature. It is now a well known fact thanks to documentaries like the social dilemma on netflix that these feeds are engineered to captivate you attention. There is a phrase that I like “ If you are not paying for it then you are the product ” which applies to these free services we use every day. Facebook’s consumers are not the people who scroll down their news feeds for hours at a time, the consumers are the advertisers who pay facebook to promote their posts and place the adverts. What those consumers are paying for is the attention of the mindless scrollers (myself included). I turn to mindless scrolling when my mind is particularly weak, when I’m too tired to do anything useful. When it isn’t the right time of the day to just have another coffee so as to do...

THREE.js: minecraft in a weekend

Image
I have been enjoying exploring the ideas behind procedural worlds and in a previous post even showed a simple voxel renderer based in THREE.js which would load chunks when the camera got close enough to the edge. That was based on the great tutorial here which explains how to create a voxel-based mesh in THREE.js such that it doesn’t use all of the machine’s resources for the smallest of worlds. I found that to be an invaluable source of information and continually referenced back to that throughout the weekend. Looking back at my git logs for this project to be able to type this up, I have no intention of this post being a tutorial in itself, my progress was as follows: Walking around rather than observer view Sideways collision detection - not walking through the map Changing to a system where there was a sensible grass - sand - water height system Adding trees Another optimisation for terrain generation in addit...

A failed attempt at yielding rivers from gradient noise

Image
From the jsfiddle here I have done a previous post on gradient noise , explaining my realisation at why the equations involved are what they are. Hydronics are notoriously challenging in procedural landscapes because very few realistic ontogenetic algorithms exist. The solutions employed by the likes of dwarf fortress is to run calculations based on a path at different levels of detail down from the mountains to the oceans. Given that gradient, noise is so-called because it makes use of gradients and from the simplicity with which beaches can be generated I wondered if a simple -1/a trick would yield path perpendicular to the beaches - a river? The reasoning behind -1/a is that if you have a gradient on a graph, say “a” from a line ax+b, if you want a perpendicular line, then the gradient will be (-1/a). Following this reasoning, and the fact that we have the gradient at each point, I attempted to calculate the negative inverse of the gradient, which ended up being fiendishly complicat...

The computer should be working harder

Image
 Computers are cheap, well compared to developers anyway. The developers time is expensive, this is why although computational power has expanded exponentially, the user experience of simple programs like the word processor has stayed relatively the same. What windows xp managed to do on a 300mHz chip was quite astounding. Nowadays you will not get away without using a 1GHz chip and if you don’t have multiple cores and giggs of ram forget about being able to run a word processor. I’m editing this post in google docs, and this helps make my point. When you used ms word on windows 95 or xp the word processor was written in C. The elements were optimised to run on x86 32bit processor. That took a lot of effort, the memory had to be managed by the developers as is the case in C. You had to malloc some memory into existence for only the time you needed it and you needed to make sure you unallocated it as soon as it was no longer needed. 128mb of ram is not much to work with after all, n...

A desert in a sandbox

Image
I have written a few times on world generation [ 1 , 2 ]. A particular interest of mine is the ability to really use the infinite world that it is possible to create with algorithms to create something more than the imagination that is put into it. Ideas which generate something which is more than the sum of it’s parts are the holy grail of ideas. General relativity was this in physics, with relatively little experimental input, a huge amount of predictive power was created. This is the case for games where the terrain is generated procedurally. The developer of the game does not need to design each bit of the world for it to emerge as a huge, possibly infinite world. The problem with these worlds such as Minecraft is that although they are very large in size, they are limited in kind. Minecraft for example uses the concept of biomes. Each has to be developed and tested individually by the developers, making the systems take longer to build and all the surprises are manufactured....

A mathematical spell check

Image
As a dyslexic, I rely heavily on spellcheck to correct my writing and put it into a readable form. I heavily rely on a similar checker when writing code, paying close attention to use before declaration errors that might indicate that I have misspelt something. I also have spellcheck on in vim, which checks snake case words individually! I don’t however have the same thing for mathematics. Notation can be incredibly powerful. The best notation is that where it makes it clear when you have done something wrong. Or better still doesn’t allow you to do anything wrong. When writing long equations I often miss a sign in one place or another, manipulate them wrong and generally propagate these errors until I find a result which doesn’t make sense. I wondered if there was something simple I could use, that would not be any more time consuming than writing the equations out by hand, that would act as a “spellcheck” for my manipulation of equations. I use a lot of equations on this blog ...

My memory is in the clouds

Image
How I tried to get my google assistant to remember things for me. I have recently bought a couple of google home devices for my flat and I find it really nice to be able to interact in a way that doesn’t require my eyes to be open. I find I use the one on my bedside table most, asking it to turn off the lights and play music before I go to sleep. This way I can control the music, volume and lighting while I’m dozing off to sleep. The most common question I ask it though is for the time. As strange as it sounds when every device has the time in one corner or another. If I look for the time on my phone, I am so often distracted by other notifications which end up in 5 minutes of being on my phone, one distraction after the next. At night the brightness of the screen is unpleasant. I don’t have too many smart devices besides the bedside lamps in the flat and so what would make the google home most useful for me would be to program my own little conversations with it. One simple one that I...

Popular posts from this blog

Greedy meshing in javascript

A world of joins

Sortis - A paper empire game