[Orxonox-commit 4854] r9523 - in code/branches/presentationHS12: . data/levels src/modules/gametypes
jo at orxonox.net
jo at orxonox.net
Sun Dec 16 18:07:39 CET 2012
Author: jo
Date: 2012-12-16 18:07:37 +0100 (Sun, 16 Dec 2012)
New Revision: 9523
Added:
code/branches/presentationHS12/src/modules/gametypes/SpaceRaceBot.cc
code/branches/presentationHS12/src/modules/gametypes/SpaceRaceBot.h
code/branches/presentationHS12/src/modules/gametypes/SpaceRaceController.cc
code/branches/presentationHS12/src/modules/gametypes/SpaceRaceController.h
Modified:
code/branches/presentationHS12/
code/branches/presentationHS12/data/levels/presentationHS12.oxw
code/branches/presentationHS12/src/modules/gametypes/CMakeLists.txt
code/branches/presentationHS12/src/modules/gametypes/GametypesPrereqs.h
code/branches/presentationHS12/src/modules/gametypes/RaceCheckPoint.cc
code/branches/presentationHS12/src/modules/gametypes/RaceCheckPoint.h
code/branches/presentationHS12/src/modules/gametypes/SpaceRace.cc
code/branches/presentationHS12/src/modules/gametypes/SpaceRaceManager.cc
code/branches/presentationHS12/src/modules/gametypes/SpaceRaceManager.h
Log:
Merging the Racingbot branch into the presentationHS12 branch.
Property changes on: code/branches/presentationHS12
___________________________________________________________________
Modified: svn:mergeinfo
- /code/branches/ai:6592-7033
/code/branches/ai2:8721-8880
/code/branches/bigships:8137-8588
/code/branches/buildsystem:1874-2276,2278-2400
/code/branches/buildsystem2:2506-2658
/code/branches/buildsystem3:2662-2708
/code/branches/ceguilua:1802-1808
/code/branches/chat:6527-6797
/code/branches/chat2:6836-6910
/code/branches/console:5941-6104
/code/branches/consolecommands2:6451-7178
/code/branches/consolecommands3:7178-7283
/code/branches/core3:1572-1739
/code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
/code/branches/core5:5768-5928,6009
/code/branches/data_cleanup:7537-7686
/code/branches/doc:7290-7400
/code/branches/dockingsystem:8101-8192
/code/branches/dockingsystem2:8196-8560
/code/branches/dynamicmatch:6584-7030
/code/branches/environment3:8887-8975
/code/branches/formation:8885-8991
/code/branches/fps:6591-7072
/code/branches/gamecontent:8893-8968
/code/branches/gameimmersion:8102-8577
/code/branches/gamestate:6430-6572,6621-6661
/code/branches/gamestates2:6594-6745
/code/branches/gametypes:2826-3031
/code/branches/gcc43:1580
/code/branches/gui:1635-1723,2795-2894
/code/branches/hud:8883-8986
/code/branches/hudelements:6584-6941
/code/branches/hudimprovements:7920-8672
/code/branches/ingamemenu:6000-6023
/code/branches/input:1629-1636
/code/branches/ipv6:7293-7458
/code/branches/kicklib:7940-8096,8098-8277
/code/branches/kicklib2:8282-8350
/code/branches/largeShip1:9384-9515
/code/branches/lastmanstanding:7479-7644
/code/branches/lastmanstanding3:7903-8175
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/lod:6586-6911
/code/branches/lodfinal:2372-2411
/code/branches/mac_osx:7789-8128,8135
/code/branches/map:2801-3086,3089
/code/branches/masterserver:7502-7738
/code/branches/masterserverfix:8933-8936
/code/branches/menu:5941-6146,6148,7536-7687
/code/branches/menue:8884-8976
/code/branches/miniprojects:2754-2824
/code/branches/netp2:2835-2988
/code/branches/netp3:2988-3082
/code/branches/netp6:3214-3302
/code/branches/network:2356
/code/branches/network2:6434-6465
/code/branches/network3:7196-7344
/code/branches/network4:7497-7755
/code/branches/network5:7757-7781
/code/branches/network6:7823-8315
/code/branches/network64:2210-2355
/code/branches/newlevel2012:9033-9244
/code/branches/notifications:7314-7401
/code/branches/objecthierarchy:1911-2085,2100,2110-2169
/code/branches/objecthierarchy2:2171-2479
/code/branches/ois_update:7506-7788
/code/branches/output:8739-8857
/code/branches/overlay:2117-2385
/code/branches/pCuts:9023-9284
/code/branches/particles:2829-3085
/code/branches/particles2:6050-6106,6109
/code/branches/pch:3113-3194
/code/branches/physics:1912-2055,2107-2439
/code/branches/physics_merge:2436-2457
/code/branches/pickup:8145-8555
/code/branches/pickup2:5942-6405
/code/branches/pickup2012:9029-9189
/code/branches/pickup3:6418-6523
/code/branches/pickup4:6594-6710
/code/branches/pickups:1926-2086,2127,2827-2915
/code/branches/pickups2:2107-2497,2915-3071
/code/branches/png2:7262-7263
/code/branches/portals:8087-8455
/code/branches/portals2:8460-8602
/code/branches/ppspickups1:6552-6708
/code/branches/ppspickups2:6527-6532,6554-6709
/code/branches/ppspickups3:6757-6997
/code/branches/ppspickups4:7003-7089
/code/branches/presentation:2369-2652,2654-2660,7736-7786,8500-8705
/code/branches/presentation2:6106-6416,7787-7800
/code/branches/presentation2011:8974-9015
/code/branches/presentation2012:9189-9268
/code/branches/presentation2012merge:9266-9347
/code/branches/presentation3:6913-7162
/code/branches/questsystem:1894-2088
/code/branches/questsystem2:2107-2259
/code/branches/questsystem5:2776-2905
/code/branches/releasetodo:7614-7647
/code/branches/resource:3327-3366
/code/branches/resource2:3372-5694
/code/branches/rocket:6523-6950
/code/branches/rocket2:6953-6970
/code/branches/script_trigger:1295-1953,1955
/code/branches/shipSelection:9038-9206
/code/branches/skybox2:6559-6989
/code/branches/sound:2829-3010
/code/branches/sound2012:9205-9214
/code/branches/sound3:5941-6102
/code/branches/spaceNavigation:9381-9497
/code/branches/spaceboundaries:8085-8457
/code/branches/spaceboundaries2:8460-8613
/code/branches/spacerace:8182-8630
/code/branches/spaceraceTwo:8881-8996
/code/branches/steering:5949-6091,8140-8595
/code/branches/surfaceRace:9028-9199
/code/branches/tetris:8100-8563
/code/branches/turret:9380-9501
/code/branches/tutoriallevel:7827-8370
/code/branches/tutoriallevel2:8370-8452
/code/branches/tutoriallevel3:8453-8636
/code/branches/unity_build:8440-8716
/code/branches/usability:7915-8078
/code/branches/weapon:1925-2094
/code/branches/weapon2:2107-2488
/code/branches/weapons:2897-3051,8143-8591
/code/branches/weaponsystem:2742-2890
+ /code/branches/Racingbot:9388-9513
/code/branches/ai:6592-7033
/code/branches/ai2:8721-8880
/code/branches/bigships:8137-8588
/code/branches/buildsystem:1874-2276,2278-2400
/code/branches/buildsystem2:2506-2658
/code/branches/buildsystem3:2662-2708
/code/branches/ceguilua:1802-1808
/code/branches/chat:6527-6797
/code/branches/chat2:6836-6910
/code/branches/console:5941-6104
/code/branches/consolecommands2:6451-7178
/code/branches/consolecommands3:7178-7283
/code/branches/core3:1572-1739
/code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
/code/branches/core5:5768-5928,6009
/code/branches/data_cleanup:7537-7686
/code/branches/doc:7290-7400
/code/branches/dockingsystem:8101-8192
/code/branches/dockingsystem2:8196-8560
/code/branches/dynamicmatch:6584-7030
/code/branches/environment3:8887-8975
/code/branches/formation:8885-8991
/code/branches/fps:6591-7072
/code/branches/gamecontent:8893-8968
/code/branches/gameimmersion:8102-8577
/code/branches/gamestate:6430-6572,6621-6661
/code/branches/gamestates2:6594-6745
/code/branches/gametypes:2826-3031
/code/branches/gcc43:1580
/code/branches/gui:1635-1723,2795-2894
/code/branches/hud:8883-8986
/code/branches/hudelements:6584-6941
/code/branches/hudimprovements:7920-8672
/code/branches/ingamemenu:6000-6023
/code/branches/input:1629-1636
/code/branches/ipv6:7293-7458
/code/branches/kicklib:7940-8096,8098-8277
/code/branches/kicklib2:8282-8350
/code/branches/largeShip1:9384-9515
/code/branches/lastmanstanding:7479-7644
/code/branches/lastmanstanding3:7903-8175
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/lod:6586-6911
/code/branches/lodfinal:2372-2411
/code/branches/mac_osx:7789-8128,8135
/code/branches/map:2801-3086,3089
/code/branches/masterserver:7502-7738
/code/branches/masterserverfix:8933-8936
/code/branches/menu:5941-6146,6148,7536-7687
/code/branches/menue:8884-8976
/code/branches/miniprojects:2754-2824
/code/branches/netp2:2835-2988
/code/branches/netp3:2988-3082
/code/branches/netp6:3214-3302
/code/branches/network:2356
/code/branches/network2:6434-6465
/code/branches/network3:7196-7344
/code/branches/network4:7497-7755
/code/branches/network5:7757-7781
/code/branches/network6:7823-8315
/code/branches/network64:2210-2355
/code/branches/newlevel2012:9033-9244
/code/branches/notifications:7314-7401
/code/branches/objecthierarchy:1911-2085,2100,2110-2169
/code/branches/objecthierarchy2:2171-2479
/code/branches/ois_update:7506-7788
/code/branches/output:8739-8857
/code/branches/overlay:2117-2385
/code/branches/pCuts:9023-9284
/code/branches/particles:2829-3085
/code/branches/particles2:6050-6106,6109
/code/branches/pch:3113-3194
/code/branches/physics:1912-2055,2107-2439
/code/branches/physics_merge:2436-2457
/code/branches/pickup:8145-8555
/code/branches/pickup2:5942-6405
/code/branches/pickup2012:9029-9189
/code/branches/pickup3:6418-6523
/code/branches/pickup4:6594-6710
/code/branches/pickups:1926-2086,2127,2827-2915
/code/branches/pickups2:2107-2497,2915-3071
/code/branches/png2:7262-7263
/code/branches/portals:8087-8455
/code/branches/portals2:8460-8602
/code/branches/ppspickups1:6552-6708
/code/branches/ppspickups2:6527-6532,6554-6709
/code/branches/ppspickups3:6757-6997
/code/branches/ppspickups4:7003-7089
/code/branches/presentation:2369-2652,2654-2660,7736-7786,8500-8705
/code/branches/presentation2:6106-6416,7787-7800
/code/branches/presentation2011:8974-9015
/code/branches/presentation2012:9189-9268
/code/branches/presentation2012merge:9266-9347
/code/branches/presentation3:6913-7162
/code/branches/questsystem:1894-2088
/code/branches/questsystem2:2107-2259
/code/branches/questsystem5:2776-2905
/code/branches/releasetodo:7614-7647
/code/branches/resource:3327-3366
/code/branches/resource2:3372-5694
/code/branches/rocket:6523-6950
/code/branches/rocket2:6953-6970
/code/branches/script_trigger:1295-1953,1955
/code/branches/shipSelection:9038-9206
/code/branches/skybox2:6559-6989
/code/branches/sound:2829-3010
/code/branches/sound2012:9205-9214
/code/branches/sound3:5941-6102
/code/branches/spaceNavigation:9381-9497
/code/branches/spaceboundaries:8085-8457
/code/branches/spaceboundaries2:8460-8613
/code/branches/spacerace:8182-8630
/code/branches/spaceraceTwo:8881-8996
/code/branches/steering:5949-6091,8140-8595
/code/branches/surfaceRace:9028-9199
/code/branches/tetris:8100-8563
/code/branches/turret:9380-9501
/code/branches/tutoriallevel:7827-8370
/code/branches/tutoriallevel2:8370-8452
/code/branches/tutoriallevel3:8453-8636
/code/branches/unity_build:8440-8716
/code/branches/usability:7915-8078
/code/branches/weapon:1925-2094
/code/branches/weapon2:2107-2488
/code/branches/weapons:2897-3051,8143-8591
/code/branches/weaponsystem:2742-2890
Modified: code/branches/presentationHS12/data/levels/presentationHS12.oxw
===================================================================
--- code/branches/presentationHS12/data/levels/presentationHS12.oxw 2012-12-16 15:02:34 UTC (rev 9522)
+++ code/branches/presentationHS12/data/levels/presentationHS12.oxw 2012-12-16 17:07:37 UTC (rev 9523)
@@ -59,51 +59,51 @@
?>
<Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
- <SpawnPoint team=0 position="-800,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort />
+ <SpawnPoint team=0 position="-900,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort />
<!--SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=bigship /-->
<!--SpawnPoint team=0 position="-900,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipcollateraldamage /-->
<!--SpawnPoint team=0 position="6000,0,2000" lookat="1,1,0" spawnclass=SpaceShip pawndesign=spaceshipcollateraldamage /-->
<SpaceRaceManager>
<checkpoints>
- <RaceCheckPoint name="checkpoint1" position="000,0,0" direction="0,-1,1" collisionType="static" scale="1" distance="70" checkpointindex="0" islast="false" nextcheckpoints="1,2,3">
+ <RaceCheckPoint name="checkpoint1" position="000,0,0" direction="0,-1,1" collisionType="static" scale="1" distance="100" checkpointindex="0" islast="false" nextcheckpoints="1,2,3">
<attached>
<Model mass="50" scale="6" mesh="BigSpacegate.mesh" yaw=90 />
</attached>
</RaceCheckPoint>
<!--- first three alternative paths --->
- <RaceCheckPoint name="checkpoint2" position="1300,0,-800" direction="0,-1,1" collisionType="static" scale="1" distance="70" checkpointindex="1" islast="false" nextcheckpoints="7,-1,-1">
+ <RaceCheckPoint name="checkpoint2" position="1300,0,-800" direction="0,-1,1" collisionType="static" scale="1" distance="100" checkpointindex="1" islast="false" nextcheckpoints="7,-1,-1">
<attached>
<Model mass="50" scale="6" mesh="BigSpacegate.mesh" yaw=90/>
</attached>
</RaceCheckPoint>
- <RaceCheckPoint name="checkpoint3" position="1200,-400,0" direction="0,-1,1" collisionType="static" scale="1" distance="70" checkpointindex="2" islast="false" nextcheckpoints="5,-1,-1">
+ <RaceCheckPoint name="checkpoint3" position="1200,-400,0" direction="0,-1,1" collisionType="static" scale="1" distance="100" checkpointindex="2" islast="false" nextcheckpoints="5,-1,-1">
<attached>
<Model mass="50" scale="6" mesh="BigSpacegate.mesh" yaw=90 />
</attached>
</RaceCheckPoint>
- <RaceCheckPoint name="checkpoint4" position="1200,100,700" direction="0,-1,1" collisionType="static" scale="1" distance="70" checkpointindex="3" islast="false" nextcheckpoints="6,-1,-1">
+ <RaceCheckPoint name="checkpoint4" position="1200,100,700" direction="0,-1,1" collisionType="static" scale="1" distance="100" checkpointindex="3" islast="false" nextcheckpoints="6,-1,-1">
<attached>
<Model mass="50" scale="6" mesh="BigSpacegate.mesh" yaw=90 />
</attached>
</RaceCheckPoint>
<!--- second three alternative paths --->
- <!--RaceCheckPoint name="checkpoint5" position="2000,500,-400" direction="0,-1,1" collisionType="static" scale="1" distance="70" checkpointindex="4" islast="false" nextcheckpoints="7,-1,-1">
+ <!--RaceCheckPoint name="checkpoint5" position="2000,500,-400" direction="0,-1,1" collisionType="static" scale="1" distance="100" checkpointindex="4" islast="false" nextcheckpoints="7,-1,-1">
<attached>
<Model mass="50" scale="6" mesh="BigSpacegate.mesh" yaw=90 />
</attached>
</RaceCheckPoint-->
- <RaceCheckPoint name="checkpoint6" position="2000,0,0" direction="0,-1,1" collisionType="static" scale="1" distance="70" checkpointindex="5" islast="false" nextcheckpoints="8,9,-1">
+ <RaceCheckPoint name="checkpoint6" position="2000,0,0" direction="0,-1,1" collisionType="static" scale="1" distance="100" checkpointindex="5" islast="false" nextcheckpoints="8,9,-1">
<attached>
<Model mass="50" scale="6" mesh="BigSpacegate.mesh" yaw=90 />
</attached>
</RaceCheckPoint>
- <RaceCheckPoint name="checkpoint7" position="2000,-500,400" direction="0,-1,1" collisionType="static" scale="1" distance="70" checkpointindex="6" islast="false" nextcheckpoints="10,-1,-1">
+ <RaceCheckPoint name="checkpoint7" position="2000,-500,400" direction="0,-1,1" collisionType="static" scale="1" distance="100" checkpointindex="6" islast="false" nextcheckpoints="10,-1,-1">
<attached>
<Model mass="50" scale="6" mesh="BigSpacegate.mesh" yaw=90 />
</attached>
@@ -112,74 +112,72 @@
<!--- third generation --->
- <RaceCheckPoint name="checkpoint8" position="5000,0,-3000" direction="0,-1,1" collisionType="static" scale="1" distance="70" checkpointindex="7" islast="false" nextcheckpoints="12,-1,-1">
+ <RaceCheckPoint name="checkpoint8" position="5000,0,-3000" direction="0,-1,1" collisionType="static" scale="1" distance="100" checkpointindex="7" islast="false" nextcheckpoints="12,-1,-1">
<attached>
<Model mass="50" scale="6" mesh="BigSpacegate.mesh" yaw=135 />
</attached>
</RaceCheckPoint>
- <RaceCheckPoint name="checkpoint9" position="3500,800,0" direction="0,-1,1" collisionType="static" scale="1" distance="70" checkpointindex="8" islast="false" nextcheckpoints="11,-1,-1">
+ <RaceCheckPoint name="checkpoint9" position="3500,800,0" direction="0,-1,1" collisionType="static" scale="1" distance="100" checkpointindex="8" islast="false" nextcheckpoints="11,-1,-1">
<attached>
<Model mass="50" scale="6" mesh="BigSpacegate.mesh" yaw=90 />
</attached>
</RaceCheckPoint>
- <RaceCheckPoint name="checkpoint10" position="3500,-800,0" direction="0,-1,1" collisionType="static" scale="1" distance="70" checkpointindex="9" islast="false" nextcheckpoints="11,-1,-1">
+ <RaceCheckPoint name="checkpoint10" position="3500,-800,0" direction="0,-1,1" collisionType="static" scale="1" distance="100" checkpointindex="9" islast="false" nextcheckpoints="11,-1,-1">
<attached>
<Model mass="50" scale="6" mesh="BigSpacegate.mesh" yaw=90 />
</attached>
</RaceCheckPoint>
- <RaceCheckPoint name="checkpoint11" position="3500,0,1000" direction="0,-1,1" collisionType="static" scale="1" distance="70" checkpointindex="10" islast="false" nextcheckpoints="12,-1,-1">
+ <RaceCheckPoint name="checkpoint11" position="3500,0,1000" direction="0,-1,1" collisionType="static" scale="1" distance="100" checkpointindex="10" islast="false" nextcheckpoints="12,-1,-1">
<attached>
<Model mass="50" scale="6" mesh="BigSpacegate.mesh" yaw=90 />
</attached>
</RaceCheckPoint>
<!-- Intermediate Solo Gate -->
- <RaceCheckPoint name="checkpoint12" position="4500,0,-100" direction="0,-1,1" collisionType="static" scale="1" distance="70" checkpointindex="11" islast="false" nextcheckpoints="12,-1,-1">
+ <RaceCheckPoint name="checkpoint12" position="4500,0,-100" direction="0,-1,1" collisionType="static" scale="1" distance="100" checkpointindex="11" islast="false" nextcheckpoints="12,-1,-1">
<attached>
<Model mass="50" scale="6" mesh="BigSpacegate.mesh" yaw=90 />
</attached>
</RaceCheckPoint>
<!---- First Common Point ---->
- <RaceCheckPoint name="checkpoint13" position="6000,0,2000" direction="0,-1,1" collisionType="static" scale="1" distance="70" checkpointindex="12" islast="false" nextcheckpoints="13,14,-1">
+ <RaceCheckPoint name="checkpoint13" position="6000,0,2000" direction="0,-1,1" collisionType="static" scale="1" distance="100" checkpointindex="12" islast="false" nextcheckpoints="13,14,-1">
<attached>
<Model mass="50" scale="6" mesh="BigSpacegate.mesh" yaw=100 pitch=45 />
</attached>
</RaceCheckPoint>
<!-- Two Paths (1) -->
- <RaceCheckPoint name="checkpoint14" position="7500,-1500,2500" direction="0,-1,1" collisionType="static" scale="1" distance="70" checkpointindex="13" islast="false" nextcheckpoints="15,-1,-1">
+ <RaceCheckPoint name="checkpoint14" position="7500,-1500,2500" direction="0,-1,1" collisionType="static" scale="1" distance="100" checkpointindex="13" islast="false" nextcheckpoints="15,-1,-1">
<attached>
<Model mass="50" scale="6" mesh="BigSpacegate.mesh" yaw=100 pitch=130 roll=1 />
- <Billboard position="0,0,0" material="Flares/ringflare2" colour="0.6,0.4,0.1" scale=3 />
</attached>
</RaceCheckPoint>
- <RaceCheckPoint name="checkpoint15" position="7500,-1500,1500" direction="0,-1,1" collisionType="static" scale="1" distance="70" checkpointindex="14" islast="false" nextcheckpoints="16,-1,-1">
+ <RaceCheckPoint name="checkpoint15" position="7500,-1500,1500" direction="0,-1,1" collisionType="static" scale="1" distance="100" checkpointindex="14" islast="false" nextcheckpoints="16,-1,-1">
<attached>
<Model mass="50" scale="6" mesh="BigSpacegate.mesh" yaw=100 pitch=90 />
</attached>
</RaceCheckPoint>
<!-- Two Paths (2) -->
- <RaceCheckPoint name="checkpoint16" position="9000,-3000, 3000" direction="0,-1,1" collisionType="static" scale="1" distance="70" checkpointindex="15" islast="false" nextcheckpoints="17,-1,-1">
+ <RaceCheckPoint name="checkpoint16" position="9000,-3000, 3000" direction="0,-1,1" collisionType="static" scale="1" distance="100" checkpointindex="15" islast="false" nextcheckpoints="17,-1,-1">
<attached>
<Model mass="50" scale="6" mesh="BigSpacegate.mesh" yaw=100 pitch=130 roll=1 />
- <Billboard position="0,0,0" material="Flares/ringflare2" colour="0.2,0.4,0.8" scale=3 />
</attached>
</RaceCheckPoint>
- <RaceCheckPoint name="checkpoint17" position="9000,-3000,1000" direction="0,-1,1" collisionType="static" scale="1" distance="70" checkpointindex="16" islast="false" nextcheckpoints="17,-1,-1">
+ <RaceCheckPoint name="checkpoint17" position="9000,-3000,1000" direction="0,-1,1" collisionType="static" scale="1" distance="100" checkpointindex="16" islast="false" nextcheckpoints="17,-1,-1">
<attached>
<Model mass="50" scale="6" mesh="BigSpacegate.mesh" yaw=100 pitch=110 />
</attached>
</RaceCheckPoint>
<!-- GOAL -->
- <RaceCheckPoint name="checkpoint18" position="12000,-4000,2000" direction="0,-1,1" collisionType="static" scale="1" distance="70" checkpointindex="17" islast="true">
+ <RaceCheckPoint name="checkpoint18" position="12000,-4000,2000" direction="0,-1,1" collisionType="static" scale="1" distance="100" checkpointindex="17" islast="true">
<attached>
<Model mass="50" scale="6" mesh="BigSpacegate.mesh" yaw=100 pitch=135 />
</attached>
@@ -188,9 +186,6 @@
</SpaceRaceManager>
-
-
-
<!-- Simplify paths -->
<!-- PORTALS -->
@@ -295,6 +290,59 @@
<BlinkingBillboard position="-29,-35,142" material="Examples/Flare" colour="1, 0.4, 0.4, 0.1" amplitude=0.2 frequency=30 phase=0 quadratic=0 />
</attached>
</StaticEntity>
+
+ <!-- Docking -->
+ <Dock position="2830,20,50" roll=0 yaw=0 >
+ <animations>
+ <MoveToDockingTarget target="destroyer" />
+ </animations>
+ <effects>
+ <DockToShip target="spaceShip" />
+ </effects>
+ <events>
+ <execute>
+ <EventListener event="dockMe" />
+ </execute>
+ <activity>
+ <EventListener event=notGameEnd />
+ </activity>
+ </events>
+ <attached>
+ <Billboard position="0,0,0" material="Flares/ringflare2" colour="0.2,0.4,0.8" scale=1 />
+ <BlinkingBillboard position="10,0,0" material="Examples/Flare" colour="1, 0.3, 1, 0.1" amplitude=0.2 frequency=0.4 phase=0 quadratic=1 />
+ <BlinkingBillboard position="20,0,0" material="Examples/Flare" colour="1, 0.3, 1, 0.1" amplitude=0.2 frequency=0.4 phase=0 quadratic=1 />
+ <BlinkingBillboard position="30,0,0" material="Examples/Flare" colour="1, 0.3, 1, 0.1" amplitude=0.2 frequency=0.4 phase=0 quadratic=1 />
+ <BlinkingBillboard position="0,10,0" material="Examples/Flare" colour="0.3, 1, 1, 0.1" amplitude=0.2 frequency=0.4 phase=0 quadratic=1 />
+ <BlinkingBillboard position="0,20,0" material="Examples/Flare" colour="0.3, 1, 1, 0.1" amplitude=0.2 frequency=0.4 phase=0 quadratic=1 />
+ <BlinkingBillboard position="0,30,0" material="Examples/Flare" colour="0.3, 1, 1, 0.1" amplitude=0.2 frequency=0.4 phase=0 quadratic=1 />
+ <BlinkingBillboard position="0,0,10" material="Examples/Flare" colour="0.3, 0.3, 1, 1" amplitude=0.2 frequency=0.4 phase=0 quadratic=1 />
+ <BlinkingBillboard position="0,0,20" material="Examples/Flare" colour="0.3, 0.3, 1, 1" amplitude=0.2 frequency=0.4 phase=0 quadratic=1 />
+ <BlinkingBillboard position="0,0,30" material="Examples/Flare" colour="0.3, 0.3, 1, 1" amplitude=0.2 frequency=0.4 phase=0 quadratic=1 />
+ <DistanceTrigger position="0,0,0" distance="200" target="Pawn"
+ beaconMode="exclude" targetname="bcnDestroyer" name="dockMe"
+ />
+ </attached>
+
+ </Dock>
+ <SpaceShip
+ template = "spaceshipcollateraldamage"
+ team = "0"
+ position = "2890,-40,6"
+ orientation = "-0.14, 0.68, 0.68, 0.223"
+ lookat = "0,0,0"
+ roll = "180"
+ name = "collateralDamage"
+ radarname = "Collateral Damage" >
+ <!--
+ pitch = "90"
+ yaw = "0"-->
+ <attached>
+ <DockingTarget name="spaceShip" />
+ <DistanceTriggerBeacon name="bcnDestroyer" />
+ <DockingTarget name="destroyer" />
+ </attached>
+ </SpaceShip>
+
<!-- triple large belt around the planet -->
<?lua
dofile("includes/asteroidField.lua")
@@ -334,10 +382,64 @@
</collisionShapes>
</Planet>
+<StaticEntity position="6750,-750,2000" yaw=0 pitch=0>
+ <attached>
+ <Model position="0,0,0" mesh="turretSocketFront.mesh" scale3D="10,10,10" />
+ <Model position="0,0,0" mesh="turretSocketIn.mesh" scale3D="10,10,10" />
+ <Model position="0,0,0" mesh="turretSocketTop.mesh" scale3D="10,10,10" />
+ <Model position="0,0,0" mesh="turretSocketLeft.mesh" scale3D="10,10,10" />
+ <Model position="0,0,0" mesh="turretSocketRight.mesh" scale3D="10,10,10" />
+ </attached>
+</StaticEntity>
+<SpaceShip position="6750,-740,2000" pitch="90" yaw="0" roll="0" radarname="Automatic Turret">
+ <templates>
+ <Template link=spaceshipturret />
+ </templates>
+ <controller>
+ <WaypointPatrolController alertnessradius=1000 team=10>
+ </WaypointPatrolController>
+ </controller>
+</SpaceShip>
-<!-- INTERACTIVE LEVEL -->
+
+ <!--- Some Randomn Asteroids --->
+ <?lua
+ for i = 1, 250, 1
+ do
+ j = math.random()
+ ?>
+
+ <MovableEntity
+ position = "<?lua print(math.random()* 15000 - 1000) ?>,<?lua print(math.random() * 12000 - 4000) ?>,<?lua print(math.random() * 12000 - 4000) ?>"
+ collisionType = dynamic
+ linearDamping = 0.8
+ angularDamping = 0
+ scale = "<?lua print(j * 150)?>"
+ collisiondamage = 1
+ enablecollisiondamage = true
+ >
+ <attached>
+ <Model mass="<?lua print(j * 1000) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh" />
+ </attached>
+ <collisionShapes>
+ <SphereCollisionShape radius="<?lua print(j * 350) ?>" />
+ </collisionShapes>
+ </MovableEntity>
+
+ <?lua
+ end
+ ?>
+
+
+
+
+
+
+<!-- INTERACTIVE PART -->
<DistanceTrigger name="start" position="-900,0,0" target="Pawn" distance=100 stayActive="true" delay=0.5 />
<DistanceTrigger name="spawnBots" position="-900,0,0" target="Pawn" distance=100 stayActive="true" delay=4.5 />
+ <DistanceTrigger name="creditPetar" position="2000,0,0" target="Pawn" distance=100 stayActive="true" delay=0.5 />
+ <DistanceTrigger name="creditDario" position="4500,0,-100" target="Pawn" distance=200 stayActive="true" delay=5 />
<SimpleNotification message="Sound Effetcs by Mike." broadcast="true">
<events>
@@ -347,6 +449,38 @@
</events>
</SimpleNotification>
+ <SimpleNotification message="Racing Bots by Michael." broadcast="true">
+ <events>
+ <trigger>
+ <EventListener event=spawnBots />
+ </trigger>
+ </events>
+ </SimpleNotification>
+
+ <SimpleNotification message="Planetary Destroyer by Petar." broadcast="true">
+ <events>
+ <trigger>
+ <EventListener event=creditPetar />
+ </trigger>
+ </events>
+ </SimpleNotification>
+
+ <SimpleNotification message="Collateral Damage by Raphael." broadcast="true">
+ <events>
+ <trigger>
+ <EventListener event=dockMe />
+ </trigger>
+ </events>
+ </SimpleNotification>
+
+ <SimpleNotification message="Automatic Turret by Dario." broadcast="true">
+ <events>
+ <trigger>
+ <EventListener event=creditDario />
+ </trigger>
+ </events>
+ </SimpleNotification>
+
<Script code="addBots 3" onLoad="false">
<events>
<trigger>
@@ -357,7 +491,7 @@
<!-- SOUNDS & MUSIC -->
- <WorldSound name="scoreSound" position="-900,0,0" source="sounds/ReadyGo.ogg" >
+ <WorldSound name="scoreSound" position="-920,0,0" source="sounds/ReadyGo.ogg" >
<events>
<play>
<EventListener event="start" />
Modified: code/branches/presentationHS12/src/modules/gametypes/CMakeLists.txt
===================================================================
--- code/branches/presentationHS12/src/modules/gametypes/CMakeLists.txt 2012-12-16 15:02:34 UTC (rev 9522)
+++ code/branches/presentationHS12/src/modules/gametypes/CMakeLists.txt 2012-12-16 17:07:37 UTC (rev 9523)
@@ -4,6 +4,8 @@
SpaceRaceManager.cc
OldSpaceRace.cc
OldRaceCheckPoint.cc
+ SpaceRaceBot.cc
+ SpaceRaceController.cc
)
ORXONOX_ADD_LIBRARY(gametypes
Modified: code/branches/presentationHS12/src/modules/gametypes/GametypesPrereqs.h
===================================================================
--- code/branches/presentationHS12/src/modules/gametypes/GametypesPrereqs.h 2012-12-16 15:02:34 UTC (rev 9522)
+++ code/branches/presentationHS12/src/modules/gametypes/GametypesPrereqs.h 2012-12-16 17:07:37 UTC (rev 9523)
@@ -66,6 +66,9 @@
{
class SpaceRace;
class OldSpaceRace;
+ class SpaceRaceManager;
+ class SpaceRaceBot;
+ class SpaceRaceController;
}
#endif /* _GametypesPrereqs_H__ */
Modified: code/branches/presentationHS12/src/modules/gametypes/RaceCheckPoint.cc
===================================================================
--- code/branches/presentationHS12/src/modules/gametypes/RaceCheckPoint.cc 2012-12-16 15:02:34 UTC (rev 9522)
+++ code/branches/presentationHS12/src/modules/gametypes/RaceCheckPoint.cc 2012-12-16 17:07:37 UTC (rev 9523)
@@ -42,10 +42,10 @@
{
CreateFactory(RaceCheckPoint);
- RaceCheckPoint::RaceCheckPoint(BaseObject* creator): DistanceMultiTrigger(creator), RadarViewable(creator, static_cast<WorldEntity*>(this))
+ RaceCheckPoint::RaceCheckPoint(BaseObject* creator) : DistanceMultiTrigger(creator),
+ RadarViewable(creator, static_cast<WorldEntity*> (this))
{
RegisterObject(RaceCheckPoint);
-
this->setDistance(100);
this->setBeaconMode("off");
this->setBroadcast(false);
@@ -59,13 +59,16 @@
this->checkpointIndex_ = 0;
this->bIsLast_ = false;
this->timeLimit_ = 0;
- this->player_ = NULL;
+ //this->players_ = vector<PlayerInfo*>();
+
+ myPosition_= this->getPosition(); //eingefuegt
+ //orxout(user_status) << "test" << std::endl;
}
+ RaceCheckPoint::~RaceCheckPoint()
+ {
- RaceCheckPoint::~RaceCheckPoint()
- {
- }
+ }
void RaceCheckPoint::XMLPort(Element& xmlelement, XMLPort::Mode mode)
{
@@ -85,7 +88,7 @@
{
ControllableEntity* entity = orxonox_cast<ControllableEntity*>(originator);
if (entity)
- this->player_ = entity->getPlayer();
+ this->players_.push_back(entity->getPlayer());
}
}
@@ -94,31 +97,131 @@
this->timeLimit_ = timeLimit;
if (this->timeLimit_ != 0)
{
- std::string message = "You have " + multi_cast<std::string>(this->timeLimit_)
- + " seconds to reach the check point " + multi_cast<std::string>(this->checkpointIndex_ + 1);
+ std::string message = "You have " + multi_cast<std::string>(this->timeLimit_)
+ + " seconds to reach the check point " + multi_cast<std::string>(this->checkpointIndex_ + 1);
this->getGametype()->getGametypeInfo()->sendAnnounceMessage(message);
ChatManager::message(message);
}
}
+ //Must not be called before setNextCheckpointsAsVector3 at least once has been called
+ void RaceCheckPoint::setNextVirtualCheckpointsAsVector3(const Vector3& checkpoints){
+ /*std::set<int> lastcheckpoints=this->nextCheckpoints_;
+ nextCheckpoints_.clear();
+ std::set<int>::iterator it = lastcheckpoints.begin();
+ if(checkpoints.x<-1){
+ virtualToRealCheckPoints_.insert(std::pair<int,int>(checkpoints.x,(*it)));
+ it++;
+ }
+ if(checkpoints.x!=-1)
+ this->nextCheckpoints_.insert(static_cast<int>(checkpoints.x + 0.5)); // the red number has the type double and for the cast (to int) is added 0.5 so that the cast works correctly
+
+ if(checkpoints.y<-1){
+ virtualToRealCheckPoints_.insert(std::pair<int,int>(checkpoints.y,(*it)));
+ it++;
+ }
+ if(checkpoints.y!=-1)
+ this->nextCheckpoints_.insert(static_cast<int>(checkpoints.y + 0.5));
+
+ if(checkpoints.z<-1){
+ virtualToRealCheckPoints_.insert(std::pair<int,int>(checkpoints.z,(*it)));
+ it++;
+ }
+ if(checkpoints.z!=-1)
+ this->nextCheckpoints_.insert(static_cast<int>(checkpoints.z + 0.5));*/
+ nextCheckpointsVirtual_.clear();
+ if(checkpoints.x!=-1)
+ nextCheckpointsVirtual_.insert(checkpoints.x);
+ if(checkpoints.y!=-1)
+ nextCheckpointsVirtual_.insert(checkpoints.y);
+ if(checkpoints.z!=-1)
+ nextCheckpointsVirtual_.insert(checkpoints.z);
+ }
+
void RaceCheckPoint::setNextCheckpointsAsVector3(const Vector3& checkpoints)
{
this->nextCheckpoints_.clear();
if (checkpoints.x > -1)
- this->nextCheckpoints_.insert(static_cast<int>(checkpoints.x + 0.5));
+ this->nextCheckpoints_.insert(static_cast<int>(checkpoints.x + 0.5)); // the red number has the type double and for the cast (to int) is added 0.5 so that the cast works correctly
if (checkpoints.y > -1)
- this->nextCheckpoints_.insert(static_cast<int>(checkpoints.y + 0.5));
+ this->nextCheckpoints_.insert(static_cast<int>(checkpoints.y + 0.5));
if (checkpoints.z > -1)
- this->nextCheckpoints_.insert(static_cast<int>(checkpoints.z + 0.5));
+ this->nextCheckpoints_.insert(static_cast<int>(checkpoints.z + 0.5));
+
+ this->nextCheckpointsVirtual_=nextCheckpoints_;
}
- Vector3 RaceCheckPoint::getNextCheckpointsAsVector3() const
+ PlayerInfo* RaceCheckPoint::getPlayer(unsigned int clientID) const
{
+ if (players_.size() > 0)
+ {
+ for (int i = 0; i < players_.size(); i++)
+ {
+ if (this->players_[i]->getClientID() == clientID)
+ {
+ return players_[i];
+ }
+ }
+ }
+ return NULL;
+ }
+
+ bool RaceCheckPoint::playerWasHere(PlayerInfo* player) const
+ {
+ if (players_.size() > 0)
+ {
+ for (int i = 0; i < players_.size(); i++)
+ {
+ if (this->players_[i] == player)
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ Vector3 RaceCheckPoint::getNextCheckpointsAsVector3()
+ {
+ Vector3 checkpoints(-1,-1,-1); int count=0;
+ for (std::set<int>::iterator it= nextCheckpoints_.begin();it!=nextCheckpoints_.end(); it++ ){
+ switch (count)
+ {
+ case 0: checkpoints.x = static_cast<Ogre::Real>(*it); break;
+ case 1: checkpoints.y = static_cast<Ogre::Real>(*it); break;
+ case 2: checkpoints.z = static_cast<Ogre::Real>(*it); break;
+ }
+ ++count;
+ }
+ return checkpoints;
+ //= getVirtualNextCheckpointsAsVector3();
+ int j[3];
+ j[0]=changeVirtualToRealCheckPoint(checkpoints.x);
+ j[1]=changeVirtualToRealCheckPoint(checkpoints.y);
+ j[2]=changeVirtualToRealCheckPoint(checkpoints.z);
+
+
+ return Vector3(j[0],j[1],j[2]);
+
+
+ }
+
+ int RaceCheckPoint::changeVirtualToRealCheckPoint(int checkpointID) {
+ int temp=checkpointID;
+ while(temp<-1){
+ temp = this->virtualToRealCheckPoints_[temp];
+ }
+ return temp;
+ }
+
+
+ Vector3 RaceCheckPoint::getVirtualNextCheckpointsAsVector3() const
+ {
Vector3 checkpoints = Vector3(-1, -1, -1);
size_t count = 0;
- for (std::set<int>::iterator it = this->nextCheckpoints_.begin(); it != this->nextCheckpoints_.end(); ++it)
+ for (std::set<int>::iterator it = this->nextCheckpointsVirtual_.begin(); it != this->nextCheckpointsVirtual_.end(); ++it)
{
switch (count)
{
Modified: code/branches/presentationHS12/src/modules/gametypes/RaceCheckPoint.h
===================================================================
--- code/branches/presentationHS12/src/modules/gametypes/RaceCheckPoint.h 2012-12-16 15:02:34 UTC (rev 9522)
+++ code/branches/presentationHS12/src/modules/gametypes/RaceCheckPoint.h 2012-12-16 17:07:37 UTC (rev 9523)
@@ -36,11 +36,12 @@
namespace orxonox
{
/**
- @brief
- The RaceCheckPoint class enables the creation of a check point to use in a SpaceRace level.
- Don't forget to control the indexes of your check points and to set one last check point
- */
- class _GametypesExport RaceCheckPoint : public DistanceMultiTrigger, public RadarViewable
+ @brief
+ The RaceCheckPoint class enables the creation of a check point to use in a SpaceRace level.
+ Don't forget to control the indexes of your check points and to set one last check point
+ */
+ class _GametypesExport RaceCheckPoint: public DistanceMultiTrigger,
+ public RadarViewable
{
public:
RaceCheckPoint(BaseObject* creator);
@@ -49,41 +50,78 @@
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
inline void setCheckpointIndex(int checkpointIndex)
- { this->checkpointIndex_ = checkpointIndex; }
+ {
+ this->checkpointIndex_ = checkpointIndex;
+ }
inline int getCheckpointIndex() const
- { return this->checkpointIndex_; }
+ {
+ return this->checkpointIndex_;
+ }
void setNextCheckpointsAsVector3(const Vector3& checkpoints);
- Vector3 getNextCheckpointsAsVector3() const;
- const std::set<int>& getNextCheckpoints() const
- { return this->nextCheckpoints_; }
+ Vector3 getNextCheckpointsAsVector3();
+ Vector3 getVirtualNextCheckpointsAsVector3() const;
+ void setNextVirtualCheckpointsAsVector3(const Vector3& checkpoints);
+ int changeVirtualToRealCheckPoint(int);
+ const std::set<int>& getVirtualNextCheckpoints() const
+ {
+ return this->nextCheckpointsVirtual_;
+ }
+
+ const std::set<int>& getNextCheckpoints()
+ {
+ return nextCheckpoints_;
+ std::set<int> temp;
+ std::set<int> temp2=getVirtualNextCheckpoints();
+ for (std::set<int>::iterator it = temp2.begin(); it!=temp2.end(); ++it){
+ temp.insert(changeVirtualToRealCheckPoint((*it)));
+ }
+ return temp;
+ }
inline void setLast(bool isLast)
- { this->bIsLast_ = isLast; }
+ {
+ this->bIsLast_ = isLast;
+ }
inline bool isLast() const
- { return this->bIsLast_; }
+ {
+ return this->bIsLast_;
+ }
virtual void setTimelimit(float timeLimit);
inline float getTimeLimit() const
- { return this->timeLimit_; }
+ {
+ return this->timeLimit_;
+ }
- inline PlayerInfo* getPlayer() const
- { return this->player_; }
+ PlayerInfo* getPlayer(unsigned int clientID) const;
+
+ bool playerWasHere(PlayerInfo* ) const;
+
inline void resetPlayer()
- { this->player_ = NULL; }
+ {
+ this->players_.clear();
+ }
protected:
+
virtual void fire(bool bIsTriggered, BaseObject* originator);
inline const WorldEntity* getWorldEntity() const
- { return this; }
+ {
+ return this;
+ }
private:
- int checkpointIndex_; ///< The index of this check point. The race starts with the check point with the index 0
+
+ int checkpointIndex_; ///< The index of this check point. The race starts with the check point with the index 0
std::set<int> nextCheckpoints_; ///< the indexes of the next check points
- bool bIsLast_; ///< True if this check point is the last of the level. There can be only one last check point for each level and there must be a last check point in the level.
- float timeLimit_; ///< The time limit (from the start of the level) to reach this check point. If the check point is reached after this time, the game ends and the player looses.
- PlayerInfo* player_; ///< The player that reached the checkpoint
+ bool bIsLast_; ///< True if this check point is the last of the level. There can be only one last check point for each level and there must be a last check point in the level.
+ float timeLimit_; ///< The time limit (from the start of the level) to reach this check point. If the check point is reached after this time, the game ends and the player looses.
+ std::vector<PlayerInfo*> players_; ///< The player that reached the checkpoint
+ Vector3 myPosition_;
+ std::set<int> nextCheckpointsVirtual_;
+ std::map<int,int> virtualToRealCheckPoints_; // if virtualChepoint was inserted the original can be reconstructed
};
}
Modified: code/branches/presentationHS12/src/modules/gametypes/SpaceRace.cc
===================================================================
--- code/branches/presentationHS12/src/modules/gametypes/SpaceRace.cc 2012-12-16 15:02:34 UTC (rev 9522)
+++ code/branches/presentationHS12/src/modules/gametypes/SpaceRace.cc 2012-12-16 17:07:37 UTC (rev 9523)
@@ -34,7 +34,7 @@
#include "chat/ChatManager.h"
#include "util/Convert.h"
#include "util/Math.h"
-
+#include "SpaceRaceBot.h"
#include "items/Engine.h"
namespace orxonox
@@ -45,6 +45,7 @@
{
RegisterObject(SpaceRace);
+ this->botclass_ = Class(SpaceRaceBot);//ClassByString("")
this->cantMove_ = false;
this->bTimeIsUp_ = false;
this->numberOfBots_ = 0; // quick fix: don't allow default-bots to enter the race
Copied: code/branches/presentationHS12/src/modules/gametypes/SpaceRaceBot.cc (from rev 9513, code/branches/Racingbot/src/modules/gametypes/SpaceRaceBot.cc)
===================================================================
--- code/branches/presentationHS12/src/modules/gametypes/SpaceRaceBot.cc (rev 0)
+++ code/branches/presentationHS12/src/modules/gametypes/SpaceRaceBot.cc 2012-12-16 17:07:37 UTC (rev 9523)
@@ -0,0 +1,38 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Created on: Oct 8, 2012
+ * Author: purgham
+ */
+
+#include "SpaceRaceBot.h"
+#include "core/CoreIncludes.h"
+
+namespace orxonox
+{
+ CreateFactory(SpaceRaceBot);
+
+ SpaceRaceBot::SpaceRaceBot(BaseObject* creator) : Bot(creator){
+ RegisterObject(SpaceRaceBot);
+ this->defaultController_ = Class(SpaceRaceController);// ClassByString("")
+ this->createController();
+ }
+}
Copied: code/branches/presentationHS12/src/modules/gametypes/SpaceRaceBot.h (from rev 9513, code/branches/Racingbot/src/modules/gametypes/SpaceRaceBot.h)
===================================================================
--- code/branches/presentationHS12/src/modules/gametypes/SpaceRaceBot.h (rev 0)
+++ code/branches/presentationHS12/src/modules/gametypes/SpaceRaceBot.h 2012-12-16 17:07:37 UTC (rev 9523)
@@ -0,0 +1,49 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Created on: Oct 8, 2012
+ * Author: purgham
+ */
+
+#ifndef SPACERACEBOT_H_
+#define SPACERACEBOT_H_
+
+#include "infos/Bot.h"
+#include "gametypes/GametypesPrereqs.h"
+#include "gametypes/SpaceRaceController.h"
+
+
+namespace orxonox
+{
+
+ /**
+
+ */
+ class _GametypesExport SpaceRaceBot: public Bot
+ {
+ public:
+ SpaceRaceBot(BaseObject* creator);
+ virtual ~SpaceRaceBot() {}
+ };
+}
+
+
+#endif /* SPACERACEBOT_H_ */
Copied: code/branches/presentationHS12/src/modules/gametypes/SpaceRaceController.cc (from rev 9513, code/branches/Racingbot/src/modules/gametypes/SpaceRaceController.cc)
===================================================================
--- code/branches/presentationHS12/src/modules/gametypes/SpaceRaceController.cc (rev 0)
+++ code/branches/presentationHS12/src/modules/gametypes/SpaceRaceController.cc 2012-12-16 17:07:37 UTC (rev 9523)
@@ -0,0 +1,606 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Created on: Oct 8, 2012
+ * Author: purgham
+ */
+
+/**
+ * Conventions:
+ * -first Checkpoint has index 0
+ * -staticCheckPoint= static Point (see def over = constructor)
+ */
+
+/*TODO:
+ * tICK KORRIGIEREN
+ *
+ *
+ */
+#include <gametypes/SpaceRaceController.h>
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "gametypes/SpaceRaceManager.h"
+#include "collisionshapes/CollisionShape.h"
+#include "BulletCollision/CollisionShapes/btCollisionShape.h"
+
+
+namespace orxonox
+{
+ CreateFactory(SpaceRaceController);
+
+ const int ADJUSTDISTANCE = 500;
+ const int MINDISTANCE = 5;
+ /*
+ * Idea: Find static Point (checkpoints the spaceship has to reach)
+ */
+ SpaceRaceController::SpaceRaceController(BaseObject* creator) :
+ ArtificialController(creator)
+ {
+ RegisterObject(SpaceRaceController)
+; std::vector<RaceCheckPoint*> checkpoints;
+
+ virtualCheckPointIndex = -2;
+ for (ObjectList<SpaceRaceManager>::iterator it = ObjectList<SpaceRaceManager>::begin(); it != ObjectList<SpaceRaceManager>::end(); ++it)
+ {
+ checkpoints = it->getAllCheckpoints();
+ nextRaceCheckpoint_ = it->findCheckpoint(0);
+ }
+
+ OrxAssert(!checkpoints.empty(), "No Checkpoints in Level");
+ checkpoints_ = checkpoints;
+ /*orxout()<<"es gibt: "<<checkpoints_.size()<<"checkpoints"<<endl;
+ for(std::vector<RaceCheckPoint*>::iterator it=checkpoints_.begin(); it!=checkpoints_.end(); it++)
+ {
+ orxout()<<"Checkpoint "<<(*it)->getCheckpointIndex()<<"; NExtReal: ";
+ std::set<int> temp =(*it)->getNextCheckpoints();
+ for (std::set<int>::iterator ii =temp.begin(); ii!=temp.end(); ii++)
+ {
+ orxout()<<(*ii)<<", ";
+ }
+
+ orxout()<<" NextVirtual: ";
+ temp=(*it)->getVirtualNextCheckpoints();
+ for (std::set<int>::iterator ii =temp.begin(); ii!=temp.end(); ii++)
+ {
+ orxout()<<(*ii)<<", ";
+ }
+ orxout()<<endl<<endl;
+
+ }//ausgabe*/
+
+ for (std::vector<RaceCheckPoint*>::iterator it = checkpoints.begin(); it != checkpoints.end(); ++it)
+ {
+ std::set<int> nextCheckPoints = ((*it)->getNextCheckpoints());
+ if(!nextCheckPoints.empty())
+ {
+ for (std::set<int>::iterator numb = nextCheckPoints.begin(); numb!=nextCheckPoints.end(); numb++)
+ {
+ RaceCheckPoint* point2 = findCheckpoint((*numb));
+
+ //if(point2 != NULL)
+ //placeVirtualCheckpoints((*it), point2);
+ }
+ }
+ }/*
+ for(std::vector<RaceCheckPoint*>::iterator it=checkpoints_.begin(); it!=checkpoints_.end(); it++)
+ {
+ orxout()<<"Checkpoint "<<(*it)->getCheckpointIndex()<<"; NExtReal: ";
+ std::set<int> temp =(*it)->getNextCheckpoints();
+ for (std::set<int>::iterator ii =temp.begin(); ii!=temp.end(); ii++)
+ {
+ orxout()<<(*ii)<<", ";
+ }
+
+ orxout()<<" NextVirtual: ";
+ temp=(*it)->getVirtualNextCheckpoints();
+ for (std::set<int>::iterator ii =temp.begin(); ii!=temp.end(); ii++)
+ {
+ orxout()<<(*ii)<<", ";
+ }
+ orxout()<<endl;
+
+ }//ausgabe
+ orxout()<<"es gibt: "<<checkpoints_.size()<<"checkpoints"<<endl;*/
+ staticRacePoints_ = findStaticCheckpoints(checkpoints);
+ // initialisation of currentRaceCheckpoint_
+ currentRaceCheckpoint_ = NULL;
+
+ int i;
+ for (i = -2; findCheckpoint(i) != NULL; i--)
+ {
+ continue;
+ }
+ //orxout()<<"Die ANzahl der virtuellen CP betraegt: "<< (-i)-2<<endl;
+
+ }
+
+ //------------------------------
+ // functions for initialisation
+
+ void SpaceRaceController::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(SpaceRaceController, XMLPort, xmlelement, mode);
+ XMLPortParam(ArtificialController, "accuracy", setAccuracy, getAccuracy, xmlelement, mode).defaultValues(100.0f);
+ XMLPortObject(ArtificialController, WorldEntity, "waypoints", addWaypoint, getWaypoint, xmlelement, mode);
+ }
+
+ /*
+ * called from constructor 'SpaceRaceController'
+ * returns a vector of static Point (checkpoints the spaceship has to reach)
+ */
+ std::vector<RaceCheckPoint*> SpaceRaceController::findStaticCheckpoints(std::vector<RaceCheckPoint*> allCheckpoints)
+ {
+ std::map<RaceCheckPoint*, int> * zaehler = new std::map<RaceCheckPoint*, int>(); // counts how many times the checkpoint was reached (for simulation)
+ for (unsigned int i = 0; i < allCheckpoints.size(); i++)
+ {
+ zaehler->insert(std::pair<RaceCheckPoint*, int>(allCheckpoints[i],0));
+ }
+ int maxWays = rekSimulationCheckpointsReached(zaehler->begin()->first, zaehler);
+
+ std::vector<RaceCheckPoint*> returnVec;
+ returnVec.clear();
+ for (std::map<RaceCheckPoint*, int>::iterator iter = zaehler->begin(); iter != zaehler->end(); iter++)
+ {
+ if (iter->second == maxWays)
+ {
+ //returnVec.insert(allCheckpoints[1]);
+ returnVec.insert(returnVec.end(), iter->first);
+ }
+ }
+ delete zaehler;
+ return returnVec;
+ }
+
+ /*
+ * called from 'findStaticCheckpoints'
+ * return how many ways go from the given Checkpoint to the last Checkpoint (of the Game)
+ */
+ int SpaceRaceController::rekSimulationCheckpointsReached(RaceCheckPoint* currentCheckpoint, std::map<RaceCheckPoint*, int>* zaehler)
+ {
+
+ if (currentCheckpoint->isLast())
+ {// last point reached
+
+ (*zaehler)[currentCheckpoint] += 1;
+ return 1; // 1 Way form the last point to this one
+ }
+ else
+ {
+ int numberOfWays = 0; // counts number of ways from this Point to the last point
+ for (std::set<int>::iterator it = currentCheckpoint->getVirtualNextCheckpoints().begin(); it!= currentCheckpoint->getVirtualNextCheckpoints().end(); ++it)
+ {
+ if(currentCheckpoint == findCheckpoint(*it))
+ {
+ //orxout() << currentCheckpoint->getCheckpointIndex()<<endl;
+ continue;
+ }
+ if(findCheckpoint(*it) == NULL)
+ {orxout()<<"Problematic Point: "<<(*it)<<endl;}
+ numberOfWays += rekSimulationCheckpointsReached(findCheckpoint(*it), zaehler);
+ }
+ (*zaehler)[currentCheckpoint] += numberOfWays;
+ return numberOfWays; // returns the number of ways from this point to the last one
+ }
+ }
+
+ //-------------------------------------
+ // functions for dynamic Way-search
+
+ int SpaceRaceController::distanceSpaceshipToCheckPoint(RaceCheckPoint* CheckPoint)
+ {
+ if (this->getControllableEntity() != NULL)
+ {
+ return (CheckPoint->getPosition()- this->getControllableEntity()->getPosition()).length();
+ }
+ return -1;
+ }
+
+ /*
+ * called by: 'tick' or 'adjustNextPoint'
+ * returns the next Checkpoint which the shortest way contains
+ */
+ RaceCheckPoint* SpaceRaceController::nextPointFind(RaceCheckPoint* raceCheckpoint)
+ {
+ int distances[] = {-1, -1, -1};
+ int temp_i = 0;
+ for (std::set<int>::iterator it =raceCheckpoint->getVirtualNextCheckpoints().begin(); it!= raceCheckpoint->getVirtualNextCheckpoints().end(); ++it)
+ {
+ distances[temp_i] = recCalculateDistance(findCheckpoint(*it), this->getControllableEntity()->getPosition());
+ temp_i++;
+ }
+ if (distances[0] > distances[1] && distances[1] != -1)
+ {
+ if (distances[2] < distances[1] && distances[2] != -1)
+ {
+ return findCheckpoint(*raceCheckpoint->getVirtualNextCheckpoints().end()); // return checkpoint with ID of raceCheckpoint->getNextCheckpoints() [2]
+ }
+ else
+ {
+ std::set<int>::iterator temp = raceCheckpoint->getVirtualNextCheckpoints().begin();
+ return findCheckpoint(*(++temp)); // return [1]
+ }
+ }
+ else
+ {
+ if (distances[2] < distances[0] && distances[2] != -1)
+ {
+ return findCheckpoint(*raceCheckpoint->getVirtualNextCheckpoints().end()); // return [2]
+ }
+ else
+ {
+ return findCheckpoint(*raceCheckpoint->getVirtualNextCheckpoints().begin()); // return [0]
+ }
+ }
+ }
+
+ /*
+ * called from 'nextPointFind'
+ * returns the distance between "currentPosition" and the next static checkpoint that can be reached from "currentCheckPoint"
+ */
+ int SpaceRaceController::recCalculateDistance(RaceCheckPoint* currentCheckPoint, Vector3 currentPosition)
+ {
+ // find: looks if the currentCheckPoint is a staticCheckPoint (staticCheckPoint is the same as: static Point)
+ if (std::find(staticRacePoints_.begin(), staticRacePoints_.end(), currentCheckPoint) != staticRacePoints_.end())
+ {
+ return (currentCheckPoint->getPosition() - currentPosition).length();
+ }
+ else
+ {
+ int minimum = std::numeric_limits<int>::max();
+ for (std::set<int>::iterator it = currentCheckPoint->getVirtualNextCheckpoints().begin(); it != currentCheckPoint->getVirtualNextCheckpoints().end(); ++it)
+ {
+ int dist_currentCheckPoint_currentPosition = static_cast<int> ((currentPosition- currentCheckPoint->getPosition()).length());
+
+ minimum = std::min(minimum, dist_currentCheckPoint_currentPosition + recCalculateDistance(findCheckpoint(*it), currentCheckPoint->getPosition()));
+ // minimum of distanz from 'currentPosition' to the next static Checkpoint
+ }
+ return minimum;
+ }
+ }
+
+ /*called by 'tick'
+ *adjust chosen way of the Spaceship every "AdjustDistance" because spaceship could be displaced through an other one
+ */
+ RaceCheckPoint* SpaceRaceController::adjustNextPoint()
+ {
+ if (currentRaceCheckpoint_ == NULL) // no Adjust possible
+
+ {
+ return nextRaceCheckpoint_;
+ }
+ if ((currentRaceCheckpoint_->getVirtualNextCheckpoints()).size() == 1) // no Adjust possible
+
+ {
+ return nextRaceCheckpoint_;
+ }
+
+ //Adjust possible
+
+ return nextPointFind(currentRaceCheckpoint_);
+ }
+
+ RaceCheckPoint* SpaceRaceController::findCheckpoint(int index) const
+ {
+ for (size_t i = 0; i < this->checkpoints_.size(); ++i)
+ if (this->checkpoints_[i]->getCheckpointIndex() == index)
+ return this->checkpoints_[i];
+ return NULL;
+ }
+
+ /*RaceCheckPoint* SpaceRaceController::addVirtualCheckPoint( RaceCheckPoint* previousCheckpoint, int indexFollowingCheckPoint , Vector3 virtualCheckPointPosition )
+ {
+ orxout()<<"add VCP at"<<virtualCheckPointPosition.x<<", "<<virtualCheckPointPosition.y<<", "<<virtualCheckPointPosition.z<<endl;
+ RaceCheckPoint* newTempRaceCheckPoint;
+ for (ObjectList<SpaceRaceManager>::iterator it = ObjectList<SpaceRaceManager>::begin(); it!= ObjectList<SpaceRaceManager>::end(); ++it)
+ {
+ newTempRaceCheckPoint = new RaceCheckPoint((*it));
+ }
+ newTempRaceCheckPoint->setVisible(false);
+ newTempRaceCheckPoint->setPosition(virtualCheckPointPosition);
+ newTempRaceCheckPoint->setCheckpointIndex(virtualCheckPointIndex);
+ newTempRaceCheckPoint->setLast(false);
+ newTempRaceCheckPoint->setNextVirtualCheckpointsAsVector3(Vector3(indexFollowingCheckPoint,-1,-1));
+
+ Vector3 temp = previousCheckpoint->getVirtualNextCheckpointsAsVector3();
+ //orxout()<<"temp bei 0: ="<< temp.x<< temp.y<< temp.z<<endl;
+ checkpoints_.insert(checkpoints_.end(), newTempRaceCheckPoint);
+ int positionInNextCheckPoint;
+ for (int i = 0; i <3; i++)
+ {
+ if(previousCheckpoint->getVirtualNextCheckpointsAsVector3()[i] == indexFollowingCheckPoint)
+ positionInNextCheckPoint=i;
+ }
+ switch(positionInNextCheckPoint)
+ {
+ case 0: temp.x=virtualCheckPointIndex; break;
+ case 1: temp.y=virtualCheckPointIndex; break;
+ case 2: temp.z=virtualCheckPointIndex; break;
+ }
+ previousCheckpoint->setNextVirtualCheckpointsAsVector3(temp); //Existiert internes Problem bei negativen index fueer next Checkpoint
+ virtualCheckPointIndex--;
+ //orxout()<<"temp bei 1: ="<< temp.x<< temp.y<< temp.z<<endl;
+ //orxout()<<"temp nach ausgabe: "<<previousCheckpoint->getVirtualNextCheckpointsAsVector3().x<<previousCheckpoint->getVirtualNextCheckpointsAsVector3().y<<previousCheckpoint->getVirtualNextCheckpointsAsVector3().z<<endl;
+ //OrxAssert(virtualCheckPointIndex < -1, "TO much virtual cp");
+ /*orxout()<<"id: "<< previousCheckpoint->getCheckpointIndex() <<", following:"<<indexFollowingCheckPoint<<" : "<<temp.x<<", "<<temp.y<<", "<<temp.z<<"; ";
+ temp=previousCheckpoint->getNextCheckpointsAsVector3();
+ orxout()<<"id: "<< previousCheckpoint->getCheckpointIndex() <<": "<<temp.x<<", "<<temp.y<<", "<<temp.z<<"; ";
+ orxout()<<endl;*//*
+ return newTempRaceCheckPoint;
+ }*/
+
+ SpaceRaceController::~SpaceRaceController()
+ {
+ for (int i =-1; i>virtualCheckPointIndex; i--)
+ {
+ delete findCheckpoint(i);
+ }
+ }
+
+ void SpaceRaceController::tick(float dt)
+ {
+ if (this->getControllableEntity() == NULL || this->getControllableEntity()->getPlayer() == NULL )
+ {
+ //orxout()<< this->getControllableEntity() << " in tick"<<endl;
+ return;
+ }
+ //FOR virtual Checkpoints
+ if(nextRaceCheckpoint_->getCheckpointIndex() < 0)
+ {
+ if( distanceSpaceshipToCheckPoint(nextRaceCheckpoint_) < 200)
+ {
+ currentRaceCheckpoint_=nextRaceCheckpoint_;
+ nextRaceCheckpoint_ = nextPointFind(nextRaceCheckpoint_);
+ lastPositionSpaceship=this->getControllableEntity()->getPosition();
+ //orxout()<< "CP "<< currentRaceCheckpoint_->getCheckpointIndex()<<" chanched to: "<< nextRaceCheckpoint_->getCheckpointIndex()<<endl;
+ }
+ }
+
+ if (nextRaceCheckpoint_->playerWasHere(this->getControllableEntity()->getPlayer()))
+ {//Checkpoint erreicht
+
+ currentRaceCheckpoint_ = nextRaceCheckpoint_;
+ OrxAssert(nextRaceCheckpoint_, "next race checkpoint undefined");
+ nextRaceCheckpoint_ = nextPointFind(nextRaceCheckpoint_);
+ lastPositionSpaceship = this->getControllableEntity()->getPosition();
+ //orxout()<< "CP "<< currentRaceCheckpoint_->getCheckpointIndex()<<" chanched to: "<< nextRaceCheckpoint_->getCheckpointIndex()<<endl;
+ }
+ else if ((lastPositionSpaceship-this->getControllableEntity()->getPosition()).length()/dt > ADJUSTDISTANCE)
+ {
+ nextRaceCheckpoint_ = adjustNextPoint();
+ lastPositionSpaceship = this->getControllableEntity()->getPosition();
+ }
+
+ // Abmessung fuer MINDISTANCE gut;
+
+ else if((lastPositionSpaceship - this->getControllableEntity()->getPosition()).length()/dt < MINDISTANCE )
+ {
+ this->moveToPosition(Vector3(rnd()*100, rnd()*100, rnd()*100));
+ this->spin();
+ //orxout(user_status) << "Mindistance reached" << std::endl;
+ return;
+ }
+ //orxout(user_status) << "dt= " << dt << "; distance= " << (lastPositionSpaceship-this->getControllableEntity()->getPosition()).length() <<std::endl;
+ lastPositionSpaceship = this->getControllableEntity()->getPosition();
+ this->moveToPosition(nextRaceCheckpoint_->getPosition());
+ }
+
+ // True if a coordinate of 'pointToPoint' is smaller then the corresponding coordinate of 'groesse'
+ bool SpaceRaceController::vergleicheQuader(Vector3 pointToPoint, Vector3 groesse)
+ {
+ if(abs(pointToPoint.x) < groesse.x)
+ return true;
+ if(abs(pointToPoint.y) < groesse.y)
+ return true;
+ if(abs(pointToPoint.z) < groesse.z)
+ return true;
+ return false;
+
+ }
+
+ bool SpaceRaceController::directLinePossible(RaceCheckPoint* racepoint1, RaceCheckPoint* racepoint2,std::vector<StaticEntity*> allObjects)
+ {
+
+ Vector3 cP1ToCP2 = (racepoint2->getPosition() - racepoint1->getPosition()) / (racepoint2->getPosition() - racepoint1->getPosition()).length(); //unit Vector
+ Vector3 centerCP1 = racepoint1->getPosition();
+ btVector3 positionObject;
+ btScalar radiusObject;
+
+ for (std::vector<StaticEntity*>::iterator it = allObjects.begin(); it != allObjects.end(); ++it)
+ {
+ for (int everyShape=0; (*it)->getAttachedCollisionShape(everyShape) != 0; everyShape++)
+ {
+ btCollisionShape* currentShape = (*it)->getAttachedCollisionShape(everyShape)->getCollisionShape();
+ if(currentShape == NULL)
+ continue;
+
+ currentShape->getBoundingSphere(positionObject,radiusObject);
+ Vector3 positionObjectNonBT(positionObject.x(), positionObject.y(), positionObject.z());
+ if((powf((cP1ToCP2.dotProduct(centerCP1-positionObjectNonBT)),2)-(centerCP1-positionObjectNonBT).dotProduct(centerCP1-positionObjectNonBT)+powf(radiusObject, 2))>0)
+ {
+ return false;
+ }
+
+ }
+ }
+ return true;
+
+ }
+
+ /*void SpaceRaceController::computeVirtualCheckpoint(RaceCheckPoint* racepoint1, RaceCheckPoint* racepoint2, std::vector<StaticEntity*> allObjects)
+ {
+ Vector3 cP1ToCP2=(racepoint2->getPosition()-racepoint1->getPosition()) / (racepoint2->getPosition()-racepoint1->getPosition()).length(); //unit Vector
+ Vector3 centerCP1=racepoint1->getPosition();
+ btVector3 positionObject;
+ btScalar radiusObject;
+
+ for (std::vector<StaticEntity*>::iterator it = allObjects.begin(); it != allObjects.end(); ++it)
+ {
+ for (int everyShape=0; (*it)->getAttachedCollisionShape(everyShape) != 0; everyShape++)
+ {
+ btCollisionShape* currentShape = (*it)->getAttachedCollisionShape(everyShape)->getCollisionShape();
+ if(currentShape == NULL)
+ continue;
+
+ currentShape->getBoundingSphere(positionObject,radiusObject);
+ Vector3 positionObjectNonBT(positionObject.x(), positionObject.y(), positionObject.z());
+ Vector3 norm_r_CP = cP1ToCP2.crossProduct(centerCP1-positionObjectNonBT);
+
+ if(norm_r_CP.length() == 0){
+ Vector3 zufall;
+ do{
+ zufall=Vector3(rnd(),rnd(),rnd());//random
+ }while((zufall.crossProduct(cP1ToCP2)).length() == 0);
+ norm_r_CP=zufall.crossProduct(cP1ToCP2);
+ }
+ Vector3 VecToVCP = norm_r_CP.crossProduct(cP1ToCP2);
+ float distanzToCP1 = sqrt(powf(radiusObject,4)/(powf((centerCP1-positionObjectNonBT).length(), 2)-powf(radiusObject,2))+powf(radiusObject,2));
+ float distanzToCP2 = sqrt(powf(radiusObject,4)/(powf((racepoint2->getPosition()-positionObjectNonBT).length(), 2)-powf(radiusObject,2))+powf(radiusObject,2));
+ float distanz = std::max(distanzToCP1,distanzToCP2);
+ //float distanz = 0.0f; //TEMPORARY
+ Vector3 newCheckpointPositionPos = positionObjectNonBT+(distanz*VecToVCP)/VecToVCP.length();
+ Vector3 newCheckpointPositionNeg = positionObjectNonBT-(distanz*VecToVCP)/VecToVCP.length();
+ if((newCheckpointPositionPos - centerCP1).length() + (newCheckpointPositionPos - (centerCP1+cP1ToCP2)).length() < (newCheckpointPositionNeg - centerCP1).length() + (newCheckpointPositionNeg - (centerCP1+cP1ToCP2)).length() )
+ {
+ RaceCheckPoint* newVirtualCheckpoint = addVirtualCheckPoint(racepoint1,racepoint2->getCheckpointIndex(), newCheckpointPositionPos);
+ }
+ else
+ {
+ RaceCheckPoint* newVirtualCheckpoint = addVirtualCheckPoint(racepoint1,racepoint2->getCheckpointIndex(), newCheckpointPositionNeg);
+ }
+ return;
+ }
+ }
+
+ }*/
+
+ /*void SpaceRaceController::placeVirtualCheckpoints(RaceCheckPoint* racepoint1, RaceCheckPoint* racepoint2)
+ {
+ Vector3 point1 = racepoint1->getPosition();
+ Vector3 point2 = racepoint2->getPosition();
+ std::vector<StaticEntity*> problematicObjects;
+
+ for (ObjectList<StaticEntity>::iterator it = ObjectList<StaticEntity>::begin(); it!= ObjectList<StaticEntity>::end(); ++it)
+ {
+
+ if (dynamic_cast<RaceCheckPoint*>(*it) != NULL)
+ {
+ continue;
+ } // does not work jet
+
+ problematicObjects.insert(problematicObjects.end(), *it);
+ //it->getScale3D();// vector fuer halbe wuerfellaenge
+ }
+
+ if(!directLinePossible(racepoint1, racepoint2, problematicObjects))
+ {
+ //orxout()<<"From "<<racepoint1->getCheckpointIndex()<<" to "<<racepoint2->getCheckpointIndex()<<"produces: "<< virtualCheckPointIndex<<endl;
+ computeVirtualCheckpoint(racepoint1, racepoint2, problematicObjects);
+ }
+
+ //
+ // do{
+ // zufall=Vector3(rnd(),rnd(),rnd());//random
+ // }while((zufall.crossProduct(objectmiddle-racepoint1->getPosition())).length()==0);
+ //
+ // Vector3 normalvec=zufall.crossProduct(objectmiddle-racepoint1->getPosition());
+ // // a'/b'=a/b => a' =b'*a/b
+ // float laengeNormalvec=(objectmiddle-racepoint1->getPosition()).length()/sqrt((objectmiddle-racepoint1->getPosition()).squaredLength()-radius*radius)*radius;
+ // addVirtualCheckPoint(racepoint1,racepoint2->getCheckpointIndex(), objectmiddle+normalvec/normalvec.length()*laengeNormalvec);
+
+ // Vector3 richtungen [6];
+ // richtungen[0]= Vector3(1,0,0);
+ // richtungen[1]= Vector3(-1,0,0);
+ // richtungen[2]= Vector3(0,1,0);
+ // richtungen[3]= Vector3(0,-1,0);
+ // richtungen[4]= Vector3(0,0,1);
+ // richtungen[5]= Vector3(0,0,-1);
+ //
+ // for (int i = 0; i< 6; i++)
+ // {
+ // const int STEPS=100;
+ // const float PHI=1.1;
+ // bool collision=false;
+ //
+ // for (int j =0; j<STEPS; j++)
+ // {
+ // Vector3 tempPosition=(point1 - (point2-point1+richtungen[i]*PHI)*(float)j/STEPS);
+ // for (std::vector<StaticEntity*>::iterator it = problematicObjects.begin(); it!=problematicObjects.end(); ++it)
+ // {
+ // btVector3 positionObject;
+ // btScalar radiusObject;
+ // if((*it)==NULL)
+ // { orxout()<<"Problempoint 1.1"<<endl; continue;}
+ // //TODO: Probably it points on a wrong object
+ // for (int everyShape=0; (*it)->getAttachedCollisionShape(everyShape)!=0; everyShape++)
+ // {
+ // if((*it)->getAttachedCollisionShape(everyShape)->getCollisionShape()==NULL)
+ // { continue;}
+ //
+ // orxout()<<"Problempoint 2.1"<<endl;
+ // (*it)->getAttachedCollisionShape(everyShape)->getCollisionShape()->getBoundingSphere(positionObject,radiusObject);
+ // Vector3 positionObjectNonBT(positionObject.x(), positionObject.y(), positionObject.z());
+ // if (((tempPosition - positionObjectNonBT).length()<radiusObject) && (vergleicheQuader((tempPosition-positionObjectNonBT),(*it)->getScale3D())))
+ // {
+ // collision=true; break;
+ // }
+ // }
+ // if(collision) break;
+ // }
+ // if(collision)break;
+ // }
+ // if(collision) continue;
+ // // no collision => possible Way
+ // for (float j =0; j<STEPS; j++)
+ // {
+ // Vector3 possiblePosition=(point1 - (point2-point1+richtungen[i]*PHI)*j/STEPS);
+ // collision=false;
+ // for(int ij=0; ij<STEPS; j++)
+ // {
+ // Vector3 tempPosition=(possiblePosition - (point2-possiblePosition)*(float)ij/STEPS);
+ // for (std::vector<StaticEntity*>::iterator it = problematicObjects.begin(); it!=problematicObjects.end(); ++it)
+ // {
+ // btVector3 positionObject;
+ // btScalar radiusObject;
+ // if((*it)==NULL)
+ // { orxout()<<"Problempoint 1"<<endl; continue;}
+ // for (int everyShape=0; (*it)->getAttachedCollisionShape(everyShape)!=0; everyShape++)
+ // {
+ // if((*it)->getAttachedCollisionShape(everyShape)->getCollisionShape()==NULL)
+ // { orxout()<<"Problempoint 2.2"<<endl; continue;}
+ // (*it)->getAttachedCollisionShape(everyShape)->getCollisionShape()->getBoundingSphere(positionObject,radiusObject);
+ // Vector3 positionObjectNonBT(positionObject.x(), positionObject.y(), positionObject.z());
+ // if (((tempPosition-positionObjectNonBT).length()<radiusObject) && (vergleicheQuader((tempPosition-positionObjectNonBT),(*it)->getScale3D())))
+ // {
+ // collision=true; break;
+ // }
+ // }
+ // if(collision) break;
+ // }
+ // if(collision)break;
+ // //addVirtualCheckPoint(racepoint1, racepoint2->getCheckpointIndex(), possiblePosition);
+ // return;
+ // }
+ //
+ // }
+ // }
+
+ }*/
+}
Copied: code/branches/presentationHS12/src/modules/gametypes/SpaceRaceController.h (from rev 9513, code/branches/Racingbot/src/modules/gametypes/SpaceRaceController.h)
===================================================================
--- code/branches/presentationHS12/src/modules/gametypes/SpaceRaceController.h (rev 0)
+++ code/branches/presentationHS12/src/modules/gametypes/SpaceRaceController.h 2012-12-16 17:07:37 UTC (rev 9523)
@@ -0,0 +1,75 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *
+ * Created on: Oct 8, 2012
+ * Author: purgham
+ */
+
+#ifndef SPACERACECONTROLLER_H_
+#define SPACERACECONTROLLER_H_
+
+#include "gametypes/GametypesPrereqs.h"
+#include "controllers/ArtificialController.h"
+#include "gametypes/Gametype.h"
+#include "gametypes/RaceCheckPoint.h"
+#include "util/Math.h"
+
+namespace orxonox
+{
+ class _GametypesExport SpaceRaceController: public ArtificialController,
+ public Tickable
+ {
+ private:
+ std::vector<RaceCheckPoint*> staticRacePoints_;
+ RaceCheckPoint* nextRaceCheckpoint_; // checkpoint that should be reached
+ RaceCheckPoint* currentRaceCheckpoint_; // last checkPoint (already reached)
+ std::vector<RaceCheckPoint*> checkpoints_;
+ Vector3 lastPositionSpaceship;
+ int virtualCheckPointIndex;
+
+ int recCalculateDistance(RaceCheckPoint*, Vector3 currentPosition);
+ int distanceSpaceshipToCheckPoint(RaceCheckPoint*);
+ RaceCheckPoint* nextPointFind(RaceCheckPoint*);
+ RaceCheckPoint* adjustNextPoint();
+ std::vector<RaceCheckPoint*> findStaticCheckpoints(std::vector<
+ RaceCheckPoint*>);
+ std::vector<RaceCheckPoint*> staticCheckpoints();
+ int rekSimulationCheckpointsReached(RaceCheckPoint*, std::map<
+ RaceCheckPoint*, int>*);
+ // same as SpaceRaceManager, but needed to add virtuell Checkpoints ( Checkpoints which don't exist but needed to avoid collisions with big Objects)
+ RaceCheckPoint* findCheckpoint(int index) const;
+ //RaceCheckPoint * addVirtualCheckPoint(RaceCheckPoint*, int , Vector3);
+ //void placeVirtualCheckpoints(RaceCheckPoint*, RaceCheckPoint*);
+ bool vergleicheQuader(Vector3, Vector3);
+ bool directLinePossible(RaceCheckPoint*, RaceCheckPoint*, std::vector<StaticEntity*>);
+ //void computeVirtualCheckpoint(RaceCheckPoint*, RaceCheckPoint*, std::vector<StaticEntity*>);
+
+ public:
+ SpaceRaceController(BaseObject* creator);
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ virtual ~SpaceRaceController();
+ virtual void tick(float dt);
+ };
+
+}
+
+#endif /* SPACERACECONTROLLER_H_ */
Modified: code/branches/presentationHS12/src/modules/gametypes/SpaceRaceManager.cc
===================================================================
--- code/branches/presentationHS12/src/modules/gametypes/SpaceRaceManager.cc 2012-12-16 15:02:34 UTC (rev 9522)
+++ code/branches/presentationHS12/src/modules/gametypes/SpaceRaceManager.cc 2012-12-16 17:07:37 UTC (rev 9523)
@@ -37,47 +37,56 @@
#include "util/Convert.h"
#include "util/Math.h"
-
-
namespace orxonox
{
CreateFactory(SpaceRaceManager);
- SpaceRaceManager::SpaceRaceManager(BaseObject* creator) : BaseObject(creator)
+ SpaceRaceManager::SpaceRaceManager(BaseObject* creator) :
+ BaseObject(creator)
{
RegisterObject(SpaceRaceManager);
-
+ this->race_ = orxonox_cast<SpaceRace*>(this->getGametype().get());
+ assert(race_);
+ //amountOfPlayers=(race_->getPlayers()).size();
this->firstcheckpointvisible_ = false;
}
SpaceRaceManager::~SpaceRaceManager()
{
for (size_t i = 0; i < this->checkpoints_.size(); ++i)
- this->checkpoints_[i]->destroy();
+ this->checkpoints_[i]->destroy();
}
void SpaceRaceManager::XMLPort(Element& xmlelement, XMLPort::Mode mode)
{
SUPER(SpaceRaceManager, XMLPort, xmlelement, mode);
- XMLPortObject(SpaceRaceManager, RaceCheckPoint, "checkpoints", addCheckpoint, getCheckpoint, xmlelement, mode);
+ XMLPortObject(SpaceRaceManager, RaceCheckPoint, "checkpoints", addCheckpoint, getCheckpoint, xmlelement, mode);
}
void SpaceRaceManager::tick(float dt)
{
SUPER(SpaceRaceManager,tick,dt);
+ this->players_ = this->race_->getPlayers();
+
if (this->checkpoints_[0] != NULL && !this->firstcheckpointvisible_)
{
this->checkpoints_[0]->setRadarVisibility(true);
this->firstcheckpointvisible_ = true;
}
- for (size_t i = 0; i < this->checkpoints_.size(); ++i)
+ for ( std::map< PlayerInfo*, Player>::iterator it = players_.begin(); it != players_.end(); ++it)
{
- if (this->checkpoints_[i]->getPlayer() != NULL)
- this->checkpointReached(this->checkpoints_[i], this->checkpoints_[i]->getPlayer());
+
+ for (size_t i = 0; i < this->checkpoints_.size(); ++i)
+ {
+ if (this->checkpoints_[i]->playerWasHere(it->first)){
+ this->checkpointReached(this->checkpoints_[i], it->first /*this->checkpoints_[i]->getPlayer()*/);
+ }
+ }
}
+
}
void SpaceRaceManager::addCheckpoint(RaceCheckPoint* checkpoint)
@@ -88,31 +97,36 @@
RaceCheckPoint* SpaceRaceManager::getCheckpoint(unsigned int index) const
{
if (index < this->checkpoints_.size())
- return this->checkpoints_[index];
+ return this->checkpoints_[index];
else
- return 0;
+ return 0;
}
+ std::vector<RaceCheckPoint*> SpaceRaceManager::getAllCheckpoints()
+ {
+ return checkpoints_;
+ }
+
/**
- @brief Returns the checkpoint with the given checkpoint-index (@see RaceCheckPoint::getCheckpointIndex).
- */
+ @brief Returns the checkpoint with the given checkpoint-index (@see RaceCheckPoint::getCheckpointIndex).
+ */
RaceCheckPoint* SpaceRaceManager::findCheckpoint(int index) const
{
for (size_t i = 0; i < this->checkpoints_.size(); ++i)
- if (this->checkpoints_[i]->getCheckpointIndex() == index)
- return this->checkpoints_[i];
+ if (this->checkpoints_[i]->getCheckpointIndex() == index)
+ return this->checkpoints_[i];
return 0;
}
bool SpaceRaceManager::reachedValidCheckpoint(RaceCheckPoint* oldCheckpoint, RaceCheckPoint* newCheckpoint, PlayerInfo* player) const
{
- if (oldCheckpoint)
+ if (oldCheckpoint != NULL)
{
// the player already visited an old checkpoint; see which checkpoints are possible now
const std::set<int>& possibleCheckpoints = oldCheckpoint->getNextCheckpoints();
for (std::set<int>::const_iterator it = possibleCheckpoints.begin(); it != possibleCheckpoints.end(); ++it)
- if (this->findCheckpoint(*it) == newCheckpoint)
- return true;
+ if (this->findCheckpoint(*it) == newCheckpoint)
+ return true;
return false;
}
else
@@ -127,9 +141,9 @@
SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype().get());
assert(gametype);
if (!gametype)
- return;
+ return;
- RaceCheckPoint* oldCheckpoint = gametype->getCheckpointReached(player);
+ RaceCheckPoint* oldCheckpoint = gametype->getCheckpointReached(player); // returns the last from player reached checkpoint
if (this->reachedValidCheckpoint(oldCheckpoint, newCheckpoint, player))
{
@@ -151,11 +165,12 @@
{
// adjust the radarvisibility
gametype->newCheckpointReached(newCheckpoint, player);
- this->updateRadarVisibility(oldCheckpoint, newCheckpoint);
+ if(player->isHumanPlayer())
+ this->updateRadarVisibility(oldCheckpoint, newCheckpoint);
}
}
- newCheckpoint->resetPlayer();
+ // newCheckpoint->resetPlayer(); loescht playerpointer TODO: check if problems occur
}
void SpaceRaceManager::updateRadarVisibility(RaceCheckPoint* oldCheckpoint, RaceCheckPoint* newCheckpoint) const
@@ -164,7 +179,7 @@
{
const std::set<int>& oldVisible = oldCheckpoint->getNextCheckpoints();
for (std::set<int>::const_iterator it = oldVisible.begin(); it != oldVisible.end(); ++it)
- this->findCheckpoint(*it)->setRadarVisibility(false);
+ this->findCheckpoint(*it)->setRadarVisibility(false);
}
if (newCheckpoint)
@@ -173,7 +188,7 @@
const std::set<int>& newVisible = newCheckpoint->getNextCheckpoints();
for (std::set<int>::const_iterator it = newVisible.begin(); it != newVisible.end(); ++it)
- this->findCheckpoint(*it)->setRadarVisibility(true);
+ this->findCheckpoint(*it)->setRadarVisibility(true);
}
}
}
Modified: code/branches/presentationHS12/src/modules/gametypes/SpaceRaceManager.h
===================================================================
--- code/branches/presentationHS12/src/modules/gametypes/SpaceRaceManager.h 2012-12-16 15:02:34 UTC (rev 9522)
+++ code/branches/presentationHS12/src/modules/gametypes/SpaceRaceManager.h 2012-12-16 17:07:37 UTC (rev 9523)
@@ -66,6 +66,8 @@
void checkpointReached(RaceCheckPoint* newCheckpoint, PlayerInfo* player);
+ std::vector<RaceCheckPoint*> getAllCheckpoints();
+
void tick(float dt);
protected:
@@ -75,6 +77,9 @@
private:
std::vector<RaceCheckPoint*> checkpoints_;
bool firstcheckpointvisible_; ///< true if the first check point is visible.
+ SpaceRace* race_; // needed to get the players
+ //int amountOfPlayers;
+ std::map<PlayerInfo*, Player> players_;
};
}
More information about the Orxonox-commit
mailing list