Skip to content

Instantly share code, notes, and snippets.

To implement the PluginBloxel for your Minecraft-style game in Rust using Bevy, you'll need to design your WorldGrid type along with appropriate traits, components, and systems to manage the voxel grid, entities, and interactions.

Types and Components

  1. IVec3: Already provided by Bevy for grid coordinates.
  2. WorldGrid: Manages the entities in the voxel grid.
  3. Block: Represents a 1-meter cube making up the terrain.
  4. NonBlockEntity: Represents non-block entities like tables, chairs, buttons, etc.
  5. SubGrid: Represents nested WorldGrid instances.

Bevy Bloxel Plugin Design Notes

This document is just scratch notes for a plugin for Bevy to manage a block-type world like in Minecraft.

Features

This plugin, to be useful, must provide a number of things.

  1. Ability to create, damage, and destroy blocks in an aligned grid.
@jrmoserbaltimore
jrmoserbaltimore / mycore.py
Last active March 12, 2024 05:29
MiSTer core template rewrite in Python with Amaranth (boredom) (FSM version)
from amaranth import *
from amaranth.lib.coding import *
from numpy import log2, ceil
# FIXME: New Amaranth release indicates we should be deriving from Component, not
# Elaboratable
class MyCore(Elaboratable):
def __init__(self):
self.clock = Signal(1)
@jrmoserbaltimore
jrmoserbaltimore / pipe.py
Last active January 29, 2024 02:59
pipeline for Amaranth
with FSM():
with m.State("Begin"):
with m.If(self.strobe):
m.next = "Process"
with m.State("Process"):
# Automatically create pipe.mult, pipe.shift
with m.Pipeline([self.mult, self.shift]) as pipe:
with pipe.Stage():
# manually set up pipe.xor
@jrmoserbaltimore
jrmoserbaltimore / dsvf.py
Created January 21, 2023 20:46
Attempt at Chamberlin DSVF
# Python 3.10 required
import numpy as np
from numpy import pi, sin, tan
from typing import Optional
import matplotlib.pyplot as plt
import scipy.fft as fft
class FilterModes:
DSVF_CHAMBERLIN = 'Chamberlin'
DSVF_LAZZARINI_TIMONEY = 'Lazzarini-Timoney'
@jrmoserbaltimore
jrmoserbaltimore / cordic-test.sv
Created January 16, 2022 21:55
CORDIC slows as pipeline grows
`default_nettype uwire
interface ICORDIC
#(
parameter width=40 // 48 max
)
(
wire logic [width-1:0] x,
wire logic [width-1:0] y,
wire logic [width-1:0] z,
@jrmoserbaltimore
jrmoserbaltimore / 6-op.md
Created June 20, 2021 06:28
6-op circuit
             +----------------------------------------------+
             |                                         /|   |
             |             +------------------------->| |   |
             |    +----+   |     /|            +----->| |---+
             +--->|    |   |    | |--->Acc1    | +--->| |
                  |Op 1|---+--->| |--->Acc2    | |     \|
                  +----+   |    | |--->Acc3    | |
               +-----------+     \|            | |
               |                               | |

| +-------------------+ |

@jrmoserbaltimore
jrmoserbaltimore / fm-step-by-step.md
Last active April 20, 2024 02:42
Step-by-step FM synthesis explanation

An attempt to explain step-by-step how FM synthesis calculation works.

OPL3

Using the OPL3 as an example, there are several components:

  • Vibrato feeds into the phase generator (PG) to modulate its frequency
  • Tremolo feeds into the envelope generator (EG) to modulate its amplitude
  • PG and EG feed into the operator
  • Operator outputs to the next operator
@jrmoserbaltimore
jrmoserbaltimore / arXiv-social-choice.md
Created May 31, 2021 18:01
Social choice theory papers on arXiv

These papers cover social choice, public choice, and voting theory. See the Handbook of Social Choice and Voting by Heckelman and Miller; or Collective Decisions and Voting by Nicolaus Tideman.

Voting rules and analysis

These are analyses of voting rules or other theoretical analysis independent of political conditions. This stretches as far as analyzing how and when voters behave strategically under particular systems, although that's more blurry.

Ordered preferences X≻A → if X is not a candidate, voter votes for A

14: Alex≻Bobbie≻Chris≻Dane  \
12: Bobbie≻Alex≻Chris≻Dane   | ← 51% majority, doesn't count.
25: Chris≻Bobbie≻Alex≻Dane  /
49: Dane≻Chris≻Bobbie≻Alex  ← Most votes, wins plurality

Instant runoff voting: