EVR.include("history/record/Record.js");
EVR.include("history/Parser.js");
EVR.include("history/view/View.js");
EVR.History = function(container)
{
   EVR.Pop_Up.call(this, container, HISTORY_WIDTH, HISTORY_HEIGHT);
   this.set_location();
   this.load();
   this.view = new EVR.History.View(this);
}
EVR.History.prototype = new EVR.Pop_Up;
EVR.History.prototype.set_location = function()
{
   this.location = SOURCE_PATH + "history/";
}
EVR.History.prototype.load = function()
{
   var path = this.location + "fetch.php";
   var document = new EVR.Requester(path, null, true).execute();
   this.records = new EVR.History.Parser(document).records;
}
EVR.History.prototype.set_level = function(level)
{
   this.level = level;
}
EVR.History.prototype.store_newest_record = function()
{
   this.build_newest_record();
   this.store_record(this.newest);
}
EVR.History.prototype.build_newest_record = function()
{
   var level = this.level;
   var time = level.clock.time.get();
   var accuracy = level.road.path.calculate_accuracy();
   this.newest = new EVR.History.Record(level.id, time, accuracy);
}
EVR.History.prototype.store_record = function(record)
{
   this.records.push(record);
   var id = record.level;
   var time = record.time.valueOf();
   var accuracy = record.accuracy.valueOf();
   var path = this.location + "insert.php";
   var query = "level=" + id + "&time=" + time + "&accuracy=" + accuracy;
   new EVR.Requester(path, query).execute();
}
EVR.History.prototype.get_accuracies = function()
{
   return this.get_field("accuracy");
}
EVR.History.prototype.get_times = function()
{
   return this.get_field("time");
}
EVR.History.prototype.get_field = function(field)
{
   var records = this.records;
   var entries = [];
   for (var ii = 0; ii < records.length; ii++)
   {
      if (records[ii].level == this.level.id)
      {
	 entries.push(records[ii][field]);
      }
   }
   return entries;
}
EVR.History.prototype.get_newest = function()
{
   return this.newest;
}
EVR.History.prototype.get_best_time = function()
{
   var times = this.get_times();
   var time, best = null;
   for (var ii = 0; ii < times.length; ii++)
   {
      time = times[ii];
      if (time < best || best == null)
      {
	 best = time;
      }
   }
   return best;
}
EVR.History.prototype.count_records = function()
{
   return this.records.length;
}
EVR.History.prototype.append = function()
{
   EVR.Pop_Up.prototype.append.call(this);
   this.view.build();
}
EVR.History.prototype.draw = function()
{
   EVR.Pop_Up.prototype.draw.call(this);
   this.view.draw();
}
EVR.History.prototype.remove = function()
{
   EVR.Pop_Up.prototype.remove.call(this);
   this.view.reset();
}
EVR.History.prototype.toString = function()
{
   return "[EVR.History]";
}
<?php
require_once "../account/get_user_path.php";
$GLOBALS["HISTORY_FILE_NAME"] = "history.gz";
$path = account\get_user_path() . $GLOBALS["HISTORY_FILE_NAME"];
ob_start();
readgzfile($path);
ob_end_flush();
<?php
require_once "../account/get_user_path.php";
$GLOBALS["HISTORY_FILE_NAME"] = "history.gz";
$path = account\get_user_path() . $GLOBALS["HISTORY_FILE_NAME"];
$level = $_GET["level"];
$time = $_GET["time"];
$accuracy = $_GET["accuracy"];
$file = gzopen($path, "a");
gzwrite($file, "$level $time $accuracy\n");
EVR.include("history/record/Time.js");
EVR.include("history/record/Accuracy.js");
EVR.History.Record = function(level, time, accuracy)
{
   this.level = level;
   this.time = new EVR.History.Record.Time(time);
   this.accuracy = new EVR.History.Record.Accuracy(accuracy);
}
EVR.History.Record.prototype.toString = function()
{
   return "[object EVR.History.Record]";
}
EVR.History.Record.Time = function(time)
{
   EVR.Time.call(this, time);
}
EVR.History.Record.Time.prototype = new EVR.Time;
EVR.History.Record.Time.prototype.toString = function(precision)
{
   if (precision == null)
   {
      precision = CLOCK_PRECISION;
   }
   var minutes = this.get_minutes();
   var seconds = this.pad(this.get_seconds() % 60, 2);
   var display = minutes + ":" + seconds;
   if (precision > 0)
   {
      var milliseconds = this.pad(this.get_milliseconds(precision), precision);
      display += "." + milliseconds;
   }
   return display;
}
EVR.History.Record.Time.prototype.valueOf = function()
{
   return this.get();
}
EVR.History.Record.Accuracy = function(accuracy)
{
   this.accuracy = accuracy;
}
EVR.History.Record.Accuracy.prototype.toString = function(precision)
{
   if (precision == null)
   {
      precision = ACCURACY_PRECISION;
   }
   return (100 * this.accuracy).toFixed(precision) + "%";
}
EVR.History.Record.Accuracy.prototype.valueOf = function()
{
   return parseFloat(this.accuracy);
}
EVR.include("history/view/level/Level.js");
EVR.History.View = function(history)
{
   EVR.Table.call(this, history, "100%", null);
   this.field = history.container;
   this.cell_count = HISTORY_CELL_COUNT;
   this.levels = [];
   this.record_index = 0;
   this.set_attributes();
   this.append();
}
EVR.History.View.prototype = new EVR.Table;
EVR.History.View.prototype.set_attributes = function()
{
   var element = this.element;
   element.cellSpacing = HISTORY_CELL_SPACING;
   var style = element.style;
   style.textAlign = "center";
   style.verticalAlign = "middle";
   style.color = "#404040";
   this.container.set_color(HISTORY_BACKGROUND);
}
EVR.History.View.prototype.build = function()
{
   this.records = this.container.records.sort(this.compare_records);
   while (this.record_index < this.records.length)
   {
      this.levels.push(new EVR.History.View.Level(this));
      this.advance_record_to_next_level();
   }
}
EVR.History.View.prototype.compare_records = function(a, b)
{
   var swap = a.level - b.level;
   if (swap === 0)
   {
      swap = a.time - b.time;
   }
   return swap;
}
EVR.History.View.prototype.advance_record_to_next_level = function()
{
   var ii = this.record_index;
   var records = this.records;
   var current = records[ii].level;
   while (ii < records.length && records[ii].level == current)
   {
      ii++;
   }
   this.record_index = ii;
}
EVR.History.View.prototype.reset = function()
{
   this.clear();
   this.record_index = 0;
   this.levels = [];
}
EVR.History.View.prototype.draw = function()
{
   var levels = this.levels;
   for (var ii = 0; ii < levels.length; ii++)
   {
      levels[ii].draw();
   }
}
EVR.History.View.prototype.toString = function()
{
   return "[object EVR.History.View]";
}
3.231.226.13
3.231.226.13
3.231.226.13
 
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!