EVR.include("level/summary/graph/Margin.js");
EVR.include("level/summary/graph/Set.js");
EVR.include("level/summary/graph/Plot.js");
EVR.Level.Summary.Graph = function(cell, level)
{
   this.level = level;
   this.road = level.road;
   this.field = level.container;
   EVR.Table.call(this, cell, 1, 1);
   this.title = GRAPH_TITLE;
   this.font_size = GRAPH_FONT_SIZE;
   this.font_color = GRAPH_FONT_COLOR;
   this.colors = GRAPH_COLORS;
   this.set_measurements();
   this.element.bgColor = GRAPH_PLOT_BACKGROUND_COLOR;
   cell.style.verticalAlign = "middle";
   cell.style.paddingLeft = GRAPH_MARGIN;
   this.add_components();
   this.initialize_sets();
   this.plot = new EVR.Level.Summary.Graph.Plot(this, this.sets);
   this.insert_title();
   this.append();
}
EVR.Level.Summary.Graph.prototype = new EVR.Table;
EVR.Level.Summary.Graph.prototype.set_measurements = function()
{
   var level = this.level;
   var history = level.history;
   var measurements = [history.get_accuracies(), history.get_times()];
   for (var ii = 0; ii < measurements.length; ii++)
   {
      measurements[ii] = measurements[ii].slice(-GRAPH_HISTORY_LENGTH);
   }
   this.measurements = measurements;
}
EVR.Level.Summary.Graph.prototype.insert_title = function()
{
   var cell = this.insert_cell(this.insert_row(0));
   var text = this.build_title_text();
   var font = GRAPH_TITLE_FONT;
   var color = this.font_color;
   var size = this.font_size;
   var title = new EVR.Text(cell, text, font, color, size, this.field);
   cell.height = "1";
   cell.style.background = GRAPH_TITLE_BACKGROUND;
   cell.style.textAlign = "center";
   cell.style.letterSpacing = GRAPH_TITLE_LETTER_SPACING;
   cell.colSpan = this.get_rows()[1].cells.length;
   this.title = title;
}
EVR.Level.Summary.Graph.prototype.build_title_text = function()
{
   var count = this.measurements[0].length;
   var text = GRAPH_TITLE;
   if (count > 1)
   {
      text += " " + count;
   }
   return text;
}
EVR.Level.Summary.Graph.prototype.add_components = function()
{
   var row = this.insert_row();
   var cells = [];
   cells[0] = [this.insert_margin_cell(row)];
   cells[1] = [this.insert_margin_cell(row)];
   this.first_row = row;
   row = this.insert_row();
   cells[0].push(this.insert_margin_cell(row, true));
   cells[1].push(this.insert_margin_cell(row, true));
   var colors = this.colors;
   var left = new EVR.Level.Summary.Graph.Margin(cells[0], this, colors[0]);
   var right = new EVR.Level.Summary.Graph.Margin(cells[1], this, colors[1]);
   this.margins = [left, right];
}
EVR.Level.Summary.Graph.prototype.insert_margin_cell = function(row, bottom)
{
   var cell = this.insert_cell(row);
   cell.style.padding = "0 " + GRAPH_MARGIN_PADDING;
   cell.style.verticalAlign = bottom ? "bottom" : "top";
   cell.style.backgroundColor = GRAPH_MARGIN_BACKGROUND;
   return cell;
}
EVR.Level.Summary.Graph.prototype.initialize_sets = function()
{
   var sets = [];
   var margins = this.margins;
   var measurements = this.measurements;
   var reverse, color, set;
   for (var ii = 0, len = measurements.length; ii < len; ii++)
   {
      reverse = measurements[ii][0] instanceof EVR.Time;
      color = this.colors[ii];
      set = new EVR.Level.Summary.Graph.Set(
	 measurements[ii], margins[ii], color, reverse);
      sets.push(set);
   }
   this.sets = sets;
}
EVR.Level.Summary.Graph.prototype.insert_plot_cell = function(spacer)
{
   var row = this.first_row;
   var cell = row.insertCell(row.cells.length - 1);
   cell.rowSpan = 2;
   cell.style.verticalAlign = "bottom";
   if (spacer)
   {
      cell.style.paddingRight = GRAPH_BAR_PADDING;
   }
   return cell;
}
EVR.Level.Summary.Graph.prototype.draw = function()
{
   this.title.set_font_size();
   this.plot.draw();
   var margins = this.margins;
   for (var ii = 0; ii < margins.length; ii++)
   {
      margins[ii].draw();
   }
}
EVR.Level.Summary.Graph.prototype.toString = function()
{
   return "[object EVR.Level.Summary.Graph]";
}
EVR.Level.Summary.Graph.Set = function(measurements, margin, color, reverse)
{
   this.measurements = measurements;
   this.margin = margin;
   this.color = color;
   this.reverse = reverse || false;
   this.set_bounds();
}
EVR.Level.Summary.Graph.Set.prototype.set_bounds = function()
{
   var measurements = this.measurements;
   var min = measurements[0];
   var max = measurements[0];
   var measurement;
   for (var ii = 0, len = measurements.length; ii < len; ii++)
   {
      measurement = measurements[ii];
      if (measurement > max)
      {
	 max = measurement;
      }
      else if (measurement < min)
      {
	 min = measurement;
      }
   }
   var reverse = this.reverse;
   this.best = reverse ? min : max;
   this.worst = reverse ? max : min;
   this.range = Math.abs(this.best - this.worst);
   this.display();
}
EVR.Level.Summary.Graph.Set.prototype.display = function()
{
   var precision = GRAPH_PRECISION;
   var worst = this.worst.toString(precision);
   var best = this.best.toString(precision);
   this.margin.set_bounds(worst, best);
}
EVR.Level.Summary.Graph.Set.prototype.toString = function()
{
   return "[EVR.Level.Summary.Graph.Set]";
}
EVR.Level.Summary.Graph.Margin = function(cells, graph, color)
{
   this.cells = cells;
   this.graph = graph;
   this.color = color;
   this.initialize_text();
}
EVR.Level.Summary.Graph.Margin.prototype.initialize_text = function()
{
   var cells = this.cells;
   this.maximum = this.build_text(cells[0]);
   this.minimum = this.build_text(cells[1]);
}
EVR.Level.Summary.Graph.Margin.prototype.build_text = function(cell)
{
   var graph = this.graph;
   var font = GRAPH_MARGIN_TEXT_FONT;
   var color = GRAPH_MARGIN_TEXT_COLOR;
   var size = graph.font_size;
   var field = graph.field;
   var text = new EVR.Text(cell, null, font, color, size, field);
   text.set_color(this.color);
   return text;
}
EVR.Level.Summary.Graph.Margin.prototype.set_bounds = function(minimum, maximum)
{
   this.minimum.set(minimum);
   this.maximum.set(maximum);
}
EVR.Level.Summary.Graph.Margin.prototype.draw = function()
{
   this.maximum.set_font_size();
   this.minimum.set_font_size();
}
EVR.Level.Summary.Graph.Margin.prototype.toString = function()
{
   return "[EVR.Level.Summary.Graph.Margin]";
}
34.239.158.107
34.239.158.107
34.239.158.107
 
June 29, 2013

A few weeks ago, for Fishing Jam, I made a fishing simulation from what was originally designed to be a time attack arcade game. In the program, Dark Stew, the player controls Aphids, an anthropod who fishes for aquatic creatures living in nine pools of black water.



Fishing means waiting by the pool with the line in. The longer you wait before pulling the line out, the more likely a creature will appear. Aside from walking, it's the only interaction in the game. The creatures are drawings of things you maybe could find underwater in a dream.

The background music is a mix of clips from licensed to share songs on the Free Music Archive. Particularly, Seed64 is an album I used a lot of songs from. The full list of music credits is in the game's README file.

I'm still planning to use the original design in a future version. There would be a reaction-based mini game for catching fish, and the goal would be to catch as many fish as possible within the time limit. I also want to add details and obstacles to the background, which is now a little boring, being a plain, tiled, white floor.

If you want to look at all the drawings or hear the music in the context of the program, there are Windows and source versions available. The source should work on any system with Python and Pygame. If it doesn't, bug reports are much appreciated. Comments are also welcome :)

Dark Stew: Windows, Pygame Source

I wrote in my last post that I would be working on an old prototype about searching a cloud for organisms for Fishing Jam. I decided to wait a while before developing that game, tentatively titled Xenographic Barrier. Its main interactive element is a first-person scope/flashlight, so I'd like to make a Wii version of it.

I'm about to start working on a complete version of Ball & Cup. If I make anything interesting for it, I'll post something. There are a lot of other things I want to write about, like game analyses, my new GP2X and arcades in Korea, and there's still music to release. Lots of fun stuff coming!