groworld/plant-eyes/plant-eyes.scm
2009-08-04 09:06:14 +01:00

69 lines
2.5 KiB
Scheme

;#lang scheme/base
;(require fluxus-016/drflux)
(require scheme/class "game-modes.ss" "logic.ss" "view.ss" "controller.ss" "client.ss" "jabberer.ss" "list-utils.ss")
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
; p l a n t e y e s
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
; notes:
;
; * keeping with a view/logic separation, although this is quite different to
; the hexagon game. the main advantages:
; - just a divide and conquer strategy for staying sane
; - able to debug the logic without the view, or vice versa
; - the logic can be ticked at a lower frequency - or even different
; parts at different rates, whereas the view needs ticking every frame
;
; * need to try to keep all the intensive 'every thing vs every thing' checking
; in the logic side, where it can be done over many frames (i'm thinking the
; lags involved with things like nutrients getting absorbed may not matter
; too much in this game)
;
; * using a message passing system to formalise the passing of information on
; the logic side. this makes it possible to have objects sending messages
; at any point, and have them automatically collected up and dispatched to
; the view
;
; * these messages are also converted to xmpp messages and sent out over the
; network
;
; * line segments are computed in the logic side, and can be represented any
; way by the view - maybe the players plant will be geometry and everyone
; elses will be ribbons (stoopid LOD)
;
; * in the same way, the line segments can be created in any way by the logic
; side - eg. lsystem, or different methods per plant (or per twig even)
(define world-list (let* ((f (open-input-file "world.txt"))
(o (list (read f)(read f)(read f))))
(close-input-port f)
o))
(clear)
(clear-shader-cache)
(define mode 'gui)
(define gui (make-object gui-game-mode% (list-ref world-list 0)))
(define game (make-object main-game-mode% world-list))
(send gui setup)
;(define t 0)
;(define d 0.02)
;(define (flxtime) t)
;(define (update-time) (set! t (+ t d)))
;(define (delta) d)
(define (animate)
(cond
((eq? mode 'gui)
(when (send gui update (flxtime) (delta))
(send game setup (send gui get-player-info))
(set! mode 'game)))
((eq? mode 'game)
(send game update (flxtime) (delta))))
#;(update-time))
(every-frame (animate))
;(start-framedump "pe7" "jpg")