Log: 5/7/2021


This week: Food and revolution, food and injustice, types of academic papers, and Chinese animated cinema.

The Belly of the Revolution: Agriculture, Energy, and the Future of Communism, Jasper Bernes

Another great essay by Jasper Bernes, partly continuing the line of thought in his essay on logistics with a turn towards questions around agriculture and, to pull on what feels like the main thread, food security (to use an NGO phrase...maybe more accurate to call it "food sovereignty", but I think that means something slightly different than what's discussed here). A lot of the essay reinforces what I learned and came to appreciate while researching fertilizer. Its core is the same general problem found everywhere: the means of individual and community survival/reproduction are disjoint spatially and in terms of control. Echoing the essay on logistics, Bernes notes that any revolution which is not totally simultaneous across the planet will—if can't meet its own needs—have to continue engaging with remaining capitalist countries to a degree of some dependency, and thus remain vulnerable to blockades, embargoes, and the like. If food shortages become an issue, then people become increasingly desperate, making an already risky and frightening project even more so, shifting the calculus for some that they would (probably understandably) rather abandon the revolution for material security. To prevent this happening, the leadership or whatever analogue there is may resort to increasingly violent coercion to prevent that or to pressure food producers to work harder. Thus food independence or food "security" is a necessary condition for any such movement.

Food injustice has deep roots: let’s start with America’s apple pie, Raj Patel

A tour of the history of various foods and their relationship to colonialism, racism, and labor movements. It's always startling to me how much of food is taken for granted as-is; I still remember how weird it felt to realize that chilis, for example, which feel so foundational to so many culinary traditions, were introduced relatively recently on those traditions' histories. Or how much violence is part of the history of sweet things—which I can't help but think of whenever I see the exorbitant amounts of sugar used on baking shows.

I don't think I've ever seen a food show that really incorporates these histories. The closest I can think of is the podcast Gastropod (which is fantastic). But nothing like a food travel show or one of the many cooking/food shows on Netflix. I did want to pitch a show tentatively called "Planet Food" which would take this on, with episodes like:

  • Bananas: about "banana republics", the United Fruit Company (now Chiquita) and its US-backed war in Guatemala; bananas as a vulnerable monoculture and how synthetic banana flavor is actually from a now-extinct variety.
  • Corn: a lot to cover here: its importance as a indigenous crop, now a massive crop for livestock and high fructose corn syrup, the latter which emerged out of constant gluts and need for new corn-based products, which then lets you go into the problem of agricultural overproduction more generally.
  • Preservation/fermentation: as alternatives to refrigeration: brines/pickles, fish sauce, curing, smoking, etc.
  • Fish: overfishing as a common problem studied in economics, fish farms and those conditions, "chilean sea bass" as a case of food "branding", the amount of human trafficking in fishing, and the net as a key technology in fishing (I'm forgetting where I originally read this, but I believe it was nylon nets that were a major change in fishing net technology).
  • Not sure what the title of this one would be, but about how dissociated fruits/vegetables/etc are from their plants, centering around an exercise where people have to draw the plant that a given fruit/vegetable/etc is from.

h/t Halah

"Types of Paper"

I'm enjoying the "types of paper" meme—industry/field-specific memes are a quick way to get a feel for that industry/fields concerns/values/culture and these are kind of an enhanced version of that. If I wanted to review an unfamiliar field's research on a topic I would honestly probably want to start with the matching types-of-paper meme to quickly get situated.

New Gods: Nezha Reborn

I watched the new Nezha movie (I actually haven't seen the first one yet) and I don't know if I would call it a "good" movie but it did indulge a fantasy of this kind of movie existing when I was growing up. I really only knew about Nezha through Uproar in Heaven/大闹天宫 which I loved growing up. An aside: a few years back I wanted to watch it again and could only find this weird new edited version. The original one wasn't digitized or something, but after digging I managed to find a fan restoration and now I keep a copy on all my backup drives (it's also on YouTube). The intro music is still as great as I remember.

Not too long ago I also watched Jiang Ziya by the same studio with my parents. It wasn't very good—the animation style is great, but we all found the movie too long and very confusing. Interestingly both the first Nezha film and this one are supposed to be anchors in a "Fengshen Cinematic Universe" (i.e. films based on Investiture of the Gods/封神演义). On the animation style: the past Chinese 3d animated films I'd seen all looks like their technology and technique lagged like 5-10 years behind Pixar, but these set of films all have carved out a compelling style that also look (to my untrained eye) technically impressive.

I wonder when/if Chinese cinema will start breaking into either US mainstream or subcultures. Korean cinema has been really high quality for a long time but only as of the past couple years started breaching wider US audiences. Hong Kong cinema has also been a staple of the more art-house film crowd but not much breakthrough to wider US audiences (best I can think of is Infernal Affairs which was "translated" into The Departed). To my knowledge Japanese cinema has also struggled to achieve a larger US audience, even with anime's now mainstream appeal (if not mainstream, then much wider than when I was growing up). The difference I see with Chinese cinema is the amount of money Chinese studios can throw behind projects and the massive captive audience they have (only a few foreign movies are allowed to screen in China each year). To my knowledge this is why we've seen movies like that Jason Statham shark movie with Li Bingbing and I've definitely noticed the increase in Tencent and Alibaba logos at the front of many new movies. QQ was also the messenger of choice in one Marvel movie (see below, I can't remember which one). I wonder if amid rising sinophobia this will become a target of conservative/nationalist backlash or not (something something propaganda).

Fugue Devlog 11: NPCs and Cut Scenes


I realized I forgot to build out an important part of the dialogue system: "cut scene" support. These aren't true cut scenes in the sense that they aren't cinematic sequences; here I'm using the term to describe something more like a play: characters moving around, saying things, with audio and animation triggers. This meant expanding the dialogue system to support "stage directions", and that required re-writing a few parts.

The implementation also meant that I had to reckon with NPCs. So far the entities engaging in dialogue were just the player and static objects. Of course it's far more typical that NPCs will be the ones engaging in dialogue. I'd written an Interactable class for things that the player can interact with, but it didn't capture the necessary functionality for NPCs (such as moving around), so I had to re-write that a bit.

Dialogue advancement got more complicated—I wanted to support chains of stage directions (e.g. walking to a place, turning around, walking to another place, etc), so dialogue timeouts and/or manual dialogue advancement don't happen until all of the stage direction sequences are finished.

This all required enough changes that everything felt a bit brittle, so I also spent a bit of time refactoring the code a bit.

Here's a small example of the cutscene system (the moving character is an NPC and the behavior is entirely directed by a dialogue script). The stage directions here are: walk to the designated point, turn to look at the player, then run the "pick up" animation.

Demo of the "cutscene" dialogue options

Stage directions can be attached to any line in a verse:

Adding stage directions in the dialogue editor

Sometimes NPCs should move around etc without saying anything, so I've added a special speaker name of <none> for these cases. The general syntax for a stage direction is npc node name:target node name (excluding directions that don't have an actor, e.g. playing an audio clip). If there are multiple directions for a single actor attached to one verse-line, they're executed in sequence. If there are directions for multiple actors, they're executed in parallel. I'm hoping this doesn't relinquish too much timing control, but who knows at this point.

One problem here is that these are just open-ended text inputs. There's nothing checking that these actor or target nodes actually exist.

I updated the dialogue editor script validation to now require an associated scene, against which all references of speakers/actors and target nodes are checked against:

Updated dialogue editor validation against associated scene nodes

That should now cover all the systems that'll be necessary no matter how the world, narrative, and other game mechanics shape up. Before moving forward with the rest of the development I need to sort those out to figure out what exactly I'll need.

Log: 4/30/2021


This week: prescribing math for gamblers, the hustle economy as a search function for capitalism, economic planning and control, beef and climate change, and the emerging phenomenon of acquisitions of Amazon sellers.

Mathematics for gamblers, Catalin Barboianu

I always like reading about randomness and probability because it's so counterintuitive and uncertainty/risk management (more broadly, "security") seems to be a decent explanation for so many behaviors. Gambling is one behavior that's sometimes pathologized as a kind of innumeracy/ignorance about probability. If that's the diagnosis, then people with gambling problems are told to "trust" the math...when gambling, like any social problem, isn't just an issue of "irrationality" or ignorance but a complex interaction of personal history, biological/psychological factors, etc. The more interesting objection in the article is: what does it mean for someone to "trust" the math when applying mathematical knowledge is a skill in itself? You need to be able to evaluate what relationships are relevant to what situations, for example, and because probability is so counterintuitive, it's very easy to misapply or misunderstand what you learn about it.

The Hustle Economy, Tressie McMillan Cottom

A great overview of the "hustle economy", where "economic opportunity" as code for "opportunity to hustle" and is increasingly just "the economy" for many people. Existing hierarchies and oppressions are reproduced if not compounded within the hustle economy, e.g. through "subprime" services that provide financing at a higher cost to those who are ignored/excluded by existing entrepreneur infrastructure.

There is a weird romanticism around "the hustle" in a lot of media representations and I wonder how oppressive relationships come to be represented in that way (I'm kind of thinking of Nomadland right now).

In line with above, the hustle economy is risk shifting en masse; e.g. with Uber and other gig economy companies shifting as much risk as possible to their drivers/workers (I take it that the gig economy is a subset of the hustle economy).

One thing that's been in my head wrt to the hustle economy is its "search" function for capitalism: if profits are harder to find, you need more people searching for opportunities for profit. With the hustle economy you have millions of people trying to find a big opportunity for themselves; if they hit upon success they often hit a wall in terms of scaling rapidly. Larger firms or more resourced entrepreneurs are able to swoop in, scale quickly, and push the original people out.

Planning and Anarchy, Jasper Bernes

Planning, or "economic calculation", is a common point of disagreement on the left. "Planning" usually implies "central planning" and evokes a shadowy bureaucracy of distant politicians sending down quotas and reprimands, hoarding and number fudging among local officials or factories, and catastrophes of scarcity and ill-met needs: that is, complete dysfunction. The recent "algorithmization" of life has brought a renewed interest in the idea that perhaps instead of people, computers can do the planning (this is a fun read on how difficult this is in practice). There are varying degrees of this belief: that planning exclusively be left to a single or consortium of AIs à la Iain M. Banks' Culture or that computers have some role to play in planning (seems reasonable). Though I've found the former more extreme position to be fairly common, at least as a desire if not a belief in something that will realistically happen soon, I've seen very little discussion on how that would come about or what that might look like (though there's this article, The Problem of Scale in Anarchism and the Case for Cybernetic Communism, that goes into more technical details). I say this as someone who still views Cybersyn, a cybernetic planning system (incompletely) developed under Allende, as a valuable if flawed utopian project. This article by Jasper Bernes is probably the best thing I've read on this topic lately.

But planning is not just about knowing what resources you have and where (the measurement part of planning) and deciding how much to make of what and where and how those affect whatever it is you're optimizing (the calculation part of planning)—it's also about whether or not those plans can be executed. Bernes puts it well:

Beneath problems of calculation lay much deeper organizational issues. At stake in planning is not simply the question of whether or not all resources and all needs can be recorded and measured in terms of labor time or some other numeric marker, not simply the transparency of that data or its legibility in terms of a single measure. The more important question is about control—whether and how that measure can effect changes in the distribution of those resources in order to satisfy those evolving needs. Inasmuch as humans are involved, this is not only a technical problem to be solved by mathematical formula and computation algorithm but a political one to be solved by class struggle.

This really becomes a question of how you get people to follow the plan, and when states want people to behave a certain way they generally resort to violence:

inasmuch as people are involved in producing things, and inasmuch as those things have as their final end the satisfactions of the needs and desires of people, one cannot so easily separate the administration of things and the administration of people. The USSR had a broken system for administering people, and did so irrationally, relying on violence, and often gratuitous violence, to move the levers of a machinery inherited from capitalism.

This may not look all that different than the typical violence of life under capitalism: the commodification of needs, the linkage of waged labor and survival as a way to "incentivize" your participation as a worker.

Bernes also goes through the more fundamental challenges of planning:

there is a deeper epistemological problem here: preferences are not stable, nor are the types of things available to people. Once one leaves behind the assumption of a fixed and unchanging set of commodities organized by stable preferences then mathematical calculation confronts strong limits: one can't really know what people may want in the future when one doesn't know what will be available. For short-run calculation, one might mobilize the technologies of contemporary logistics, developing algorithmic systems that monitor inventories and stocks and make predictions about needed supply and future demand from such observations. But this would do little to guide decisions about long-term investments in plant and infrastructure, nor the allocation of labor, which can't simply be whipped about from site to site, like a pallet of toilet paper. At some point, the planners themselves would have to choose between incompatible developmental paths based on only speculation about the future. Though they would be advised by referenda and juries, one might question whether a group of people should have such power in the first place.

Or that with central planning: "the planners would make themselves a target for capture by groups or factions wanting to gain privileged access to social wealth."

"Planning" is of course not the same as "central planning", and so these indictments are not against planning more generally. The possibility is left open of some kind of intensely local planning, for example, where it seems that at least some of these problems become more manageable. But it seems like some minimum scale is necessary to reliably fulfill all needs, and that local planning will eventually hit up against a more macro-level planning.

Beef Rules, Jonathan Foley

Beef consumption is a very hot topic wrt to climate change—massive pools of manure creating waste management and contamination problems, huge amounts of agricultural productivity diverted towards feed for livestock, flourishing conditions for disease and antibiotic resistance, methane emissions, not to mention horrendous conditions in CAFOs (concentrated animal feeding operations). As a solution you have people like Bill Gates advocating for synthetic and/or plant-based meat substitutes. These are problems of industrial beef production and not beef production in general. I'd read about cattle's value in field preparation, e.g. consuming cover crop and incorporating it into the soil, so clearly there are alternatives. But it seems clear that current levels of beef consumption can't be sustained in any other way (I'm not familiar enough with synthetic meat production to comment on that, only that in general we should be skeptical of these proposals). I left my understanding at that until I had more time to read about the topic.

I came across this piece and this Twitter thread by Paige Stanley on the topic via Max Ajl, which mostly confirmed my understanding. Grass-fed (grazing) beef can be beneficial in terms of climate change but can't meet existing levels of consumption, though potentially up to 60% of it, possibly more with improved grazing techniques and with reduced wastage. Maybe the biggest challenge is that grass-fed beef requires more land, but as pointed out in the piece, this land might not have many competing uses (in terms of food production, at least).

The Great Amazon Flip-a-Thon, John Herrman

An emerging phenomenon in the Amazon ecosystem is the acquisition of sellers by investment firms. This isn't something that I'd ever thought about but makes sense in retrospect—surprising to see, via the chart below, that this is really something that only took off over the past year. I wonder what impact it'll have.

From Companies Acquiring Amazon Businesses

h/t Moira

Fugue Devlog 10: Scene Setups and Outdoor Environments


Karsts test outdoor environment

Scene portals

One of the last two scene components were "portals", i.e. the connections to other scenes. I didn't give this a whole lot of thought; I just used Areas that have an associated scene that the player's sent to. It works fine, though there were a couple small snags at first.

The first was infinite scene looping: when the player leaves out of one portal and enters the new scene, they spawn in the portal of the other scene. That immediately sends them back to the previous scene, where they spawn in the portal, thus sending back to the other scene, and so on. I just needed a bit of code that starts with portals deactivated until the player leaves the entrance portal area.

The second was load times. There's some hanging after entering a portal while the new scene loads. I added a very simple preloading system, where a scene preloads any linked scenes. A cache of recent scenes is kept (right now the last ten, but could probably be higher than that) to reduce loading further. I imagine a more sophisticated preloading system might be ideal later, such as one that preloads not only the immediately linked scenes but those that are two jumps out.

Scene boundaries

The other last scene component was scene boundaries, i.e. preventing players from walking out of the camera's view or falling off the map. I don't know what the best practice around this is, but I just used static bodies and collision polygons; basically invisible walls. Godot's collision polygons were pretty frustrating to use at first, but eventually I got the hang of it.

Top-down view of level boundaries

Grass and wind shader

I took a shot at creating my own grass wind shader to emulate the Ghibli effect I talked about last time and didn't produce anything worthwhile. Shaders are still really confusing for me! I ended up following this grass shader tutorial for Godot which gave me a bit more insight into how to implement a shader for a particular effect, but still way above my knowledge level. In any case, it looks amazing and I gave it a try in the outdoor environment. The performance lags a bit (20-24fps) but it's not nearly as bad as I thought it'd be.

What I need to think on more is whether or not the effect needs to be reproduced in the background, and if so, how best to do it. I might be able to layout levels so that I don't even need to do that. For example here I shaped the terrain so that it looks like you're at the top of a hill, which is why you don't see any more grass in the closest part of the background. This is just a trick so I don't have to render more grass than absolutely necessary (I'm realizing a huge benefit of the fixed cameras is that you can do many of these kinds of tricks).

Throughout this whole process I'm learning a lot about how challenging emulating light is, especially in video games where you are far more resource-constrained (i.e. you need to hit a certain number of frames per second). I've kind of known that light/shadow is where a lot of the focus is in better video game graphics (e.g. raytracing) but didn't really appreciate it until now. I thought that by sacrificing mesh complexity and detail I'd have more room for light/shadow effects, but I had it backwards: the light/shadow effects were always the primary bottleneck. This is all to say that one problem with the grass/wind shader above is that shadows aren't cast onto the grass! But I think I have to let that slide. I did have a sketch of a very simple cloud shadow shader for grass; maybe I'll try to combine it with this one in the future.

Background environments and skyboxes

I'm still working on figuring out my general approach to these outdoor environments. I thought I should design the foreground to be more like an "indoor" environment with elements like the grass shader and then just have a pre-rendered skybox as the background. I'd create all the terrains in Blender, then just export the environment render and load it in Godot as a skybox.

I was not very successful at this. I tried creating a terrain of karsts, which itself was fun to do in Blender. The shader system there is powerful and you can generate a variety of environments with noise textures (probably much trickier to do if they have to have concave elements like overhangs though). The snag came when importing into Godot—it just looked terrible. I think skyboxes are literally just for skies.

The karsts of Guilin

This was really discouraging...I wasn't sure what to do. Eventually I decided to try just exporting the terrain as a mesh rather than as a background image or skybox and that worked surprisingly well.

There are still some issues with textures here (banding, doesn't seem to be the right resolution), and I simplified the geometry too much (way too pointy). But this captures the gist of what I was going for, and more importantly, the workflow is promising!

What's next

This terrain/environment process needs more tuning, but I'm happy with it for now. That was one of the last big unknowns for me in terms of the art asset workflow (the other one is character design, but I'm holding off on that for now). I think I'll take a step back from the art/game development and dig back into the world-building/narrative side.

Fugue Devlog 9: More Natural Environments and Better Player Control


As I mentioned in the last devlog, I implemented a two viewport system: one viewport for the half-resolution 3d rendering and then a second main (the root) viewport to render the UI and scale up the 3d output. One problem: shadows weren't rendering anymore. This was easy to fix; by default new viewports don't have a shadow atlas, so I just had to change that value from 0 to 1.

I also continued work on the outdoor/natural environment scenes, which brought up some more issues. The forest clearing scene dropped in performance (down to 11-15fps) once more trees were added, which I kind of expected. I reduced the tree model to about 330 vertices (from ~1.2k), which probably helped a little, but was less impactful than I'd hoped. I ended up playing around with the root viewport settings (which confusingly are mixed into Project Settings > General). By default the root viewport is set to render 3d, but now it's only rendering the 2d image it's passed by the half-resolution viewport. So I set the root viewport's render mode to 2d (under Project Settings > General > Intended Usage) and that boosted the scene to around 24-30fps. Still not the greatest, but fine for now.

I also wanted to set up a baked lightmap for ambient occlusion, but there's a bug where environmental lighting isn't taken into account (a fix should be out in 3.3.1).

I also put together a cave/grotto scene, which went quickly:

I realized the cave and forest clearing scenes are actually closer to indoor scenes: there's no skybox or distant environment to render. So I started playing around with a proper outdoor environment, where the sky is visible and there's distant geometry to handle:

A lot of new things to consider here. One, which is mostly specific to this particular scene, is grass and wind effects. I have a lot of grass here...I want to evoke that wind-sweeping-through-the-grass effect that comes up in a lot of Ghibli films. Of course this is a performance hit, with the scene rendering at 10-15fps.

A real-life example

If you look at the effect in Ghibli films, it's actually very simple. The grass is just a static image with trails moving on top:

From The Wind Rises

So I don't really need actual grass geometry for the effect to look good. I can probably put together some kind of shader that moves these trails over the surface of a static texture.

The other thing I'm not sure about is what to render as a skybox and what to render as in-game terrain. I'm using the HTerrain plugin to generate terrain and in the image above all the terrain is in-game. It's really lacking in detail/richness which is mostly because I'm only using one texture. I'm thinking I should probably only render the foreground as in-game geometry and everything else as skybox for performance's sake. Which means I need to figure out a workflow for modeling and exporting skyboxes from Blender. This is something I'll have to think on more, I'm really not sure how best to approach this.

A few other updates:

  • Set up a test character and started giving character animations a try, which I was dreading (I still am, but less so). The whole process was made way easier with Mixamo—this will sound like an ad, but it has an auto-rigger that makes a rigging a character very easy and their library of free motion-capture animations covers a lot of what I need right now. For the character itself I based a mesh off of Kiros from FF8 an am using a texture someone extracted from the game.
    • It's very helpful to have a character for scale. The scale of the indoor test environment, for example, was way too huge.
    • I spent quite a long time tweaking the third-person controls, eventually settling on a system that doesn't use the mouse. Basically, with the default keybindings of WASD: W moves the character forward in whatever direction they're facing, S moves the character backwards (i.e. they literally walk/job backwards), and A/D turns them to their left or right respectively. So far it feels smooth and intuitive.
  • Formalized the "scene" system a bit more. I implemented a node type called Scene which contains information like fixed camera configurations and where the player spawns. This is really simple at the moment, but I imagine it'll be more complicated as I need to switch between cameras in a scene, or track the player for certain segments, and so on.
<< >>