Posts

Showing posts from January, 2012

Distributing your app with sources

Ever wanted a super-easy way for including the sources of your program into your distribution?  SBT  makes it possible with just one line: unmanagedResourceDirectories in Compile += new File("src/main/scala") And now, after you run "package", all your sources would be placed alongside with compiled classes in the .jar.

Algorithm to create realistic forest

Image
I am doing some funny spare coding these days (while getting used to emacs) - and in the picture above you can see one of my projects. I call this "Rangband" - a simple clone of Zangband, actually. But it seems that Zangband (the best crawl rpg I saw) and ToME (the crawl rpg with the best story setting) are out of active development, and also they are buggy as hell. So I set off to write a small clone, just for my fun. As for now, there is only auto-generated forest, moving character (@), and line-of-sight and fog-of-war calculations. First thought for generating forest is just to spray objects all over the map randomly, but that generates true chaos. And I wanted some clearings and thickenings in my forest, so I decided to trim that chaos a bit. It turns out that if we run this chaotic forest through just one iteration of modified  game of life  algorithm, we will get exactly what we want (or I want :) You just need to remove all trees that have less than three...