--- a/antipodes.asd Sat Jan 07 14:16:41 2017 +0000
+++ b/antipodes.asd Sat Jan 07 14:30:26 2017 +0000
@@ -22,8 +22,10 @@
(:module "src" :serial t
:components
((:file "utilities")
- (:module "gen" :serial t
+ (:module "generation" :serial t
:components ((:file "world")))
- (:module "ent" :serial t
+ (:module "aspects" :serial t
+ :components ((:file "coordinates")))
+ (:module "entities" :serial t
:components ((:file "player")))
(:file "main")))))
--- a/package.lisp Sat Jan 07 14:16:41 2017 +0000
+++ b/package.lisp Sat Jan 07 14:30:26 2017 +0000
@@ -27,7 +27,7 @@
:init-colors
))
-(defpackage :ap.gen
+(defpackage :ap.generation
(:use
:cl
:iterate
@@ -38,7 +38,7 @@
:ap.quickutils)
(:export))
-(defpackage :ap.ent
+(defpackage :ap.entities
(:use
:cl
:iterate
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/aspects/coordinates.lisp Sat Jan 07 14:30:26 2017 +0000
@@ -0,0 +1,2 @@
+(in-package :ap.entities)
+
--- a/src/ent/player.lisp Sat Jan 07 14:16:41 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-(in-package :ap.ent)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/entities/player.lisp Sat Jan 07 14:30:26 2017 +0000
@@ -0,0 +1,1 @@
+(in-package :ap.entities)
--- a/src/gen/world.lisp Sat Jan 07 14:16:41 2017 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-(in-package :ap.gen)
-
-
-(defparameter *map-size* 2000)
-(defparameter *noise-scale* 0.03)
-(defparameter *noise-seed-x* (random 1000.0))
-(defparameter *noise-seed-y* (random 1000.0))
-
-(defun make-empty-heightmap ()
- (make-array (list *map-size* *map-size*)
- :element-type 'single-float
- :initial-element 0.0))
-
-(defun noise-heightmap (heightmap)
- (iterate
- (with ox = *noise-seed-x*)
- (with oy = *noise-seed-x*)
- (with scale = *noise-scale*)
- (for (val x y) :in-array heightmap)
- (setf (aref heightmap x y)
- (black-tie:perlin-noise-single-float
- (+ ox (* x scale))
- (+ oy (* y scale))
- 0.0))))
-
-(defun generate-heightmap ()
- (let ((heightmap (make-empty-heightmap)))
- (noise-heightmap heightmap)
- heightmap))
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/generation/world.lisp Sat Jan 07 14:30:26 2017 +0000
@@ -0,0 +1,33 @@
+(in-package :ap.generation)
+
+;;;; Parameters ---------------------------------------------------------------
+(defparameter *map-size* 2000)
+(defparameter *noise-scale* 0.03)
+(defparameter *noise-seed-x* (random 1000.0))
+(defparameter *noise-seed-y* (random 1000.0))
+
+
+;;;; Heightmap ----------------------------------------------------------------
+;;; TODO: Switch to something less samey
+
+(defun make-empty-heightmap ()
+ (make-array (list *map-size* *map-size*)
+ :element-type 'single-float
+ :initial-element 0.0))
+
+(defun noise-heightmap (heightmap)
+ (iterate
+ (with ox = *noise-seed-x*)
+ (with oy = *noise-seed-x*)
+ (with scale = *noise-scale*)
+ (for (val x y) :in-array heightmap)
+ (setf (aref heightmap x y)
+ (black-tie:perlin-noise-single-float
+ (+ ox (* x scale))
+ (+ oy (* y scale))
+ 0.0))))
+
+(defun generate-heightmap ()
+ (let ((heightmap (make-empty-heightmap)))
+ (noise-heightmap heightmap)
+ heightmap))
--- a/src/main.lisp Sat Jan 07 14:16:41 2017 +0000
+++ b/src/main.lisp Sat Jan 07 14:30:26 2017 +0000
@@ -32,8 +32,6 @@
(+yellow-black+ charms/ll:COLOR_YELLOW charms/ll:COLOR_BLACK)
(+green-black+ charms/ll:COLOR_GREEN charms/ll:COLOR_BLACK)
(+pink-black+ charms/ll:COLOR_MAGENTA charms/ll:COLOR_BLACK)
-
- (+black-white+ charms/ll:COLOR_BLACK charms/ll:COLOR_WHITE)
)
@@ -99,7 +97,7 @@
;;;; World Generation ---------------------------------------------------------
(defun generate-world% ()
- (setf *terrain* (ap.gen::generate-heightmap))
+ (setf *terrain* (ap.generation::generate-heightmap))
(destructuring-bind (map-width map-height) (array-dimensions *terrain*)
(setf *view-x* (truncate map-width 2)
*view-y* (truncate map-height 2))))