This is the mail archive of the xconq7@sources.redhat.com mailing list for the Xconq project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Bug in day/night code?


I've been experimenting with the Day/Night code (among other things) to
try to come up with a module for ultra-realistic terrain.  However, I've
found that, when I set up a game with day length, year length, and axial
tilt equal to that of the Earth, I get very strange lighting patterns
that don't look like anything that happens on Earth.  I don't know how
to describe the pattern in words, so I've attached the module to this
e-mail so that someone familiar with the Day/Night code can reproduce
it.

I also tried setting the axial tilt to zero, and I found that the
lighting pattern comes closer to what I'd expect, but it's still
unrealistic.  Specifically, if the Earth's rotation was perpendicular to
the sun, the area on the map that would be lit would be rectangular, not
hexagonal (i.e. on all point at a particular latitude, the sun would
rise and set at the same time).

To reproduce the behavior I describe, just set up the interface to show
Day/Night information, zoom out so that the main window shows the entire
map, and let it run for at least 100 turns (maybe just put your unit to
sleep).


There are more issues that I've encountered while writing this terrain
module, but I'm focusing on this one for now because it's the most
obvious (I'm pretty sure that this weird behavior is not due to a bug in
the module).

---
Lincoln Peters
<sampln@sbcglobal.net>

Is a wedding successful if it comes off without a hitch?


Here is the module:

(game-module "omniterr"
  (blurb "A highly-detailed module for representing terrain")
  (variants
    (see-all true)
    (world-size (800 320 800))
  )
)

(set sides-min 1)
(set sides-wanted 1)
(set sides-max 1)
 
(world
  ; Set up the world to equal Earth at 50km/hex, with an axial tile of 23.5 degrees.

  (axial-tilt 23.5)
  
  ; Set up the game for 1 hour per turn, 24 hours per day, 365 days per year.

; (day-length 24)
; (year-length 8760)

  (day-length 144)
  (year-length 52560)

)

; Set Earth-like seasons.

; (set season-names '((0 2190 "Winter") (2191 4380 "Spring") (4381 6570 "Summer") (6571 8760 "Autumn")))

(set season-names '((0 13140 "Winter") (13141 26280 "Spring") (26280.1 39420 "Summer") (39421 525600 "Autumn")))


;;; CELL TERRAIN

;; Cell terrain reflects soil composition or other such factors.

(terrain-type void (image-name "black")
  (help "An area with no mass"))

(terrain-type large-rocks (image-name "gray")
  (help "Solid rock"))
  
(terrain-type small-rocks (image-name "gray")
  (help "Terrain strewn with large chunks of rock"))
  
(terrain-type sand (image-name "desert")
  (help "Fine rocks"))
  
(terrain-type fertile-soil (image-name "brown")
  (help "Soil that can sustain lots of plant life"))
  
(terrain-type infertile-soil (image-name "brown")
  (help "Soil that can sustain limited plant life"))
  
  
;;; TERAIN COATINGS

;; Topographical features

(terrain-type fresh-water (image-name "shallows")
  (subtype coating)
  (help "Fresh water, usually a lake or a large river"))
  
(terrain-type salt-water (image-name "sea")
  (subtype coating)
  (help "Salt water, usually an ocean or a salt lake"))
  
(terrain-type glacier (image-name "ice")
  (subtype coating)
  (help "Large blocks of frozen water, found in extremely cold environments"))

;; Plant life

(terrain-type grass (image-name "plains")
  (subtype coating)
  (help "Fields of grass"))
  
(terrain-type evergreen-forest (image-name "forest")
  (subtype coating)
  (help "A mass of evergreen trees"))
  
(terrain-type deciduous-forest (image-name "forest")
  (subtype coating)
  (help "A mass of deciduous trees"))
  
(terrain-type desert-plants (image-name "yellow")
  (subtype coating)
  (help "Sparse cacti and small plants of various types"))
  
(terrain-type tundra-plants (image-name "brown")
  (subtype coating)
  (help "Small plants adapted to extreme cold"))
  
(terrain-type aquatic-plants (image-name "swamp")
  (subtype coating)
  (help "Various plants adapted to extremely wet regions"))
  
(terrain-type kelp-forest (image-name "forest")
  (subtype coating)
  (help "Underwater algae that live on continential shelves"))
  
(terrain-type algae (image-name "orange")
  (subtype coating)
  (help "A mass of very simple single-cell organisms, usually found in salt water"))
  
;; Weather

(terrain-type fire (image-name "red")
  (subtype coating)
  (help "Burning vegetation"))
  
(terrain-type rain (image-name "blue")
  (subtype coating)
  (help "Normal rainfall"))
  
(terrain-type tropical-storm (image-name "purple")
  (subtype coating)
  (help "A mass of spinning water and high winds"))
  
(terrain-type thunderstorm (image-name "purple")
  (subtype coating)
  (help "A large, potentially destructive storm"))
  
(terrain-type lava (image-name "red")
  (subtype coating)
  (help "An extremely hot flow of molten rock"))
  
; A single unit type is defined so that this module can be loaded on its own
; without crashing.

(unit-type human (image-name "person") (acp-per-turn 1) (start-with 1))
  
(define base-terrain (large-rocks small-rocks sand fertile-soil infertile-soil))
(define features (fresh-water salt-water glacier))
(define plant-life (grass evergreen-forest deciduous-forest desert-plants tundra-plants aquatic-plants kelp-forest algae))
(define weather (fire rain tropical-storm thunderstorm lava))
  
;;; TERRAIN PROPERTIES

; To keep things simple, allow a lot of creative liberty.

#| To simplify things while debugging the day/night cycle...

(add t* elevation-min -10000)
(add t* elevation-max 10000)

(add t* temperature-min -500)
(add t* temperature-max 5000)

(add t* wind-force-min 0)
(add t* wind-force-max 1000)

(add t* temperature-average 50)
(add t* temperature-variability 50)

(set temperature-moderation-range 1)

; temperature-year-cycle only works fro pre-defined maps!

(add t* wind-force-min 1)
(add t* wind-force-average 1)
(add t* wind-force-max 4)
(add t* wind-force-variability 50.00)
(add t* wind-variability 50.00)

(set wind-mix-range 1)

; Cannot set speed-wind-effect without knowing the nature of the affected unit!

|#

;;; SYNTHESIS

; This is grossly over-simplified!

(add sand wet-percentile-min 0)
(add sand wet-percentile-max 20)

(add fertile-soil wet-percentile-min 20)
(add fertile-soil wet-percentile-max 40)

(add infertile-soil wet-percentile-min 40)
(add infertile-soil wet-percentile-max 60)

(add small-rocks wet-percentile-min 60)
(add small-rocks wet-percentile-max 80)

(add large-rocks wet-percentile-min 80)
(add large-rocks wet-percentile-max 100)

(add base-terrain alt-percentile-min 0)
(add base-terrain alt-percentile-max 100)


; (set synthesis-methods
;   '(make-random-terrain make-countries make-independent-units))



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]