aboutsummaryrefslogtreecommitdiff
path: root/src/world.moon
diff options
context:
space:
mode:
authorAlex Pickering <alex@cogarr.net>2026-02-01 13:14:32 -0600
committerAlexander M Pickering <alex@cogarr.net>2026-02-01 13:14:32 -0600
commit3a975db66a3711f34e8b64bb27a8eaca79fdeca9 (patch)
treefcc12f8f9d638ff575c1963796de76b7628854b4 /src/world.moon
downloadggj26-3a975db66a3711f34e8b64bb27a8eaca79fdeca9.tar.gz
ggj26-3a975db66a3711f34e8b64bb27a8eaca79fdeca9.tar.bz2
ggj26-3a975db66a3711f34e8b64bb27a8eaca79fdeca9.zip
Initial commitHEADmaster
Diffstat (limited to 'src/world.moon')
-rw-r--r--src/world.moon52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/world.moon b/src/world.moon
new file mode 100644
index 0000000..d3a2ca7
--- /dev/null
+++ b/src/world.moon
@@ -0,0 +1,52 @@
+-- Global state
+--win = require("window")
+hc = require("party.hc.init")
+--ecs = require("ecs")
+--settings = require("settings")
+color = require("color")
+log = require("log")
+
+MAX_LAMPS = 8
+
+--Use a collider to decide what to render
+x = {
+ -- client-side viewport offsets from the world
+ world_x: 0
+ world_y: 0
+ -- Have we selected an input type yet?
+ controller: { -- logical input abstraction, not a physical input device controller
+ text_size: 1
+ }
+ domain: "client" -- "client" or "server"
+ -- (Client) Level information
+ level: {
+ graphics:{} -- Client side graphics
+ entities:{} -- Client side entities
+ graphic_world: hc.new(5) -- Client side graphics world
+ physics_world: hc.new(1)
+ collider: nil -- Collider in the physics world to figure out what we can see
+ }
+ -- (Server Networked) level information
+ level_sync: {
+ name: "" -- The name of the level
+ data: {} -- sequence, holds arguments for level initalization
+ ents: {} -- holds all the entities in the level
+ entid: 0 -- a nonce entid, just keep increasing and allows for holes in "ents"
+ peers: {} -- holds peers in [peerid: string] = Entity
+ phys: hc.new(5) -- The physics world we need to collide with
+ ref: nil -- Holds a ref to the level, has things like name, get_spawn_location(), ect.
+ }
+ sync_time: () ->
+ am.current_time!
+ hub: nil -- server, filled out later
+ network: nil -- client, filled out later
+ -- Stuff that goes to the shader
+ geom_view: nil -- am.vec3_array
+ uv_view: nil -- am.vec4_array
+ check: () =>
+ assert(@level_sync.ents, "Ents is nil")
+ assert(type(@level_sync.ents), "ents is not a table")
+}
+
+log.info("At the end of src/world.moon, world_x is" .. tostring(x.world_x))
+x