Hey for the lasts 6 months I am developing an action RPG game in clojure (and learning the language).
For this game I developed an entity component system which is a way of using composition to create entities in the game. I also use slick2d for the 2d engine. Here I posted some examples for defmonster/player-entity: http://slick.javaunlimited.net/viewtopic.php?p=17375#17375 (last post under name hardcore) Basically I just thougt maybe somebody is interested in my solution and I would maybe write some more about this engine or make it open source. ------ Here my post from the slick2d forums: Hello guys For the last 6 months I have been learning clojure (lisp for the jvm) and writing my own entity engine for my action rpg in this language. It is soo much less verbose than my java attempt at such an engine. Here is an example of a few monsters defined: Code: (defmonster armored-skull {:hp 2 :armor 65 :lvl 4 :pxsize 31} (default-death-trigger level) (create-melee-avoidance-movement-comp 0.0008) (rotation-component) (hp-regen-component 2) (body-image-render-component (monsterimage "armoredskull.png")) (create-monster-melee-comp 500 250 level (sound "slash.wav") (get-id player-body))) (defmonster mage-skull {:hp 4.8 :armor 0 :lvl 4 :pxsize 30} (default-death-trigger level) (create-ranged-movement-comp 0.004 (rand-int-between 3 4)) (hp-regen-component 10) (rotation-component) (body-image-render-component (monsterimage "mageskull.png")) (create-monster-ranged-comp level 3000 50)) and spawning an instance of a monster-type at position 10 5: Code: (try-spawn [10 5] :mage-skull) Or the player character: Code: (defn create-player-body [position] (create-body-with-id player-entity-id true :player position 30 30 (death-trigger player-death) (create-player-skillmanager) (movement-component {:control-update (fn [body control delta] (cond @saved-mouseover-body (get-vector-from-to body @saved-mouseover-body) (and (not (:leftm-consumed @state)) (is-leftbutton-down?)) (get-vector-to-mouse-coords)))} player-move-speed) (destructible-component player-start-hp 0) (rotation-component) (dmg-modifier-component) (hp-regen-component 0.25) (light-component 1 1 1 0.7 7) (mana-regen-component 0.25) (player-animation) (show-on-minimap Color/red))) My solution evolved over many months and I find it clean and simple. Basically I have a map of ids to entities. An entity just consists of multiple components (and nothing else). If somebody is interested I would write more about my entity-component system in clojure. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en