[Orxonox-commit 4472] r9143 - in code/branches/newlevel2012: . data/levels src/modules/towerdefense

jo at orxonox.net jo at orxonox.net
Wed May 2 13:22:21 CEST 2012


Author: jo
Date: 2012-05-02 13:22:20 +0200 (Wed, 02 May 2012)
New Revision: 9143

Modified:
   code/branches/newlevel2012/.project
   code/branches/newlevel2012/data/levels/towerDefense.oxw
   code/branches/newlevel2012/src/modules/towerdefense/Tower.cc
   code/branches/newlevel2012/src/modules/towerdefense/TowerDefense.cc
   code/branches/newlevel2012/src/modules/towerdefense/TowerDefense.h
   code/branches/newlevel2012/src/modules/towerdefense/TowerDefenseCenterpoint.cc
   code/branches/newlevel2012/src/modules/towerdefense/towerdefensereadme.txt
Log:
Some hints added on how to proceed.

Modified: code/branches/newlevel2012/.project
===================================================================
--- code/branches/newlevel2012/.project	2012-04-29 15:22:56 UTC (rev 9142)
+++ code/branches/newlevel2012/.project	2012-05-02 11:22:20 UTC (rev 9143)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <projectDescription>
-	<name>Orxonox-Source at newlevel2012</name>
+	<name>Orxonox-Source at towerDefense</name>
 	<comment></comment>
 	<projects>
 	</projects>

Modified: code/branches/newlevel2012/data/levels/towerDefense.oxw
===================================================================
--- code/branches/newlevel2012/data/levels/towerDefense.oxw	2012-04-29 15:22:56 UTC (rev 9142)
+++ code/branches/newlevel2012/data/levels/towerDefense.oxw	2012-05-02 11:22:20 UTC (rev 9143)
@@ -98,16 +98,22 @@
 	mass=100000>
 		 
 		 <attached>
-		
 			<Model position="-0.5,-0.5,0" mesh="Playfield_ME.mesh" scale=0.8 />
-			
+            <!--Model position="0,0,0" mesh="crate.mesh" scale3D="3,3,3" /--> <!-- Only temporary needed to help align the collisionshape -->
 			<!-- This was used to mark the playfield, let's let it be here for now -->
 			<!--Model position="-8,8,0" mesh="crate.mesh" scale3D="0.3,0.3,0.3" /-->
 			<!--Model position="-8,-8,0" mesh="crate.mesh" scale3D="0.3,0.3,0.3" /-->
 			<!--Model position="8,-8,0" mesh="crate.mesh" scale3D="0.3,0.3,0.3" /-->
 			<!--Model position="8,8,0" mesh="crate.mesh" scale3D="0.3,0.3,0.3" /-->
-			
         </attached>
+        <collisionShapes> <!-- The collisionshape forbids other worldentities that have a collisionShape to fly through it.
+        
+                               TODO: Find correct size for the collisionshape; since a collisionShape is invisible
+                               I added the crate wich currently has the same dimensions as the collisionshape.
+                               You have to adjust the crate's scale3D as well as the collisionshape's halfExtens to
+                               find the proper shape. -->
+           <BoxCollisionShape position="0,0,0" halfExtents="15,15,15" />
+        </collisionShapes>
     </TowerDefenseCenterpoint>
 
   </Scene>

Modified: code/branches/newlevel2012/src/modules/towerdefense/Tower.cc
===================================================================
--- code/branches/newlevel2012/src/modules/towerdefense/Tower.cc	2012-04-29 15:22:56 UTC (rev 9142)
+++ code/branches/newlevel2012/src/modules/towerdefense/Tower.cc	2012-05-02 11:22:20 UTC (rev 9143)
@@ -30,7 +30,19 @@
         this->delayTimer_.setTimer(0.2f, false, createExecutor(createFunctor(&TetrisStone::enableMovement, this)));
 		*/
     }
-	
+	// This function is called whenever a player presses the up or the down key.
+    // You have to implement what happens when the up or the down key is pressed.
+    // value.x < 0 means: down key is pressed.
+    // I suggest to create a new class which is a controllable entity I will refer to as "TowerMover". This is the controllable entity that the
+    // player controls in order to move the tower along the centerpoint and in order to place the tower at the appropriate position.
+    //
+
+    // The tower itsself is controlled by a WayPointPatroController at the instance you place it on the centerpoint.
+    //(don't forget to set the team_ parameter such that all tower are in the same team)
+
+    //How to move a tower: simply attach the tower to the TowerMover
+    //How to place a tower: detach the tower from the TowerMover
+
     /**
 	 @brief
 	 Overloaded the function to rotate the stone.
@@ -65,4 +77,4 @@
         }
 		 */
     }
-}
\ No newline at end of file
+}

Modified: code/branches/newlevel2012/src/modules/towerdefense/TowerDefense.cc
===================================================================
--- code/branches/newlevel2012/src/modules/towerdefense/TowerDefense.cc	2012-04-29 15:22:56 UTC (rev 9142)
+++ code/branches/newlevel2012/src/modules/towerdefense/TowerDefense.cc	2012-05-02 11:22:20 UTC (rev 9143)
@@ -25,10 +25,6 @@
  *      ...
  *
  *NACHRICHT:
- * Ich habe die Klasse Deathmatch einfach per Copy&Paste&Rename als Vorlage für euren Deathmatch genommen.
- * Ein Deathmatch erbt vom Gametype. Der einzige Unterschied zum Gametype ist, dass hier ein bisschen
- * Textausgabe stattfindet. Sollte das Später nicht erwünscht sein, könnt ihr einfach die Gametype-Klasse
- * an die Stelle von Deathmatch setzten.
  *
  * Hier empfehle ich euch die gesamte Spielogik unter zu bringen. Viele Funktionen werden automatisch
  * bei gewissen Ereignissen aufgerufen bzw. lösen Ereignisse aus
@@ -52,6 +48,29 @@
  * z.B: WaypointPatrolController. Wenn kein Team zugewiesen wurde bekämpft ein WaypointPatrolController alles,
  * was in seiner Reichweite liegt.
  *
+ *
+ *HUD:
+ * Ein Gametype kann ein HUD (Head up Display haben.) Z.B: hat Pong eine Anzeige welcher Spieler wieviele Punkte hat.
+ * Generell kann man a) Grafiken oder b) Zeichen in einer HUD anzeigen.
+ * Fuer den ersten Schritt reicht reiner Text.
+ *
+ * a)
+ * PongScore.cc uebernehmen und eigene Klasse draus machen.
+ * Wenn ihr bloss anzeigen wollt wieviele Punkte der Spieler bereits erspielt hat (Punkte = Kapital fuer neue Tuerme) dann orientiert ihr euch an
+ * TetrisScore.cc (im pCuts branch): http://www.orxonox.net/browser/code/branches/pCuts/src/modules/tetris/TetrisScore.cc
+ * Ich habe TetrisScore lediglich dazu gebraucht, um eine Variable auf dem HUD auszugeben. Ein Objekt fuer statischen Text gibt es bereits.
+ *
+ * b)
+ * Im naesten Schritt erstellt man die Vorlage fuer das HUD-Objekt: siehe /data/overlays/pongHUD
+ * OverlayText ist eine Vorlage fuer statischen text zb: "Points Scored:". Aus mir nicht erklaerlichen Gruenden sollte man die OverlayText
+ * Objekte immer erst nach dem PongScore anlegen.
+ *
+ * c) Im TowerDefense gamtype muss im Constructor noch das HUD-Template gesetzt werden.
+ *
+ * d) in CMakeLists.txt noch das Module includen das fuer die Overlays zustaendig ist. Siehe das gleiche File im Pong module.
+ *
+ *
+ *
  */
 
 #include "TowerDefense.h"
@@ -118,6 +137,9 @@
 		orxout() << "Done" << endl;
 		
 		ChatManager::message("Use the console command addTower x y to add towers");
+
+		//TODO: let the player control his controllable entity && TODO: create a new ControllableEntity for the player
+
 	}
 	
 	void TowerDefense::end()
@@ -130,7 +152,7 @@
 	
 	void TowerDefense::addTower(int x, int y)
 	{
-		if (x > 15 || y > 15 || x < 0 || y < 0)
+		if (x > 15 || y > 15 || x < 0 || y < 0)//Hard coded: TODO: let this depend on the centerpoint's height, width and fieldsize (fieldsize doesn't exist yet)
 		{
 			orxout() << "Can not add Tower: x and y should be between 0 and 15" << endl;
 			return;
@@ -145,6 +167,7 @@
 		
 		newTower->setPosition(x-8,y-8,0);
 		newTower->setGame(this);
+		//TODO: Save the Tower in a Vector. I would suggest std::vector< std::vector<Tower*> > towers_ as a protected member variable;
 		
 		// TODO: create Tower mesh
 		// TODO: load Tower mesh

Modified: code/branches/newlevel2012/src/modules/towerdefense/TowerDefense.h
===================================================================
--- code/branches/newlevel2012/src/modules/towerdefense/TowerDefense.h	2012-04-29 15:22:56 UTC (rev 9142)
+++ code/branches/newlevel2012/src/modules/towerdefense/TowerDefense.h	2012-05-02 11:22:20 UTC (rev 9143)
@@ -69,6 +69,11 @@
 		/* Part of a temporary hack to allow the player to add towers */
 		ConsoleCommand* dedicatedAddTower_;
 		
+		//TODO: void spawnNewWave()
+	    //TODO: create a timer which regularly calls the spawnNewWave function  (time driven)
+		//      or spawn a new wave when the old wave has been killed           (event driven)
+
+
 	private:
 //		WeakPtr<TowerDefenseCenterpoint> center_;
 		TowerDefenseCenterpoint *center_;

Modified: code/branches/newlevel2012/src/modules/towerdefense/TowerDefenseCenterpoint.cc
===================================================================
--- code/branches/newlevel2012/src/modules/towerdefense/TowerDefenseCenterpoint.cc	2012-04-29 15:22:56 UTC (rev 9142)
+++ code/branches/newlevel2012/src/modules/towerdefense/TowerDefenseCenterpoint.cc	2012-05-02 11:22:20 UTC (rev 9143)
@@ -68,6 +68,12 @@
         XMLPortParam(TowerDefenseCenterpoint, "width", setWidth, getWidth, xmlelement, mode);
         XMLPortParam(TowerDefenseCenterpoint, "height", setHeight, setWidth, xmlelement, mode);
         XMLPortParam(TowerDefenseCenterpoint, "towerTemplate", setTowerTemplate, getTowerTemplate, xmlelement, mode);
+        //TODO: add XMLPortObject(TowerDefenseCenterpoint, WorldEntity, "waypoints", addWaypoint, getWaypoint,  xmlelement, mode);
+        // This was copied and shightly modified from WaypointController.cc ; there are no getters and setters and no membervariable yet
+        // The centerpoint should have all waypoints for "attached" to it. By using this function you can seperately add waypoints
+        // When you spawn a new enemy you should let it be controlled by a WaypointController. And that controller should get the waypoints.
+
+        // Alternatively you can manage the waypoints directly in TowerDefense.cc
     }
 
     /**

Modified: code/branches/newlevel2012/src/modules/towerdefense/towerdefensereadme.txt
===================================================================
--- code/branches/newlevel2012/src/modules/towerdefense/towerdefensereadme.txt	2012-04-29 15:22:56 UTC (rev 9142)
+++ code/branches/newlevel2012/src/modules/towerdefense/towerdefensereadme.txt	2012-05-02 11:22:20 UTC (rev 9143)
@@ -10,8 +10,26 @@
 
 Tower
 Represents a Tower
+I'm not actually sure if you have to code C++ in order to have your result. I would suggest to simply create a new spaceship template or maybe better a
+new template for a pawn. (The tower don't need to be spaceships; pawn is just fine.)
+Example for a template: /data/levels/templates/assff.oxt && /data/levels/include/weaponSettingsAssff.oxi
+@ assff.oxt: you don't need an engine (or your towers could fly away :-) and probably no Cameras. (just try what happens if you leave them out.) 
+@ weaponSettingsAssff.oxi:
+<weaponslots>: location where you want to have your tower to be equiped with weapons
+<weaponsets> : if you press fire, you actually always fire a whole set of weapons. The amount of weaponsets is defined here. (I'm not 100% sure whether this explanation is right.)
 
+There are three <Weapon> tags - one for each weaponslot. Each weapon can contain several objects which you would probably
+refer to as "weapons":
 
+LightningGun: Shoots a slow, rotation, yellow "ball".
+HsW01: the default laser weapon
+SimpleRocketFire: a weak (self steering) rocket
+RocketFire: a strong rocket
+                         
+About your Tower's Template location - either keep it in the level or do it similarly to the Assff templates.
+(If your towers behave & look nicely, I'm quite sure others want to include them in other levels, too.)
+
+
 ===============================================================================
 Other files
 ===============================================================================




More information about the Orxonox-commit mailing list