Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/data/levels/cityLevelHS15.oxw @ 12014

Last change on this file since 12014 was 11094, checked in by landauf, 9 years ago

added night-mode in city level (with city-lights and darker skybox)

  • Property svn:eol-style set to native
File size: 7.5 KB
Line 
1<LevelInfo
2 name = "City level"
3 description = "A large random generated city"
4 tags = "test"
5 screenshot = "emptylevel.png"
6/>
7
8<?lua
9  include("stats.oxo")
10  include("HUDTemplates3.oxo")
11  include("templates/lodInformation.oxt")
12?>
13
14<?lua
15  include("templates/spaceshipAssff2.oxt")
16  include("templates/spaceshipPirate.oxt")
17  include("templates/spaceshipEscort.oxt")
18  include("templates/spaceshipRing.oxt")
19  include("templates/spaceshipSwallow.oxt")
20?>
21
22
23<!-- Global variable definition -->
24<?lua
25X = 20
26Y = 20
27CELL_SIZE = 600
28
29NIGHTMODE = true
30if (NIGHTMODE) then
31  AMBIENT_MULT = 0.2
32  LIGHT_MULT = 0.4
33else
34  AMBIENT_MULT = 1.0
35  LIGHT_MULT = 1.0
36end
37?>
38
39<!-- city generator -->
40<?lua
41function randomHouses(x,y,cellSize)
42    returnString = ""
43    for currentX = 1, x, 1 do
44      for currentY = 1, y, 1 do
45        houseNr = math.floor(math.random()*7 + 1)
46        orientation = math.floor(math.random()*4)*90
47        houses = {"Glasstower1","ETH","Hausc1","PrimeTower","Hausc2","101","hausc3"}
48        scales = {100,100,100,100,100,100,100}
49        collisionShapes = {--[[Glasstower1]]"<BoxCollisionShape position=\"0,405,0\" halfExtents=\"90,405,90\" /><BoxCollisionShape  position=\"0,855,0\" halfExtents=\"110, 45, 110\" /><BoxCollisionShape      position=\"0,957,0\" halfExtents=\"5, 70, 5\" />  ",--[[ETH]]"<BoxCollisionShape      position=\"-46.16,22.423,3.439\" halfExtents=\"89.5,30.4,151.5\" /><BoxCollisionShape      position=\"105.607996,22.905,-137.980005\" halfExtents=\"31.40,23.55,39.25\" /><BoxCollisionShape      position=\"105.607996,22.905,137.078003\" halfExtents=\"31.40,23.55,39.25\" /><BoxCollisionShape      position=\"65.356,22.905,118.208997\" halfExtents=\"31.40,23.55,20.40\" /><BoxCollisionShape      position=\"65.356,22.905,-121.712\" halfExtents=\"31.40,23.55,20.40\" /><SphereCollisionShape  position=\"44.985001,60.196997,0.352 \" radius=\"31.65\" />",--[[Hausc1]]"<BoxCollisionShape position=\"0,71.43,0\" halfExtents=\"142.86, 71.43, 142.86\" /><BoxCollisionShape position=\"-71.43,285.72,-71.43\" halfExtents=\"71.43, 142.86, 71.43\" /><BoxCollisionShape position=\"71.43,428.58,0\" halfExtents=\"71.43, 285.72, 142.86\" /><BoxCollisionShape position=\"71.43,857.16,-71.43\" halfExtents=\"71.43, 142.86, 71.43\" /><BoxCollisionShape position=\"-35.715,214.29,35.715\" halfExtents=\"35.715, 71.43, 35.715\" /><BoxCollisionShape position=\"-35.715,500.01,-107.145\" halfExtents=\"35.715, 71.43, 35.715\" /><BoxCollisionShape position=\"107.145,785.73,35.715\" halfExtents=\"35.715, 71.43, 35.715\" />",--[[PrimeTower]]"<BoxCollisionShape      position=\"-16.1,278.6,053.\" halfExtents=\"063,296,063\" yaw=\"-16.5\" /> <BoxCollisionShape      position=\"007.1,278.6,027.3\" halfExtents=\"065,296,065\" yaw=\"-28\" /><BoxCollisionShape      position=\"012.8,278.6,-63.3\" halfExtents=\"076,296,076\" yaw=\"4\" /> <BoxCollisionShape      position=\"023.18,278.6,-135.4\" halfExtents=\"067.7,296,067.7\" yaw=\"-36\" />",--[[Hausc2]]"<BoxCollisionShape      position=\"0,349.999,-166.667\" halfExtents=\"83.333, 349.999, 83.333\" /><BoxCollisionShape      position=\"0,349.999,166.667\" halfExtents=\"83.333, 349.999, 83.333\" /><BoxCollisionShape      position=\"41.666,291.666,0\" halfExtents=\"41.666, 58.333, 83.333\" /><BoxCollisionShape      position=\"-41.666,524.999,0\" halfExtents=\"41.666, 58.333, 83.333\" /> ",--[[101]]"<BoxCollisionShape    position=\"0,565.7,0\" halfExtents=\"76,565.7,76\" /><BoxCollisionShape position=\"-2.8,1210,1\" halfExtents=\"39,82,39\" />",--[[hausc3]]"<BoxCollisionShape      position=\"0,300,-208.33\" halfExtents=\"250,0,65.1\" pitch=\"-50.194\" /><BoxCollisionShape      position=\"0,300,-125\" halfExtents=\"250,0,65.1\" pitch=\"50.194\" /><BoxCollisionShape      position=\"125,275,0\" halfExtents=\"48.59,0,250\" roll=\"30.964\" /><BoxCollisionShape      position=\"208.33,275,0\" halfExtents=\"48.59,0,250\" roll=\"-30.964\" /><BoxCollisionShape      position=\"166.67,125,0\" halfExtents=\"83.33,125,250\" /><BoxCollisionShape      position=\"-83.33,125,-166.67\" halfExtents=\"166.66,125,83.33\" />"}
50        if (currentX > 0 and currentX < x and currentY > 1 --[[and currentY ~= y]]) then
51          returnString = returnString .. "<StaticEntity collisionType=\"static\" position=\"" .. (currentX*cellSize) .. ",0," .. (currentY*cellSize - (cellSize/2)) .. "\" direction=\"0,0,1\" pitch=\"0\" roll=\"0\" yaw=\"" .. orientation .. "\">  <attached> <Model position=\"0,0,0\" mesh=\"" .. houses[houseNr] .. ".mesh\" scale=\"" .. scales[houseNr] .. "\"/></attached><collisionShapes>" .. collisionShapes[houseNr] .. "</collisionShapes></StaticEntity>\n\n"
52        end
53        if (NIGHTMODE) then
54          billboards = "<Billboard position=\"40,82,55\" scale=\"0.5\" material=\"Examples/Flare\" colour=\"1.0, 0.9, 0.9\" /><Billboard position=\"-40,82,55\" scale=\"0.5\" material=\"Examples/Flare\" colour=\"1.0, 0.9, 0.9\" /><Billboard position=\"40,82,192\" scale=\"0.5\" material=\"Examples/Flare\" colour=\"1.0, 0.9, 0.9\" /><Billboard position=\"-40,82,192\" scale=\"0.5\" material=\"Examples/Flare\" colour=\"1.0, 0.9, 0.9\" /><Billboard position=\"40,82,-55\" scale=\"0.5\" material=\"Examples/Flare\" colour=\"1.0, 0.9, 0.9\" /><Billboard position=\"-40,82,-55\" scale=\"0.5\" material=\"Examples/Flare\" colour=\"1.0, 0.9, 0.9\" /><Billboard position=\"40,82,-192\" scale=\"0.5\" material=\"Examples/Flare\" colour=\"1.0, 0.9, 0.9\" /><Billboard position=\"-40,82,-192\" scale=\"0.5\" material=\"Examples/Flare\" colour=\"1.0, 0.9, 0.9\" />"
55        else
56          billboards = ""
57        end
58        returnString = returnString .. "<StaticEntity collisionType=\"static\" position=\"" .. (currentX*cellSize - cellSize/2) .. ",0," .. (currentY*cellSize) .. "\" direction=\"0,0,1\" pitch=\"0\" roll=\"0\" yaw=\"0\">  <attached> " .. billboards .. " <Model position=\"0,0,0\" mesh=\"CityGroundLamps.mesh\" scale=\"" .. cellSize .. "\"/><Model position=\"0,0,0\" mesh=\"CityGround.mesh\" scale=\"" .. cellSize .. "\"/></attached><collisionShapes><BoxCollisionShape position=\"0,0,0\" halfExtents=\"500,0,500\"/><BoxCollisionShape position=\"48.5,50.88,192\" halfExtents=\"5,50.88,5\"/><BoxCollisionShape position=\"48.5,50.88,-192\" halfExtents=\"5,50.88,5\"/><BoxCollisionShape position=\"48.5,50.88,-54\" halfExtents=\"5,50.88,5\"/><BoxCollisionShape position=\"48.5,50.88,54\" halfExtents=\"5,50.88,5\"/><BoxCollisionShape position=\"-48.5,50.88,192\" halfExtents=\"5,50.88,5\"/><BoxCollisionShape position=\"-48.5,50.88,-192\" halfExtents=\"5,50.88,5\"/><BoxCollisionShape position=\"-48.5,50.88,-54\" halfExtents=\"5,50.88,5\"/><BoxCollisionShape position=\"-48.5,50.88,54\" halfExtents=\"5,50.88,5\"/></collisionShapes></StaticEntity>\n\n"
59      end
60    end
61    return returnString
62end
63
64?>
65
66<Level>
67  <templates>
68    <Template link=lodtemplate_default />
69  </templates>
70
71  <?lua include("includes/notifications.oxi") ?>
72
73
74  <Scene
75    ambientlight = "<?lua print(0.45 * AMBIENT_MULT) ?>, <?lua print(0.4 * AMBIENT_MULT) ?>, <?lua print(0.35 * AMBIENT_MULT) ?>"
76    skybox       = "Orxonox/skyBoxClouds<?lua if (NIGHTMODE) then print('Dark') end ?>"
77  >
78    <?lua print(randomHouses(X,Y,CELL_SIZE)) ?>
79
80    <Light type="directional" position="-100,52,-59" lookat="0,0,0" diffuse="<?lua print(1.0 * LIGHT_MULT) ?>, <?lua print(0.9 * LIGHT_MULT) ?>, <?lua print(0.9 * LIGHT_MULT) ?>, 1.0" specular="<?lua print(1.0 * LIGHT_MULT) ?>, <?lua print(0.9 * LIGHT_MULT) ?>, <?lua print(0.9 * LIGHT_MULT) ?>, 1.0"/>
81    <LensFlare position="-100000,52000,-59000" />
82
83    <SpawnPoint team=0 position="<?lua print(X*CELL_SIZE/2) ?>,500,<?lua print(Y*CELL_SIZE/2) ?>" spawnclass=SpaceShip pawndesign=spaceshipescort />
84  </Scene>
85</Level>
Note: See TracBrowser for help on using the repository browser.