#!/usr/bin/python

# Rocket Land Launch
# "A gracious spring, turned to blood-ravenous autumn" - Rihaku,
# Lament of the Frontier Guard

from os import environ
from os.path import join
from random import randint, randrange, choice, random, uniform, shuffle
from math import tan, radians, ceil

from pygame import init, Surface, transform, PixelArray
from pygame.time import get_ticks, wait
from pygame.event import get
from pygame.display import set_mode, flip, set_caption
from pygame.mouse import set_visible
from pygame.image import load
from pygame.draw import polygon, aaline, circle
from pygame.locals import *

class Between:

    resolution = (640, 480)
    target_frame_duration = 40

    def __init__(self):
        self.quit_queued = False
        self.duration = 0
        init()
        set_visible(False)
        set_caption("Divine Remains Holds Domain")
        set_caption("Desert of Utility")
        set_caption("Involution")
        self.set_screen()
        self.characters = Characters(self)
        self.title = Title(self)
        self.field = Field(self)
        self.title.activate()
        self.last_ticks = get_ticks()
        self.reset()

    def reset(self):
        self.characters.reset()
        self.title.reset()
        self.field.reset()

    def run(self):
        while True:
            self.maintain_framerate()
            self.dispatch_events()
            if self.quit_queued:
                break
            self.title.update()
            self.field.update()
            flip()

    def maintain_framerate(self):
        while self.duration < self.target_frame_duration:
            wait(2)
            ticks = get_ticks()
            self.duration += ticks - self.last_ticks
            self.last_ticks = ticks
        self.duration -= self.target_frame_duration

    def dispatch_events(self):
        for event in get():
            if event.type == KEYDOWN:
                key = event.key
                if key == K_F11:
                    self.set_screen(True)
                elif key == K_F8:
                    self.reset()
                elif key == K_ESCAPE:
                    self.quit()
                elif self.title.active and key in (K_UP, K_DOWN):
                    self.title.change_character(key == K_UP)
                elif self.title.active and key == K_RETURN:
                    self.title.deactivate()
                    self.field.activate()
                    self.field.start_level()
            elif event.type == QUIT:
                self.quit()

    def set_screen(self, toggle_fullscreen=False):
        flags = 0
        if toggle_fullscreen:
            flags = self.screen.get_flags() ^ FULLSCREEN
        self.screen = set_mode(self.resolution, flags)

    def quit(self):
        self.quit_queued = True


class Child:

    def __init__(self, parent):
        self.parent = parent
        self.set_root()
        self.set_screen()

    def set_root(self):
        node = self.parent
        while not isinstance(node, Between):
            node = node.parent
        self.root = node

    def set_screen(self):
        self.screen = self.root.screen


class Characters(Child, list):

    folder = join("resource", "img", "character")
    paths = "h-Hh", "6oF", "Bag"

    def __init__(self, parent):
        Child.__init__(self, parent)
        list.__init__(self, (Character(self, join(self.folder, path)) for \
                             path in self.paths))

    def reset(self):
        self.current_index = 1
        self.parent.field.jumper.set_surface()

    def shift_index(self, decrease=False):
        step = -1 if decrease else 1
        self.current_index += step
        if self.current_index == len(self):
            self.current_index = 0
        elif self.current_index < 0:
            self.current_index = len(self) - 1
        self.parent.field.jumper.set_surface()

    def get_selected_character(self):
        return self[self.current_index]


class Character(Child):

    def __init__(self, parent, path):
        Child.__init__(self, parent)
        self.mono_surface = load(join(path, "mono.png")).convert_alpha()
        self.large_surface = load(join(path, "large.png")).convert_alpha()
        self.mini_surface = load(join(path, "mini.png")).convert_alpha()

    def is_selected_character(self):
        return self == self.parent.get_selected_character()


class Animation(Child):

    def __init__(self, parent, interval):
        Child.__init__(self, parent)
        self.interval = interval
        self.playing = False

    def play(self):
        self.playing = True
        self.last_ticks = get_ticks()
        self.frame_duration = 0

    def stop(self):
        self.playing = False

    def update(self):
        if self.playing:
            self.frame_duration += get_ticks() - self.last_ticks
            if self.frame_duration >= self.interval:
                self.frame_duration -= self.interval
                self.advance_frame()
            self.last_ticks = get_ticks()


class Title(Animation):

    color_components = (0, 80, 70), (0, 60, 60), (0, 90, 80)
    interval_range = 0, 120
    interval_change_rate = .005
    indicator_colors = (Color(*components) for components in \
                        ((255, 255, 0), (255, 0, 255), (0, 255, 255),
                         (255, 192, 87)))

    def __init__(self, parent):
        Animation.__init__(self, parent, self.interval_range[0])
        self.background_index = 0
        self.set_backgrounds()
        rects = self.character_rects = []
        characters = self.parent.characters
        for ii, character in enumerate(characters):
            rect = character.large_surface.get_rect()
            rect.center = self.screen.get_width() / 2, \
                          int(float(ii + 1) / (len(characters) + 1) * \
                              self.screen.get_height())
            rects.append(rect)
        indicator_surfaces = self.indicator_surfaces = []
        rect = self.indicator_rect = Rect(self.screen.get_width() / 3, 0, 22,
                                          23)
        for color in self.indicator_colors:
            surface = Surface(rect.size)
            surface.set_colorkey((0, 0, 0))
            polygon(surface, color, ((0, 0), (rect.w - 1, rect.h / 2 - 1),
                                     (0, rect.h - 1)))
            indicator_surfaces.append(surface)
        self.indicator_surfaces_index = 0

    def set_backgrounds(self):
        backgrounds = self.backgrounds = []
        tiles = []
        size = 4
        colors = []
        for h, s, l in self.color_components:
            color = Color(0, 0, 0)
            color.hsla = h, s, l, 100
            colors.append(color)
        for ii in xrange(len(colors)):
            tile = Surface((size, size))
            for x in xrange(size):
                for y in xrange(size):
                    if not (x + y) % 2:
                        color = colors[ii]
                    elif (x + y) % 4 == 1:
                        color = colors[(ii + 1) % len(colors)]
                    else:
                        color = colors[(ii + 2) % len(colors)]
                    tile.set_at((x, y), color)
            surface = Surface(self.screen.get_size())
            for x in xrange(0, surface.get_width(), size):
                for y in xrange(0, surface.get_height(), size):
                    surface.blit(tile, (x, y))
            backgrounds.append(surface)

    def reset(self):
        self.place_indicator()
        self.activate()

    def place_indicator(self):
        self.indicator_rect.centery = self.\
                                      character_rects[self.parent.characters.\
                                                      current_index].centery

    def activate(self):
        self.active = True
        self.play()

    def deactivate(self):
        self.active = False

    def advance_frame(self):
        self.background_index += 1
        if self.background_index == len(self.backgrounds):
            self.background_index = 0

    def change_character(self, decrement=False):
        self.parent.characters.shift_index(decrement)
        self.place_indicator()

    def update(self):
        if self.active:
            if random() < self.interval_change_rate:
                self.interval = randint(*self.interval_range)
            Animation.update(self)
            self.screen.blit(self.backgrounds[self.background_index], (0, 0))
            for ii, character in enumerate(self.parent.characters):
                if character.is_selected_character():
                    surface = character.large_surface
                else:
                    surface = character.mono_surface
                self.screen.blit(surface, self.character_rects[ii])
            self.indicator_surfaces_index += 1
            if self.indicator_surfaces_index == len(self.indicator_surfaces):
                self.indicator_surfaces_index = 0
            self.screen.blit(self.\
                             indicator_surfaces[self.indicator_surfaces_index],
                             self.indicator_rect)


class Level:

    def __init__(self, pad_width_range, pad_speed_range, pad_gap_range,
                 room_height):
        self.pad_width_range = pad_width_range
        self.pad_speed_range = pad_speed_range
        self.pad_gap_range = pad_gap_range
        self.room_height = room_height

    def generate_pad_parameters(self):
        return tuple((uniform(*limits) for limits in (self.pad_width_range,
                                                      self.pad_speed_range,
                                                      self.pad_gap_range)))


class Field(Child):

    levels = Level((25, 40), (.75, 1), (52, 72), 16), \
             Level((18, 28), (1.2, 1.5), (58, 80), 45), \
             Level((4, 12), (8, 11), (100, 150), 360)

    def __init__(self, parent):
        Child.__init__(self, parent)
        self.background = Background(self)
        self.road = Road(self)
        self.pit = Pit(self)
        self.room = Room(self)
        self.jumper = Jumper(self)

    def reset(self):
        self.level_index = 0
        self.deactivate()

    def deactivate(self):
        self.active = False

    def activate(self):
        self.active = True
        self.pit.play()
        self.road.fire.play()

    def get_current_level(self):
        return self.levels[self.level_index]

    def start_level(self):
        self.background.paint()
        pad_color = self.pad_color = Color(0, 0, 0)
        pad_color.hsla = randrange(0, 360), 100, 32, 100
        pad_border_color = self.pad_border_color = Color(0, 0, 0)
        pad_border_color.hsla = randrange(0, 360), 60, 86, 100
        self.road.populate()
        self.room.place()
        self.jumper.drop()

    def update(self):
        if self.active:
            self.background.update()
            self.pit.update()
            self.road.update()
            self.room.update()
            self.jumper.update()


class Background(Child):

    tile_size = 16
    tile_count = 32
    tile_color_range = 0, 120
    blend = BLEND_RGB_ADD
    segment_sizes = [.1, .15, .25, .33]
    foreground_saturation_range = 80, 80
    foreground_lightness_range = 70, 70
    foreground_hue_offset_range = 4, 30
    mask_speed = 1

    def __init__(self, parent):
        Child.__init__(self, parent)
        self.mask_x = 0
        self.mask = Surface(self.screen.get_size())
        self.foreground = Surface(self.screen.get_size())

    def paint(self):
        self.fill_mask()
        self.fill_foreground()

    def fill_mask(self):
        self.set_tiles()
        mask = self.mask
        for x in xrange(0, mask.get_width(), self.tile_size):
            for y in xrange(0, mask.get_height(), self.tile_size):
                mask.blit(choice(self.tiles), (x, y))

    def set_tiles(self):
        self.tiles = tiles = []
        for _ in xrange(self.tile_count):
            size = self.tile_size
            tile = Surface((size, size))
            palette = self.get_palette()
            window = Rect(0, 0, size / 2, size / 2)
            for x in xrange(0, size, window.w):
                for y in xrange(0, size, window.h):
                    window.topleft = x, y
                    tile.fill(palette[(x + y) % 2], window)
            tiles.append(tile)

    def get_palette(self):
        return self.get_tile_color(), self.get_tile_color()

    def get_tile_color(self):
        color = [0, 0, 0]
        color[randint(0, 2)] = randint(*self.tile_color_range)
        return color

    def fill_foreground(self):
        foreground = self.foreground
        rect = foreground.get_rect()
        x_intervals = [0]
        total = 0
        shuffle(self.segment_sizes)
        for size in self.segment_sizes:
            interval = int(size * rect.w)
            x_intervals.append(interval + total)
            total += interval
        x_intervals.append(rect.w)
        interval_index = 0
        base_hue = randrange(0, 360)
        saturation = randint(*self.foreground_saturation_range)
        lightness = randint(*self.foreground_lightness_range)
        next_base_color = self.get_foreground_color(base_hue, saturation,
                                                    lightness)
        for x in xrange(rect.w):
            if x >= x_intervals[interval_index]:
                interval_index += 1
                base_color = next_base_color
                next_base_color = self.get_foreground_color(base_color.hsla[0],
                                                            saturation,
                                                            lightness)
            bh = base_color.hsla[0]
            nh = next_base_color.hsla[0]
            if nh < bh:
                difference = 360 - bh + nh
            else:
                difference = nh - bh
            hue = int(bh + difference * \
                      ((x - x_intervals[interval_index - 1]) / \
                       float(x_intervals[interval_index] - \
                             x_intervals[interval_index - 1]))) % 360
            color = Color(0, 0, 0)
            color.hsla = [hue] + map(int, base_color.hsla[1:])
            foreground.fill(color, (x, 0, 1, rect.h))

    def get_foreground_color(self, base, saturation, lightness):
        color = Color(0, 0, 0)
        hue = (base + randint(*self.foreground_hue_offset_range)) % 360
        color.hsla = hue, saturation, lightness, 100
        return color

    def update(self):
        self.mask_x -= self.mask_speed
        if self.mask_x < -self.screen.get_width():
            self.mask_x = 0
        self.screen.blit(self.foreground, (0, 0))
        self.screen.blit(self.mask, (self.mask_x, 0), None, self.blend)
        self.screen.blit(self.mask, (self.mask_x + self.screen.get_width(), 0),
                         None, self.blend)


class Road(Child):

    def __init__(self, parent):
        Child.__init__(self, parent)
        self.fire = Fire(self)
        self.pads = Pads(self)

    def populate(self):
        self.pads.populate()

    def update(self):
        self.fire.update()
        self.pads.update()


class Fire(Animation):

    frame_count = 128
    tile_path = join("resource", "img", "fire.png")
    speed = 1
    height = 20

    def __init__(self, parent):
        Animation.__init__(self, parent, 0)
        self.frame_index = 0
        base_tile = load(self.tile_path).convert()
        self.tile_height = base_tile.get_height()
        frames = self.frames = []
        frame_count = self.frame_count
        for ii in xrange(frame_count):
            tile = base_tile.copy()
            pixels = PixelArray(tile)
            for x in xrange(len(pixels)):
                for y in xrange(len(pixels[0])):
                    color = Color(*tile.unmap_rgb(pixels[x][y]))
                    h, s, l, a = color.hsla
                    color.hsla = int((h + ii * 360.0 / frame_count) % 360), \
                                 max(0, s - 10), min(100, l + 10), a
                    pixels[x][y] = color
            del pixels
            tr = tile.get_rect()
            frame = Surface((self.screen.get_width(),
                             tr.h * (self.height / tr.h + 2)), SRCALPHA)
            for x in xrange(0, frame.get_width(), tr.w):
                for y in xrange(0, frame.get_height(), tr.h):
                    frame.blit(tile, (x, y))
            frames.append(frame)
        window_rect = self.window_rect = Rect(0, self.screen.get_height() - \
                                              self.height,
                                              self.screen.get_width(),
                                              self.height)
        self.rect = self.frames[0].get_rect()
        self.rect.bottom = window_rect.bottom

    def advance_frame(self):
        self.frame_index += 1
        if self.frame_index == len(self.frames):
            self.frame_index = 0

    def get_current_frame(self):
        return self.frames[self.frame_index]

    def update(self):
        Animation.update(self)
        self.rect.bottom += self.speed
        if self.rect.bottom == self.window_rect.bottom + self.tile_height:
            self.rect.bottom = self.window_rect.bottom
        self.screen.set_clip(self.window_rect)
        self.screen.blit(self.get_current_frame(), self.rect)
        self.screen.set_clip(None)


class Pads(Child, list):

    def __init__(self, parent):
        Child.__init__(self, parent)

    def populate(self):
        list.__init__(self, [])
        x = -20
        while x < self.screen.get_width():
            width, speed, self.gap = self.parent.parent.get_current_level().\
                                     generate_pad_parameters()
            self.append(Pad(self, width, speed))
            self[-1].x = x
            x += self.gap + width

    def update(self):
        self.retire()
        for pad in self:
            pad.update()
        if self.screen.get_width() - self[-1].rect.right >= self.gap:
            width, speed, self.gap = self.parent.parent.get_current_level().\
                                     generate_pad_parameters()
            self.append(Pad(self, width, speed))

    def retire(self):
        while self[0].rect.right < 0:
            self.pop(0)


class Pad(Child):

    height = 6

    def __init__(self, parent, width, speed):
        Child.__init__(self, parent)
        self.speed = speed
        surface = self.surface = Surface((width, self.height))
        rect = self.rect = surface.get_rect()
        field = self.parent.parent.parent
        rect.bottomleft = self.screen.get_width(), \
                          field.road.fire.window_rect.top
        surface.fill(field.pad_color)
        surface.fill(field.pad_border_color, (0, 0, rect.w, 2))
        surface.fill(field.pad_border_color, (0, 0, 2, rect.h))
        surface.fill(field.pad_border_color, (rect.w - 2, 0, 2, rect.h))
        self.x = rect.left

    def update(self):
        self.x -= self.speed
        self.rect.left = int(self.x)
        self.screen.blit(self.surface, self.rect)


class Pit(Animation):

    frame_count = 20
    radius = 8
    alpha = 220

    def __init__(self, parent):
        Animation.__init__(self, parent, 600)
        self.frame_index = 0
        background_frames = self.background_frames = []
        foreground_frames = self.foreground_frames = []
        radius = self.radius
        for ii in xrange(self.frame_count):
            background_frame = Surface((radius * 2, self.screen.get_height()))
            background_frame.set_colorkey((0, 0, 0))
            foreground_frame = background_frame.copy()
            color = Color(0, 0, 0)
            color.hsla = int(ii * 360.0 / self.frame_count), 100, 60, 100
            for y in xrange(radius, background_frame.get_height(), radius * 2):
                # circle(background_frame, color, (radius, y), radius)
                color.hsla = [(color.hsla[0] + 30) % 360] + list(color.hsla[1:])
                circle(foreground_frame, color, (radius, y), radius - 4)
            background_frame.set_alpha(self.alpha)
            foreground_frame.set_alpha(self.alpha)
            background_frames.append(background_frame)
            foreground_frames.append(foreground_frame)
        rect = self.rect = background_frame.get_rect()
        rect.right = self.screen.get_rect().right - 2

    def advance_frame(self):
        self.frame_index += 1
        if self.frame_index == len(self.background_frames):
            self.frame_index = 0

    def update(self):
        Animation.update(self)
        self.screen.blit(self.background_frames[self.frame_index], self.rect)
        self.screen.blit(self.foreground_frames[self.frame_index], self.rect)


class Room(Child):

    image_path = join("resource", "img", "cliff")

    def __init__(self, parent):
        Child.__init__(self, parent)
        self.set_surfaces()
        self.close()

    def set_surfaces(self):
        self.closed_surface = load(join(self.image_path,
                                        "closed.png")).convert_alpha()
        self.open_surface = load(join(self.image_path,
                                      "open.png")).convert_alpha()
        rect = self.rect = self.closed_surface.get_rect()
        rect.right = self.screen.get_rect().right

    def close(self):
        self.closed = True
        self.set_active_surface()

    def set_active_surface(self):
        if self.closed:
            self.active_surface = self.closed_surface
        else:
            self.active_surface = self.open_surface

    def open(self):
        self.closed = False
        self.set_active_surface()

    def place(self):
        self.rect.bottom = self.screen.get_height() - \
                           self.parent.get_current_level().room_height

    def update(self):
        self.screen.blit(self.active_surface, self.rect)


class Jumper(Child):

    hover_location = 38, 300
    hover_length = 3000

    def __init__(self, parent):
        Child.__init__(self, parent)
        self.blink = Blink(self)

    def set_surface(self):
        self.surface = self.parent.parent.characters.get_selected_character().\
                       mini_surface
        self.rect = self.surface.get_rect()

    def drop(self):
        self.blink.play()
        self.hover_remaining = self.hover_length
        self.last_ticks = get_ticks()
        self.velocity = [0, 0]
        self.rect.center = self.hover_location
        self.precise_location = list(self.rect.topleft)

    def update(self):
        if self.hover_remaining > 0:
            self.hover_remaining -= get_ticks() - self.last_ticks
            if self.hover_remaining <= 0:
                self.blink.stop()
                self.velocity = [0, -5]
            else:
                self.last_ticks = get_ticks()
        self.blink.update()
        self.precise_location[0] += self.velocity[0]
        self.precise_location[1] -= self.velocity[1]
        self.rect.topleft = map(int, self.precise_location)
        if self.blink.visible:
            self.screen.blit(self.surface, self.rect)


class Blink(Animation):

    def __init__(self, parent):
        Animation.__init__(self, parent, 300)
        self.stop()

    def advance_frame(self):
        self.visible = not self.visible

    def stop(self):
        Animation.stop(self)
        self.visible = True


if __name__ == "__main__":
    environ["SDL_VIDEO_CENTERED"] = "1"
    Between().run()
3.144.124.161
3.144.124.161
3.144.124.161
 
July 18, 2022


A new era ‼

Our infrastructure has recently upgraded ‼

Nugget Communications Bureau 👍

You've never emailed like this before ‼

Roundcube

Webmail software for reading and sending email from @nugget.fun and @shampoo.ooo addresses.

Mailman3

Email discussion lists, modernized with likes and emojis. It can be used for announcements and newsletters in addition to discussions. See lists for Picture Processing or Scrapeboard. Nowadays, people use Discord, but you really don't have to!

FreshRSS

With this hidden in plain sight, old technology, even regular people like you and me can start our own newspaper or social media feed.

Nugget Streaming Media 👍

The content you crave ‼

HLS

A live streaming, video format based on M3U playlists that can be played with HTML5.

RTMP

A plugin for Nginx can receive streaming video from ffmpeg or OBS and forward it as an RTMP stream to sites like Youtube and Twitch or directly to VLC.


Professional ‼

Nugget Productivity Suite 👍

Unleash your potential ‼

Kanboard

Virtual index cards you can use to gamify your daily grind.

Gitea

Grab whatever game code you want, share your edits, and report bugs.

Nugget Security 👍

The real Turing test ‼

Fail2ban

Banning is even more fun when it's automated.

Spamassassin

The documentation explains, "an email which mentions rolex watches, Viagra, porn, and debt all in one" will probably be considered spam.

GoAccess

Display HTTP requests in real time, so you can watch bots try to break into WordPress.

Nugget Entertainment Software 👍

The best in gaming entertainment ‼

Emoticon vs. Rainbow

With everything upgraded to the bleeding edge, this HTML4 game is running better than ever.


Zoom ‼

The game engine I've been working on, SPACE BOX, is now able to export to web, so I'm planning on turning nugget.fun into a games portal by releasing my games on it and adding an accounts system. The upgraded server and software will make it easier to create and maintain. I'm also thinking of using advertising and subscriptions to support the portal, so some of these services, like webmail or the RSS reader, may be offered to accounts that upgrade to a paid subscription.

March 3, 2021

Video 📺

Computers are a gun. They can see the target; they can pull the trigger. Computers were made by the military to blow people's brains out if they stepped out of line. Google Coral is the same technology that pollutes the oceans, and so is the computer I'm using, and so are the platforms I'm using to post this.

Game 🎲

Games are a context in which all play is purposeful. Games expose the fundamentally nihilistic nature of the universe and futility of pursuing any path other than the inevitability of death and the torture of an evil that knows and exploits absolute freedom. Games are not educational; they are education.

Propaganda 🆒

Education is propaganda — ego driven by-product conveying nothing that would enable us to expose that vanities made for gain subject us further to an illusion created by those in control: the illusion that quantity can represent substance and that data or observation can replace meaning. And why say it, or how, without contradicting yourself, that everything, once registered, no longer exists, and in fact never did, exists only in relation to other non-existent things, and when you look, it's not there, not only because it's long vanished, but because where would it be?


fig. 2: Gamer goo is a lubricant — not for your skin, but for facilitating your ability to own the competition (image from Gamer goo review)

As a result of video games, the great Trojan horse 🎠 of imperialist consumerist representationalism, people are divided in halves to encourage them to act according to market ordained impulses, to feign assurance, penetrating themselves deeper into a tyranny from which every action signals allegiance, confusing the world with definitions and borders, constantly struggling to balance or brace themselves against forces that threaten the crumbling stability of their ego.

F

or example, a cup 🥃 is designed and built to hold something, maintain order and prevent chaos. It keeps water from spilling back to where it belongs, back where it wants to go and gravity wants it to go. The cup is a trap, and it is used to assert dominance over nature, to fill with thoughts about existence, time and self, thoughts regarding dissimilarity between equal parts and patterns that manifest in variation. These ruminations disguised as revelations boil away to reveal isolated and self-aggrandizing thoughts about an analogy fabricated to herald the profundity of one's campaign's propaganda. You have no authentic impulse except to feed a delusion of ultimate and final supremacy. That is why you play games. That is your nature. That is why you eventually smash the cup to bits 💥 or otherwise watch it disintegrate forever because it, by being useful, threatens your facade of ownership and control.


fig. 3: worth1000

The cup is you; it reflects you; it is a lens through which you see yourself; it reassures you, confirming your presence; it says something, being something you can observe. When you move, it moves, and it opens after being closed. You can use it as a vessel for penetration fantasies, keeping you warm and fertile, a fine host for the plague of consciousness, you reptile, you sun scorched transgressor that not only bites the hand that feeds, but buries it deep within a sterile chamber where nothing remains for it as a means of escape except the corpses of others that infringed upon your feeding frenzy.

January 23, 2021

I wanted to document this chat-controlled robot I made for Babycastles' LOLCAM📸 that accepts a predefined set of commands like a character in an RPG party 〰 commands like walk, spin, bash, drill. It can also understand donut, worm, ring, wheels, and more. The signal for each command is transmitted as a 24-bit value over infrared using two Arduinos, one with an infrared LED, and the other with an infrared receiver. I built the transmitter circuit, and the receiver was built into the board that came with the mBot robot kit. The infrared library IRLib2 was used to transmit and receive the data as a 24-bit value.


fig. 1.1: the LEDs don't have much to do with this post!

I wanted to control the robot the way the infrared remote that came with the mBot controlled it, but the difference would be that since we would be getting input from the computer, it would be like having a remote with an unlimited amount of buttons. The way the remote works is each button press sends a 24-bit value to the robot over infrared. Inspired by Game Boy Advance registers and tracker commands, I started thinking that if we packed multiple parameters into the 24 bits, it would allow a custom move to be sent each time, so I wrote transmitter and receiver code to process commands that looked like this:

bit
name
description
00
time
multiply by 64 to get duration of command in ms
01
02
03
04
left
multiply by 16 to get left motor power
05
06
07
08
right
multiply by 16 to get right motor power
09
10
11
12
left sign
0 = left wheel backward, 1 = left wheel forward
13
right sign
0 = right wheel forward, 1 = right wheel backward
14
robot id
0 = send to player one, 1 = send to player two
15
flip
negate motor signs when repeating command
16
repeats
number of times to repeat command
17
18
19
delay
multiply by 128 to get time between repeats in ms
20
21
22
23
swap
swap the motor power values on repeat
fig 1.2: tightly stuffed bits

The first command I was able to send with this method that seemed interesting was one that made the mBot do a wheelie.

$ ./send_command.py 15 12 15 1 0 0 0 7 0 1
sending 0xff871fcf...


fig 1.3: sick wheels

A side effect of sending the signal this way is any button on any infrared remote will cause the robot to do something. The star command was actually reverse engineered from looking at the code a random remote button sent. For the robot's debut, it ended up with 15 preset commands (that number is in stonks 📈). I posted a highlights video on social media of how the chat controls turned out.

This idea was inspired by a remote frog tank LED project I made for Ribbit's Frog World which had a similar concept: press a button, and in a remote location where 🐸 and 🐠 live, an LED would turn on.


fig 2.1: saying hi to froggo remotely using an LED

😇 The transmitter and receiver Arduino programs are available to be copied and modified 😇

March 22, 2020

The chicken nugget business starter kit is now available online! Send me any amount of money through Venmo or PayPal, and I will mail you a package which will enable you to start a chicken nugget business of your own, play a video game any time you want, introduce a new character into your Animal Crossing village, and start collecting the chicken nugget trading cards.

The kit includes:

  • jellybean
  • instruction manual
  • limited edition trading card

By following the instructions you'll learn how to cook your own chicken or tofu nugget and be well on your way to financial success. I'm also throwing in one randomly selected card from the limited edition trading card set. Collect them, trade them, and if you get all eighteen and show me your set, I will give you an exclusive video game product.

All orders are processed within a day, so you can have your kit on your doorstep as quickly as possible. Don't sleep on this offer! Click the PayPal button or send a Venmo payment of any amount to @ohsqueezy, and in a matter of days you'll be counting money and playing video games.

PayPal me

June 23, 2019

is pikachu dead

yes and how about that for a brain tickler that what you're seeing all along was a ghost. we used a digital stream of bits that in the future we call blood to recreate everything as a malleable substance that is projected through computers over a massive interstellar network that runs faster than the speed of light in order to simultaneously exist at every moment in time exactly the same way effectively creating a new dimension through which you can experience the timeless joy of video games. you can press a button and watch the impact of your actions instantaneously resonate eternally across an infinite landscape as you the master of a constantly regenerating universe supplant your reality with your imagination giving profoundly new meaning to the phrase what goes around comes around as what comes around is the manifestation of the thoughts you had before you were aware of them. thoughts before they were thought and actions before they were done! it's so revolutionary we saved it for 10,000 years from now but it's all recycled here in the past with you at the helm and the future at the tips of your fingers

June 7, 2018

May 17, 2018

Line Wobbler Advance is a demake of Line Wobbler for Game Boy Advance that started as a demo for Synchrony. It contains remakes of the original Line Wobbler levels and adds a challenging advance mode with levels made by various designers.


f1. Wobble at home or on-the-go with Line Wobbler Advance

This project was originally meant to be a port of Line Wobbler and kind of a joke (demaking a game made for even lower level hardware), but once the original levels were complete, a few elements were added, including a timer, different line styles and new core mechanics, such as reactive A.I.


f2. Notes on Line Wobbler

I reverse engineered the game by mapping the LED strip on paper and taking notes on each level. Many elements of the game are perfectly translated, such as enemy and lava positions and speeds and the sizes of the streams. The boss spawns enemies at precisely the same rate in both versions. Thanks in part to this effort, Line Wobbler Advance was awarded first prize in the Wild category at Synchrony.


f3. First prize at Synchrony

Advance mode is a series of levels by different designers implementing their visions of the Line Wobbler universe. This is the part of the game that got the most attention. It turned into a twitchy gauntlet filled with variations on the core mechanics, cinematic interludes and new elements, such as enemies that react to the character's movements. Most of the levels are much harder than the originals and require a lot of retries.

Thanks Robin Baumgarten for giving permission to make custom levels and share this project, and thanks to the advance mode designers Prashast Thapan, Charles Huang, John Rhee, Lillyan Ling, GJ Lee, Emily Koonce, Yuxin Gao, Brian Chung, Paloma Dawkins, Gus Boehling, Dennis Carr, Shuichi Aizawa, Blake Andrews and mushbuh!

DOWNLOAD ROM
You will need an emulator to play. Try Mednafen (Windows/Linux) or Boycott Advance (OS X)

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.

June 6, 2016
September 30, 2015


Edge of Life is a form I made with Babycastles and Mouth Arcade for an event in New York called Internet Yami-ichi, a flea market of internet-ish goods. We set up our table to look like a doctor's office and pharmacy and offered free examinations and medication prescriptions, a system described by one person as "a whole pharmacy and medical industrial complex".

Diagnoses were based on responses to the form and observations by our doctor during a short examination. The examination typically involved bizarre questions, toy torpedoes being thrown at people and a plastic bucket over the patient's head. The form combined ideas from Myers-Briggs Type Indicators, Codex Seraphinianus and chain-mail personality tests that tell you which TV show character you are. In our waiting room, we had Lake of Roaches installed in a stuffed bat (GIRP bat). It was really fun!

The icons for the food pyramid are from Maple Story and the gun icons are from the dingbat font Outgunned. I'm also using Outgunned to generate the items in Food Spring.

January 28, 2014


E F F L U E N C E

December 3, 2013

Where in the mind's prism does light shine, inward, outward, or backward, and where in a plane does it intersect, experientially and literally, while possessing itself in a dripping wet phantasm?


Fig 1.1 What happens after you turn on a video game and before it appears?

The taxonomy of fun contains the difference between gasps of desperation and exaltation, simultaneously identical and opposite; one inspires you to have sex, while the other to ejaculate perpetually. A destruction and its procession are effervescent, while free play is an inseminated shimmer hatching inside you. Unlikely to be resolved, however, in such a way, are the climaxes of transitions between isolated, consecutive game states.

You walk through a door or long-jump face first (your face, not Mario's) into a painting. A moment passes for eternity, viscerally fading from your ego, corpus, chakra, gaia, the basis of your soul. It happens when you kill too, and especially when you precisely maim or obliterate something. It's a reason to live, a replicating stasis.


Fig 1.2 Sequence in a video game

Video games are death reanimated. You recurse through the underworld toward an illusion. Everything in a decision and logic attaches permanently to your fingerprint. At the core, you use its energy to soar, comatose, back into the biosphere, possibly because the formal structure of a mind by human standards is useful in the next world.

November 10, 2013


Food Spring - Watermelon Stage

Getting the fruit as far as possible is the object of each level, collecting bigger, more valuable guns. The final result is determined by the size of the fruits' collection when the monkey arrives in North America and either survives or perishes in the fruits' attack.

Watermelon Peach
Pineapple Grapes
September 13, 2013

from array import array
from time import sleep

import pygame
from pygame.mixer import Sound, get_init, pre_init

class Note(Sound):

    def __init__(self, frequency, volume=.1):
        self.frequency = frequency
        Sound.__init__(self, self.build_samples())
        self.set_volume(volume)

    def build_samples(self):
        period = int(round(get_init()[0] / self.frequency))
        samples = array("h", [0] * period)
        amplitude = 2 ** (abs(get_init()[1]) - 1) - 1
        for time in xrange(period):
            if time < period / 2:
                samples[time] = amplitude
            else:
                samples[time] = -amplitude
        return samples

if __name__ == "__main__":
    pre_init(44100, -16, 1, 1024)
    pygame.init()
    Note(440).play(-1)
    sleep(5)

This program generates and plays a 440 Hz tone for 5 seconds. It can be extended to generate the spectrum of notes with a frequency table or the frequency formula. Because the rewards in Send are idealized ocean waves, they can also be represented as tones. Each level has a tone in its goal and a tone based on where the player's disc lands. Both play at the end of a level, sounding harmonic for a close shot and discordant for a near miss. The game can dynamically create these tones using the program as a basis.

I'm also building an algorithmically generated song: Silk Routes (Scissored). Here is an example of how it sounds so far.

August 12, 2013

I've been researching tartan/plaid recently for decoration in my updated version of Ball & Cup, now called Send. I want to create the atmosphere of a sports event, so I plan on drawing tartan patterns at the vertical edges of the screen as backgrounds for areas where spectator ants generate based on player performance. I figured I would make my own patterns, but after browsing tartans available in the official register, I decided to use existing ones instead.

I made a list of the tartans that had what I thought were interesting titles and chose 30 to base the game's levels on. I sequenced them, using their titles to form a loose narrative related to the concept of sending. Here are three tartans in the sequence (levels 6, 7 and 8) generated by an algorithm I inferred by looking at examples that reads a tartan specification and draws its pattern using a simple dithering technique to blend the color stripes.


Acadia


Eve


Spice Apple

It would be wasting an opportunity if I didn't animate the tartans, so I'm thinking about animations for them. One effect I want to try is making them look like water washing over the area where the ants are spectating. I've also recorded some music for the game. Here are the loops for the game over and high scores screens.

Game Over

High Scores

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!

May 20, 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!