Mercurial > cortex
comparison org/games.org @ 31:f0562b9bde94
fixed picture links
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Mon, 24 Oct 2011 12:54:04 -0700 |
parents | 0206878c28b4 |
children | 183744c179e6 |
comparison
equal
deleted
inserted
replaced
30:0206878c28b4 | 31:f0562b9bde94 |
---|---|
1 #+title: Simulated Senses | 1 #+title: Games! Games! Games! <3 |
2 #+author: Robert McIntyre | 2 #+author: Robert McIntyre |
3 #+email: rlm@mit.edu | 3 #+email: rlm@mit.edu |
4 #+description: Simulating senses for AI research using JMonkeyEngine3 | 4 #+description: Simulating senses for AI research using JMonkeyEngine3 |
5 #+SETUPFILE: ../../aurellem/org/setup.org | 5 #+SETUPFILE: ../../aurellem/org/setup.org |
6 #+INCLUDE: ../../aurellem/org/level-0.org | 6 #+INCLUDE: ../../aurellem/org/level-0.org |
7 #+babel: :mkdirp yes :noweb yes :exports both | 7 #+babel: :mkdirp yes :noweb yes :exports both |
8 | 8 |
9 | 9 |
10 * Simulation Base | 10 * Games! |
11 | 11 |
12 | 12 Here are the jMonkeyEngine "Hello" programs translated to clojure. |
13 ** Hello | 13 ** Hello Simple App |
14 Here are the jmonkeyengine "Hello" programs translated to clojure. | |
15 *** Hello Simple App | |
16 Here is the hello world example for jme3 in clojure. It's a more or | 14 Here is the hello world example for jme3 in clojure. It's a more or |
17 less direct translation from the java source [[http://jmonkeyengine.org/wiki/doku.php/jme3:beginner:hello_simpleapplication][here]]. | 15 less direct translation from the java source [[http://jmonkeyengine.org/wiki/doku.php/jme3:beginner:hello_simpleapplication][here]]. |
18 | 16 |
19 Of note is the fact that since we don't have access to the | 17 Of note is the fact that since we don't have access to the |
20 =AssetManager= via extendig =SimpleApplication=, we have to build one | 18 =AssetManager= via extendig =SimpleApplication=, we have to build one |
60 #+begin_src clojure :exports code :results silent | 58 #+begin_src clojure :exports code :results silent |
61 (.start (hello.hello-simple-app/simple-app)) | 59 (.start (hello.hello-simple-app/simple-app)) |
62 #+end_src | 60 #+end_src |
63 | 61 |
64 #+caption: the simplest JME game. | 62 #+caption: the simplest JME game. |
65 [[./images/simple-app.jpg]] | 63 [[../images/simple-app.jpg]] |
66 | 64 |
67 | 65 |
68 | 66 ** Hello Physics |
69 *** Hello Physics | |
70 From http://jmonkeyengine.org/wiki/doku.php/jme3:beginner:hello_physics | 67 From http://jmonkeyengine.org/wiki/doku.php/jme3:beginner:hello_physics |
71 | 68 |
72 #+srcname: brick-wall-header | 69 #+srcname: brick-wall-header |
73 #+begin_src clojure :results silent | 70 #+begin_src clojure :results silent |
74 (ns hello.brick-wall) | 71 (ns hello.brick-wall) |
212 #+begin_src clojure :results silent | 209 #+begin_src clojure :results silent |
213 (hello.brick-wall/brick-wall-game-run) | 210 (hello.brick-wall/brick-wall-game-run) |
214 #+end_src | 211 #+end_src |
215 | 212 |
216 #+caption: the brick wall standing | 213 #+caption: the brick wall standing |
217 [[./images/brick-wall-standing.jpg]] | 214 [[../images/brick-wall-standing.jpg]] |
218 | 215 |
219 #+caption: the brick wall after it has been knocked over by a "pok\eacute{}ball" | 216 #+caption: the brick wall after it has been knocked over by a "pok\eacute{}ball" |
220 [[./images/brick-wall-knocked-down.jpg]] | 217 [[../images/brick-wall-knocked-down.jpg]] |
221 | 218 |
222 *** Other Brick Games | 219 ** Other Brick Games |
223 #+srcname: other-games | 220 #+srcname: other-games |
224 #+begin_src clojure :results silent | 221 #+begin_src clojure :results silent |
225 (ns cortex.other-games | 222 (ns cortex.other-games |
226 {:author "Dylan Holmes"}) | 223 {:author "Dylan Holmes"}) |
227 (use 'cortex.world) | 224 (use 'cortex.world) |
363 #+begin_src clojure :results silent | 360 #+begin_src clojure :results silent |
364 (cortex.other-games/domino-game-run) | 361 (cortex.other-games/domino-game-run) |
365 #+end_src | 362 #+end_src |
366 | 363 |
367 #+caption: floating dominos | 364 #+caption: floating dominos |
368 [[./images/dominos.jpg]] | 365 [[../images/dominos.jpg]] |
369 | 366 |
370 *** Hello Loop | 367 ** Hello Loop |
371 #+srcname: hello-loop | 368 #+srcname: hello-loop |
372 #+begin_src clojure :results silent | 369 #+begin_src clojure :results silent |
373 (ns hello.loop) | 370 (ns hello.loop) |
374 (use 'cortex.world) | 371 (use 'cortex.world) |
375 (use 'cortex.import) | 372 (use 'cortex.import) |
391 {} | 388 {} |
392 no-op | 389 no-op |
393 (fn [game tpf] | 390 (fn [game tpf] |
394 (.rotate cube 0.0 (* 2 tpf) 0.0))))) | 391 (.rotate cube 0.0 (* 2 tpf) 0.0))))) |
395 #+end_src | 392 #+end_src |
396 | 393 |
397 *** Hello Collision | 394 ** Hello Collision |
398 | 395 |
399 #+srcname: hello-collision | 396 #+srcname: hello-collision |
400 #+begin_src clojure :results silent | 397 #+begin_src clojure :results silent |
401 (ns hello.collision) | 398 (ns hello.collision) |
402 (use 'cortex.world) | 399 (use 'cortex.world) |
514 (responses) | 511 (responses) |
515 setup-fn | 512 setup-fn |
516 update-fn))) | 513 update-fn))) |
517 #+end_src | 514 #+end_src |
518 | 515 |
519 *** Hello Terrain | 516 ** Hello Terrain |
520 #+srcname: hello-terrain | 517 #+srcname: hello-terrain |
521 #+begin_src clojure :results silent | 518 #+begin_src clojure :results silent |
522 (ns hello.terrain) | 519 (ns hello.terrain) |
523 (use 'cortex.world) | 520 (use 'cortex.world) |
524 (use 'cortex.import) | 521 (use 'cortex.import) |
664 (key-map channel) | 661 (key-map channel) |
665 (partial setup-fn channel) | 662 (partial setup-fn channel) |
666 no-op)))) | 663 no-op)))) |
667 #+end_src | 664 #+end_src |
668 | 665 |
669 *** Hello Materials | 666 ** Hello Materials |
670 #+srcname: material | 667 #+srcname: material |
671 #+begin_src clojure :results silent | 668 #+begin_src clojure :results silent |
672 (ns hello.material) | 669 (ns hello.material) |
673 (use 'cortex.world) | 670 (use 'cortex.world) |
674 (use 'cortex.import) | 671 (use 'cortex.import) |
716 (doto | 713 (doto |
717 (.setTextureMode Sphere$TextureMode/Projected) | 714 (.setTextureMode Sphere$TextureMode/Projected) |
718 (TangentBinormalGenerator/generate))) | 715 (TangentBinormalGenerator/generate))) |
719 (-> (.getMaterial) | 716 (-> (.getMaterial) |
720 (doto | 717 (doto |
721 (.setTexture "DiffuseMap" (.loadTexture (asset-manager) | 718 (.setTexture "DiffuseMap" |
722 "Textures/Terrain/Pond/Pond.png")) | 719 (.loadTexture (asset-manager) |
723 (.setTexture "NormalMap" (.loadTexture (asset-manager) | 720 "Textures/Terrain/Pond/Pond.png")) |
724 "Textures/Terrain/Pond/Pond_normal.png")) | 721 (.setTexture "NormalMap" |
722 (.loadTexture (asset-manager) | |
723 "Textures/Terrain/Pond/Pond_normal.png")) | |
725 (.setFloat "Shininess" (float 5)))) | 724 (.setFloat "Shininess" (float 5)))) |
726 (.rotate (float 1.6) 0 0))) | 725 (.rotate (float 1.6) 0 0))) |
727 | 726 |
728 | 727 |
729 (defn start-game [] | 728 (defn start-game [] |
785 | 784 |
786 | 785 |
787 | 786 |
788 | 787 |
789 | 788 |
789 |