[Orxonox-commit 6317] r10974 - in code/branches/presentationHS15: . data/levels src/orxonox/controllers
maxima at orxonox.net
maxima at orxonox.net
Mon Dec 14 11:31:31 CET 2015
Author: maxima
Date: 2015-12-14 11:31:30 +0100 (Mon, 14 Dec 2015)
New Revision: 10974
Modified:
code/branches/presentationHS15/
code/branches/presentationHS15/data/levels/AITest.oxw
code/branches/presentationHS15/src/orxonox/controllers/ActionpointController.cc
code/branches/presentationHS15/src/orxonox/controllers/ActionpointController.h
code/branches/presentationHS15/src/orxonox/controllers/CommonController.cc
code/branches/presentationHS15/src/orxonox/controllers/CommonController.h
code/branches/presentationHS15/src/orxonox/controllers/DivisionController.cc
code/branches/presentationHS15/src/orxonox/controllers/DivisionController.h
code/branches/presentationHS15/src/orxonox/controllers/FightingController.cc
code/branches/presentationHS15/src/orxonox/controllers/MasterController.cc
code/branches/presentationHS15/src/orxonox/controllers/SectionController.cc
code/branches/presentationHS15/src/orxonox/controllers/SectionController.h
code/branches/presentationHS15/src/orxonox/controllers/WingmanController.cc
code/branches/presentationHS15/src/orxonox/controllers/WingmanController.h
Log:
merged campaign and presentation
Property changes on: code/branches/presentationHS15
___________________________________________________________________
Modified: svn:mergeinfo
- /code/branches/AI_HS15:10640-10832
/code/branches/ParticleEffectsFS15:10309-10612
/code/branches/Racingbot:9388-9513
/code/branches/SciptableControllerFS15:10308-10613
/code/branches/ScriptableController:9999-10075
/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/campaignHS15:10639-10967
/code/branches/ceguilua:1802-1808
/code/branches/chat:6527-6797
/code/branches/chat2:6836-6910
/code/branches/clangenb:10385-10609
/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/core6:9552-9666
/code/branches/core7:10328-10623
/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/explosionChunksHS15:10641-10961
/code/branches/fabienHS15:10685-10960
/code/branches/formation:8885-8991
/code/branches/formationFS15:10320-10610
/code/branches/formationupdate:9580-9624
/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/hoverHS15:10633-10959
/code/branches/hud:8883-8986
/code/branches/hudHS14:10083-10241
/code/branches/hudelements:6584-6941
/code/branches/hudimprovements:7920-8672
/code/branches/ingamemenu:6000-6023
/code/branches/input:1629-1636
/code/branches/invaders:9694-9896
/code/branches/ipv6:7293-7458
/code/branches/keckslevelHS14:10082-10222
/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/levelElias:9697-9921
/code/branches/levelKaan:9695-9921
/code/branches/levelMichael:9696-9921
/code/branches/leveljoemeHS14:10087-10223
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/libs:9668-9674
/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/minigame4DHS14:10081-10230
/code/branches/miniprojects:2754-2824
/code/branches/modularships:9994-10071
/code/branches/multiplayerFS15:10324-10611
/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/particleEffectsHS15:10644-10962
/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/pickupsFS14:10000-10259
/code/branches/planetLevelHS15:10637-10966
/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/presentationFS14:10069-10215
/code/branches/presentationFS15:10499
/code/branches/presentationFS15merge:10595-10621
/code/branches/presentationHS12:9481-9525
/code/branches/presentationHS13:9891-9938
/code/branches/presentationHS14merge:10222-10257
/code/branches/questsystem:1894-2088
/code/branches/questsystem2:2107-2259
/code/branches/questsystem5:2776-2905
/code/branches/radarDreiD:9690-9901
/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/sfxThilo:9691-9917
/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/spacestationentry:9699-9905
/code/branches/steering:5949-6091,8140-8595
/code/branches/storymodeHS14:10085-10254
/code/branches/surfaceRace:9028-9199
/code/branches/surfaceraceHS14:10080-10236
/code/branches/testing:9015-9549
/code/branches/tetris:8100-8563
/code/branches/towerdefenseFS15:10283-10614
/code/branches/towerdefenseHS14:10086-10247
/code/branches/turret:9380-9501
/code/branches/turretFS14:9998-10070
/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/weaponFS15:10302-10615
/code/branches/weapons:2897-3051,8143-8591
/code/branches/weaponsystem:2742-2890
/code/branches/weaponupdateHS14:10084-10237
+ /code/branches/AI_HS15:10640-10832
/code/branches/ParticleEffectsFS15:10309-10612
/code/branches/Racingbot:9388-9513
/code/branches/SciptableControllerFS15:10308-10613
/code/branches/ScriptableController:9999-10075
/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/campaignHS15:10639-10973
/code/branches/ceguilua:1802-1808
/code/branches/chat:6527-6797
/code/branches/chat2:6836-6910
/code/branches/clangenb:10385-10609
/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/core6:9552-9666
/code/branches/core7:10328-10623
/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/explosionChunksHS15:10641-10961
/code/branches/fabienHS15:10685-10960
/code/branches/formation:8885-8991
/code/branches/formationFS15:10320-10610
/code/branches/formationupdate:9580-9624
/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/hoverHS15:10633-10959
/code/branches/hud:8883-8986
/code/branches/hudHS14:10083-10241
/code/branches/hudelements:6584-6941
/code/branches/hudimprovements:7920-8672
/code/branches/ingamemenu:6000-6023
/code/branches/input:1629-1636
/code/branches/invaders:9694-9896
/code/branches/ipv6:7293-7458
/code/branches/keckslevelHS14:10082-10222
/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/levelElias:9697-9921
/code/branches/levelKaan:9695-9921
/code/branches/levelMichael:9696-9921
/code/branches/leveljoemeHS14:10087-10223
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/libs:9668-9674
/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/minigame4DHS14:10081-10230
/code/branches/miniprojects:2754-2824
/code/branches/modularships:9994-10071
/code/branches/multiplayerFS15:10324-10611
/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/particleEffectsHS15:10644-10962
/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/pickupsFS14:10000-10259
/code/branches/planetLevelHS15:10637-10966
/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/presentationFS14:10069-10215
/code/branches/presentationFS15:10499
/code/branches/presentationFS15merge:10595-10621
/code/branches/presentationHS12:9481-9525
/code/branches/presentationHS13:9891-9938
/code/branches/presentationHS14merge:10222-10257
/code/branches/questsystem:1894-2088
/code/branches/questsystem2:2107-2259
/code/branches/questsystem5:2776-2905
/code/branches/radarDreiD:9690-9901
/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/sfxThilo:9691-9917
/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/spacestationentry:9699-9905
/code/branches/steering:5949-6091,8140-8595
/code/branches/storymodeHS14:10085-10254
/code/branches/surfaceRace:9028-9199
/code/branches/surfaceraceHS14:10080-10236
/code/branches/testing:9015-9549
/code/branches/tetris:8100-8563
/code/branches/towerdefenseFS15:10283-10614
/code/branches/towerdefenseHS14:10086-10247
/code/branches/turret:9380-9501
/code/branches/turretFS14:9998-10070
/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/weaponFS15:10302-10615
/code/branches/weapons:2897-3051,8143-8591
/code/branches/weaponsystem:2742-2890
/code/branches/weaponupdateHS14:10084-10237
Modified: code/branches/presentationHS15/data/levels/AITest.oxw
===================================================================
--- code/branches/presentationHS15/data/levels/AITest.oxw 2015-12-14 10:24:35 UTC (rev 10973)
+++ code/branches/presentationHS15/data/levels/AITest.oxw 2015-12-14 10:31:30 UTC (rev 10974)
@@ -161,7 +161,7 @@
<!-- HERE ENDS DEMO FOR THE ACTIONPOINTS -->
<!-- HERE STARTS DEMO FOR FIGHTING -->
- <!--
+
<SpaceShip position="-4000, 1500, -1000" lookat="0,0,0" team=0 name="d1sd1">
<templates>
@@ -237,11 +237,11 @@
<WingmanController team=1>
</WingmanController>
</controller>
- </SpaceShip> -->
+ </SpaceShip>
<!-- HERE ENDS DEMO FOR FIGHTING -->
<!-- HERE STARTS DEMO FOR FORMATIONS -->
-
+ <!--
<Model mesh="cube.mesh" scale=8 position=" 0,2000, 0" />
<Model mesh="cube.mesh" scale=8 position=" 0,2000,-2000" />
<Model mesh="cube.mesh" scale=8 position="2000,2000,-2000" />
@@ -290,7 +290,7 @@
</WingmanController>
</controller>
</SpaceShip>
-
+ -->
<!-- HERE ENDS DEMO FOR FORMATIONS -->
<!-- 1 division is roughly equal to 6 AIControllers--!>
<!--
Modified: code/branches/presentationHS15/src/orxonox/controllers/ActionpointController.cc
===================================================================
--- code/branches/presentationHS15/src/orxonox/controllers/ActionpointController.cc 2015-12-14 10:24:35 UTC (rev 10973)
+++ code/branches/presentationHS15/src/orxonox/controllers/ActionpointController.cc 2015-12-14 10:31:30 UTC (rev 10974)
@@ -52,7 +52,6 @@
this->bStartedDodging_ = false;
this->bDefaultPatrol_ = true;
this->bDefaultFightAll_ = true;
- this->stop_ = false;
RegisterObject(ActionpointController);
}
@@ -74,7 +73,7 @@
}
void ActionpointController::tick(float dt)
{
- if (!this || !this->getControllableEntity() || !this->isActive() || this->stop_)
+ if (!this || !this->getControllableEntity() || !this->isActive())
return;
//count ticks, ticks_ is unsigned, so overflow is not a problem
@@ -732,35 +731,31 @@
{
if (!this || !this->getControllableEntity())
return;
-
- //if (this->action_ != Action::FIGHT && this->action_ != Action::FIGHTALL)
+
+ if (!this->target_ || (this->target_ && CommonController::distance (this->getControllableEntity(), this->target_) > this->attackRange_))
{
- if (!this->target_ || (this->target_ && CommonController::distance (this->getControllableEntity(), this->target_) > this->attackRange_))
+ if (!this || !this->getControllableEntity())
+ return;
+ Pawn* newTarget = this->closestTarget();
+ if ( newTarget &&
+ CommonController::distance (this->getControllableEntity(), static_cast<ControllableEntity*>(newTarget))
+ <= this->attackRange_ )
{
if (!this || !this->getControllableEntity())
return;
- Pawn* newTarget = this->closestTarget();
- if ( newTarget &&
- CommonController::distance (this->getControllableEntity(), static_cast<ControllableEntity*>(newTarget))
- <= this->attackRange_ )
+ this->setTarget(newTarget);
+ if (this->bLoop_ && !this->bPatrolling_)
{
- if (!this || !this->getControllableEntity())
- return;
- this->setTarget(newTarget);
- if (this->bLoop_ && !this->bPatrolling_)
- {
- Point p = { Action::FIGHT, "", Vector3::ZERO, true };
- this->loopActionpoints_.push_back(p);
- }
- else if (!this->bPatrolling_)
- {
- //orxout (internal_error) << "found new target " << CommonController::getName(newTarget) <<endl;
- Point p = { Action::FIGHT, "", Vector3::ZERO, false };
- this->parsedActionpoints_.push_back(p);
- }
- this->bPatrolling_ = true;
- this->executeActionpoint();
+ Point p = { Action::FIGHT, "", Vector3::ZERO, true };
+ this->loopActionpoints_.push_back(p);
}
+ else if (!this->bPatrolling_)
+ {
+ Point p = { Action::FIGHT, "", Vector3::ZERO, false };
+ this->parsedActionpoints_.push_back(p);
+ }
+ this->bPatrolling_ = true;
+ this->executeActionpoint();
}
}
}
Modified: code/branches/presentationHS15/src/orxonox/controllers/ActionpointController.h
===================================================================
--- code/branches/presentationHS15/src/orxonox/controllers/ActionpointController.h 2015-12-14 10:24:35 UTC (rev 10973)
+++ code/branches/presentationHS15/src/orxonox/controllers/ActionpointController.h 2015-12-14 10:31:30 UTC (rev 10974)
@@ -62,6 +62,7 @@
being stored in an array of type Point::Value.
@note
ActionpointController will not work, if there is no MasterController in the level!
+ All the demos are in a file called AITest.oxw. In the menu look for New AI Testing Level.
*/
namespace Action
{
@@ -215,9 +216,9 @@
float squaredaccuracy_;
std::vector<Point > parsedActionpoints_;//<! actionpoints as they are stored here after being parsed from XML
std::vector<Point > loopActionpoints_; //<! actionpoints that are to be looped
- bool bInLoop_;
+ bool bInLoop_; //<! variable for addActionpoint method
bool bLoop_; //<! is state machine looping?
- bool bEndLoop_;
+ bool bEndLoop_; //<! variable for addActionpoint method
bool bTakenOver_; //<! are actionpoints taken over from the leader when he died? if yes, top actionpoint
//<! is to be executed for the state machine to start working
//----[/Actionpoint information]----
@@ -249,13 +250,11 @@
void nextActionpoint();
//----[Actionpoint methods]----
- bool bDefaultFightAll_;
+ bool bDefaultFightAll_; //<! if true, when no action set, this will fight all
- bool bPatrolling_;
- bool bDefaultPatrol_;
- bool stop_;
+ bool bPatrolling_; //<! true if current action_ is FIGHT because this found enemies that are close, need this to correctly go back to looping if was looping
+ bool bDefaultPatrol_; //<! if true, this will look out for enemies that are close if this is just flying or doing nothing
unsigned int ticks_; //<! local tick counter
-
};
}
Modified: code/branches/presentationHS15/src/orxonox/controllers/CommonController.cc
===================================================================
--- code/branches/presentationHS15/src/orxonox/controllers/CommonController.cc 2015-12-14 10:24:35 UTC (rev 10973)
+++ code/branches/presentationHS15/src/orxonox/controllers/CommonController.cc 2015-12-14 10:31:30 UTC (rev 10974)
@@ -22,7 +22,7 @@
* Author:
* Gani Aliguzhinov
* Co-authors:
- * Dominik Solenicki
+ * ...
*
*/
#include "controllers/CommonController.h"
@@ -72,10 +72,7 @@
*/
bool CommonController::sameTeam (ControllableEntity* entity1, ControllableEntity* entity2, Gametype* gametype)
{
- //uncomment following code if functions stops working due to being a hack
- /*if (!entity1 || !entity2)
- return false;
- return entity1->getTeam() == entity2->getTeam();*/
+
if (!entity1 || !entity2)
return false;
if (entity1 == entity2)
Modified: code/branches/presentationHS15/src/orxonox/controllers/CommonController.h
===================================================================
--- code/branches/presentationHS15/src/orxonox/controllers/CommonController.h 2015-12-14 10:24:35 UTC (rev 10973)
+++ code/branches/presentationHS15/src/orxonox/controllers/CommonController.h 2015-12-14 10:31:30 UTC (rev 10974)
@@ -22,7 +22,7 @@
* Author:
* Gani Aliguzhinov
* Co-authors:
- * Dominik Solenicki
+ * ...
*
*/
@@ -48,11 +48,11 @@
CommonController(Context* context);
virtual ~CommonController();
- static float randomInRange(float a, float b);
- static float distance(const ControllableEntity* entity1, const ControllableEntity* entity2);
+ static float randomInRange(float a, float b); //<! returns random number from a to b
+ static float distance(const ControllableEntity* entity1, const ControllableEntity* entity2); //<! returns distance between arguments
static bool sameTeam (ControllableEntity* entity1, ControllableEntity* entity2, Gametype* gt);
- static bool isLooking(const ControllableEntity* entityThatLooks, const ControllableEntity* entityBeingLookedAt, float angle ) ;
- static std::string getName(const Pawn* entity ) ;
+ static bool isLooking(const ControllableEntity* entityThatLooks, const ControllableEntity* entityBeingLookedAt, float angle) ;
+ static std::string getName(const Pawn* entity) ;
};
}
Modified: code/branches/presentationHS15/src/orxonox/controllers/DivisionController.cc
===================================================================
--- code/branches/presentationHS15/src/orxonox/controllers/DivisionController.cc 2015-12-14 10:24:35 UTC (rev 10973)
+++ code/branches/presentationHS15/src/orxonox/controllers/DivisionController.cc 2015-12-14 10:31:30 UTC (rev 10974)
@@ -78,6 +78,7 @@
return;
if (!(this->parsedActionpoints_.empty() && this->loopActionpoints_.empty()))
{
+ //when this dies, its follower will execute all its actionpoints, if follower dies before this, wingman will do this
if (this->myFollower_)
{
this->myFollower_->takeActionpoints(this->parsedActionpoints_, this->loopActionpoints_, this->bLoop_);
Modified: code/branches/presentationHS15/src/orxonox/controllers/DivisionController.h
===================================================================
--- code/branches/presentationHS15/src/orxonox/controllers/DivisionController.h 2015-12-14 10:24:35 UTC (rev 10973)
+++ code/branches/presentationHS15/src/orxonox/controllers/DivisionController.h 2015-12-14 10:31:30 UTC (rev 10974)
@@ -38,6 +38,7 @@
/**
@note
ActionpointController will not work, if there is no MasterController in the level!
+ All the demos are in a file called AITest.oxw. In the menu look for New AI Testing Level.
*/
class _OrxonoxExport DivisionController : public ActionpointController
{
Modified: code/branches/presentationHS15/src/orxonox/controllers/FightingController.cc
===================================================================
--- code/branches/presentationHS15/src/orxonox/controllers/FightingController.cc 2015-12-14 10:24:35 UTC (rev 10973)
+++ code/branches/presentationHS15/src/orxonox/controllers/FightingController.cc 2015-12-14 10:31:30 UTC (rev 10974)
@@ -150,7 +150,6 @@
return;
if (!this->bDodge_)
{
- // orxout(internal_error) << "attacking" << endl;
this->bStartedDodging_ = false;
this->setTargetPosition(this->positionOfTarget_ - diffUnit * 50.0f);
@@ -158,7 +157,6 @@
}
else if (bTargetIsLookingAtThis || diffLength < 700.0f)
{
- // orxout(internal_error) << "dodging" << endl;
if (!this->bStartedDodging_)
{
this->bStartedDodging_ = true;
@@ -169,14 +167,12 @@
{
if (diffLength < 1000)
{
- // orxout(internal_error) << "looking" << endl;
this->stopMoving();
this->startLookingAtTarget();
}
else
{
- // orxout(internal_error) << "closing up" << endl;
this->setTargetPosition(this->positionOfTarget_ - diffUnit * 300.0f);
}
}
@@ -353,14 +349,13 @@
// SubclassIdentifier<Munition> munition = ClassByString(wName);
if (wName == "RocketFire")
this->rocketsLeft_ = 10;
- // this->rocketsLeft_ = orxonox_cast<Pawn*>(this->getControllableEntity())->getWeaponSystem()->getMunition(&munition)->getNumMunitionInCurrentMagazine(wMode);
if(this->getFiremode(wName) == -1) //only add a weapon, if it is "new"
weaponModes_[wName] = wMode->getMode();
}
}
if(weaponModes_.size())//at least one weapon detected
this->bSetupWorked = true;
- }//pawn->weaponSystem_->getMunition(SubclassIdentifier< Munition > *identifier)->getNumMunition (WeaponMode *user);
+ }
}
}
Modified: code/branches/presentationHS15/src/orxonox/controllers/MasterController.cc
===================================================================
--- code/branches/presentationHS15/src/orxonox/controllers/MasterController.cc 2015-12-14 10:24:35 UTC (rev 10973)
+++ code/branches/presentationHS15/src/orxonox/controllers/MasterController.cc 2015-12-14 10:31:30 UTC (rev 10974)
@@ -37,8 +37,6 @@
MasterController::MasterController(Context* context) : Controller(context)
{
RegisterObject(MasterController);
- // orxout(internal_error) << "MasterController was created" << endl;
-
this->controllers_.clear();
this->numberOfTicksPassedSinceLastActionCall_ = 0;
this->indexOfCurrentController_ = 0;
@@ -49,12 +47,13 @@
{
this->controllers_.clear();
}
+ /*HACK*/
+ //the whole idea is a hack
void MasterController::tick(float dt)
{
if (!this->isActive())
return;
++this->ticks_;
- //orxout(internal_error) << "Tick = " << this->ticks_ << endl;
if (this->ticks_ == 1)
{
//fill the vector in the first tick
@@ -65,11 +64,9 @@
continue;
this->controllers_.push_back(*it);
}
- //orxout(internal_error) << "I got " << this->controllers_.size() << " controllers" << endl;
}
else
{
-
if (this->controllers_.empty())
return;
@@ -86,40 +83,41 @@
if (this->numberOfTicksPassedSinceLastActionCall_ > 0)
{
- //call maneuver for current index
if (this->numberOfTicksPassedSinceLastActionCall_ == 3)
{
+ //check if 0ptr
if (!this->controllers_.at(this->indexOfCurrentController_))
{
this->controllers_.erase(this->controllers_.begin() + this->indexOfCurrentController_);
return;
}
- //orxout (internal_error) << "Executing maneuver of Controller # " << this->indexOfCurrentController_ << endl;
+ //call maneuver for current index
this->controllers_.at(this->indexOfCurrentController_)->maneuver();
}
else if (this->numberOfTicksPassedSinceLastActionCall_ == 6)
{
- //call canFire for current index
+ //check if 0ptr
if (!this->controllers_.at(this->indexOfCurrentController_))
{
this->controllers_.erase(this->controllers_.begin() + this->indexOfCurrentController_);
return;
}
- //orxout (internal_error) << "Executing maneuver of Controller # " << this->indexOfCurrentController_ << endl;
+ //call canFire for current index
this->controllers_.at(this->indexOfCurrentController_)->bShooting_ = this->controllers_.at(this->indexOfCurrentController_)->canFire();
}
++this->numberOfTicksPassedSinceLastActionCall_;
}
else
{
- //call action for current index
+ //check if 0ptr
if (!this->controllers_.at(this->indexOfCurrentController_))
{
this->controllers_.erase(this->controllers_.begin() + this->indexOfCurrentController_);
return;
}
- //orxout (internal_error) << "Executing action of Controller # " << this->indexOfCurrentController_ << endl;
- this->controllers_.at(this->indexOfCurrentController_)->action();
+ //call action for current index
+ this->controllers_.at(this->indexOfCurrentController_)->action();
+
//bCopyOrientation makes ship oscillate like crazy if set to true all the time.s
this->controllers_.at(this->indexOfCurrentController_)->bCopyOrientation_ = this->ticks_ % 3 == 0;
Modified: code/branches/presentationHS15/src/orxonox/controllers/SectionController.cc
===================================================================
--- code/branches/presentationHS15/src/orxonox/controllers/SectionController.cc 2015-12-14 10:24:35 UTC (rev 10973)
+++ code/branches/presentationHS15/src/orxonox/controllers/SectionController.cc 2015-12-14 10:31:30 UTC (rev 10974)
@@ -83,8 +83,6 @@
return;
this->myDivisionLeader_ = newDivisionLeader;
- //spread copyOrientation called equally among the division
-
}
//----If have leader----
else
@@ -110,8 +108,6 @@
|| this->myDivisionLeader_->getAction() == Action::ATTACK))
{
this->keepFormation();
- //orxout (internal_error) << "Keeping formation" << endl;
-
}
else if (!this->myDivisionLeader_->bKeepFormation_)
{
@@ -161,7 +157,6 @@
{
foundTarget = true;
target = (*itP);
- //orxout(internal_error) << "Found target" << endl;
break;
}
}
Modified: code/branches/presentationHS15/src/orxonox/controllers/SectionController.h
===================================================================
--- code/branches/presentationHS15/src/orxonox/controllers/SectionController.h 2015-12-14 10:24:35 UTC (rev 10973)
+++ code/branches/presentationHS15/src/orxonox/controllers/SectionController.h 2015-12-14 10:31:30 UTC (rev 10974)
@@ -37,6 +37,7 @@
/**
@note
ActionpointController will not work, if there is no MasterController in the level!
+ All the demos are in a file called AITest.oxw. In the menu look for New AI Testing Level.
*/
class _OrxonoxExport SectionController : public ActionpointController
{
@@ -65,7 +66,7 @@
protected:
//----action must only be managed by this----
- virtual void action(); //<! action() is called in regular intervals managing the bot's behaviour.
+ virtual void action(); //<! action() is called in regular intervals by MasterController managing the bot's behaviour.
Vector3 getFormationPosition ();
void keepFormation();
private:
Modified: code/branches/presentationHS15/src/orxonox/controllers/WingmanController.cc
===================================================================
--- code/branches/presentationHS15/src/orxonox/controllers/WingmanController.cc 2015-12-14 10:24:35 UTC (rev 10973)
+++ code/branches/presentationHS15/src/orxonox/controllers/WingmanController.cc 2015-12-14 10:31:30 UTC (rev 10974)
@@ -98,7 +98,8 @@
}
else if (this->myLeader_)
{
- if (this->myLeader_->bKeepFormation_ || !(this->myLeader_->getAction() == Action::FIGHT || this->myLeader_->getAction() == Action::FIGHTALL
+ if (this->myLeader_->bKeepFormation_ || !(this->myLeader_->getAction() == Action::FIGHT
+ || this->myLeader_->getAction() == Action::FIGHTALL
|| this->myLeader_->getAction() == Action::ATTACK))
{
this->keepFormation();
@@ -147,7 +148,6 @@
}
else
{
-
switch (this->formationMode_){
case FormationMode::WALL:
{
@@ -214,16 +214,10 @@
if (closestLeader)
{
//----Racing conditions----
+ /*TODO: racing condition check is wrong and redundant, as there is no multithreading here, ticks get called one after another,
+ so it can be simplified to a check of whether leader got a wingman*/
if (closestLeader->setWingman(orxonox_cast<ActionpointController*>(this)))
{
- if (closestLeader->getIdentifier()->getName() == "SectionController")
- {
- this->actionTime_ = 1.6f;
- }
- else
- {
- this->actionTime_ = 2.0f;
- }
return closestLeader;
}
}
Modified: code/branches/presentationHS15/src/orxonox/controllers/WingmanController.h
===================================================================
--- code/branches/presentationHS15/src/orxonox/controllers/WingmanController.h 2015-12-14 10:24:35 UTC (rev 10973)
+++ code/branches/presentationHS15/src/orxonox/controllers/WingmanController.h 2015-12-14 10:31:30 UTC (rev 10974)
@@ -38,6 +38,7 @@
/**
@note
ActionpointController will not work, if there is no MasterController in the level!
+ All the demos are in a file called AITest.oxw. In the menu look for New AI Testing Level.
*/
class _OrxonoxExport WingmanController : public ActionpointController
{
@@ -72,7 +73,6 @@
//----private variables-----
WeakPtr<ActionpointController> myLeader_;
bool bFirstAction_;
- float actionTime_;
};
More information about the Orxonox-commit
mailing list