Meditations on blit

So I’m teaching a python game development class and I am using the pygame library.  There are so many options these days to develop games – unity, unreal, twine, phaser. I was thinking why am I using pygame??

Well I am teaching a “python” class, so there is that, and we can publish our game to the steam store, so that is cool. But pygame is a pretty easy to use and robust. For the class we are using the pygame book at Invent with python.

The core of pygame is a loop that monitors events and updates the screen. It is a while True loop that monitors events, updates the display object and then updates the display.  To draw an image, like a jpg, on the surface you use the blit method:

DISPLAYSURF.blit(img, (x,y))

Blit is an ancient command, as I tell my students You look in all sorts of graphics frameworks and languages and you see blit!  Blit originally stood for bitmap graphics terminal and it was a different type of computer terminal that could draw bitmap graphics.   In graphics programming it also refers to  “bit-boundary block transfer”, this is where you transfer a block of memory from one location to another.

In graphics programming you can optimize your library by having a sheet of sprites of graphics that you then draw (blit) to the screen. This is an example of one of the sprite maps from the legend of zelda 1:

First we blit the image from the spritemap, then we blit that image to the pygame surface:

import pygame

spritesheet = pygame.image.load(filename).convert()
rect = pygame.Rect(rectangle)
image = pygame.Surface(rect.size).convert()
image.blit(spritesheet, (0, 0), rect)

DISPLAYSURF.blit(image, (x,y))

With this sort of framework I think there is interesting work to be done to sort of remix and reinvent existing games. What would a mashup between zelda and mario look like? What would a game version of fan fiction look like? We are playing with the graphical elements but we can use new different game mechanics and create a new story.

Cryptography as a personal practice

I gave this talk a few months ago, and it is something that came out of working through cryptopals at RC.  I was drafting the powerpoint into a conference proposal that sort of encapsulates my thinking right now.

I am going to look at encryption broadly – as a process that undergirds all technological knowledge. Anything from compression (e.g., a JPEG) to cryptography (e.g., PGP), to the binary system on which all computers run, I consider a form of encryption. Almost all current encryption protocols, while mostly open source, are monolithic and centralized. The structure of knowledge can be construed as depended on the structure of encryption protocols. How do we create our own personal practices and systems of encryption and cryptography to restructure knowledge?

Personal practices are at the forefront of today’s life-hacking movement(s). The cultivation of the self, once a matter of character, is now a matter of capital. Today we ask, how can I optimize myself and become the most efficient self that is able to contribute to capitalist production and consumption? There is a history of using personal practices as a bulwark against commodification, in practices from anarchism to veganism.

It is in this vein that I want to consider personal practices of encryption and the broader question of how can we rethink technological production and consumption in terms of a personal practice? This is particularly urgent when we consider our engagement with technology as part of the feedback loop of knowledge production. Even for something as banal as using a search engine, creates usage data that turns into knowledge, which then structures our next search.

When we extrapolate this to mapping and sensors, as well as the use of energy and physical space for manufacturing servers and microcontrollers, we are directly in the physical realm – the realm of nature.

Technology practices contribute both to the practical use case of data collection in the creation of AI, and the theoretical consideration of cybernetic impact of culture on nature.  As the LAMP stack was an innovation critical to Web 2.0, encryption and cryptography is an innovation critical to the rise of AI and its dependence on our data.

There is a rich history of personal practices of encryption from DaVinci to Anne Lister. In the past it was to keep thoughts radical thoughts private.  Now we need it to keep thoughts non-commodified.

How do we bring back a craft culture of encryption? What is knowledge produced and codified through personal encryption? What happens when our encryption systems are ‘artisanal’ instead of commodities? How can we engage in personal practices of encryption and what sort of knowledge organization will this create?

Thinking about Sortition and Discovery

I have been toying with an idea about generating a piece of work and documentation around discovery based on sortition. Please excuse the jargon that is also one of the things I am toying with.

Sortition/Protocol project is an experiment in culture creation through
restructuring and preserving network topologies on the principles of
sortition. It is an exercise in taking ideas from anarchist and Marxist
notions of personal practice and extrapolating them to activities that are
now controlled by algorithms, professional taste-makers, and influencers.

Lets talk about instagram, twitter, facebook, or any social network where
people attempt to communicate and connect. These networks originally
promised a many-to-many topology, where everyone communicates with
everyone else. To use an overused phrase – it was heralded as democratic. The reality of the network topologies that we see in social media is more of a
one-to-many relationship, with a small number of influencers communicating to a
large number of individuals who have exponentially less connections. The
communication is asymmetrical in its content and impact.

There is also the matter of surfacing this content, how is an influencer or individual ‘seen’ is largely regulated and controlled by opaque algorithm. I call this the hidden layer, analogous to the hidden layer of a neural network that creates the weighting and vectors determining the structure of the network. This hidden layer in conjunction with the network topology assist in creating a certain epistemic and interactive regime that we are going to overthrow.

How are we going to overthrow it? Sortition.

What is sortition? Sortition is a method of governing by selecting leaders
based on random selection or lottery. It was the way that the ancient
Athenians selected political officials. Although, the pool of potential leaders in Athens was exclusionary and limited to the small number of landowning men of leisure, the idea that anyone could rule, or make important decisions is a stark contrast to today. In our society algorithms and influencers guide and create the world of our possible virtual experience.

The idea of sortition has not disappeared. Theorists such as the Marxist
scholar CLR James have proposed sortition as an alternative to current
governing electoral paradigms. What does it mean to select people by lot
to make decisions? It is anathema to the contemporary emphasis on
democracy and meritocracy, but perhaps the meritocracy is a fiction and we
should replace it with a different narrative.

The Sortition/Protocol project randomly selects, every few days, a new group of people to post to the Sortition/Protocol social media account for a short period of time. I will refer to these people as leaders. The code for this selection is open source so anyone can change, fork or submit pull requests. This is the engine of our new network topology; a constantly shifting nexus. But what does this mean for creating a framework or fiction around what we are doing?

The traditional algorithmic and influencer networks persist in time, but they have no history. The eternal construction and mediation of a persona is their narrative and their mythology. The history of these networks are quantitative measurements of success in getting people to click, friend, like, or buy. What are the metrics for a network on a sortition topology? What do the temporary leaders have as a record of their tenure? Does it matter that they have a record? What does it mean to have a record for this sort of network topology, or in other words, how is history related to a network topology based on sortition?

A sortition topology does indeed have a history in a way that a topology
based on algorithmic or influencer decision making does not. Each set of
leaders represent a different epistemic regime. I am intentionally
referencing Foucault and the notion that a network represents a
power-knowledge system. The ground of that knowledge, in the case of
sortition, changes with each new group of leaders who create a new
knowledge regime.

Another question becomes, how to create a narrative for a topology in constant change and epistemic flux. Can we even create a narrative or a mythology? A sortition network is a discontinuous network and in order to find continuity and a sense of communal responsibility we should strive to create this base level of meaning. This is the document. The act of leading, of being selected and posting content, and managing the Sortition/Protocol account, is the performance. The documentation is the artwork and the codification of a symbolic regime or episteme.

We can also consider the document in phenomenological terms as the
condition for phenomenological bracketing. The notion of bracketing in a
phenomenological context is to suspend judgement and experience a phenomena without cognitive biases. In the context of Sortition/Protocol, there is a question as to whether we should suspend our personal judgement and act as
Sortition/Protocol, or if we should act as our personal selves. The history of Sortition/Protocol documentation provides a meta-narrative for Sortition/Protocol against the personal proclivities of the temporary leaders. Bracketing in this sense is bracketing personal personal judgement, experiencing the historical document, and when acting as the Sortition/Protocol.

The sort of documentation that we create, like the program for selecting
and running sortition itself, is public and open-source. Initially it is
conceivable as a LaTex program run over the history of items shared and
activity generated on the social media account. The LaTex generation and
object selection is itself an algorithm, but rather than using the
algorithm to surface data, we are using the algorithm to create a past
narrative – a construction of what it means to exist in this new topology.

It is a step away from real-time posting, sharing and exchange, but a
moment of reflection and historicizing. Since the documentation structure
is open source we can extend the documentation to include video, web
documentation, sound, or a multiplicity of representations. With all the
code open-sourced, different communities can implement their own sortition
network topologies on a variety of networks such as instagram, twitter,
mastodon, or scuttlebutt.

Let’s subvert the existing trend toward algorithmic obfuscation and
consolidation of power. It’s no longer about narrative but about
structure. Let’s change the structure and create a narrative around that
structure. Let’s promote historicism and ephemeral media and turn it into mythology.

Code Scaffolding

Code Scaffolding

Did you know, internet friends, that Michelangelo had to construct a special scaffolding system to paint the sistine chapel?? Its true. So my meditation on scaffolding is not with out historical precedence.

One of the things I wanted from my time at  RC was to build better coding habits. This included things like consistently posting projects to github, having a good dev environment (ie tricking out my vim conf), but also structuring my projects in a less idiosyncratic way. And that means scaffolding!

This week was hack week at my job, where we hack on personal projects. I was working on a machine learning project – more to come on that in another post. Since my code was going to be in its own repo, and not part of the monolithic code base, I was wondering what sort of code scaffolding I should use. The code in question is python code – fyi…

What do I mean by code scaffolding?  These are the files and documents that every software project has.  Frameworks like Rails, and Django automatically scaffold projects because they are very opinionated in how things need to work. Node also has some great scaffolding libraries thanks to yeoman. Rust and Haskell also have good project generators – but what about python, just plain ole python??

I posted this question to our corporate internal slack … do we have any corporate python project structural requirements?? Crickets. Although one person did point me to a nifty command line parsing library called click. I was going to say I used this in Rust but really I used the clap library -I just cant think straight because 5 planets are in retrograde and I just got off an airplane.

In any case, after a quick google I found this sample module repository, by Kenneth Reitz. It’s nice. The directory structure is set up well with licenses, readmes, documentation (sphinx), and testing (node). I forked one, and will probably modify this for our internal corporate usage, and also for my own personal usage. Maybe I’ll add some functionality for selenium 🙂

Getting into the habit of setting up my projects in a standard and organized way, helps focus my mind on the task of just writing code and it gives me confidence that the code I share will not be arranged in some bizarro manner. Sometimes bizarro is good, but if you are writing corporate code, or code that has to be  reused, best to take your ego out of it and write something clean, functional, and understandable.