2009-07-30 15:03:21 +00:00
|
|
|
;#lang scheme/base
|
|
|
|
;(require fluxus-016/drflux)
|
2009-08-04 08:06:14 +00:00
|
|
|
(require scheme/class "game-modes.ss" "logic.ss" "view.ss" "controller.ss" "client.ss" "jabberer.ss" "list-utils.ss")
|
2009-07-21 16:33:26 +00:00
|
|
|
|
2009-06-25 12:09:52 +00:00
|
|
|
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
; 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
|
|
|
|
;
|
2009-07-13 15:01:20 +00:00
|
|
|
; * these messages are also converted to xmpp messages and sent out over the
|
|
|
|
; network
|
|
|
|
;
|
2009-06-25 12:09:52 +00:00
|
|
|
; * 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)
|
|
|
|
|
2009-08-04 08:06:14 +00:00
|
|
|
(define world-list (let* ((f (open-input-file "world.txt"))
|
2009-08-19 16:16:48 +00:00
|
|
|
(o (list (read f)(read f)(read f)(read f))))
|
2009-08-04 08:06:14 +00:00
|
|
|
(close-input-port f)
|
|
|
|
o))
|
2009-07-24 19:02:49 +00:00
|
|
|
|
2009-08-19 16:16:48 +00:00
|
|
|
(printf "~a~n" (length world-list))
|
|
|
|
|
2009-07-24 19:02:49 +00:00
|
|
|
(clear)
|
2009-07-30 15:03:21 +00:00
|
|
|
(clear-shader-cache)
|
2009-09-25 16:19:48 +00:00
|
|
|
(clear-texture-cache)
|
2009-06-23 07:31:12 +00:00
|
|
|
|
2009-07-24 19:02:49 +00:00
|
|
|
(define mode 'gui)
|
2009-08-04 08:06:14 +00:00
|
|
|
(define gui (make-object gui-game-mode% (list-ref world-list 0)))
|
|
|
|
(define game (make-object main-game-mode% world-list))
|
2009-07-24 19:02:49 +00:00
|
|
|
(send gui setup)
|
2009-06-29 16:51:32 +00:00
|
|
|
|
2009-08-04 08:06:14 +00:00
|
|
|
;(define t 0)
|
|
|
|
;(define d 0.02)
|
|
|
|
;(define (flxtime) t)
|
|
|
|
;(define (update-time) (set! t (+ t d)))
|
|
|
|
;(define (delta) d)
|
|
|
|
|
2009-07-24 19:02:49 +00:00
|
|
|
(define (animate)
|
|
|
|
(cond
|
|
|
|
((eq? mode 'gui)
|
|
|
|
(when (send gui update (flxtime) (delta))
|
2009-09-25 16:19:48 +00:00
|
|
|
(send game setup (send gui get-player-info) (send gui get-players))
|
2009-07-24 19:02:49 +00:00
|
|
|
(set! mode 'game)))
|
|
|
|
((eq? mode 'game)
|
2009-08-04 08:06:14 +00:00
|
|
|
(send game update (flxtime) (delta))))
|
2009-08-12 11:14:47 +00:00
|
|
|
#;(update-time)
|
|
|
|
(sleep 0.01))
|
2009-07-24 19:02:49 +00:00
|
|
|
|
2009-06-25 16:04:55 +00:00
|
|
|
(every-frame (animate))
|
2009-08-04 08:06:14 +00:00
|
|
|
|
|
|
|
;(start-framedump "pe7" "jpg")
|