Skip to content

Ecce Signum

Immanentize the Empathy

  • Home
  • About Me
  • Published Works and Literary Matters
  • Indexes
  • Laboratory
  • Notebooks
  • RSS Feed

Month: November 2011

Wikipedia as a Seed for Flash Fiction

2011-11-15 John Winkelman

Lacking for a creative outlet, I recently tried a new writing exercise:

  1. go to the front page of Wikipedia
  2. click “random article”
  3. research/plan for a maximum of one minute
  4. write for fifteen minutes, or 500 words, or one page, or some other arbitrarily small limit

You must use the first random page that comes up, and the subject of that random page must be integral to the story. No picking and choosing.

It actually turned out to be a lot of fun! In one afternoon I wrote short pieces about a coastal town in Kenya, an early 20th century ceramics artist, data compression, and a Dungeons and Dragons version of Hell. All told, a little over an hour of writing. My mind felt limbered up and cleared out. Dusted off, even; like hitting the gym after an extended absence. My favorite part was that it broke me out of my comfort zone. I know next to nothing about Kenya, or ceramics. But that is still more than I knew before I tried this exercise.

In a way, this could work as a brainstorming exercise for an external topic. Trying to fit disparate ideas into a common narrative creates new viewpoints for that narrative. Imagine writing a story about wineries of the Great Lakes region, and when stuck for inspiration, randomly hitting the following five pages: Inger GiskeødegÃ¥rd, Tahuna Breaks, Vincent Hallinan, List of Pittsburgh Pirates first-round draft picks, and Telephone numbers in the British Indian Ocean Territory. For each page, try to fit the the content or concept into the larger narrative. Completely random brainstorm. Let your mind go where it will. At the end of the exercise, go back through and see if there are any useful insights; any new and unusual ways of thinking about Great Lakes wine.

 

Posted in Writing comment on Wikipedia as a Seed for Flash Fiction

Procedural Generation X – User Modified Content

2011-11-14 John Winkelman

Having all the content in a game created dynamically simplifies many aspects of game design. One code base can potentially create an infinite number of unique gaming experiences. However, what if you want to include a save game feature? If the game content is created anew every time the game is loaded, how is it possible to close the game, then pick it up tomorrow without losing all my progress?

Fortunately, the very act of creating locations and objects can be used to allow data to persist across multiple sessions. Here is an example:

Imagine you have created a dungeon crawl in a procedurally generated cave. The player has the option to dig through walls to reach e.g. deposits of minerals. You want to have a save-game feature, but you don’t want to have the caves reset to new every time the game is reloaded.

Every location in the cave has a unique x/y coordinate, starting at the upper left corner with (0,0) and ending at the lower right with (63,63). Each of these points is either a wall or a floor tile. Now here is the brain-twisty part: you don’t need to store the individual tiles of the original state. Every time the tile map is regenerated, it will be exactly the same. It doesn’t need to be stored.

Your character blows up a chunk of wall, say, at (20,20). Suddenly, the tile map has changed. It has history. It exists in a state different from the one which was produced by the algorithm which created it. Does that mean the entire map needs to be saved now? No! The only piece which needs to be saved is the piece which has changed. And this can be done by creating a data file which saves only the changed pieces of the map.

{
x:20,
y:20,
z:0
terrain:0
}

Reading the above data, we can see that the map coordinate 20,20 on level 0 should be to the terrain-type 0. So a workflow would look something like this:

  1. generate the initial map data
  2. look for a save game file
  3. iterate through the save game file and, where necessary, change the tiles.
  4. render the map to the screen

 

Posted in ProgrammingTagged game development, procedural art comment on Procedural Generation X – User Modified Content

Red-Tailed Hawk in Downtown Grand Rapids

2011-11-11 John Winkelman

Yesterday a large red-tailed hawk took a breather on a light pole just outside the Cynergy offices. I managed to grab a few shots before it took off. Clicking any of the photos will take you to the full-sized images on Flickr.

Red-tailed Hawk

Red-tailed Hawk

Red-tailed Hawk

Posted in Photography comment on Red-Tailed Hawk in Downtown Grand Rapids

Rosy Mound Natural Area

2011-11-07 John Winkelman

Bald Eagles

This past Saturday I took a long walk along the beach at the Rosy Mound Natural Area in Ottawa County. The highlight: a pair of bald eagles eyeballing me from a tree at the edge of the dunes. Click here to see the whole set.

Posted in Photography comment on Rosy Mound Natural Area

Away3d and Flash Player 11 – Source Code

2011-11-06 John Winkelman

Here is the source code for the Flash experiment I posted on Thursday.

package
{
	import away3d.containers.ObjectContainer3D;
	import away3d.containers.View3D;
	import away3d.debug.AwayStats;
	import away3d.entities.Sprite3D;
	import away3d.filters.BloomFilter3D;
	import away3d.filters.BlurFilter3D;
	import away3d.filters.DepthOfFieldFilter3D;
	import away3d.lights.DirectionalLight;
	import away3d.lights.LightBase;
	import away3d.lights.PointLight;
	import away3d.materials.BitmapMaterial;
	import away3d.materials.ColorMaterial;
	import away3d.materials.methods.FogMethod;
	import away3d.primitives.Cube;
	import away3d.primitives.Plane;
	import away3d.primitives.Sphere;
	
	import flash.display.BitmapData;
	import flash.display.BlendMode;
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.events.Event;
	import flash.geom.ColorTransform;
	import flash.geom.Vector3D;
	import flash.utils.getTimer;
	
	/**
	 * Cubes01 Stage3D Demo by Felix Turner - www.airtight.cc
	 * Modified by John Winkelman - www.eccesignum.org
	 */
	
	[SWF( backgroundColor='0xffffff', frameRate='60', width='800', height='600')]
	public class Cubes02 extends Sprite
	{
		private var CUBE_COUNT:int = 500;
		private var MATERIAL_COUNT:int = 30;
		private var CUBE_SIZE:int = 10;
		
		private var view : View3D;
		private var cubes:Array = [];
		private var cubeHolder : ObjectContainer3D;
		
		private var theta:Number = 0;  
		private var radius:Number = 150;
		private var orbitSteps:Number = 1000; // number of steps necessary to complete one orbit
		private var orbitSpeed:Number = Math.PI*2/orbitSteps; //amount by which theta will be incremented at each interval
		private var objectInterval:Number = orbitSteps/CUBE_COUNT;	//	distance between objects on the curve
		private var objectPosition:Number;   
		private var direction:Number = 1;	//	or -1 - controls direction of orbit
		public function Cubes02(){
			super();
			
			stage.scaleMode = StageScaleMode.NO_SCALE;
			stage.align = StageAlign.TOP_LEFT;
			
			//init 3D world
			view = new View3D();
			view.camera.z = -1000;
			addChild(view);
			//init object to hold cubes and rotate
			cubeHolder = new ObjectContainer3D();
			view.scene.addChild(cubeHolder);
			
			//add lights
			var light:PointLight = new PointLight();
			light.position = new Vector3D(-1000,1000,-1000);
			light.color = 0xffeeaa;
			view.scene.addChild(light);
			
			var light2:PointLight = new PointLight();
			light2.position = new Vector3D(1000,1000,1000);
			light2.color = 0xFFFFFF;
			view.scene.addChild(light2);
			
			//init materials
			var materials:Array = [];
			
			for (var i:int = 0 ; i < MATERIAL_COUNT; i ++ ){
				var material : ColorMaterial = new ColorMaterial(Math.random()*0xFFFFFF,1);
				//material.blendMode = BlendMode.ADD;
				material.lights = [light,light2];
				materials.push(material);
			}
			
			
			for (var j:int = 0 ; j < CUBE_COUNT; j ++ ){
				var s:Number = CUBE_SIZE;
				var cube:Cube = new Cube(materials[j % MATERIAL_COUNT], s,s,s);
				cubeHolder.addChild(cube);
				cube.x = 0;
				cube.y = 0;
				cube.z = 0;
				cubes.push(cube);
				
			}
			
			//add stats
			addChild(new AwayStats(view));
			
			this.addEventListener(Event.ENTER_FRAME, onEnterFrame);
			stage.addEventListener(Event.RESIZE, onStageResize);
			onStageResize(null);
		}
		
		private function onStageResize(event : Event) : void{
			view.width = stage.stageWidth;
			view.height = stage.stageHeight;
		}
		
		
		private function onEnterFrame(ev : Event) : void{
			cubeHolder.rotationX+=.2;
			cubeHolder.rotationY+=.4;
			cubeHolder.rotationZ+=.8;
			for(var i:int=0; i < CUBE_COUNT; i++) {
				objectPosition = orbitSpeed*objectInterval*i;    //    each object is individually updated
				/*	OBJECT MOVEMENT CODE GOES HERE	*/
				
				
				cubes[i].x = radius * (Math.cos(theta + objectPosition) * (Math.pow(5,Math.cos(theta+objectPosition)) - 2 * Math.cos(4 * (theta+objectPosition)) - Math.pow(Math.sin((theta+objectPosition)/12),4)));
				cubes[i].y = radius * (Math.sin(theta + objectPosition) * (Math.pow(5,Math.cos(theta+objectPosition)) - 2 * Math.cos(4 * (theta+objectPosition)) - Math.pow(Math.sin((theta+objectPosition)/12),4)));
				cubes[i].z = radius * Math.sin(theta + objectPosition) - radius*1*(Math.sin((radius/radius + 3) * (theta + objectPosition)));
				
				/*	OBJECT MOVEMENT CODE GOES HERE	*/
			}
			theta += (orbitSpeed*direction);
			view.render();
		}
	}
}

Most everything is a duplication of a block of code I snagged from Airtight Interactive’s Stage3D vs. WebGL demo. In addition to finally understanding something of how programming for 3d interfaces works, this gave me an opportunity to dive back into some of the trigonometry experiments I built back in the day.

In the code above, look at the method onEnterFrame. In it, inside the for loop, are three lines which update the x, y, and z coordinates of each block. Those blocks have some scary looking math attached to them; lots of sin and cos and radii, and thetas. I cheated – I actually wrote that code almost three years ago for my Simple Trigonometric Curves Tutorial over on Kongregate. X and Y positions are set using a transcendental Butterfly curve. The Z position is set using a variation on an Epicycloid curve. For fun, grab some of the other curves out of the tutorial, and plug them in in place of the current formulae. If you come up with something interesting, post it.

Posted in ProgrammingTagged Flash, procedural art comment on Away3d and Flash Player 11 – Source Code

Away3d and Flash Player 11

2011-11-03 John Winkelman

Butterfly Curve animated with Away3d

Click the image above to launch the experiment. Requires Flash Player 11. May beat up on older computers. A lot.

What you see here is a simple example of what the Flash 11 player is capable of. There are 500 cubes, dynamically lit, moving through a “Transcendent Butterfly” curve on the x and y axes, and a variation of an epicycloid in the Z. The whole formation is oscillating through the x, y, and z axes as well. The little box in the upper left corner shows frame rate and the amount of RAM which the animation is using. I have had as many as 1000 cubes running through this animation but the frame rate dropped down below 30 FPS. 500 cubes is plenty for the moment.

This animation was created using the Away3d code library.

Posted in ProgrammingTagged Flash, procedural art comment on Away3d and Flash Player 11

Procedural Generation 1 – Creating a Cave using Cellular Automata

2011-11-01 John Winkelman

Cellular Automata rule sets are quite useful for building cave-like systems.

  1. Fill a bitmap with random black and white dots. Black represents filled space, white represents open space.
  2. Iterate through the bitmap, applying the CA rules to each pixel
  3. create the updated bitmap
  4. cycle back to step 2, repeat until desired result

The following is the series, from random noise all the way to a completed cave system. Each image is 64×64, though it can easily be scaled up to any arbitrary size. I have found that images at 256×256 and above tend to bog down somewhat, so be careful.

Once you have tweaked the algorithms to get the desired cave design, you may have more than one disconnected piece. There are three ways you can re-connect those pieces to the cave system

  1. go through and eliminate all but the largest open area
    – This might result in a quite small cave, so some experimentation here might be necessary, such as setting an arbitrary number of pixels or percentage of overall area as the minimum allowed cave size
  2. draw tunnels to connect the pieces
    – either find the center point of each piece, and draw a tunnel from point A to point B, or iterate through each point in each open area, find there they are closest together, and connect those points
  3. in multilevel games, connect to the next level(s) up and down. A cave needn’t be only one level.
    – this assumes that the same issue does not exist in the next level up and/or down. An unfortunate selection of initial starting conditions could result in two “silo” caves next to each other, with few or no connection points.

There will be some back and forth between tweaking the algorithm and deciding what makes for the best caves. You can add logic to sometimes eliminate extra rooms, sometimes connect them, and sometimes connect them to the next level.

Of course, you don’t necessarily need to create all of the levels at load time. You can create them on the fly – though this does make vertical connections more difficult. Do some experimenting; see which method works best for you. I suggest always having at least two lower levels created, to reduce potential conflicts when fleshing out the current level.

Posted in ProgrammingTagged procedural art comment on Procedural Generation 1 – Creating a Cave using Cellular Automata

Exploring the Primal Blueprint

2011-11-01 John Winkelman

For about eight months now I have been following a diet and lifestyle plan called the Primal Blueprint. It has many dedicated followers and fervent advocates. Actually, rather than “follow” I would say I fly in loose formation with the Blueprint. I have my lapses – being only human, and living around the corner from one of the best bakeries in the city. Still – my health and fitness levels are much improved, and despite the occasional bag of potato chips for dinner, things continue to improve on a gradual and manageable trajectory. I can fit into clothes that last buttoned in my early 30s, if not earlier. My weight hasn’t been this low, I think, since I began building websites for a living.

I have never been one to follow “a diet”. The path that took me to where I am now follows:

Back in 2007 my brother, his future wife and I road-tripped to Louisiana to visit our dad and spend some time wandering around Mardi Gras. We had a splendid old time, ate tremendous amounts of really good food, and got to enjoy New Orleans when it was bearably hot and humid. Every day brought a new delicacy, and it being Mardi Gras time, we went through at least one full King Cake every day. Add to that all the deep-fried southern delicacies, gallons of beer from the Abita Springs brewery less than a mile from Dad’s house, and, well, a lot more of me came back from vacation than started out.

I didn’t really feel like I had gained weight. My clothes were tight, and I had to let out my belts a notch, but I told myself it was just the winter hibernation metabolism doing its thing. I bought a bathroom scale, found out I weighed around 205 pounds. It didn’t seem like such a big deal; as a martial arts instructor I work out a lot; up to fifteen hours a week in class, plus all my personal training. Still, 205 seemed kind of high.

Thinking back through the list of food on the vacation, talking to my girlfriend, I realized I couldn’t name a single vegetable I had eaten, other than those in the buckets of gumbo or chili, or french fries, or onion rings. That made me feel kind of queasy.

I immediately drove to the store and bought a car-load of fresh (-ish; they were from a grocery store) vegetables and fruit, and started packing bowls of chopped up tomatoes and avocado for lunch at work. This represented a big change from my usual habit of ordering a sandwich nearly as big as my head from the amazing kitchen at Founders Brewing Company, which at the time was one floor down from where I worked. In a surprisingly short amount of time, the weight began dropping off. For a while, it seemed like every other day I would weigh myself and I would have lost another pound. By the beginning of May I was approaching 190. That was when the Fulton Street Farmer’s Market opened for the year. Suddenly I had vegetables in abundance.

At about that same time my girlfriend put herself on a restricted diet, which cut out all refined sugar, corn syrup and wheat gluten. Have you ever tried going out to eat, or buying common snack foods, without getting at least one of those three ingredients? Not easy at all. Here is where I had to begin adding new tools to my intellectual toolkit. Namely, cooking. A random bowl of raw vegetables is perfectly acceptable for a lunch for one, but when it comes to full meals with a significant other, it quickly gets old.

Between the internet and my girlfriend’s stash of vegetarian and vegan cookbooks, we built up a reasonable repertoire of yummy recipes. For me, the weight continued to fall. I got down below 190 for the first time in who knows how long. Finally, I stabilized around 185, with one noticeable dip down close to 180 during a serious bout of the flu.

Life was good. Then I got complacent. Then the weight started creeping back, a pound at a time. Work- and life- related stress made things worse. Over the next year and a half I returned to 195, where my weight stabilized, though a hard weekend of pizza and beer could bring it back up close to 200. And here I stayed until roughly February 2011.

As is usual at the turning of the lunar new year, I had made a few goals for myself. Not resolutions in the sense that I wanted to accomplish this and that and the other thing. More like, these few important things in my life, I want to do a little better. Of course my weight was one of those things.

I don’t remember how I discovered Mark’s Daily Apple, but I had been reading it for a few months. He seemed to really know what he was talking about, and backed up everything with scientific research (from actual scientists, no less!), statistics, and anecdotal evidence from himself and others of a similar mind-set. And his website is the hub of a community of happy, healthy, motivated people.

Anyway: Chinese New Year came and went, it was now the Year of the Rabbit. And I read the story of the Unconquerable Dave. Take a minute to read this one. It is really something.

Re-inspired, I cut way back on the grains and legumes, and ramped up the meat and veggies. Again, the weight started coming off; more slowly this time, but also more steadily. 190 came and went, then 185. Then I got laid off, and my weight stabilized at 185. More free time meant more time to prepare good food, but it also means more time to eat. Took me a little while to find the right balance. I got the food figured out, and the weight started to come off again, still slowly and manageably. Unlike in 2007, I this time I noticed my energy level increasing, as well as the quality of my sleep, and my overall sense of strength and well-being. I don’t know exactly what I did differently this time. Possibly less sugar.

So here I am now. My weight is now stable around 175. I have had to replace most of my wardrobe; three bags of large clothes off to Goodwill, and a small stash of 36″-waist pants for the holidays. I have a new job, and I walk or bike one and a half miles to work every day, carrying an 18 pound backpack. The fresh vegetables are becoming scarce, so I will have to start buying supermarket produce again for the first time in six months. I still indulge in the occasional snack food or pizza, but usually only on the weekends, and always in smaller quantities than before.

So: What do I think of the Primal Blueprint? Here is a list.

1. The food side of the PB was surprisingly easy to stick to, up to about 80%. Cutting out starchy root vegetables, legumes, and grains seriously impacts dining out. So I prefer to show moderation, even in moderation. Having said that, knowing that I got such great results even while not being super-strict gives me more respect for the PB.

2. The exercise/lifestyle aspect of PB – move slowly a lot, sprint occasionally, lift heavy things, get lots of sleep – fits in well with the current phase of my life. Martial arts and the PB complement each other nicely. The most difficult part is “get lots of sleep”.

3. The online community is great! Lots of support from the commenters and posters in the forums. Given the lifestyles of many of the PB aficionados, it feels like a distributed tribe.

4. The information on the site is well documented. Sisson is very good at backing up everything he says with references for people who want to do more research on their own.

So I feel comfortable advocating the Primal Blueprint. It worked for me. A few of my friends have tried it out, and have had great results. I haven’t felt this healthy since I was in my late 20s. If any of my half-dozen or so readers have tried this, post a comment! I am interested in hearing your story.

Posted in LifeTagged food, health comment on Exploring the Primal Blueprint

Personal website of
John Winkelman

John Winkelman in closeup

Archives

Categories

Posts By Month

November 2011
S M T W T F S
 12345
6789101112
13141516171819
20212223242526
27282930  
« Oct   Dec »

Links of Note

Reading, Writing
Tor.com
Locus Online
The Believer
File 770
IWSG

Watching, Listening
Writing Excuses Podcast
Our Opinions Are Correct
The Naropa Poetics Audio Archive

News, Politics, Economics
Naked Capitalism
Crooked Timber

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

© 2025 Ecce Signum

Proudly powered by WordPress | Theme: x-blog by wpthemespace.com