Revision | 2493ad6671f932abe59433c678df0d633caa4876 (tree) |
---|---|
Zeit | 2021-05-06 05:33:43 |
Autor | sebastian_bugiu |
Commiter | sebastian_bugiu |
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.
@@ -51,7 +51,7 @@ | ||
51 | 51 | @Override |
52 | 52 | public void update() { |
53 | 53 | // TODO Auto-generated method stub |
54 | - | |
54 | + super.update(); | |
55 | 55 | if (!psCreated) { |
56 | 56 | psCreated = true; |
57 | 57 | ENG_SceneManager sceneManager = ENG_RenderRoot.getRenderRoot().getSceneManager(APP_Game.SCENE_MANAGER); |
@@ -2,19 +2,26 @@ | ||
2 | 2 | |
3 | 3 | import com.artemis.Entity; |
4 | 4 | import headwayent.blackholedarksun.Animation; |
5 | +import headwayent.blackholedarksun.components.EntityProperties; | |
5 | 6 | import headwayent.blackholedarksun.components.ShipProperties; |
7 | +import headwayent.blackholedarksun.gamestatedebugger.FrameInterval; | |
6 | 8 | import headwayent.blackholedarksun.world.WorldManagerBase; |
9 | +import headwayent.hotshotengine.ENG_Utility; | |
7 | 10 | |
8 | 11 | /** |
9 | 12 | * Created by sebas on 19.11.2015. |
10 | 13 | */ |
11 | 14 | public class CountermeasuresWithoutRenderingAnimation extends Animation { |
12 | 15 | protected static final long TOTAL_ANIM_TIME = 10000; |
16 | + protected static final long COUNTER_MEASURE_ACTIVE_TIME = 3000; | |
17 | + protected final EntityProperties entityProperties; | |
13 | 18 | protected final ShipProperties shipProperties; |
19 | + protected long currentCounterMeasureTime; | |
14 | 20 | |
15 | 21 | public CountermeasuresWithoutRenderingAnimation(String name, Entity shipEntity, long totalTime) { |
16 | 22 | super(name, totalTime); |
17 | 23 | WorldManagerBase worldManager = WorldManagerBase.getSingleton(); |
24 | + entityProperties = worldManager.getEntityPropertiesComponentMapper().get(shipEntity); | |
18 | 25 | shipProperties = worldManager.getShipPropertiesComponentMapper().getSafe(shipEntity); |
19 | 26 | if (shipProperties == null) { |
20 | 27 | throw new IllegalArgumentException(worldManager.getEntityPropertiesComponentMapper().get(shipEntity).getName() + " is not a valid ship entity"); |
@@ -25,11 +32,22 @@ | ||
25 | 32 | public void start() { |
26 | 33 | super.start(); |
27 | 34 | 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(); | |
28 | 41 | } |
29 | 42 | |
30 | 43 | @Override |
31 | 44 | 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 | + } | |
33 | 51 | } |
34 | 52 | |
35 | 53 | @Override |
@@ -860,6 +860,18 @@ | ||
860 | 860 | } |
861 | 861 | |
862 | 862 | /** |
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 | + /** | |
863 | 875 | * @return the scanable |
864 | 876 | */ |
865 | 877 | public boolean isScanable() { |
@@ -46,6 +46,7 @@ | ||
46 | 46 | private transient boolean afterburnerSoundEmitted; |
47 | 47 | private transient int lastSpeedScrollPercentageBeforeAfterburner; |
48 | 48 | private boolean countermeasureLaunched; // To make sure no duplicate |
49 | + private boolean countermeasureTrackingDefenseActive; | |
49 | 50 | // particle system |
50 | 51 | private transient AnimationFactory countermeasuresAnimationFactory; |
51 | 52 | private transient long currentSelectedEnemy = -1; |
@@ -363,6 +364,19 @@ | ||
363 | 364 | makeDirty(); |
364 | 365 | } |
365 | 366 | |
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 | + | |
366 | 380 | public AnimationFactory getCountermeasuresAnimationFactory() { |
367 | 381 | return countermeasuresAnimationFactory; |
368 | 382 | } |
@@ -67,6 +67,7 @@ | ||
67 | 67 | public static final String SET_AFTERBURNER_ACTIVE = "set_afterburner_active "; |
68 | 68 | public static final String UPDATE_COLLISION_PLAYER_SHIP_HIT_ANIMATION = "update_collision_player_ship_hit_animation"; |
69 | 69 | public static final String SOUND_SHOULD_PLAY_SOUND = "should_play_sound "; |
70 | + public static final String COUNTER_MEASURE_EXPIRATION_TIME = "countermeasure_expiration_time "; | |
70 | 71 | |
71 | 72 | |
72 | 73 | public static class GameFrameIntervalFactory extends FrameIntervalFactory { |
@@ -45,10 +45,18 @@ | ||
45 | 45 | boolean eDestroyed = false; |
46 | 46 | boolean nextDestroyed = false; |
47 | 47 | |
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)) { | |
49 | 57 | eDestroyed = updateCollision(colObj0UserPointer, colObj1UserPointer, colObj0, colObj1, 0); |
50 | 58 | } |
51 | - if (isEntityRigidBody(colObj1UserPointer)) { | |
59 | + if ((!eDestroyed && !nextDestroyed) && isEntityRigidBody(colObj1UserPointer)) { | |
52 | 60 | nextDestroyed = updateCollision(colObj1UserPointer, colObj0UserPointer, colObj1, colObj0, 1); |
53 | 61 | } |
54 | 62 |
@@ -60,6 +68,43 @@ | ||
60 | 68 | } |
61 | 69 | } |
62 | 70 | |
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 | + | |
63 | 108 | private boolean updateCollision(long ePtr, long nextPtr, btCollisionObject eColObj, btCollisionObject nextColObj, int updateCall) { |
64 | 109 | // We know we are an entity but we can't be sure about the next object. |
65 | 110 | EntityRigidBody eEntityRigidBody = (EntityRigidBody) eColObj; |
@@ -309,4 +354,8 @@ | ||
309 | 354 | private static boolean isEntityRigidBody(long userPointer) { |
310 | 355 | return userPointer == PhysicsEntityType.ENTITY_RIGID_BODY.getType(); |
311 | 356 | } |
357 | + | |
358 | + private static boolean isInvisibleWall(long userPointer) { | |
359 | + return userPointer == PhysicsEntityType.INVISIBLE_WALL.getType(); | |
360 | + } | |
312 | 361 | } |
@@ -11,13 +11,13 @@ | ||
11 | 11 | |
12 | 12 | public class InvisibleWall { |
13 | 13 | |
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; | |
21 | 21 | |
22 | 22 | public InvisibleWall() { |
23 | 23 |
@@ -33,4 +33,32 @@ | ||
33 | 33 | this.collisionGroup = collisionGroup; |
34 | 34 | this.collisionMask = collisionMask; |
35 | 35 | } |
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 | + } | |
36 | 64 | } |
@@ -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 | +} |
@@ -9,6 +9,8 @@ | ||
9 | 9 | |
10 | 10 | import java.util.EnumMap; |
11 | 11 | |
12 | +import headwayent.hotshotengine.ENG_Vector4D; | |
13 | + | |
12 | 14 | /** |
13 | 15 | * Created by sebas on 02-Oct-17. |
14 | 16 | */ |
@@ -25,7 +27,33 @@ | ||
25 | 27 | private boolean created; |
26 | 28 | |
27 | 29 | 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 | + } | |
29 | 57 | } |
30 | 58 | |
31 | 59 | private InvisibleWallsManager() { |
@@ -70,17 +98,19 @@ | ||
70 | 98 | short collisionGroup = PhysicsProperties.CollisionGroup.STANDARD.getVal(); |
71 | 99 | short collisionMask = PhysicsProperties.CollisionMask.STANDARD.getVal(); |
72 | 100 | |
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()); | |
74 | 103 | |
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); | |
76 | 106 | |
77 | - world.addRigidBody(rigidBody, collisionGroup, collisionMask); | |
107 | + world.addRigidBody(invisibleWallRigidBody, collisionGroup, collisionMask); | |
78 | 108 | |
79 | 109 | return invisibleWall; |
80 | 110 | } |
81 | 111 | |
82 | 112 | private void destroyInvisibleBox(btDiscreteDynamicsWorld world, InvisibleWall wall) { |
83 | - world.removeRigidBody(wall.rigidBody); | |
113 | + world.removeRigidBody(wall.getRigidBody()); | |
84 | 114 | } |
85 | 115 | |
86 | 116 | public btDiscreteDynamicsWorld getWorld() { |
@@ -5,12 +5,13 @@ | ||
5 | 5 | */ |
6 | 6 | |
7 | 7 | enum PhysicsEntityType { |
8 | - ENTITY_RIGID_BODY(1); | |
8 | + ENTITY_RIGID_BODY(1), | |
9 | + INVISIBLE_WALL(2); | |
9 | 10 | |
10 | 11 | private int type; |
11 | 12 | |
12 | 13 | PhysicsEntityType(int i) { |
13 | - type = 1; | |
14 | + type = i; | |
14 | 15 | } |
15 | 16 | |
16 | 17 | public int getType() { |
@@ -43,6 +43,7 @@ | ||
43 | 43 | private static final int VELOCITY_CHANGE_NAME_DESTINATION_REACHED = 10; |
44 | 44 | private static final int VELOCITY_CHANGE_NAME_REACHING_DESTINATION = 9; |
45 | 45 | private static final int VELOCITY_CHANGE_NAME_ESCAPING_LIMITS = 8; |
46 | + private static final int VELOCITY_CHANGE_NAME_ESCAPING_LIMITS_FULL_STOP = 13; | |
46 | 47 | private static final int VELOCITY_CHANGE_NAME_MIN_DISTANCE = 7; |
47 | 48 | private static final int VELOCITY_CHANGE_NAME_FOLLOWED_SHIP_VELOCITY = 6; |
48 | 49 | private static final int VELOCITY_CHANGE_NAME_EVADE_HIT = 5; |
@@ -77,6 +78,7 @@ | ||
77 | 78 | private static final float EVASION_ACCELERATION = 1.0f; |
78 | 79 | private static final long EVADE_COLLISION_TIME = 3000; |
79 | 80 | 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; | |
80 | 82 | private static final float MIN_COUNTERMEASURES_DISTANCE = ENG_Math.sqr(800.0f); |
81 | 83 | private static final float MIN_EVASION_DISTANCE = ENG_Math.sqr(500.0f); |
82 | 84 | private static final long EVASION_HIT_TIME = 5000; |
@@ -886,11 +888,19 @@ | ||
886 | 888 | aiProperties.setState(AIState.SEEK_CLOSEST_PLAYER); |
887 | 889 | showAIStateChange(shipProperties, aiProperties); |
888 | 890 | } 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(); | |
889 | 895 | levelLimits.invert(awayFromLimitsPos); |
890 | - awayFromLimitsPos.addInPlace(entityProperties.getNode().getPosition()); | |
896 | + float angleBetween = currentFrontVec.angleBetween(awayFromLimitsPos); | |
897 | +// awayFromLimitsPos.addInPlace(entityProperties.getNode().getPosition()); | |
891 | 898 | entityProperties.getNode().getPosition(currentPos); |
892 | 899 | 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); | |
894 | 904 | // ENG_Math.rotateTowardPositionDeg(awayFromLimitsPos, currentPos, currentFrontVec, currentUpVec, rotation, getRotationAngle(shipProperties)); |
895 | 905 | // entityProperties.rotate(rotation, true, TransformSpace.TS_WORLD); |
896 | 906 | Utility.rotateToPosition(currentFrontVec, |
@@ -898,17 +908,21 @@ | ||
898 | 908 | updateInterval, entityProperties, |
899 | 909 | shipProperties.getShipData().maxAngularVelocity); |
900 | 910 | |
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) { | |
907 | 921 | System.out.println("ship " + entityProperties.getUniqueName() |
908 | 922 | + " has reached the limits " + levelLimits |
909 | 923 | + " and moved towards " + awayFromLimitsPos |
910 | 924 | + " . Current pos: " + currentPos); |
911 | - } | |
925 | +// } | |
912 | 926 | } |
913 | 927 | } |
914 | 928 |
@@ -204,11 +204,25 @@ | ||
204 | 204 | // projectileProperties.addToDistanceTraveled(velocity.length()); |
205 | 205 | WeaponData weaponData = WeaponData.getWeaponData(projectileProperties.getType()); |
206 | 206 | // 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 | + | |
210 | 212 | if (projectileProperties.getDistanceTraveled() > weaponData.maxDistance) { |
211 | 213 | // 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 | + } | |
212 | 226 | entitiesToDestroyQueue.offer(entityProperties); |
213 | 227 | } else { |
214 | 228 | // Check if tracking missile and rotate accordingly |
@@ -241,7 +255,7 @@ | ||
241 | 255 | |
242 | 256 | // Check for countermeasures |
243 | 257 | ShipProperties trackedShipProps = shipPropertiesMapper.get(ship); |
244 | - if (trackedShipProps.isCountermeasureLaunched()) { | |
258 | + if (trackedShipProps.isCountermeasureTrackingDefenseActive()) { | |
245 | 259 | float length = followedShipEntityProperties.getNode().getPosition().distance(entityProperties.getNode().getPosition()); |
246 | 260 | int rand = (int) (ENG_Math.clamp(length, |
247 | 261 | TRACKING_MISSILE_MINIMUM_DISTANCE_RAND, |
@@ -253,6 +267,7 @@ | ||
253 | 267 | && ENG_Utility.hasRandomChanceHit( |
254 | 268 | FrameInterval.TRACKING_MISSILE_MINIMUM_DISTANCE_RAND |
255 | 269 | + entityProperties.getNode().getName() + projectileProperties.getId(), rand)) { |
270 | + System.out.println("Projectile: " + entityProperties.getNode().getName() + projectileProperties.getId() + " has been evaded by: " + followedShipEntityProperties.getNode().getName()); | |
256 | 271 | entitiesToDestroyQueue.offer(entityProperties); |
257 | 272 | } |
258 | 273 | } |
@@ -334,12 +334,13 @@ | ||
334 | 334 | final int averageStepNum = 100; |
335 | 335 | int currentStep = 0; |
336 | 336 | 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 | + | |
343 | 344 | // if (ENG_Utility.hasTimePassed(lastGCTime, 5000)) { |
344 | 345 | // lastGCTime = ENG_Utility.currentTimeMillis(); |
345 | 346 | //// System.gc(); |
@@ -22,15 +22,15 @@ | ||
22 | 22 | obj PlayerShip |
23 | 23 | { |
24 | 24 | type player_ship |
25 | - position 0.0 0.0 0.0 | |
25 | + position 0.0 0.0 -9500.0 | |
26 | 26 | ai 0 |
27 | - invincible 0 | |
27 | + invincible 1 | |
28 | 28 | } |
29 | 29 | obj Defender0 |
30 | 30 | { |
31 | 31 | mesh ship_human0 |
32 | 32 | type fighter_ship |
33 | - position -300.0 0.0 300.0 | |
33 | + position -200.0 0.0 -9600.0 | |
34 | 34 | orientation 0.0 0.0 0.0 0.0 |
35 | 35 | speed 0.0 0.0 0.0 |
36 | 36 | ai 1 |
@@ -6,7 +6,7 @@ | ||
6 | 6 | name "Draco Tinte" |
7 | 7 | team ALIEN |
8 | 8 | ship_type FIGHTER |
9 | - max_speed 450.0f | |
9 | + max_speed 400.0f | |
10 | 10 | armor 100.0f |
11 | 11 | turn_angle 60.0f |
12 | 12 | max_angular_velocity 1200.0f |
@@ -26,7 +26,7 @@ | ||
26 | 26 | name "Bloody Grugu" |
27 | 27 | team ALIEN |
28 | 28 | ship_type FIGHTER |
29 | - max_speed 400.0f | |
29 | + max_speed 350.0f | |
30 | 30 | armor 150.0f |
31 | 31 | turn_angle 70.0f |
32 | 32 | max_angular_velocity 2000.0f |
@@ -45,7 +45,7 @@ | ||
45 | 45 | name "Vengeful Ewaldi" |
46 | 46 | team ALIEN |
47 | 47 | ship_type FIGHTER |
48 | - max_speed 440.0f | |
48 | + max_speed 390.0f | |
49 | 49 | armor 200.0f |
50 | 50 | turn_angle 80.0f |
51 | 51 | max_angular_velocity 2000.0f |
@@ -65,7 +65,7 @@ | ||
65 | 65 | name "Gliurkiudooyiaian" |
66 | 66 | team ALIEN |
67 | 67 | ship_type FIGHTER |
68 | - max_speed 450.0f | |
68 | + max_speed 400.0f | |
69 | 69 | armor 300.0f |
70 | 70 | turn_angle 90.0f |
71 | 71 | max_angular_velocity 2000.0f |
@@ -86,7 +86,7 @@ | ||
86 | 86 | name "Pollux" |
87 | 87 | team ALIEN |
88 | 88 | ship_type FIGHTER |
89 | - max_speed 450.0f | |
89 | + max_speed 400.0f | |
90 | 90 | armor 400.0f |
91 | 91 | turn_angle 100.0f |
92 | 92 | max_angular_velocity 2000.0f |
@@ -141,7 +141,7 @@ | ||
141 | 141 | name "Arcturus" |
142 | 142 | team HUMAN |
143 | 143 | ship_type FIGHTER |
144 | - max_speed 450.0f | |
144 | + max_speed 400.0f | |
145 | 145 | armor 100.0f |
146 | 146 | turn_angle 110.0f |
147 | 147 | max_angular_velocity 1200.0f |
@@ -164,7 +164,7 @@ | ||
164 | 164 | name "Dark Colbert" |
165 | 165 | team HUMAN |
166 | 166 | ship_type FIGHTER |
167 | - max_speed 500.0f | |
167 | + max_speed 450.0f | |
168 | 168 | armor 150.0f |
169 | 169 | turn_angle 100.0f |
170 | 170 | max_angular_velocity 1200.0f |
@@ -185,7 +185,7 @@ | ||
185 | 185 | name "Aldemarin" |
186 | 186 | team HUMAN |
187 | 187 | ship_type FIGHTER |
188 | - max_speed 440.0f | |
188 | + max_speed 390.0f | |
189 | 189 | armor 300.0f |
190 | 190 | turn_angle 70.0f |
191 | 191 | max_angular_velocity 2000.0f |
@@ -208,7 +208,7 @@ | ||
208 | 208 | name "Jovian Falcon" |
209 | 209 | team HUMAN |
210 | 210 | ship_type FIGHTER |
211 | - max_speed 450.0f | |
211 | + max_speed 400.0f | |
212 | 212 | armor 400.0f |
213 | 213 | turn_angle 60.0f |
214 | 214 | max_angular_velocity 2000.0f |
@@ -53,11 +53,12 @@ | ||
53 | 53 | weapon_type CONCUSSION |
54 | 54 | filename "missile_concssn.mesh" |
55 | 55 | name "missile_concussion" |
56 | - max_speed 1400.0f | |
56 | + max_speed 1000.0f | |
57 | 57 | turn_angle 0.0f |
58 | 58 | damage 20 |
59 | 59 | cooldown_time 1500 |
60 | 60 | default_missile_number 20 |
61 | + max_distance 4000.0f | |
61 | 62 | } |
62 | 63 | |
63 | 64 | weapon missile_homing |
@@ -65,13 +66,14 @@ | ||
65 | 66 | weapon_type HOMING |
66 | 67 | filename "missile_homing.mesh" |
67 | 68 | name "missile_homing" |
68 | - max_speed 1200.0f | |
69 | + max_speed 800.0f | |
69 | 70 | turn_angle 50.0f |
70 | 71 | max_angular_velocity 20.0f |
71 | 72 | damage 20 |
72 | 73 | cooldown_time 2000 |
73 | 74 | default_missile_number 20 |
74 | 75 | enemy_selection_time 800 |
76 | + max_distance 6000.0f | |
75 | 77 | } |
76 | 78 | |
77 | 79 | weapon missile_piranha |
@@ -79,14 +81,15 @@ | ||
79 | 81 | weapon_type PIRANHA |
80 | 82 | filename "missile_piranha.mesh" |
81 | 83 | name "missile_piranha" |
82 | - max_speed 1400.0f | |
84 | + max_speed 900.0f | |
83 | 85 | turn_angle 10.0f |
84 | 86 | max_angular_velocity 10.0f |
85 | 87 | damage 10 |
86 | 88 | cooldown_time 3000 |
87 | 89 | default_missile_number 10 |
88 | 90 | tracking_delay 2000 |
89 | - enemy_selection_time 1300 | |
91 | + enemy_selection_time 1000 | |
92 | + max_distance 6000.0f | |
90 | 93 | } |
91 | 94 | |
92 | 95 | weapon plasma |
@@ -106,11 +109,12 @@ | ||
106 | 109 | weapon_type MEGA |
107 | 110 | filename "missile_mega.mesh" |
108 | 111 | name "missile_mega" |
109 | - max_speed 800.0f | |
112 | + max_speed 600.0f | |
110 | 113 | turn_angle 0.0f |
111 | 114 | damage 100 |
112 | 115 | cooldown_time 8000 |
113 | 116 | default_missile_number 3 |
114 | - enemy_selection_time 3000 | |
117 | + enemy_selection_time 2000 | |
118 | + max_distance 4000.0f | |
115 | 119 | } |
116 | 120 | } |
\ No newline at end of file |