• R/O
  • SSH

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javaandroidc++linuxc#objective-c誰得cocoaqtpythonrubywindowsphpgameguibathyscaphec翻訳omegat計画中(planning stage)frameworktwitterdombtronvb.nettestarduinodirectxpreviewerゲームエンジン

Commit MetaInfo

Revisão2493ad6671f932abe59433c678df0d633caa4876 (tree)
Hora2021-05-06 05:33:43
Autorsebastian_bugiu
Commitersebastian_bugiu

Mensagem de Log

Countermeasures animations are now decoupled from the actual time the projectiles are allowed to decide if to abandon chase. Projectiles now get destroyed when they reach level limits. Still working on AI changing directions when reaching level limits.

Mudança Sumário

Diff

diff -r 12d8b44236a9 -r 2493ad6671f9 core/src/headwayent/blackholedarksun/animations/CountermeasuresAnimation.java
--- a/core/src/headwayent/blackholedarksun/animations/CountermeasuresAnimation.java Tue May 04 21:39:48 2021 +0300
+++ b/core/src/headwayent/blackholedarksun/animations/CountermeasuresAnimation.java Wed May 05 23:33:43 2021 +0300
@@ -51,7 +51,7 @@
5151 @Override
5252 public void update() {
5353 // TODO Auto-generated method stub
54-
54+ super.update();
5555 if (!psCreated) {
5656 psCreated = true;
5757 ENG_SceneManager sceneManager = ENG_RenderRoot.getRenderRoot().getSceneManager(APP_Game.SCENE_MANAGER);
diff -r 12d8b44236a9 -r 2493ad6671f9 core/src/headwayent/blackholedarksun/animations/CountermeasuresWithoutRenderingAnimation.java
--- a/core/src/headwayent/blackholedarksun/animations/CountermeasuresWithoutRenderingAnimation.java Tue May 04 21:39:48 2021 +0300
+++ b/core/src/headwayent/blackholedarksun/animations/CountermeasuresWithoutRenderingAnimation.java Wed May 05 23:33:43 2021 +0300
@@ -2,19 +2,26 @@
22
33 import com.artemis.Entity;
44 import headwayent.blackholedarksun.Animation;
5+import headwayent.blackholedarksun.components.EntityProperties;
56 import headwayent.blackholedarksun.components.ShipProperties;
7+import headwayent.blackholedarksun.gamestatedebugger.FrameInterval;
68 import headwayent.blackholedarksun.world.WorldManagerBase;
9+import headwayent.hotshotengine.ENG_Utility;
710
811 /**
912 * Created by sebas on 19.11.2015.
1013 */
1114 public class CountermeasuresWithoutRenderingAnimation extends Animation {
1215 protected static final long TOTAL_ANIM_TIME = 10000;
16+ protected static final long COUNTER_MEASURE_ACTIVE_TIME = 3000;
17+ protected final EntityProperties entityProperties;
1318 protected final ShipProperties shipProperties;
19+ protected long currentCounterMeasureTime;
1420
1521 public CountermeasuresWithoutRenderingAnimation(String name, Entity shipEntity, long totalTime) {
1622 super(name, totalTime);
1723 WorldManagerBase worldManager = WorldManagerBase.getSingleton();
24+ entityProperties = worldManager.getEntityPropertiesComponentMapper().get(shipEntity);
1825 shipProperties = worldManager.getShipPropertiesComponentMapper().getSafe(shipEntity);
1926 if (shipProperties == null) {
2027 throw new IllegalArgumentException(worldManager.getEntityPropertiesComponentMapper().get(shipEntity).getName() + " is not a valid ship entity");
@@ -25,11 +32,22 @@
2532 public void start() {
2633 super.start();
2734 shipProperties.setCountermeasureLaunched(true);
35+ // The time for which the countermeasure has its effect on the
36+ // tracking projectiles is limited to less than animation time.
37+ // If we just setCountermeasureLaunched(false) then we get duplicate
38+ // nodes when creating multiple countermeasures within the animation time limit.
39+ shipProperties.setCountermeasureTrackingDefenseActive(true);
40+ currentCounterMeasureTime = ENG_Utility.currentTimeMillis();
2841 }
2942
3043 @Override
3144 public void update() {
32-
45+ if (ENG_Utility.hasTimePassed(
46+ FrameInterval.COUNTER_MEASURE_EXPIRATION_TIME +
47+ entityProperties.getNode().getName(),
48+ currentCounterMeasureTime, COUNTER_MEASURE_ACTIVE_TIME)) {
49+ shipProperties.setCountermeasureTrackingDefenseActive(false);
50+ }
3351 }
3452
3553 @Override
diff -r 12d8b44236a9 -r 2493ad6671f9 core/src/headwayent/blackholedarksun/components/EntityProperties.java
--- a/core/src/headwayent/blackholedarksun/components/EntityProperties.java Tue May 04 21:39:48 2021 +0300
+++ b/core/src/headwayent/blackholedarksun/components/EntityProperties.java Wed May 05 23:33:43 2021 +0300
@@ -860,6 +860,18 @@
860860 }
861861
862862 /**
863+ * This should only be used for updating from EntityContactListener.
864+ * @return
865+ */
866+ public ENG_Vector4D getLimitsReachedOriginal() {
867+ return limitsReached;
868+ }
869+
870+ public void resetLimitsReached() {
871+ limitsReached.set(ENG_Math.VEC4_ZERO);
872+ }
873+
874+ /**
863875 * @return the scanable
864876 */
865877 public boolean isScanable() {
diff -r 12d8b44236a9 -r 2493ad6671f9 core/src/headwayent/blackholedarksun/components/ShipProperties.java
--- a/core/src/headwayent/blackholedarksun/components/ShipProperties.java Tue May 04 21:39:48 2021 +0300
+++ b/core/src/headwayent/blackholedarksun/components/ShipProperties.java Wed May 05 23:33:43 2021 +0300
@@ -46,6 +46,7 @@
4646 private transient boolean afterburnerSoundEmitted;
4747 private transient int lastSpeedScrollPercentageBeforeAfterburner;
4848 private boolean countermeasureLaunched; // To make sure no duplicate
49+ private boolean countermeasureTrackingDefenseActive;
4950 // particle system
5051 private transient AnimationFactory countermeasuresAnimationFactory;
5152 private transient long currentSelectedEnemy = -1;
@@ -363,6 +364,19 @@
363364 makeDirty();
364365 }
365366
367+ public boolean isCountermeasureTrackingDefenseActive() {
368+ return countermeasureTrackingDefenseActive;
369+ }
370+
371+ /**
372+ * Only for internal use by CountermeasureAnimationWithoutRendering to distinguish
373+ * between animation time and tracking defense time.
374+ * @param countermeasureTrackingDefenseActive
375+ */
376+ public void setCountermeasureTrackingDefenseActive(boolean countermeasureTrackingDefenseActive) {
377+ this.countermeasureTrackingDefenseActive = countermeasureTrackingDefenseActive;
378+ }
379+
366380 public AnimationFactory getCountermeasuresAnimationFactory() {
367381 return countermeasuresAnimationFactory;
368382 }
diff -r 12d8b44236a9 -r 2493ad6671f9 core/src/headwayent/blackholedarksun/gamestatedebugger/FrameInterval.java
--- a/core/src/headwayent/blackholedarksun/gamestatedebugger/FrameInterval.java Tue May 04 21:39:48 2021 +0300
+++ b/core/src/headwayent/blackholedarksun/gamestatedebugger/FrameInterval.java Wed May 05 23:33:43 2021 +0300
@@ -67,6 +67,7 @@
6767 public static final String SET_AFTERBURNER_ACTIVE = "set_afterburner_active ";
6868 public static final String UPDATE_COLLISION_PLAYER_SHIP_HIT_ANIMATION = "update_collision_player_ship_hit_animation";
6969 public static final String SOUND_SHOULD_PLAY_SOUND = "should_play_sound ";
70+ public static final String COUNTER_MEASURE_EXPIRATION_TIME = "countermeasure_expiration_time ";
7071
7172
7273 public static class GameFrameIntervalFactory extends FrameIntervalFactory {
diff -r 12d8b44236a9 -r 2493ad6671f9 core/src/headwayent/blackholedarksun/physics/EntityContactListener.java
--- a/core/src/headwayent/blackholedarksun/physics/EntityContactListener.java Tue May 04 21:39:48 2021 +0300
+++ b/core/src/headwayent/blackholedarksun/physics/EntityContactListener.java Wed May 05 23:33:43 2021 +0300
@@ -45,10 +45,18 @@
4545 boolean eDestroyed = false;
4646 boolean nextDestroyed = false;
4747
48- if (isEntityRigidBody(colObj0UserPointer)) {
48+ // The entity which is not the wall is always on the first position.
49+ if (isInvisibleWall(colObj0UserPointer)) {
50+ nextDestroyed = checkCollidedWithInvisibleWall(colObj1UserPointer, colObj0UserPointer, colObj1, colObj0, 0);
51+ }
52+ if (isInvisibleWall(colObj1UserPointer)) {
53+ eDestroyed = checkCollidedWithInvisibleWall(colObj0UserPointer, colObj1UserPointer, colObj0, colObj1, 1);
54+ }
55+
56+ if ((!eDestroyed && !nextDestroyed) && isEntityRigidBody(colObj0UserPointer)) {
4957 eDestroyed = updateCollision(colObj0UserPointer, colObj1UserPointer, colObj0, colObj1, 0);
5058 }
51- if (isEntityRigidBody(colObj1UserPointer)) {
59+ if ((!eDestroyed && !nextDestroyed) && isEntityRigidBody(colObj1UserPointer)) {
5260 nextDestroyed = updateCollision(colObj1UserPointer, colObj0UserPointer, colObj1, colObj0, 1);
5361 }
5462
@@ -60,6 +68,43 @@
6068 }
6169 }
6270
71+ private boolean checkCollidedWithInvisibleWall(long ePtr, long nextPtr, btCollisionObject eColObj, btCollisionObject nextColObj, int updateCall) {
72+ boolean entityDestroyed = false;
73+ EntityRigidBody eEntityRigidBody = (EntityRigidBody) eColObj;
74+ Entity e = eEntityRigidBody.getEntity();
75+
76+ WorldManagerBase worldManager = null;
77+ if (MainApp.getApplicationMode() == MainApp.Mode.CLIENT) {
78+ worldManager = WorldManager.getSingleton();
79+ } else {
80+ worldManager = WorldManagerServerSide.getSingleton();
81+ }
82+ ComponentMapper<EntityProperties> entityPropertiesMapper = worldManager.getEntityPropertiesComponentMapper();
83+ ComponentMapper<ShipProperties> shipPropertiesMapper = worldManager.getShipPropertiesComponentMapper();
84+ ComponentMapper<ProjectileProperties> projectilePropertiesMapper = worldManager.getProjectilePropertiesComponentMapper();
85+ ComponentMapper<AIProperties> aIPropertiesMapper = worldManager.getAiPropertiesComponentMapper();
86+
87+ EntityProperties entityProperties = entityPropertiesMapper.get(e);
88+ ProjectileProperties projectileProperties = projectilePropertiesMapper.getSafe(e);
89+
90+ System.out.println("Invisible wall collided with: " + entityProperties.getNode().getName());
91+
92+ if (projectileProperties != null) {
93+ entityProperties.decreaseHealth(entityProperties.getHealth());
94+ entityDestroyed = true;
95+ }
96+
97+ ShipProperties shipProperties = shipPropertiesMapper.getSafe(e);
98+ AIProperties aiComponent = aIPropertiesMapper.getSafe(e);
99+ if (aiComponent != null) {
100+ // Set the AI to turn around its ship.
101+ InvisibleWallRigidBody invisibleWallRigidBody = (InvisibleWallRigidBody) nextColObj;
102+ invisibleWallRigidBody.getInvisibleWall().getWallType().getLimitReached(entityProperties.getLimitsReachedOriginal());
103+ }
104+
105+ return entityDestroyed;
106+ }
107+
63108 private boolean updateCollision(long ePtr, long nextPtr, btCollisionObject eColObj, btCollisionObject nextColObj, int updateCall) {
64109 // We know we are an entity but we can't be sure about the next object.
65110 EntityRigidBody eEntityRigidBody = (EntityRigidBody) eColObj;
@@ -309,4 +354,8 @@
309354 private static boolean isEntityRigidBody(long userPointer) {
310355 return userPointer == PhysicsEntityType.ENTITY_RIGID_BODY.getType();
311356 }
357+
358+ private static boolean isInvisibleWall(long userPointer) {
359+ return userPointer == PhysicsEntityType.INVISIBLE_WALL.getType();
360+ }
312361 }
diff -r 12d8b44236a9 -r 2493ad6671f9 core/src/headwayent/blackholedarksun/physics/InvisibleWall.java
--- a/core/src/headwayent/blackholedarksun/physics/InvisibleWall.java Tue May 04 21:39:48 2021 +0300
+++ b/core/src/headwayent/blackholedarksun/physics/InvisibleWall.java Wed May 05 23:33:43 2021 +0300
@@ -11,13 +11,13 @@
1111
1212 public class InvisibleWall {
1313
14- public InvisibleWallsManager.WallType wallType;
15- public Matrix4 transform;
16- public btDefaultMotionState motionState;
17- public btBoxShape boxShape;
18- public btRigidBody rigidBody;
19- public short collisionGroup;
20- public short collisionMask;
14+ private InvisibleWallsManager.WallType wallType;
15+ private Matrix4 transform;
16+ private btDefaultMotionState motionState;
17+ private btBoxShape boxShape;
18+ private btRigidBody rigidBody;
19+ private short collisionGroup;
20+ private short collisionMask;
2121
2222 public InvisibleWall() {
2323
@@ -33,4 +33,32 @@
3333 this.collisionGroup = collisionGroup;
3434 this.collisionMask = collisionMask;
3535 }
36+
37+ public InvisibleWallsManager.WallType getWallType() {
38+ return wallType;
39+ }
40+
41+ public Matrix4 getTransform() {
42+ return transform;
43+ }
44+
45+ public btDefaultMotionState getMotionState() {
46+ return motionState;
47+ }
48+
49+ public btBoxShape getBoxShape() {
50+ return boxShape;
51+ }
52+
53+ public btRigidBody getRigidBody() {
54+ return rigidBody;
55+ }
56+
57+ public short getCollisionGroup() {
58+ return collisionGroup;
59+ }
60+
61+ public short getCollisionMask() {
62+ return collisionMask;
63+ }
3664 }
diff -r 12d8b44236a9 -r 2493ad6671f9 core/src/headwayent/blackholedarksun/physics/InvisibleWallRigidBody.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/core/src/headwayent/blackholedarksun/physics/InvisibleWallRigidBody.java Wed May 05 23:33:43 2021 +0300
@@ -0,0 +1,24 @@
1+package headwayent.blackholedarksun.physics;
2+
3+import com.badlogic.gdx.math.Vector3;
4+import com.badlogic.gdx.physics.bullet.collision.btCollisionShape;
5+import com.badlogic.gdx.physics.bullet.dynamics.btRigidBody;
6+import com.badlogic.gdx.physics.bullet.linearmath.btMotionState;
7+
8+public class InvisibleWallRigidBody extends btRigidBody {
9+
10+ private InvisibleWall invisibleWall;
11+
12+ public InvisibleWallRigidBody(float mass, btMotionState motionState, btCollisionShape collisionShape, Vector3 localInertia) {
13+ super(mass, motionState, collisionShape, localInertia);
14+ }
15+
16+
17+ public InvisibleWall getInvisibleWall() {
18+ return invisibleWall;
19+ }
20+
21+ public void setInvisibleWall(InvisibleWall invisibleWall) {
22+ this.invisibleWall = invisibleWall;
23+ }
24+}
diff -r 12d8b44236a9 -r 2493ad6671f9 core/src/headwayent/blackholedarksun/physics/InvisibleWallsManager.java
--- a/core/src/headwayent/blackholedarksun/physics/InvisibleWallsManager.java Tue May 04 21:39:48 2021 +0300
+++ b/core/src/headwayent/blackholedarksun/physics/InvisibleWallsManager.java Wed May 05 23:33:43 2021 +0300
@@ -9,6 +9,8 @@
99
1010 import java.util.EnumMap;
1111
12+import headwayent.hotshotengine.ENG_Vector4D;
13+
1214 /**
1315 * Created by sebas on 02-Oct-17.
1416 */
@@ -25,7 +27,33 @@
2527 private boolean created;
2628
2729 public enum WallType {
28- FRONT, BACK, LEFT, RIGHT, UP, DOWN
30+ FRONT, BACK, LEFT, RIGHT, UP, DOWN;
31+
32+ public void getLimitReached(ENG_Vector4D limitReached) {
33+ switch (this.ordinal()) {
34+ case 0:
35+ limitReached.z = -1.0f;
36+ break;
37+ case 1:
38+ limitReached.z = 1.0f;
39+ break;
40+ case 2:
41+ limitReached.x = -1.0f;
42+ break;
43+ case 3:
44+ limitReached.x = 1.0f;
45+ break;
46+ case 4:
47+ limitReached.y = 1.0f;
48+ break;
49+ case 5:
50+ limitReached.y = -1.0f;
51+ break;
52+ default:
53+ // Should never get here.
54+ throw new IllegalArgumentException(this.toString() + this.ordinal());
55+ }
56+ }
2957 }
3058
3159 private InvisibleWallsManager() {
@@ -70,17 +98,19 @@
7098 short collisionGroup = PhysicsProperties.CollisionGroup.STANDARD.getVal();
7199 short collisionMask = PhysicsProperties.CollisionMask.STANDARD.getVal();
72100
73- btRigidBody rigidBody = new btRigidBody(0.0f, motionState, boxShape, localInertia);
101+ InvisibleWallRigidBody invisibleWallRigidBody = new InvisibleWallRigidBody(0.0f, motionState, boxShape, localInertia);
102+ invisibleWallRigidBody.setUserPointer(PhysicsEntityType.INVISIBLE_WALL.getType());
74103
75- InvisibleWall invisibleWall = new InvisibleWall(wallType, transform, motionState, boxShape, rigidBody, collisionGroup, collisionMask);
104+ InvisibleWall invisibleWall = new InvisibleWall(wallType, transform, motionState, boxShape, invisibleWallRigidBody, collisionGroup, collisionMask);
105+ invisibleWallRigidBody.setInvisibleWall(invisibleWall);
76106
77- world.addRigidBody(rigidBody, collisionGroup, collisionMask);
107+ world.addRigidBody(invisibleWallRigidBody, collisionGroup, collisionMask);
78108
79109 return invisibleWall;
80110 }
81111
82112 private void destroyInvisibleBox(btDiscreteDynamicsWorld world, InvisibleWall wall) {
83- world.removeRigidBody(wall.rigidBody);
113+ world.removeRigidBody(wall.getRigidBody());
84114 }
85115
86116 public btDiscreteDynamicsWorld getWorld() {
diff -r 12d8b44236a9 -r 2493ad6671f9 core/src/headwayent/blackholedarksun/physics/PhysicsEntityType.java
--- a/core/src/headwayent/blackholedarksun/physics/PhysicsEntityType.java Tue May 04 21:39:48 2021 +0300
+++ b/core/src/headwayent/blackholedarksun/physics/PhysicsEntityType.java Wed May 05 23:33:43 2021 +0300
@@ -5,12 +5,13 @@
55 */
66
77 enum PhysicsEntityType {
8- ENTITY_RIGID_BODY(1);
8+ ENTITY_RIGID_BODY(1),
9+ INVISIBLE_WALL(2);
910
1011 private int type;
1112
1213 PhysicsEntityType(int i) {
13- type = 1;
14+ type = i;
1415 }
1516
1617 public int getType() {
diff -r 12d8b44236a9 -r 2493ad6671f9 core/src/headwayent/blackholedarksun/systems/AISystem.java
--- a/core/src/headwayent/blackholedarksun/systems/AISystem.java Tue May 04 21:39:48 2021 +0300
+++ b/core/src/headwayent/blackholedarksun/systems/AISystem.java Wed May 05 23:33:43 2021 +0300
@@ -43,6 +43,7 @@
4343 private static final int VELOCITY_CHANGE_NAME_DESTINATION_REACHED = 10;
4444 private static final int VELOCITY_CHANGE_NAME_REACHING_DESTINATION = 9;
4545 private static final int VELOCITY_CHANGE_NAME_ESCAPING_LIMITS = 8;
46+ private static final int VELOCITY_CHANGE_NAME_ESCAPING_LIMITS_FULL_STOP = 13;
4647 private static final int VELOCITY_CHANGE_NAME_MIN_DISTANCE = 7;
4748 private static final int VELOCITY_CHANGE_NAME_FOLLOWED_SHIP_VELOCITY = 6;
4849 private static final int VELOCITY_CHANGE_NAME_EVADE_HIT = 5;
@@ -77,6 +78,7 @@
7778 private static final float EVASION_ACCELERATION = 1.0f;
7879 private static final long EVADE_COLLISION_TIME = 3000;
7980 private static final float TARGETING_ANGLE = 1.0f * ENG_Math.DEGREES_TO_RADIANS;
81+ private static final float ESCAPE_LEVEL_LIMITS_ANGLE = 20.0f * ENG_Math.DEGREES_TO_RADIANS;
8082 private static final float MIN_COUNTERMEASURES_DISTANCE = ENG_Math.sqr(800.0f);
8183 private static final float MIN_EVASION_DISTANCE = ENG_Math.sqr(500.0f);
8284 private static final long EVASION_HIT_TIME = 5000;
@@ -886,11 +888,19 @@
886888 aiProperties.setState(AIState.SEEK_CLOSEST_PLAYER);
887889 showAIStateChange(shipProperties, aiProperties);
888890 } else {
891+ // We must make sure that we reset the level limits for each frame or we
892+ // will end up with previous limits never going away since they are
893+ // only additive in EntityContactListener.
894+ entityProperties.resetLimitsReached();
889895 levelLimits.invert(awayFromLimitsPos);
890- awayFromLimitsPos.addInPlace(entityProperties.getNode().getPosition());
896+ float angleBetween = currentFrontVec.angleBetween(awayFromLimitsPos);
897+// awayFromLimitsPos.addInPlace(entityProperties.getNode().getPosition());
891898 entityProperties.getNode().getPosition(currentPos);
892899 entityProperties.getNode().getLocalInverseZAxis(currentFrontVec);
893- entityProperties.getNode().getLocalYAxis(currentUpVec);
900+// entityProperties.getNode().getLocalYAxis(currentUpVec);
901+
902+ // First slow down to 0 then rotate away.
903+ entityProperties.setVelocity(0.0f);
894904 // ENG_Math.rotateTowardPositionDeg(awayFromLimitsPos, currentPos, currentFrontVec, currentUpVec, rotation, getRotationAngle(shipProperties));
895905 // entityProperties.rotate(rotation, true, TransformSpace.TS_WORLD);
896906 Utility.rotateToPosition(currentFrontVec,
@@ -898,17 +908,21 @@
898908 updateInterval, entityProperties,
899909 shipProperties.getShipData().maxAngularVelocity);
900910
901- // Also get to max speed
902- changeVelocity(entityProperties, shipProperties, aiProperties, new VelocityChange(
903- VELOCITY_CHANGE_NAME_ESCAPING_LIMITS,
904- shipProperties.getShipData().maxSpeed,
905- ESCAPING_LIMITS_ACCELERATION_RATE));
906- if (DEBUG) {
911+
912+
913+ if (angleBetween < ESCAPE_LEVEL_LIMITS_ANGLE) {
914+ // Also get to max speed
915+ changeVelocity(entityProperties, shipProperties, aiProperties, new VelocityChange(
916+ VELOCITY_CHANGE_NAME_ESCAPING_LIMITS,
917+ shipProperties.getShipData().maxSpeed,
918+ ESCAPING_LIMITS_ACCELERATION_RATE));
919+ }
920+// if (DEBUG) {
907921 System.out.println("ship " + entityProperties.getUniqueName()
908922 + " has reached the limits " + levelLimits
909923 + " and moved towards " + awayFromLimitsPos
910924 + " . Current pos: " + currentPos);
911- }
925+// }
912926 }
913927 }
914928
diff -r 12d8b44236a9 -r 2493ad6671f9 core/src/headwayent/blackholedarksun/systems/MovementSystem.java
--- a/core/src/headwayent/blackholedarksun/systems/MovementSystem.java Tue May 04 21:39:48 2021 +0300
+++ b/core/src/headwayent/blackholedarksun/systems/MovementSystem.java Wed May 05 23:33:43 2021 +0300
@@ -204,11 +204,25 @@
204204 // projectileProperties.addToDistanceTraveled(velocity.length());
205205 WeaponData weaponData = WeaponData.getWeaponData(projectileProperties.getType());
206206 // If a projectile hits the level limits destroy it
207- if (projectileProperties != null && entityProperties.isLimitsReached()) {
208- entitiesToDestroyQueue.offer(entityProperties);
209- }
207+ // This is now handled directly in EntityContactListener.
208+// if (projectileProperties != null && entityProperties.isLimitsReached()) {
209+// entitiesToDestroyQueue.offer(entityProperties);
210+// }
211+
210212 if (projectileProperties.getDistanceTraveled() > weaponData.maxDistance) {
211213 // entityProperties.setDestroyed(true);
214+ TrackerProperties trackerProperties = trackerPropertiesMapper.getSafe(e);
215+ if (trackerProperties != null) {
216+ String shipName = "";
217+ Entity ship = MainApp.getGame().getWorldManager().getEntityByUniqueId(trackerProperties.getTrackedEntityId());
218+ if (ship != null) {
219+ EntityProperties followedShipEntityProperties = entityPropertiesMapper.getSafe(ship);
220+ if (followedShipEntityProperties != null) {
221+ shipName = followedShipEntityProperties.getNode().getName();
222+ }
223+ }
224+ System.out.println("Projectile: " + entityProperties.getNode().getName() + projectileProperties.getId() + " has reached max distance following ship: " + shipName);
225+ }
212226 entitiesToDestroyQueue.offer(entityProperties);
213227 } else {
214228 // Check if tracking missile and rotate accordingly
@@ -241,7 +255,7 @@
241255
242256 // Check for countermeasures
243257 ShipProperties trackedShipProps = shipPropertiesMapper.get(ship);
244- if (trackedShipProps.isCountermeasureLaunched()) {
258+ if (trackedShipProps.isCountermeasureTrackingDefenseActive()) {
245259 float length = followedShipEntityProperties.getNode().getPosition().distance(entityProperties.getNode().getPosition());
246260 int rand = (int) (ENG_Math.clamp(length,
247261 TRACKING_MISSILE_MINIMUM_DISTANCE_RAND,
@@ -253,6 +267,7 @@
253267 && ENG_Utility.hasRandomChanceHit(
254268 FrameInterval.TRACKING_MISSILE_MINIMUM_DISTANCE_RAND
255269 + entityProperties.getNode().getName() + projectileProperties.getId(), rand)) {
270+ System.out.println("Projectile: " + entityProperties.getNode().getName() + projectileProperties.getId() + " has been evaded by: " + followedShipEntityProperties.getNode().getName());
256271 entitiesToDestroyQueue.offer(entityProperties);
257272 }
258273 }
diff -r 12d8b44236a9 -r 2493ad6671f9 core/src/headwayent/hotshotengine/ENG_MainThread.java
--- a/core/src/headwayent/hotshotengine/ENG_MainThread.java Tue May 04 21:39:48 2021 +0300
+++ b/core/src/headwayent/hotshotengine/ENG_MainThread.java Wed May 05 23:33:43 2021 +0300
@@ -334,12 +334,13 @@
334334 final int averageStepNum = 100;
335335 int currentStep = 0;
336336 while (true) {
337- if ((++currentStep) == averageStepNum) {
338- currentStep = 0;
339- long currentTime = ENG_Utility.currentTimeMillis();
340- System.out.println("average FPS: " + ((currentTime - averageCycleTime) / (float) averageStepNum));
341- averageCycleTime = currentTime;
342- }
337+// if ((++currentStep) == averageStepNum) {
338+// currentStep = 0;
339+// long currentTime = ENG_Utility.currentTimeMillis();
340+// System.out.println("average FrameTime: " + ((currentTime - averageCycleTime) / (float) averageStepNum));
341+// averageCycleTime = currentTime;
342+// }
343+
343344 // if (ENG_Utility.hasTimePassed(lastGCTime, 5000)) {
344345 // lastGCTime = ENG_Utility.currentTimeMillis();
345346 //// System.gc();
diff -r 12d8b44236a9 -r 2493ad6671f9 desktop/raw/hotshot_gamedata/level_retribution.txt
--- a/desktop/raw/hotshot_gamedata/level_retribution.txt Tue May 04 21:39:48 2021 +0300
+++ b/desktop/raw/hotshot_gamedata/level_retribution.txt Wed May 05 23:33:43 2021 +0300
@@ -22,15 +22,15 @@
2222 obj PlayerShip
2323 {
2424 type player_ship
25- position 0.0 0.0 0.0
25+ position 0.0 0.0 -9500.0
2626 ai 0
27- invincible 0
27+ invincible 1
2828 }
2929 obj Defender0
3030 {
3131 mesh ship_human0
3232 type fighter_ship
33- position -300.0 0.0 300.0
33+ position -200.0 0.0 -9600.0
3434 orientation 0.0 0.0 0.0 0.0
3535 speed 0.0 0.0 0.0
3636 ai 1
diff -r 12d8b44236a9 -r 2493ad6671f9 desktop/raw/hotshot_gamedata/ship_data_list.txt
--- a/desktop/raw/hotshot_gamedata/ship_data_list.txt Tue May 04 21:39:48 2021 +0300
+++ b/desktop/raw/hotshot_gamedata/ship_data_list.txt Wed May 05 23:33:43 2021 +0300
@@ -6,7 +6,7 @@
66 name "Draco Tinte"
77 team ALIEN
88 ship_type FIGHTER
9- max_speed 450.0f
9+ max_speed 400.0f
1010 armor 100.0f
1111 turn_angle 60.0f
1212 max_angular_velocity 1200.0f
@@ -26,7 +26,7 @@
2626 name "Bloody Grugu"
2727 team ALIEN
2828 ship_type FIGHTER
29- max_speed 400.0f
29+ max_speed 350.0f
3030 armor 150.0f
3131 turn_angle 70.0f
3232 max_angular_velocity 2000.0f
@@ -45,7 +45,7 @@
4545 name "Vengeful Ewaldi"
4646 team ALIEN
4747 ship_type FIGHTER
48- max_speed 440.0f
48+ max_speed 390.0f
4949 armor 200.0f
5050 turn_angle 80.0f
5151 max_angular_velocity 2000.0f
@@ -65,7 +65,7 @@
6565 name "Gliurkiudooyiaian"
6666 team ALIEN
6767 ship_type FIGHTER
68- max_speed 450.0f
68+ max_speed 400.0f
6969 armor 300.0f
7070 turn_angle 90.0f
7171 max_angular_velocity 2000.0f
@@ -86,7 +86,7 @@
8686 name "Pollux"
8787 team ALIEN
8888 ship_type FIGHTER
89- max_speed 450.0f
89+ max_speed 400.0f
9090 armor 400.0f
9191 turn_angle 100.0f
9292 max_angular_velocity 2000.0f
@@ -141,7 +141,7 @@
141141 name "Arcturus"
142142 team HUMAN
143143 ship_type FIGHTER
144- max_speed 450.0f
144+ max_speed 400.0f
145145 armor 100.0f
146146 turn_angle 110.0f
147147 max_angular_velocity 1200.0f
@@ -164,7 +164,7 @@
164164 name "Dark Colbert"
165165 team HUMAN
166166 ship_type FIGHTER
167- max_speed 500.0f
167+ max_speed 450.0f
168168 armor 150.0f
169169 turn_angle 100.0f
170170 max_angular_velocity 1200.0f
@@ -185,7 +185,7 @@
185185 name "Aldemarin"
186186 team HUMAN
187187 ship_type FIGHTER
188- max_speed 440.0f
188+ max_speed 390.0f
189189 armor 300.0f
190190 turn_angle 70.0f
191191 max_angular_velocity 2000.0f
@@ -208,7 +208,7 @@
208208 name "Jovian Falcon"
209209 team HUMAN
210210 ship_type FIGHTER
211- max_speed 450.0f
211+ max_speed 400.0f
212212 armor 400.0f
213213 turn_angle 60.0f
214214 max_angular_velocity 2000.0f
diff -r 12d8b44236a9 -r 2493ad6671f9 desktop/raw/hotshot_gamedata/weapon_data_list.txt
--- a/desktop/raw/hotshot_gamedata/weapon_data_list.txt Tue May 04 21:39:48 2021 +0300
+++ b/desktop/raw/hotshot_gamedata/weapon_data_list.txt Wed May 05 23:33:43 2021 +0300
@@ -53,11 +53,12 @@
5353 weapon_type CONCUSSION
5454 filename "missile_concssn.mesh"
5555 name "missile_concussion"
56- max_speed 1400.0f
56+ max_speed 1000.0f
5757 turn_angle 0.0f
5858 damage 20
5959 cooldown_time 1500
6060 default_missile_number 20
61+ max_distance 4000.0f
6162 }
6263
6364 weapon missile_homing
@@ -65,13 +66,14 @@
6566 weapon_type HOMING
6667 filename "missile_homing.mesh"
6768 name "missile_homing"
68- max_speed 1200.0f
69+ max_speed 800.0f
6970 turn_angle 50.0f
7071 max_angular_velocity 20.0f
7172 damage 20
7273 cooldown_time 2000
7374 default_missile_number 20
7475 enemy_selection_time 800
76+ max_distance 6000.0f
7577 }
7678
7779 weapon missile_piranha
@@ -79,14 +81,15 @@
7981 weapon_type PIRANHA
8082 filename "missile_piranha.mesh"
8183 name "missile_piranha"
82- max_speed 1400.0f
84+ max_speed 900.0f
8385 turn_angle 10.0f
8486 max_angular_velocity 10.0f
8587 damage 10
8688 cooldown_time 3000
8789 default_missile_number 10
8890 tracking_delay 2000
89- enemy_selection_time 1300
91+ enemy_selection_time 1000
92+ max_distance 6000.0f
9093 }
9194
9295 weapon plasma
@@ -106,11 +109,12 @@
106109 weapon_type MEGA
107110 filename "missile_mega.mesh"
108111 name "missile_mega"
109- max_speed 800.0f
112+ max_speed 600.0f
110113 turn_angle 0.0f
111114 damage 100
112115 cooldown_time 8000
113116 default_missile_number 3
114- enemy_selection_time 3000
117+ enemy_selection_time 2000
118+ max_distance 4000.0f
115119 }
116120 }
\ No newline at end of file