<?php

header("Content-type: text/xml");
define("ROOT", "../../../../../../users/");
define("LEVEL_IDS_FILE_NAME", "level_ids");
define("FIELD_SEPARATOR", "|");
define("FILE_SPECIAL_CHARACTER", "_");
define("LEVEL_FILE_EXTENSION", ".xml.gz");

$id = $_GET["id"];
$path = build_path($id);
if (!file_exists($path))
{
   $path = str_replace(".gz", "", $path);
}
ob_start();
readgzfile($path);
ob_end_flush();

function build_path($id)
{
   $entry = file_read_line($id);
   $fields = explode(FIELD_SEPARATOR, $entry);
   $user = $fields[0];
   $file_name = convert_name($fields[1]) . LEVEL_FILE_EXTENSION;
   $path = ROOT . $user . "/levels/" . $file_name;
   return $path;
}
function file_read_line($line)
{
   $path = ROOT . "/" . LEVEL_IDS_FILE_NAME;
   $levels = file($path);
   return trim($levels[$line - 1]);
}
function convert_name($name)
{
   $name = preg_replace("/[^a-zA-Z0-9]{1}/", FILE_SPECIAL_CHARACTER, $name);
   return strtolower($name);
}
EVR.Level.Summary.Time = function(container, level)
{
   this.container = container;
   this.level = level;
   this.set();
}
EVR.Level.Summary.Time.prototype.set = function()
{
   var level = this.level;
   var container = this.container;
   var relative = level.container;
   var font = TIME_FONT;
   var color = this.determine_color();
   var size = TIME_FONT_SIZE;
   var text = level.history.get_newest().time;
   this.text = new EVR.Text(container, text, font, color, size, relative);
   this.set_line_height();
   this.text.css.overflow = "visible";
   var style = container.style;
   style.verticalAlign = "middle";
   style.paddingLeft = TIME_PADDING;
   style.letterSpacing = TIME_LETTER_SPACING;
   style.overflow = "visible";
}
EVR.Level.Summary.Time.prototype.determine_color = function()
{
   if (this.level.goal_cleared())
   {
      return TIME_CLEAR_FONT_COLOR;
   }
   return TIME_FAIL_FONT_COLOR;
}
EVR.Level.Summary.Time.prototype.set_line_height = function()
{
   var text = this.text;
   var height = text.get_font_size();
   height -= height * TIME_LINE_HEIGHT_MODIFIER;
   text.set_line_height(height);
}
EVR.Level.Summary.Time.prototype.draw = function()
{
   this.text.set_font_size();
   this.set_line_height();
}
EVR.Level.Summary.Time.prototype.toString = function()
{
   return "[object EVR.Level.Summary.Time]";
}
EVR.Level.Summary.Goal = function(container, level)
{
   this.container = container;
   this.level = level;
   this.set();
}
EVR.Level.Summary.Goal.prototype.set = function()
{
   var level = this.level;
   var container = this.container;
   var string = this.get_goal_string();
   var family = GOAL_FONT_FAMILY;
   var color = GOAL_FONT_COLOR;
   var size = GOAL_FONT_SIZE;
   var relative = level.container;
   this.text = new EVR.Text(container, string, family, color, size, relative);
   this.set_attributes();
}
EVR.Level.Summary.Goal.prototype.get_goal_string = function()
{
   var level = this.level;
   var goal, text;
   if (level.is_clear())
   {
      goal = level.advanced;
      text = GOAL_ADVANCED_TEXT;
   }
   else
   {
      goal = level.goal;
      text = GOAL_TEXT;
   }
   return text + " " + goal.toString(0, 1);
}
EVR.Level.Summary.Goal.prototype.set_attributes = function()
{
   var text = this.text;
   text.set_color(GOAL_BACKGROUND);
   text.css.textAlign = GOAL_TEXT_ALIGN;
   text.css.letterSpacing = GOAL_LETTER_SPACING;
   text.css.marginTop = GOAL_MARGIN;
   text.css.padding = GOAL_PADDING + " 0";
}
EVR.Level.Summary.Goal.prototype.draw = function()
{
   this.text.set_font_size();
}
EVR.Level.Summary.Goal.prototype.toString = function()
{
   return "[object EVR.Level.Summary.Goal]";
}
EVR.Level.Summary.Accuracy = function(container, level)
{
   this.container = container;
   this.field = level.container;
   this.path = level.road.path;
   this.history = level.history;
   this.align();
   this.add_heading();
   this.add_accuracy();
}
EVR.Level.Summary.Accuracy.prototype.align = function()
{
   var style = this.container.style;
   style.verticalAlign = "middle";
   style.textAlign = "center";
}
EVR.Level.Summary.Accuracy.prototype.add_heading = function()
{
   var cell = this.container;
   var text = ACCURACY_HEADING;
   var font = ACCURACY_HEADING_FONT;
   var size = ACCURACY_HEADING_FONT_SIZE;
   var color = ACCURACY_FONT_COLOR;
   var heading = new EVR.Text(cell, text, font, color, size, this.field);
   heading.css.textDecoration = ACCURACY_HEADING_TEXT_DECORATION;
   heading.css.letterSpacing = ACCURACY_HEADING_LETTER_SPACING;
   heading.css.backgroundColor = ACCURACY_BACKGROUND_COLOR;
   heading.css.borderBottom = ACCURACY_HEADING_BORDER;
   this.heading = heading;
}
EVR.Level.Summary.Accuracy.prototype.add_accuracy = function()
{
   var cell = this.container;
   var size = ACCURACY_FONT_SIZE;
   var text = this.history.get_newest().accuracy;
   var font = ACCURACY_FONT;
   var color = ACCURACY_FONT_COLOR;
   var accuracy = new EVR.Text(cell, text, font, color, size, this.field);
   accuracy.css.fontWeight = ACCURACY_FONT_WEIGHT;
   accuracy.css.letterSpacing = ACCURACY_LETTER_SPACING;
   accuracy.css.backgroundColor = ACCURACY_BACKGROUND_COLOR;
   accuracy.css.padding = "0 " + ACCURACY_PADDING + "px";
   this.accuracy = accuracy;
}
EVR.Level.Summary.Accuracy.prototype.draw = function()
{
   this.heading.set_font_size();
   this.accuracy.set_font_size();
}
EVR.Level.Summary.Accuracy.toString = function()
{
   return "[object EVR.Level.Summary.Accuracy]";
}
EVR.include("level/summary/Accuracy.js");
EVR.include("level/summary/Time.js");
EVR.include("level/summary/Goal.js");
EVR.include("level/summary/comparison/Comparison.js");
EVR.include("level/summary/graph/Graph.js");
EVR.Level.Summary = function(level)
{
   EVR.Table.call(this, level.road, "1%", "100%");
   level.road.set_color(SUMMARY_BACKGROUND);
   this.level = level;
   this.row = this.insert_row();
   this.add_finish_line();
   this.add_widgets();
   this.append();
}
EVR.Level.Summary.prototype = new EVR.Table;
EVR.Level.Summary.prototype.add_finish_line = function()
{
   var road = this.container;
   var finish_line = new EVR.Level.Road.Path.Line(road, LINE_FINISH);
   finish_line.place(SUMMARY_FINISH_LINE_OFFSET);
   finish_line.append();
   this.finish_line = finish_line;
}
EVR.Level.Summary.prototype.add_widgets = function()
{
   var level = this.level;
   var cell = this.insert_cell();
   this.accuracy = new EVR.Level.Summary.Accuracy(cell, level);
   this.goal = new EVR.Level.Summary.Goal(cell, level);
   this.graph = new EVR.Level.Summary.Graph(this.insert_cell(), level);
   this.comparison = new EVR.Level.Summary.Comparison(this.row, level);
   this.time = new EVR.Level.Summary.Time(this.insert_cell(), level);
}
EVR.Level.Summary.prototype.draw = function()
{
   this.comparison.draw();
   this.time.draw();
   this.goal.draw();
   this.accuracy.draw();
   this.graph.draw();
   this.finish_line.draw();
}
EVR.Level.Summary.prototype.toString = function()
{
   return "[object EVR.Level.Summary]";
}
44.201.97.0
44.201.97.0
44.201.97.0
 
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!