Index: /orxonox/branches/burli/src/world.cc
===================================================================
--- /orxonox/branches/burli/src/world.cc	(revision 2036)
+++ /orxonox/branches/burli/src/world.cc	(revision 2037)
@@ -19,4 +19,6 @@
 
 #include <iostream>
+#include <stdlib.h>
+#include <math.h>
 
 using namespace std;
@@ -175,5 +177,5 @@
 {
   glLoadIdentity();
-  gluLookAt(0.0, -14.0 + DataTank::yOffset, 15.0, 0.0, 0.0 + DataTank::yOffset, 0.0, 0.0, 1.0, 0.0);
+  gluLookAt(2*sin(DataTank::yOffset/90*3.141)+DataTank::xOffset, -17.0 + DataTank::yOffset, 14.0 + 5*cos(DataTank::yOffset/50*3.141), DataTank::xOffset, 0.0 + DataTank::yOffset, 0.0, 0.0, 1.0, 0.0);
   /* first draw all players */
   playerList* tmpPlayer = lastPlayer;
@@ -200,39 +202,56 @@
     }
   
-  /* draw the ground grid  */
+  /* draw the repeating ground grid  */
   glColor3f(0.0, 1.0, 0.0); 
   glBegin(GL_LINES);
-  /* for the moment, we've got only pseudo moving ground */
-  for (int y = 0; y < 60; y += 2)
-    {
-      for (int x = 0; x < 60; x += 2)
+  float drawx, drawy;
+  int offsetx, offsety;
+  float s1, s2;
+  
+  for (int y = 0; y < GRIDLENGTH; y++)
+  {
+	drawy = y + floor(DataTank::yOffset) - GRIDLENGTH / 2;
+	offsety = (int)floor(DataTank::yOffset) + y;
+	if (offsety < 0)
 	{
-	  glVertex3f((float)(x - 30), (float)(y - 30), surface[x][y]);
-	  glVertex3f((float)(x - 28), (float)(y - 30), surface[x+2][y]);
-	}
-    }
-  glEnd();
-  
-  glBegin(GL_LINES);
-  for (int x = 0; x < 60; x += 2)
-    {
-      for (int y = 0; y < 60; y += 2)
+	  offsety = GRIDLENGTH - ((-offsety) % GRIDLENGTH);
+	}
+	
+	for (int x = 0; x < GRIDWIDTH; x++)
 	{
-	  glVertex3f((float)(x - 30), (float)(y - 30), surface[x][y]);
-	  glVertex3f((float)(x - 30), (float)(y - 28), surface[x][y+2]);
-	}
-    }
+	  drawx = x + floor(DataTank::xOffset) - GRIDWIDTH / 2;
+	  offsetx = (int)floor(DataTank::xOffset) + x;
+	  if (offsetx < 0)
+	  {
+		offsetx = GRIDWIDTH - ((-offsetx) % GRIDWIDTH);
+	  }
+	  	  
+	  /* horizontal */
+	  /* not simplified! */
+	  s1 = surface[(offsetx+GRIDWIDTH   )%GRIDWIDTH][offsety%GRIDLENGTH];
+	  s2 = surface[(offsetx+GRIDWIDTH+1)%GRIDWIDTH][offsety%GRIDLENGTH];
+	  glVertex3f(drawx, drawy, s1);
+	  glVertex3f(drawx+1, drawy, s2);
+	  
+	  /* vertical */
+	  s1 = surface[offsetx%GRIDWIDTH][(offsety+GRIDLENGTH  )%GRIDLENGTH];
+	  s2 = surface[offsetx%GRIDWIDTH][(offsety+GRIDLENGTH+1)%GRIDLENGTH];
+	  glVertex3f(drawx, drawy, s1);
+	  glVertex3f(drawx, drawy+1, s2);
+	}
+  }
   glEnd();
 
   //primitiveMove+=0.07;
   DataTank::yOffset += step;
-
+  
   tmpPlayer = lastPlayer;
   while( tmpPlayer != null ) 
     {
       tmpPlayer->player->yCor += step;
+      /* just for testing: alway have the player in the center */
+      DataTank::xOffset = (20 * DataTank::xOffset + (float)tmpPlayer->player->xCor) / 21.0;
       tmpPlayer = tmpPlayer->next;
     }
-
   
 }
@@ -241,12 +260,16 @@
 void World::initEnvironement()
 {
-
- for (int x = 0; x < 60; x += 2)
-    {
-      for (int y = 0; y < 60; y += 2)
+ double rx;
+ for (int y = 0; y < GRIDLENGTH; y++)
+ {
+    for (int x = 0; x < GRIDWIDTH; x++)
 	{
-	  surface[x][y] = 0;
-	}
-    }
+	  /*surface[x][y] = cos(y*3.141/8 )*0.7 * (0.6 + sin(x*3.141/5 + phase)*cos(y*3.141/5*3) * 0.4);*/
+	 rx = double(x - GRIDWIDTH/2 + GRIDWIDTH / 20)/GRIDWIDTH*12;
+	 surface[x][y] = -exp(-abs(rx))*rx*5 + cos(y*3.141/6)*0.6-3;
+	 surface[x][y] += (x%8 && y%12) ? 5 : 0; 
+	 surface[x][y] -= (x%3 && y%3) ? 0.3 : 0; 
+	}	
+  }
 }
 
Index: /orxonox/branches/burli/src/world.h
===================================================================
--- /orxonox/branches/burli/src/world.h	(revision 2036)
+++ /orxonox/branches/burli/src/world.h	(revision 2037)
@@ -15,4 +15,7 @@
 #include "stdincl.h"
 #include "data_tank.h"
+
+const long GRIDWIDTH = 100;
+const long GRIDLENGTH = 120;
 
 class World {
@@ -71,5 +74,5 @@
 
  private:
-  float surface[120][120];
+  float surface[GRIDWIDTH][GRIDLENGTH];
   float step;
 
