From 0dc1276df57aa16b4f0eaecf54fb5cd8f00115c6 Mon Sep 17 00:00:00 2001 From: ubq323 Date: Sat, 4 Feb 2023 23:03:19 +0000 Subject: many many optimizations and refactorings; introduction of Map to support multiple chunks, modify worldgen and client drawing to support multiple chunks --- common/chunk.lua | 23 +++++++++------- common/class.lua | 7 +++++ common/constants.lua | 4 +++ common/coords.lua | 77 ++++++++++++++++++++++++++++++++++++++++++++-------- common/map.lua | 51 ++++++++++++++++++++++++++++++++++ 5 files changed, 140 insertions(+), 22 deletions(-) create mode 100644 common/constants.lua (limited to 'common') diff --git a/common/chunk.lua b/common/chunk.lua index 1d3faa6..affdab8 100644 --- a/common/chunk.lua +++ b/common/chunk.lua @@ -1,9 +1,8 @@ local json = require"common.dkjson" local class = require"common.class" +local coords = require"common.coords" -local CHUNK_SIZE = 64 - --- for now tiles shall be booleans +local CHUNK_SIZE = require"common.constants".CHUNK_SIZE local function index_ok(offq,offr) return 0<=offq and 0<=offr and offq