Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

ADM - Automatic Defense Machanism

This is an archived page!
This page is very old and the content is not up to date.
Not everything (if any) which is written here will be in the final game!

Author

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.

* Ticket #210
* Developers Journal

* Ticket #212: Sebastians Turret, detailed: Turret
* Ticket #216: Michis Moonstation, detailed: Moonstation

Progress

Deadline Description More Progress
Do, 26. April Ideas, plans and understanding more
Do, 03. Mai UML and Understanding UML
Do, 07. June Coding CODING



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.

UML



CODING

The code can be found found under 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).
Last modified 8 years ago Last modified on Apr 15, 2017, 3:28:45 PM

Attachments (2)

Download all attachments as: .zip