Click here for the larger version.
All images courtesy of giphy.com.
I’ve updated and elaborated my “eat/mate/die” simulation. In the previous version, creatures would eat food, mate, reproduce, and eventually die of starvation or old age. My new version has a number of new features, including social class, private property, farming, and an online mode that runs indefinitely.
You can see the new version at tinyurl.com/samsim. This version is seeded from code that’s running indefinitely on a node.js server. Multiple users can connect at the same and they should see the same thing.
You can also take a look at an “offline” version here: tinyurl.com/samsim2. The offline version let’s you refresh the page to generate a new simulation.
The code is over on github.
I ported my original Processing code to javascript with p5js to allow the simulation to run in the browser. Then I split the code into a client and server application in node.js. Now the simulation runs indefinitely online with hosting from nodejitsu. When you connect to tinyurl.com/samsim, the client downloads the current state of the simulation from the server, and then receives periodic updates. There are still some issues with syncing – you may notice the simulation “jumps” periodically as it’s re-synced.
I’m really interested in working with (and possibly on) P5.js, a new port of Processing to Javascript. Here are some ideas I have for P5.js projects.
A persistent simulation, visualized with P5.js
I’d like to continue working on my “eat/mate/die” sketch, expanding on three or four aspects of the project.
1) Add more simulated behaviors:
2) Use the behaviors to tell stories in text. I’m already logging important life events for each creature, so I would just need to expand on this feature.
3) Create a persistent world by sticking all the code on a Node.js or Meteor server, and then write a client app in P5.js. The server and the client could share code since they’d both be written in Javascript. Ideally the server would run the script indefinitely, continually evolving the world.
4) If possible I’d also like to add the ability for users to interact with the world, likely by manipulating the environment to either help or hinder its inhabitants. Individual users would wield powers over the world in a kind of pantheistic sense – each in charge and able to manipulate a different a aspect of simulated life.
A library of important (to me) texts, illustrated with animated gifs.
I started this off already with this sketch of the Communist Manifest. I’d like to continue the project, by 1) porting my code to P5.js so that it can live online and 2) gif-ifying other texts, but with a different look and feel for each one. Possible texts by: Kafka, Spinoza, Foucault, Artaud etc.
Port The Nature of Code to P5.js
It would be great to port over all the examples from Nature of Code to P5.js.
Here’s a little program that:
I’m using the giphy api to source the images, and the Communist Manifest as the text.
[vimeo http://vimeo.com/78612357 w=640]
I broke the work up into two scripts: one that breaks apart the text, finds the images and then creates a csv file of the words associated with image urls. The second program reads the csv file and displays the images/text. I wanted to use animated gifs rather than static images. To get this working in processing used the gifAnimation library. The only problem with this library is that the images load one at a time, which blocks the sketch from running smoothly – so I implemented some threading to make the library load the gifs asynchronously.
My code is here on github: https://github.com/antiboredom/gif-to-text
UPDATE: html version here.
Here’s some video documentation of my Memento Mori project. Pushing a button opens a box which then provides a highly specific fortune.
[vimeo http://vimeo.com/78491745 w=640]
I’m using a standard servo screwed to the bottom right side of the box to open the lid (I had to upgrade from a micro servo which wasn’t powerful enough). Once the box opens a fortune prints out using a thermal printer.
My initial goal was to have hundreds if not thousands of fortunes, stored on an SD card. Unfortunately I had some difficulty in getting the card reader working with Arduino, so I resorted to using the flash memory of the microcontroller itself – a technique I learned here.
My other challenge was hooking up enough power to the system. I wanted to power everything with batteries, but was having trouble providing enough current for the thermal printer to output anything. I tried connecting some 9V batteries in parallel but it didn’t quite do the trick and also made the batteries dangerously hot. This is definitely an amateur issue… I ended up powering the printer with an adapter and the arduino with a 9V.
I sourced the fortunes from New York Times obituaries. I wrote a little script using NodeBox’s Linguistics library that alters texts by switching sentences from third to second person, and changes tense from past to future. I edited the results to produce the fortunes:
The arduino code for the project is here on github: https://github.com/antiboredom/memento-mori-box