from os import environ

from pygame import display, image, mouse
from pygame.locals import *

from GameChild import *

class Display(GameChild):

    def __init__(self, game):
        GameChild.__init__(self, game)
        self.delegate = self.get_delegate()
        self.load_configuration()
        self.align_window()
        self.init_screen()
        self.set_caption()
        self.set_icon()
        self.set_mouse_visibility()
        self.subscribe(self.toggle_fullscreen)

    def load_configuration(self):
        config = self.get_configuration("display")
        self.centered = config["centered"]
        self.fullscreen_enabled = config["fullscreen"]
        self.caption = config["caption"]
        self.windowed_flag = config["windowed-flag"]
        self.icon_path = self.get_resource("display", "icon-path")
        self.mouse_visibility = self.get_configuration("mouse", "visible")

    def align_window(self):
        if self.centered:
            environ["SDL_VIDEO_CENTERED"] = "1"

    def init_screen(self):
        flags = 0
        if self.fullscreen_requested():
            flags = FULLSCREEN
        self.set_screen(flags)

    def fullscreen_requested(self):
        return not self.check_command_line(self.windowed_flag) and \
               self.fullscreen_enabled

    def set_screen(self, flags=0, dimensions=None):
        self.dimensions_changed = dimensions is not None
        if dimensions is None:
            if display.get_surface():
                dimensions = display.get_surface().get_size()
            else:
                dimensions = self.get_configuration("display", "dimensions")
        self.screen = display.set_mode(dimensions, flags)
        if self.dimensions_changed:
            interpolator = self.get_game().interpolator
            if interpolator.gui_enabled:
                interpolator.gui.rearrange()

    def set_caption(self):
        display.set_caption(self.caption)

    def set_icon(self):
        if self.icon_path:
            print self.icon_path
            display.set_icon(image.load(self.icon_path).convert_alpha())

    def set_mouse_visibility(self, visibility=None):
        if visibility is None:
            visibility = self.mouse_visibility
        return mouse.set_visible(visibility)

    def get_screen(self):
        return self.screen

    def get_size(self):
        return self.screen.get_size()

    def toggle_fullscreen(self, event):
        if self.delegate.compare(event, "toggle-fullscreen"):
            screen = self.screen
            cpy = screen.convert()
            self.set_screen(self.screen.get_flags() ^ FULLSCREEN)
            screen.blit(cpy, (0, 0))
from os.path import exists, join, basename, normpath, abspath
from sys import argv

from pygame import mixer, event, time
from pygame.locals import *

import Game

class GameChild:

    def __init__(self, parent=None):
        self.parent = parent
        self.game = self.get_game()

    def get_game(self):
        current = self
        while not isinstance(current, Game.Game):
            current = current.parent
        return current

    def get_configuration(self, section=None, option=None, linebreaks=True):
        config = self.game.configuration
        if option is None and section is None:
            return config
        if option and section:
            rvalue = config.get(section, option)
            if not linebreaks and isinstance(rvalue, str):
                rvalue = rvalue.replace("\n", " ")
            return rvalue
        return config.get_section(section)

    def get_input(self):
        return self.game.input

    def get_screen(self):
        return self.game.display.get_screen()

    def get_display_surface(self):
        current = self
        attribute = "display_surface"
        while not isinstance(current, Game.Game):
            if hasattr(current, attribute):
                return getattr(current, attribute)
            current = current.parent
        return current.display.get_screen()

    def get_audio(self):
        return self.game.audio

    def get_delegate(self):
        return self.game.delegate

    def get_resource(self, path_or_section, option=None):
        config = self.get_configuration()
        rel_path = path_or_section
        if option is not None:
            rel_path = config.get(path_or_section, option)
        if rel_path:
            for root in config.get("setup", "resource-search-path"):
                if self.is_shared_mode() and not self.is_absolute_path(root):
                    continue
                path = join(root, rel_path)
                if exists(path):
                    return path
        self.print_debug("Couldn't find resource: {0} {1}".\
                                   format(path_or_section, option))

    def is_shared_mode(self):
        return self.check_command_line("s")

    def check_command_line(self, flag):
        return "-" + flag in argv

    def print_debug(self, statement):
        if self.is_debug_mode():
            print statement

    def is_debug_mode(self):
        return self.check_command_line("d")

    def is_absolute_path(self, path):
        return normpath(path) == abspath(path)

    def subscribe(self, callback, kind=None):
        self.game.delegate.add_subscriber(callback, kind)

    def unsubscribe(self, callback, kind=None):
        self.game.delegate.remove_subscriber(callback, kind)
import cProfile
from time import strftime
from os import mkdir
from os.path import join, exists

from GameChild import GameChild

class Profile(cProfile.Profile, GameChild):

    def __init__(self, parent):
        GameChild.__init__(self, parent)
        cProfile.Profile.__init__(self)
        if self.requested():
            self.enable()

    def requested(self):
        return self.check_command_line("p")

    def end(self):
        if self.requested():
            root = "stat/"
            if not exists(root):
                mkdir(root)
            self.disable()
            self.create_stats()
            self.dump_stats(join(root, strftime("%Y%m%d-%H%M_%S.stat")))
54.224.168.206
54.224.168.206
54.224.168.206
 
September 26, 2017

I made a video about my game Picture Processing for Out of Index 2017! Here is the video along with a transcript.

To save memory, video games are designed to repeat graphics. In raster-based games, image files like textures, tiles and sprites are loaded once into memory and drawn repeatedly by the program to create environments, characters, animations and text. In my puzzle game, 8 by 8 pixel tiles are used to create scenes the player has to recreate. For level 1, the tiles are a cloud, a tree, a mushroom, a character, sky, ground and rock.

An algorithm scrambles the tiles so that each tile is in the wrong memory address at the beginning of a level and the screen looks like a graphics glitch. When level 1 begins, the clouds may be where the trees should be, the mushrooms may be floating in the sky and the character may be switched with rock or the ground. The player's task is to put the tiles where they belong by swapping each tile with a tile in another memory address.

There are five levels, in order of difficulty, based on classic video games or classic video game genres.

The name of this game is taken from the Picture Processing Unit, a microprocessor designed by Nintendo for the Nintendo Entertainment System. The PPU is the hardware component responsible for translating image data into video signals for televisions and screens. It does this with a memory of 8 by 8 pixel tile data, which, along with palette and sprite attribute memory, generates each frame of a video game.

Companies often create lofty, evocative titles for hardware and products. What does the name Picture Processing Unit mean if we consider pictures something independent of a video screen? The phrase picture processing evokes the phrase image processing, a technique used to create applications such as automatic facial and emotion recognition. We often anthropomorphize electronic devices, infusing them with intelligence and souls, forgetting how much more infinitely complex the human mind is compared to a digital processor.

The game is named as a reference to Nintendo's microprocessor because the graphics are tile based, but it is also a reference to the players who are image processors, interpreting a picture from something deterministic into something non-deterministic.

The prototype of this game was created for a game jam called A Game By Its Cover where designers created video games based on imagined Nintendo game cartridges created by visual artists for an exhibition called My Famicase.

Picture Processing is based on one of the imagined cartridges from that exhibition. The cartridge's cover depicts a grid of unordered tiles and is described as a game where one inserts a game cartridge, sees a glitching screen, and meditates about the concept of beauty in imperfection. I added the idea that the player meditates into a state of transcendence until they are able to fix the game's graphics by accessing the memory telepathically.

July 19, 2017


f1. BOSS

Games are corrupt dissolutions of nature modeled on prison, ordering a census from the shadows of a vile casino, splintered into shattered glass, pushing symbols, rusted, stale, charred, ultraviolet harbingers of consumption and violence, badges without merit that host a disease of destruction and decay.

You are trapped. You are so trapped your only recourse of action is to imagine an escape route and deny your existence so fully that your dream world becomes the only reality you know. You are fleeing deeper and deeper into a chasm of self-delusion.

While you're dragging your listless, distending corpus from one cell to another, amassing rewards, upgrades, bonuses, achievements, prizes, add-ons and status boosts in rapid succession, stop to think about what's inside the boxes because each one contains a vacuous, soul-sucking nightmare.

Playing can be an awful experience that spirals one into a void of harm and chaos, one so bad it creates a cycle between the greater and lesser systems, each breaking the other's rules. One may succeed by acting in a way that ruins the world.

May 19, 2013

Welcome! I will be posting here about open-source games and music I am making for free online distribution. Most recently, I made Ball & Cup for Ludum Dare 26, a game I will work on more in June. After finishing, if it's fun, I will build an arcade cabinet for it! Next week, I am joining the 7-Day Fishing Jam to develop an A-life prototype about searching a cloud of noise for organisms.

Before Ball & Cup, I was adding features like vehicle engines, new graphics and effects and detailed scoring to an updated version of E.S.P. Hadouken, currently a prototype about navigating five psychic hadoukens to save your Game Boy. The new version will be similar with a clearer story and more ways to judge your performance. I plan on finishing it after making a public version of Ball & Cup.

I will also upload some digital albums soon. One, Man's Womb, is a solo collection of chiptunes from Emoticon Vs. Rainbow, an online racing/rhythm game. The other, Tor Ghul/Spin Ghul is a guitar and synth record recorded with my friends last summer. The recording and sequencing are finished for both -- I just have to make their web pages and artwork and package them for downloading.

Later, I hope to write about games in their early stages, an abstract action-RPG called Panopticon: Swarm, a massively multiplayer exploration, voting, post-catastrophic city simulation, Vomit Inspector and a mobile mini-game compilation project that includes an external digital pet raising and social networking mode. I also plan to post analyses of games I'm playing as a design exercise and for fun.

I will write about more game stuff like arcade trips, game jams and electronics! Plus whatever I haven't thought of! If you use RSS, subscribe to my feed!


↠ RSS Feed ↞