wip noise-based formulations
This commit is contained in:
commit
93cba190c0
53
main.moon
Normal file
53
main.moon
Normal file
@ -0,0 +1,53 @@
|
||||
w, h = love.graphics.getDimensions!
|
||||
|
||||
map = {}
|
||||
map.get = (x, y) -> if map[x] return map[x][y]
|
||||
map.set = (x, y, v) ->
|
||||
map[x] = {} unless map[x]
|
||||
map[x][y] = v
|
||||
seed = love.math.random!
|
||||
scale = 10
|
||||
tileSize = 20
|
||||
camera = { x: 0, y: 0 }
|
||||
|
||||
update = ->
|
||||
if love.keyboard.isDown "a"
|
||||
camera.x -= 4
|
||||
if love.keyboard.isDown "d"
|
||||
camera.x += 4
|
||||
if love.keyboard.isDown "w"
|
||||
camera.y -= 4
|
||||
if love.keyboard.isDown "s"
|
||||
camera.y += 4
|
||||
|
||||
time, tick = 0, 1/60
|
||||
love.update = (dt) ->
|
||||
time += dt
|
||||
if time >= tick
|
||||
time -= tick
|
||||
update()
|
||||
|
||||
love.draw = ->
|
||||
a, b = math.floor(camera.x / tileSize), math.floor(camera.y / tileSize)
|
||||
i, j = camera.x % tileSize, camera.y % tileSize
|
||||
for x = 0, w / tileSize
|
||||
for y = 0, h / tileSize
|
||||
n = love.math.noise (x + a + seed) / scale, (y + b + seed) / scale
|
||||
m = love.math.noise (x + a + seed) / scale, (y + b + seed) / scale, n
|
||||
if m < 0.72
|
||||
love.graphics.setColor n, 1, 0, 1
|
||||
else
|
||||
love.graphics.setColor 1, 1, 1, 1
|
||||
X, Y = x * tileSize - i, y * tileSize - j
|
||||
love.graphics.rectangle "fill", X, Y, tileSize, tileSize
|
||||
if map.get x + a, y + b
|
||||
love.graphics.setColor 0, 0, 0, 1
|
||||
love.graphics.line X + tileSize / 2, Y + tileSize / 2, X, Y
|
||||
|
||||
love.mousepressed = (x, y, btn) ->
|
||||
X, Y = math.floor((x + camera.x) / tileSize), math.floor((y + camera.y) / tileSize)
|
||||
print X, Y
|
||||
map.set X, Y, true
|
||||
|
||||
love.keypressed = (key) ->
|
||||
love.event.quit! if key == "escape"
|
143
src/main.moon
Normal file
143
src/main.moon
Normal file
@ -0,0 +1,143 @@
|
||||
SPAWN = {} -- special value, for things existing naturally
|
||||
-- <name tool used (not destroyed, but causes wear)
|
||||
-- name+ heavy/large variant required
|
||||
-- name- light/small or medium variant required (no +/- == medium)
|
||||
-- name name multiple types of product / resource required
|
||||
-- name#int 1 to int produced / exactly int required
|
||||
-- unless int==1 -> 0 or 1
|
||||
-- unless construct-based -> exact numbers
|
||||
-- name:type specific subtype produced / specific subtype required
|
||||
-- :type produces random type OF subtype / requires any type OF subtype
|
||||
-- name/name requires one of specific types / produces one of specific types
|
||||
|
||||
-- NOTE tool use may refer to tools (hand-crafted) and constructs
|
||||
-- (factory-crafted)
|
||||
|
||||
-- most resources can be a tile, inside a tile (something with capacity), or inside a player
|
||||
|
||||
recipes = {
|
||||
tree: SPAWN
|
||||
bush: SPAWN
|
||||
grass: SPAWN
|
||||
tall_grass: SPAWN
|
||||
["log#1 leaf#2 seed#1/fruit#1"]: "tree"
|
||||
["log#2 leaf#5 seed#4/fruit#4"]: "tree <cutter"
|
||||
["leaf#4 fruit#3/herb#3/vegetable#3"]: "bush"
|
||||
["grain#1/herb#1/seed#1"]: "grass"
|
||||
["herb#2/seed#2/grain#3 plant_fiber#1"]: "tall_grass"
|
||||
animal: SPAWN
|
||||
carcass: "animal" -- must be killed
|
||||
["raw_meat bone#1"]: "carcass"
|
||||
["raw_meat#2 leather#2 bone#2"]: "carcass <cutter-"
|
||||
-- TODO cooker is not obtainable
|
||||
meat: "raw_meat <cooker-"
|
||||
rock: SPAWN
|
||||
stone: SPAWN
|
||||
["flint/stone"]: "rock"
|
||||
["stone#3 metal_ore#1/coal#1"]: "stone <digger+"
|
||||
-- driftwood: SPAWN
|
||||
-- wood: "driftwood"
|
||||
-- TODO smelter is not obtainable
|
||||
["metal#1"]: "metal_ore <smelter-"
|
||||
["metal#2"]: "metal_ore <smelter"
|
||||
["metal#4"]: "metal_ore <smelter+"
|
||||
["wood#2"]: "log <cutter"
|
||||
-- TODO forge is not obtainable
|
||||
-- TODO plastic is not obtainable
|
||||
-- TODO molder is not obtainable
|
||||
knife: { "flint/stone", "metal_ore/metal <forge-", "plastic <molder", tool: "cutter-" }
|
||||
axe: { "log/wood flint/stone", "log/wood metal_ore/metal <forge", "plastic <molder+", tool: "cutter" }
|
||||
pickaxe: { "log/wood flint/stone", "log/wood metal_ore/metal <forge", "plastic <molder+", tool: "digger+" }
|
||||
-- NOTE there are no container types defined
|
||||
milk: { "animal:mammal", fluid: true } -- note: medium or large animal
|
||||
egg: "animal:laying"
|
||||
["cheese#1"]: "milk"
|
||||
-- TODO bacteria is not obtainable
|
||||
["cheese#2"]: "milk bacteria"
|
||||
-- TODO farm is not obtainable
|
||||
fertilizer: { SPAWN, "leaf#2/seed#4", "<farm:animal" }
|
||||
-- TODO syringe is not obtainable (make sure it requires a needle-)
|
||||
-- NOTE organic is not defined
|
||||
dna: ":organic <syringe"
|
||||
-- TODO cloner is not obtainable
|
||||
["animal#1"]: "dna <cloner"
|
||||
["tree#1/bush#1/tall_grass#1"]: "seed farmland water"
|
||||
["seed#2"]: "fruit/vegetable"
|
||||
["seed#1"]: "herb/grain"
|
||||
dirt: { SPAWN, "dirt <digger" }
|
||||
farmland: "dirt <tiller"
|
||||
hoe: { "log/wood flint/stone", "log/wood metal_ore/metal <forge", "plastic <molder+", tool: "tiller" }
|
||||
shovel: { "log/wood flint/stone", "log/wood metal_ore/metal <forge", "plastic <molder+", tool: "digger" }
|
||||
sand: { SPAWN, "sand <digger" }
|
||||
-- hammer: { "log/wood flint/stone", "log/wood metal_ore/metal <forge", "plastic <molder+", tool: "smasher" }
|
||||
-- gravel: { SPAWN, "gravel <digger", "stone <smasher" }
|
||||
water: { SPAWN, fluid: true }
|
||||
-- salt_water: SPAWN
|
||||
["glass#1"]: "sand <forge-"
|
||||
["glass#2"]: "sand <forge"
|
||||
["glass#4"]: "sand <forge+"
|
||||
-- TODO distiller is not obtainable
|
||||
alcohol: { "fruit <distiller-", "grain#2 herb water <distiller+", "vegetable <distiller", fluid: true }
|
||||
-- NOTE remember that depending on origins, different flavor text for item types will exist
|
||||
-- ie: alcohol should be wine, beer, and vodka
|
||||
-- TODO mineral is not obtainable (idea: refine from stone)
|
||||
-- TODO lab is not obtainable
|
||||
medicine: { "herb#3", "mineral plastic water <lab" }
|
||||
textile: { "plant_fiber#2/leather <needle-" }
|
||||
["needle#1-"]: "bone/wood/log"
|
||||
needle: { "plastic <molder-", "metal_ore/metal <forge-", "bone/wood/log <cutter" }
|
||||
["needle-"]: { "plastic <molder", "metal_ore/metal <forge" }
|
||||
backpack: { "textile#2/leather#2 <needle", capacity: 12 } -- base capacity can fluctuate
|
||||
["backpack+"]: { "textile#3/leather#3 <needle-", capacity: 20 }
|
||||
sack: { "textile/leather <needle", capacity: 5 }
|
||||
belt: { "textile/leather/plant_fiber <needle", capacity: 7 }
|
||||
-- crystal: { SPAWN, "crystal <digger+" } -- NOTE will be used in advanced electronics
|
||||
-- TODO factory is unobtainable
|
||||
microscope: "glass metal/plastic#2 <factory+" -- TODO more advanced recipes for better microscopes
|
||||
-- TODO well is unobtainable
|
||||
oil: { SPAWN, "oil <well+" }
|
||||
ice: SPAWN
|
||||
-- ["medicine acid"]: "mineral#5 oil water#2"
|
||||
-- TODO gem -> lens
|
||||
-- TODO uranium -> centrifuge -> fission reactor -> electricity
|
||||
-- TODO oil -> plastic&gasoline&kerosine&tar&methane?
|
||||
-- TODO bacteria -> hydrocarbons
|
||||
-- TODO oxygen, hydrogen, carbon, methane, carbon dioxide, carbon monoxide, nitrogen, argon, helium
|
||||
-- TODO catalytic_metal ?
|
||||
-- TODO ??? super strong metal (harvest from gas giant for advanced techs?)
|
||||
-- TODO bose-einstein condensate, neutronium, superfluidics, superconductors, quantum lockers
|
||||
-- TODO electricity
|
||||
-- TODO computer
|
||||
-- TODO zero-point energy, casimir energy, fusion energy, he3 mining
|
||||
-- TODO battery tech: lead acid, lithium ion, aluminium air, zinc-nickel (metal batteries)
|
||||
-- TODO dynamite
|
||||
-- TODO machinery :mining,logging,farm
|
||||
-- TODO chair,table,dresser,desk,bookshelf,shelf,lamp,locker,door
|
||||
-- TODO clothing
|
||||
-- TODO medkit: syringes, medicine, textiles
|
||||
-- TODO tesla coil
|
||||
-- TODO many foodstuffs (bread, pie, stew, pilaf, salad, etc)
|
||||
-- TODO offices ?
|
||||
-- TODO antimatter generator, particle accelerator, magnetic trap
|
||||
-- TODO plasma, alignment crystal, etc, matter transmitter
|
||||
-- TODO research subatomic particles
|
||||
-- TODO wormhole expansion drive, gravimetric drive, ion drive/photonic drives
|
||||
-- TODO quantum drive, reality rupture drive, warp folding drive
|
||||
|
||||
-- NOTE hay is just a grain type
|
||||
}
|
||||
|
||||
buildings = { -- listing what constructs are required
|
||||
-- NOTE everything requires at least one office and bathroom
|
||||
capitol: { "office", "atrium/lounge", optional: { "cafeteria", "garage?" } }
|
||||
bank: {}
|
||||
}
|
||||
|
||||
-- TODO list animal types somewhere
|
||||
-- NOTE materials have inherint strength, which will effect quality of things
|
||||
-- produced from them
|
||||
-- building: enclosed with walls (and door(s)/window(s))
|
||||
-- and has floors and "roof", two materials per interior tile, one per wall tile :3
|
||||
-- pen: enclosed with fence (and gate(s))
|
||||
-- TODO food edibility chart
|
||||
-- TODO research, universities, prototyping
|
Loading…
Reference in New Issue
Block a user