<?php
require_once "../../../../account/get_user_path.php";
$GLOBALS["GHOSTS_DIRECTORY"] = "ghosts/";
load_ghost();
function load_ghost()
{
   if (file_exists($path = build_path()))
   {
      ob_start();
      readgzfile($path);
      ob_end_flush();
   }
}
function build_path()
{
   $file = $_GET["level"] . ".gz";
   return account\get_user_path() . $GLOBALS["GHOSTS_DIRECTORY"] . $file;
}
<?php
require_once "../../../../account/get_user_path.php";
$GLOBALS["GHOSTS_DIRECTORY"] = "ghosts/";
save_ghost();
function save_ghost()
{
   create_files();
   $trail = str_replace("|", "\n", $_POST["trail"]);
   gzwrite(gzopen(build_path(), "w"), $trail);
}
function create_files()
{
   create_directory();
   create_file();
}
function create_directory()
{
   $path = build_directory_path();
   if (!file_exists($path))
   {
      mkdir($path, 02770);
   }
}
function create_file()
{
   $path = build_path();
   if (!file_exists($path))
   {
      touch($path);
      chmod($path, 0660);
   }
}
function build_directory_path()
{
   return account\get_user_path() . $GLOBALS["GHOSTS_DIRECTORY"];
}
function build_path()
{
   return build_directory_path() . $_POST["level"] . ".gz";
}
EVR.include("level/road/path/trail/Marker.js");
EVR.Level.Road.Path.Trail = function(level)
{
   this.level = level;
   this.trail = [];
}
EVR.Level.Road.Path.Trail.prototype.add = function(speed, lane)
{
   var level = this.level;
   var time = 0;
   if (!!level.clock)
   {
      time = level.clock.time.get();
   }
   var trail = this.trail;
   var marker = new EVR.Level.Road.Path.Trail.Marker(time, speed, lane);
   trail.push(marker);
}
EVR.Level.Road.Path.Trail.prototype.load = function()
{
   var trail = this.trail;
   var parameters, marker, raw = this.get_raw();
   for (var ii = 0; ii < raw.length; ii++)
   {
      parameters = raw[ii].split(" ");
      marker = new EVR.Level.Road.Path.Trail.Marker();
      EVR.Level.Road.Path.Trail.Marker.apply(marker, parameters);
      trail.push(marker);
   }
}
EVR.Level.Road.Path.Trail.prototype.get_raw = function()
{
   var script = this.get_script_root() + "load_ghost.php";
   var query = this.build_query();
   var raw = new EVR.Requester(script, query, true).execute().split("\n");
   if (raw.length <= 1)
   {
      raw = [];
   }
   return raw;
}
EVR.Level.Road.Path.Trail.prototype.build_query = function()
{
   return "level=" + this.level.id;
}
EVR.Level.Road.Path.Trail.prototype.get_script_root = function()
{
   return SOURCE_PATH + "level/road/path/trail/";
}
EVR.Level.Road.Path.Trail.prototype.save = function()
{
   this.fix();
   var script = this.get_script_root() + "save_ghost.php";
   var query = this.build_query() + "&trail=" + this.serialize();
   new EVR.Requester(script, query, true, true).execute();
}
EVR.Level.Road.Path.Trail.prototype.fix = function()
{
   var trail = this.trail;
   var time;
   for (var ii = 0; ii < trail.length - 1; ii++)
   {
      time = trail[ii].time;
      if (time > 0 && time == trail[ii + 1].time)
      {
	 ii = this.fix_duplicates(ii);
      }
   }
}
EVR.Level.Road.Path.Trail.prototype.fix_duplicates = function(ii)
{
   var trail = this.trail;
   var count = this.count_duplicates(ii);
   var previous = trail[ii - 1].time;
   var difference = trail[ii].time - previous;
   var step = parseInt(difference / count);
   var limit = ii + count;
   while (ii < limit)
   {
      trail[ii].time -= step * (limit - ii++ - 1);
   }
   return ii - 1;
}
EVR.Level.Road.Path.Trail.prototype.count_duplicates = function(ii)
{
   var trail = this.trail;
   var time = trail[ii].time;
   var count = 1;
   while (ii < trail.length - 1 && trail[++ii].time == time)
   {
      count++;
   }
   return count;
}
EVR.Level.Road.Path.Trail.prototype.serialize = function()
{
   return this.trail.join("|");
}
EVR.Level.Road.Path.Trail.prototype.toString = function()
{
   return "[EVR.Level.Road.Path.Trail]";
}
EVR.Level.Road.Path.Trail.Marker = function(time, speed, lane)
{
   this.time = parseInt(time);
   this.speed = parseFloat(speed);
   this.lane = parseInt(lane);
}
EVR.Level.Road.Path.Trail.Marker.prototype.toString = function()
{
   return this.time + " " + this.speed + " " + this.lane;
}
EVR.include("/level/map/Indicator.js");
EVR.Level.Map.Display = function(container, level)
{
   EVR.Component.call(this, container, "table");
   this.level = level;
   this.clusters = level.clusters;
   this.colors = level.beams;
   this.current = 0;
   this.row = this.element.insertRow(-1);
   this.style();
   this.populate();
   this.append();
   this.align();
   this.add_indicators();
}
EVR.Level.Map.Display.prototype = new EVR.Component;
EVR.Level.Map.Display.prototype.style = function()
{
   this.element.cellSpacing = "0";
   this.css.width = MAP_WIDTH;
   this.css.position = "absolute";
   this.css.border = MAP_BORDER;
}
EVR.Level.Map.Display.prototype.populate = function()
{
   var passage, cell;
   for (var ii = 0; ii < this.clusters.length; ii++)
   {
      passage = this.clusters[ii].passage;
      cell = this.row.insertCell(-1);
      cell.style.backgroundColor = this.colors[passage];
   }
}
EVR.Level.Map.Display.prototype.align = function()
{
   var relative = this.level.register.previews[0];
   var coordinates = relative.get_coordinates();
   this.css.height = relative.get_dimensions()[1];
   this.css.left = coordinates[0];
   this.css.top = coordinates[1];
}
EVR.Level.Map.Display.prototype.add_indicators = function()
{
   this.player_indicator = new EVR.Level.Map.Indicator(this, INDICATOR_OPACITY);
   this.ghost_indicator = new EVR.Level.Map.Indicator(
      this, GHOST_INDICATOR_OPACITY);
}
EVR.Level.Map.Display.prototype.draw = function()
{
   this.align();
   this.player_indicator.draw(+this.css.height.slice(0, -2));
   this.ghost_indicator.draw(+this.css.height.slice(0, -2));
}
EVR.Level.Map.Display.prototype.advance_player = function(ii)
{
   var ghost = this.ghost_indicator;
   if (ghost.attached && ghost.get_position() == ii)
   {
      ghost.remove();
   }
   this.player_indicator.advance(ii);
}
EVR.Level.Map.Display.prototype.advance_ghost = function(ii)
{
   var ghost = this.ghost_indicator;
   var player = this.player_indicator;
   if (!player.attached || player.get_position() != ii)
   {
      ghost.advance(ii);
   }
   else
   {
      ghost.remove();
   }
}
EVR.Level.Map.Display.prototype.get_player_position = function()
{
   return this.player_indicator.get_position();
}
EVR.Level.Map.Display.prototype.toString = function()
{
   return "[object EVR.Level.Map.Display]";
}
13.59.5.179
13.59.5.179
13.59.5.179
 
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!