= ADM - Automatic Defense Machanism =
[[ArchivePage]]
== Author ==
[wiki:RetoLüchinger Reto Lüchinger]
== Description ==
||The goal of the ADM is, to have an fix located enemy for the player. I want to implement an anti-personal Defense Mechanism, meaning a turret (Ticket 212) which will shoot at the player. [[br]] [[br]] * [https://dev.orxonox.net/ticket/210 Ticket #210] [[br]] * [https://forum.orxonox.net/viewtopic.php?p=853#853 Developers Journal] [[br]] [[br]] * [https://dev.orxonox.net/ticket/212 Ticket #212: Sebastians Turret], detailed: [wiki:Turret Turret] [[br]] * [https://dev.orxonox.net/ticket/216 Ticket #216: Michis Moonstation], detailed: [wiki:MoonStation Moonstation] || || [[Image(turret.JPG)]] ||
----
== Progress ==
|| '''Deadline''' || '''Description''' || '''More''' || '''Progress''' ||
|| Do, 26. April || Ideas, plans and understanding || [wiki:archive/ADM#ideas more] || https://dev.orxonox.net/attachment/wiki/SpaceStationInterior/100percent.gif?format=raw ||
|| Do, 03. Mai || UML and Understanding || [wiki:archive/ADM#UML UML] || https://dev.orxonox.net/attachment/wiki/SpaceStationInterior/100percent.gif?format=raw ||
|| Do, 07. June || Coding || [wiki:archive/ADM#CODING CODING] || https://dev.orxonox.net/attachment/wiki/SpaceStationInterior/100percent.gif?format=raw ||
[[br]]
[[br]]
{{{
#!html
}}}
=== Ideas and plans ===
* The first idea of the functionality of the turret. It is activated by a space trigger, when the player approaches, but still is out of sight. I`m not sure yet, on how the turret should behave, when activated, but not yet has vision of the player. We were thinking of a vision cone, and a left-right scanning of the surveyed area. When the "enemy" (you, player) is located, it will aim at you and start to shoot (not yet sure about the conditions (how close aimed to the target, reload?)). When loosing sight, it will turn back to active mode, when destroyed, will be inactivated, whitout beeing able to be triggered again.
{{{
#!html
}}}
=== UML ===
[[Image(ADM01.jpeg)]]
[[br]]
[[br]]
{{{
#!html
}}}
=== CODING ===
The code can be found found under [https://dev.orxonox.net/browser/trunk/src/world_entities/npcs root/trunk/src/world_entities/npcs]. Furthermore, there had to be made an extra class called bsp_weapon {cc, h}, which are found under World_entities/weapons/.
Explanations to the code:
- Since we've experienced troubles with the turret turning left/right and up/down simultaniously, we had to adjust this function, so that the turret can only be placed vertically. This has to be declared in the XML file with the setting (type), which can be `floor` or `ceil`. In the XML file, there must also be the coordinates of the turret, the target, and specifications for the weapon.
- It is suggested to just copy/paste the relative coordinates and the models, if the turret is not scaled. Otherwise the relative coordinates and the AddPoint-Values (needed for the "MuzzleFlash") must be adjusted by the scale factor in the XMLfile. The Weapon (Bsp_Weapon) has the values "Range" (if within, the Player is "seen"), "SetDamage" (Life Energy that is taken from Target, if hit), "FireRate" (persec) and a value "AlwaysHit". If "AlwaysHit" is set false, the turret "misses" the target with a probability depending on range and distance between Turret and Target (probability: p[d=range] = 0, p[d=0] = 1).