Skip to content

Jackrekirby/minecraft-ca-ts

Repository files navigation

Minecraft Cellular Automaton in Typescript

This project aims to recreate minecraft redstone using cellular automaton.

Using Website

Below is a link to the website where you can run the cellular automaton.

https://jackrekirby.github.io/minecraft-ca-ts/

Guide

The guide will automatically appear for first time visitors of the website as well as when the version is bumped. To manually open the guide click the ? icon at the top right of the website.

Task List

  • Add zoomable and pannable world renderer
  • Make tool for layering and rotating textures
  • Make texture atlas generator
  • Add pistons, redstone block, moveable block
  • Add redstone torch
  • Make isOutputtingPower directional
  • Make placement directional
  • Convert all create block function to take state input
  • World loading from local storage
  • Pull out powerable block interface
  • Make generic moveable block function
  • Make piston powered texture
  • Add redstone lamp
  • Piston will not retract if pending block
  • [-] Side blocks disappear on complete movement block
  • Make saveable state (to file so users can try them out)
  • Test pistons pushing and facing eachother (they replicate infinitely!!!)
  • Make blocks classes so they can use prototypes
  • Add subticks
  • Add chunk system (infinite world)
  • Add moveable pistons
  • Make rendering block more efficient (chunking?)
  • Make block picker (inventory)
  • Make world selection system
  • Make world snap to grid
  • Make minor and major grid lines
  • Make world panning have minimum threshold
  • Negate the single click select block function on double click delete block
  • Cannot just check if block is of moveable type. A moveable type can be temporarily immovable. Must check movement method
  • Reconsider movement method function on block interface
  • Save world location and scale
  • [-] Auto-position camera at largest mass of blocks?
  • Fix duplicate pistons in double piston extender when powered incorrectly
  • Remove defaults from blocks (maybe have explicit default function)
  • Convert blocks to use prototypes to improve efficiency / performance
  • Add touch support
  • Add controller support
  • Split index.ts into more files
  • Support Full Screen Canvas
  • Add basic command line (history, hints, output)
  • Add bitmap font rendering
  • Prevent texture bleeding on atlas
  • Grid size should be based on pixel width of block, large screens should remain at unit grid size longer
  • [-] If updates are faster than the frame rate then do not render (do not wait to render before processing next step)
  • Fix panning freeze / jitter
  • Make number of allowed subticks unlimited (until all processed)
  • Improve user input so place and delete events are easy to distinguish (single vs double click)
  • Add failing state to block movement once subupdate block movement implemented
  • Overhaul game loop - render at any time, rendering and logic should not be in same loop
  • Overhaul local storage save system (should not be saving multiple times per second)
  • History only toggles between two
  • Overhaul command line html/css - list grouping so they both disappear correctly
  • Fix overlapping textures by flooring and ceiling together/seperate?
  • Add hide command output command
  • Add commands for hiding fields in debug panel
  • Put ups and sups in state management
  • Fix zoom of browser breaks panning/zooming
  • Add powerable block type
  • Fix repeater never turning on after being powered if power duration less than repeater delay
  • Add 1 tick sticky piston spit out block
  • Add non-sticky pistons
  • Add redstone dust
  • Fix pixel shifting when texture changes when zoomed out
  • Fix blocks like lamps should have their state ready when movement complete (quick fix with subtick power processing)
  • Fix command history/hint on click makes command line disappear before execution
  • Improve texture packer to handle different texture sizes
  • Design redstone textures and add to atlas
  • Add wool blocks
  • Add generic user interact function to blocks
  • Add ability to pick block with state, not just block type
  • Add ability to use pick block command with state, not just block type
  • Add command / structure blocks
  • Add clone command
  • Fix bug with texture packer not waiting for all images to be generated before packing
  • Add lever block
  • Should block powering occur in subticks
  • Enable block pick to support state
  • Add drag selection copy paste
  • Add button block
  • Add force clear of local storage when version bumped
  • Blocks should not output power whilst moving (quick fix with subtick power processing)
  • Add world download
  • Allow blocks to filter states visible to observers
  • Add performance metric to debug panel (tps, stps, fps)
  • User block placement/deletion/interaction should update blocks on canvas on next frame instead of logic tick
  • Paused logical ticks should be remembered on reload and blocks should render on load
  • Add falling blocks
  • Add clear falling blocks command
  • Add comparator block
  • Remove unused toString function from blocks
  • Investigate performance
  • Investigate object pooling rather than creating new instance
  • Build time should update on webpack watch
  • Actual FPS/TPS much lower than target (consider overshoot and sleep remaining not elapsed)
  • Typing in command window should not trigger keyboard shortcuts
  • Observer double pulses when facing piston head
  • Observer pulses on incomplete block movement
  • Demo world not loading on local storage clear
  • Add world update queue rather than updating entire world every tick
  • Center world at 0,0 on load
  • Add teleport command
  • Add scale command
  • Add guide (copy readme into game)
  • Consider new chunk container and iteration for improved performance
  • Save on place/destroy block immediately, otherwise every 30s
  • Can tick/subtick processing be increased more (until fps tanks)? Yes
  • Add queue length to debug panel
  • Command callbacks to change fps/tps not always updating when tps high. Clear overshoot if it exceeds loop period.
  • [-] Improve update canvas block performance by not overwriting entire array but just changes.
  • Replace dictionaries with maps, much faster
  • Add slime blocks
  • Add target block
  • Add obsidian
  • Add random texture rotation
  • Add hard and soft power types
  • Support texture layers
  • Support rotated textures
  • Convert all textures to texture layers that could benefit from it
  • Support color blending for redstone signal strength (in-browser available but slow so generate in texture atlas instead)
  • Support togglable redstone signal strength
  • Add signal strength view limit
  • Reduce idle time - performance worse without updateCanvasBlocks call due to more idle
  • Increase signal strength number size
  • Investigate web workers
  • Investigate webgl canvas context
  • Fix world not displaying on clear/load when tick rate 0
  • Add redstone junction
  • Make solid blocks support signal strength
  • Add block with variable comparator output signal
  • Stop storage variable initialising themselves on file import
  • Make pickblock goto existing slot on inventory if it exists
  • Make pickblock not copy state into inventory slot
  • Save inventory state in local storage
  • Add block debug tooltip
  • Add signs that make use of tooltip
  • Make moving block a type rather than a feature of all blocks
  • Add all copied blocks to queue
  • Add drag deletion
  • Add max subticks to avoid game freeze
  • Add grass
  • Add dirt
  • Add crops
  • Add trees
  • Add water
  • Add lava
  • Add cobble generator
  • Add tnt
  • Add dispenser (block copier)
  • Fix inventory disappear whilst writing commands
  • Fix infinite subticks with solid block internal power state
  • Improve debug tools for infinite subticks to isolate blocks at fault
  • Add block name aliasing
  • Make editable block state debug
  • Add command blocks
  • Improve tree growth check to enable growth into leaves
  • Prevent non-inventory blocks being picked (piston head)
  • Moved blocks should not carry across power
  • Fix 4 tick repeater texture
  • Make leaves breakable
  • Add set and fill commands
  • Add clear commands
  • Add animated textures
  • User inputs need to be processed as part of processing loop to prevent race conditions. Command blocks cannot update a block during block update loop as block is about to be overridden.
  • Command blocks do not follow rules of cellular automaton. Is this ok?

webgl canvas

  • Rather than attempting to draw lines just draw a repeating texture
  • Reinitialise context on window resize
  • Make shader programs completely seperate
  • Test if base 2 atlas size is required