from os import listdir
from os.path import join

from pygame.mixer import Channel, Sound, music, find_channel

from GameChild import *
from Input import *

class Audio(GameChild):

    current_channel = None
    paused = False
    muted = False

    def __init__(self, game):
        GameChild.__init__(self, game)
        self.delegate = self.get_delegate()
        self.load_fx()
        self.subscribe(self.respond)

    def load_fx(self):
        fx = {}
        if self.get_configuration().has_option("audio", "sfx-path"):
            root = self.get_resource("audio", "sfx-path")
            if root:
                for name in listdir(root):
                    fx[name.split(".")[0]] = Sound(join(root, name))
        self.fx = fx

    def respond(self, event):
        if self.delegate.compare(event, "mute"):
            self.mute()

    def mute(self):
        self.muted = True
        self.set_volume()

    def unmute(self):
        self.muted = False
        self.set_volume()

    def set_volume(self):
        volume = int(not self.muted)
        music.set_volume(volume)
        if self.current_channel:
            self.current_channel.set_volume(volume)

    def play_bgm(self, path, stream=False):
        self.stop_current_channel()
        if stream:
            music.load(path)
            music.play(-1)
        else:
            self.current_channel = Sound(path).play(-1)
        self.set_volume()

    def stop_current_channel(self):
        music.stop()
        if self.current_channel:
            self.current_channel.stop()
        self.current_channel = None
        self.paused = False

    def play_fx(self, name, panning=.5):
        if not self.muted:
            channel = find_channel(True)
            if panning != .5:
                offset = 1 - abs(panning - .5) * 2
                if panning < .5:
                    channel.set_volume(1, offset)
                else:
                    channel.set_volume(offset, 1)
            channel.play(self.fx[name])

    def pause(self):
        channel = self.current_channel
        paused = self.paused
        if paused:
            music.unpause()
            if channel:
                channel.unpause()
        else:
            music.pause()
            if channel:
                channel.pause()
        self.paused = not paused

    def is_bgm_playing(self):
        current = self.current_channel
        if current and current.get_sound():
            return True
        return music.get_busy()
import os
delattr(os, "link")

from dark_stew.pgfw.Setup import Setup

if __name__ == "__main__":
    Setup().setup()
from dark_stew.pgfw.SetupWin import SetupWin

if __name__ == "__main__":
    SetupWin().setup()
from math import sqrt
from random import choice

from pygame import Rect

from dark_stew.pgfw.GameChild import GameChild
from dark_stew.floor.Floor import Floor
from dark_stew.pool.Pools import Pools
from dark_stew.aphids.Aphids import Aphids

class World(GameChild, Rect):

    def __init__(self, parent):
        GameChild.__init__(self, parent)
        self.input = self.get_input()
        self.display_surface = self.get_display_surface()
        self.directions = 0, 1, 2, 3
        self.direction = self.directions[2]
        self.load_configuration()
        self.reset_active_directions()
        self.init_rect()
        self.pools = Pools(self)
        self.floor = Floor(self)
        self.aphids = Aphids(self)
        self.get_audio().play_bgm(self.get_resource("world", "audio-path"),
                                  True)
        self.scroll_to_random_intersection()

    def load_configuration(self):
        config = self.get_configuration("world")
        self.dimensions = config["dimensions"]
        self.walk_step = config["walk-step"]
        self.run_step = config["run-step"]

    def reset_active_directions(self):
        self.active_directions = [False, False, False, False]
        self.scroll_active = False

    def init_rect(self):
        Rect.__init__(self, (0, 0), self.dimensions)

    def scroll_to_random_intersection(self):
        pools = self.pools
        cx, cy = choice(pools).center
        step = pools.step / 2
        dx, dy = self.display_surface.get_rect().center
        self.shift(cx + dx + step, cy + dy + step)

    def get_corners(self):
        x, y = self.topleft
        w, h = self.size
        return (x, y), (x, y - h), (x + w, y - h), (x + w, y), (x + w, y + h), \
               (x, y + h), (x - w, y + h), (x - w, y), (x - w, y - h)

    def update(self):
        self.scroll()
        self.floor.draw()
        self.pools.update()
        self.aphids.update()

    def scroll(self):
        if not self.aphids.sitting and not self.parent.monsters.current:
            keys = self.input
            axes = keys.get_axes()
            self.scroll_active = True in axes.values()
            shift = self.shift
            step = self.walk_step
            if keys.is_command_active("run"):
                step = self.run_step
            active = self.active_directions
            up, right, down, left = self.directions
            if axes["up"]:
                shift(y=step)
                active[up] = True
                if not active[left] and not active[right]:
                    self.direction = up
            else:
                active[up] = False
            if axes["right"]:
                shift(x=-step)
                active[right] = True
                if not active[up] and not active[down]:
                    self.direction = right
            else:
                active[right] = False
            if axes["down"]:
                shift(y=-step)
                active[down] = True
                if not active[left] and not active[right]:
                    self.direction = down
            else:
                active[down] = False
            if axes["left"]:
                shift(x=step)
                active[left] = True
                if not active[up] and not active[down]:
                    self.direction = left
            else:
                active[left] = False

    def shift(self, x=0, y=0, collide=True):
        self.move_ip(x, y)
        if collide:
            self.collide_aphids(-x, -y)
        viewport = self.display_surface.get_rect()
        if self.left > viewport.w:
            self.right = self.left
        if self.top > viewport.h:
            self.bottom = self.top
        if self.right < 0:
            self.left = self.right
        if self.bottom < 0:
            self.top = self.bottom

    def collide_aphids(self, x, y):
        for dx, dy in self.get_corners():
            aphids = self.aphids.collision_rect.move(x - dx, y - dy)
            for pool in self.pools:
                if aphids.colliderect(pool.water.rect):
                    water = pool.water.rect
                    radius = water.w / 2.0
                    distance = sqrt((aphids.centerx - water.centerx) ** 2 + \
                                    (aphids.centery - water.centery) ** 2)
                    if distance < radius:
                        self.shift(x, y)
                        return
216.73.216.8
216.73.216.8
216.73.216.8
 
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.