Skip to content

DNA Area Charts

I’m exploring different data representation models for plant DNA data. I want to impart the effects of genetic drift on the carrying capacity of the world. At it’s most basic, we follow a line chart that represents the number of living plants on the planet over time. This will allow users to see the location of the carrying capacity line.

From there we can explore different genetic variables that upon alteration might also alter the carrying capacity of the planet. I’m particularly interested in modeling the sexual maturity age of plants over time, and whether it affects the carrying capacity.

14453900_1375975812420575_2085979332_o

I am exploring using an area chart to model the number of plants over time. The top line represents the total plants, and each stratification of the chart represents the required age for sexual maturity in plant agents. In this graph, three types of plants that mature at age 3, 6, and 10 respectively replace each other as the simulation progresses.

I am still working through how I’d represent the stratifications since there can be several dozen/hundreds of different sexual maturity ages. Perhaps I can represent it with a gradient of colors within the area of the line chart.

You can readily process the changes over time, and the maximum value doesn’t skew your perception of the data with this graph. Though I can see a multitude of maturity ages making this graph too noisy.

Effectiveness of DNA Map

I’m moving on to more formal analyses of the SoilScape simulation. In the past, I utilized maps where the intensity of the color at position x,y imparts the value over maximum ratio of the data point.

Screen Shot 2016-08-04 at 8.26.19 PM

The plant height over maximum plant height

This model was particularly effective at imparting comparative data i.e. this group of plants are taller than that group of plants. The model is not effective however when outliers are introduced.

Screen Shot 2016-06-05 at 1.28.23 AM

Tall mountains wash away good data

In this height map example, mountains have formed that far outstretch the height of their neighbors. These mountains jack up the max value of the height, meaning that color difference of the continents is minimized, creating an appearance of might-as-well-be-flat hills.

Another draw back of the colored map is showing progress over time. The plot cannot impart a time component, as each plot only represents a single day. What makes day to day comparison doubly difficult is that the max values of each day are different. What would the brightest point day 1 might become dark on day 10. Without an inherent numerical scale, it is hard to quantify the data over time.

Managing Packets over UDP

So I’ve worked through a few key roadblocks pertaining to creating a client server experience over udp. First, I worried that if integral packets like game room setup info were dropped then code that depended on it would break. I also worried about how I should structure larger messages.

I will be sending the position and velocity of all the players in the game. Do I send each players p and v as individual messages? Turns out you don’t have to split up messages like that, messages are broken up into appropriate packages on the fly.

To clear up my original fear, packets are continually sent until they are received, and client code is usually set up to wait for the arrival of integral information before continuing by using a request-response pattern.

 

Submodules, Heroku, & Node Modules

I’ve moved my cosmopolitos simulation into it’s own node module! Before I included the simulation files as a git submodule, which worked to a certain extent but made working with Heroku is a pain. Heroku very recently added submodule support, and keeping the submodule up to date and synced within the parent web app seemed like problem I shouldn’t have.

Wrapping the simulation code into a node module makes it easier to add and manage the code. Now, if I want to utilize the simulation as the base for future projects, it’s as easy as npm install soil-scape

I moved all the render and date management code out of the submodule, as how the simulation is displayed and stored is entirely up to the user. My Cosmopolitos web app and a Minecraft modder will have very different needs, though both could use the simulation.

Blind.io Networking API

I’m building a list of events that trigger messages between the client and the server. I have a feeling like this list will grow as I learn what goes into making a multiplayer experience.

Assume all messages included a timestamp

Server Side Events

Every Tick

Scores

All [ int score ]

Wind Direction and Phase

All float phase, direction

Players pos and vel

All [ Float px, py vx, vy ; int id ]

Knives pos and vel

All [ Float px, py vx, vy ; int id ]

Numbers of players in Room

All Int player count, max players

Room

Player Enters Room

All All string playername ; int id

You String ‘You joined the game’ ; [ obstacle ] ; int id

Player Leaves Room

All String playername

Game

Throw Knife

All float px, py, vx, vy ; int id

Knife Collides with Wall

All float px, py ; int id

Knife Despawns

All float px, py; int id

Knife collides with player

All float px, py ; int knifeID, playerID

Player Dies

All float px, py ; int id ; string playername

You int score, string “you lose”

Client Side Events

Every Tick

Arrow Keys

[ <char, bool> keydown ]

Room

Join Room

String room, string playername

Leave Room

String room, string playername

Game

Spawn Knife

String playername ; int id ; Float angle from player

Networking Blind.io

The Dancing Lobsters team and I have decided to develop Blindfolded into a networked multiplayer game. In this new iteration, players will be dropped into a random room in which they will attempt to kill all other players.

For our stack we have chosen to use Phaser for rendering on the front end , and Ruby’s Puma+Sinatra for the http server and game server on the back end.

Because the connection is on the web over a browser, my only option for socketed connection is websockets. Chrome and I imagine other browsers simply disallow raw sockets, so the usual route of unreliable connection through UDP is unavailable.

What I am realizing that there is a great deal of player and network information that must be maintained between the server and client.

The server as it stands maintain a list of rooms that it places players into. When a player connects via a socket he placed into a random room. A onDisconnect() alerts the server when the client has closed out the tab. The problem is, when I receive this notification, I do not know which player left, only which socket disconnected.

I can either assign the socket information to each player  object or I could maintain a table keyed by websockets with player values. Being able to pass a websocket id to a delete function seems desirable, but maintaining the table seems unnecessary. Networked games maintain enormous playerbases, so iterating over the entire playerbase looking for a player with a matching websocket seems dumb, and the constant lookup time of the hash table could alleviate it, but it means having more items in memory. All things to consider.

Plant size and reproductive cycles

In the current model of plant life, plants must reach a genetically encoded height in order to reproduce. Once sexually mature, plants produce S seeds every time they have the required seed nutrient endowment N times the seed count S stored.

Some plants continue to grow continually, think of Redwood forest, and some plants like ferns stop growing. Whether they are genetically encoded to stop growing or the soil nutrients restrict growth is another story.

If we were to introduce a required reproductive cool down, plants who have the required nutrients to seed but are growing their seeds would instead spend their nutrients growing larger and taller. Fertile ground and small seed endowments with low reproductive would be selected for over longer reproductive cycles, as height confers no intrinsic reproductive benefit. If we were to tie the maximum nutrient storage to height however, larger plants would more easily resist droughts of rainfall or soil nutrients, creating a slow pressure for plants to grow taller.

My hunch is that live fast die young plants will die in droves at times of drought, however the slower growing taller trees would not be able to take over fast enough before the die fast plants are able to recuperate and reconquer.

Slowly, the taller plants would be able to take over for the ability to resist environmental pressures. The early stages of plant development would select for live fast plants, giving way to evergreen forests.

Neat.

Do Plants Grow Old?

What is particularly interesting about plant life is that they don’t grow old. There aren’t gray haired willow trees or ferns with walking sticks. Plants can always have more leaves and taller stems.

A human on the other hand, do age and need exactly one heart, two lungs, four limbs, and etc. Unlike plants, who can have as many leaves as they can, humans cannot have multiple hearts. Thus, wanton growth in humans is deadly. Those humans who could not stop this growth died of cancer.

To prevent this gruesome double heart death, organisms that had a recipe for limbs and hearts evolved a limit to the number of times a cell can reproduce called the Hayflick Limit. This prevented most sudden growth of second hearts, but caused the cells of the organisms to slowly become weaker and fewer in number as the years go on. Eventually, this weakening results in a failure within the organism, resulting in death by old age.

Wanton growth of extra limbs and organs kills quickly and early in life, old age however, takes ones life after several decades, thus giving the aging organism a competitive advantage comparatively. The old age isn’t even selected against in prehistory, as external forces such as lions prevent those aging from ever growing old.

What is key to understanding the life cycle of plants is to realize that all plant growth is good. Plant growth patterns consist of repetitive organs, root stems and leaves, and thus, under the correct circumstances, live forever.

Generations – Heliophilic Plants Move In

In this demo, I show off the new generation map mode. Darker greens represent older plants. You will notice that in year two, the main continent flora is replaced by efficient sunlight loving plants. This is marked by the influx of young, heliophilic plants seen between the two mapmodes.

WIP Tectonic Explosions

So the new algorithm for new plates forming ‘works’, however my fracturing algorithm leaves much to be desired. The main problem is too many tiny shards form, carrying with them the landmasses that define the continents. Once an algorithm that produces rounder, larger plates is put in place, the other features will become more sensical.