Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v1.10.0 - dev to main #227

Merged
merged 45 commits into from
Jan 16, 2025
Merged
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
8dd37c7
feat: add protection field to Player
IsaacThoman Jan 4, 2025
9cb9687
add respawn_delay to config
IsaacThoman Jan 4, 2025
f2f8778
default protection to 1
IsaacThoman Jan 4, 2025
0339697
adjust default health regen slightly
IsaacThoman Jan 4, 2025
85564bf
enhancement: make projected size of hit indicators physically accurate
IsaacThoman Jan 4, 2025
ded81ea
sparkle test
IsaacThoman Jan 6, 2025
2350420
Merge branch 'main' into dev
IsaacThoman Jan 6, 2025
ca2f087
arrow assets
IsaacThoman Jan 7, 2025
78c7f1b
start of direction arrow, make generic 3D indicator base
IsaacThoman Jan 7, 2025
65c3493
add height, lerp to direction indicator
IsaacThoman Jan 7, 2025
4be30e5
add fog
IsaacThoman Jan 7, 2025
52b98e7
direction indicator use perspective camera, better fog
IsaacThoman Jan 7, 2025
2201dfb
fix: let user use default name in chat
IsaacThoman Jan 8, 2025
00a0efd
update lockfile?
IsaacThoman Jan 8, 2025
8e90914
Merge pull request #218 from candirugame/fix-dont-require-name-for-chat
IsaacThoman Jan 8, 2025
6d21d4c
Merge remote-tracking branch 'origin/dev' into feat-ctf-gamemode
IsaacThoman Jan 8, 2025
f8a8c41
feat: add client outdated message
IsaacThoman Jan 8, 2025
961b07d
hiding and showing arrow
IsaacThoman Jan 8, 2025
73226a6
format docs, add flag to item list
IsaacThoman Jan 10, 2025
506f63d
add flag item
IsaacThoman Jan 10, 2025
4433a70
style: lint issues
IsaacThoman Jan 10, 2025
8adc1b5
chore:remove extra healthIndicator render call
IsaacThoman Jan 10, 2025
568a121
docs: add texture compression script
IsaacThoman Jan 13, 2025
5db5b9a
chore: upload pizza and flamingo models
IsaacThoman Jan 13, 2025
f7f21a2
chore: reorient pizza, update flagItem to pizza
IsaacThoman Jan 13, 2025
0c2e963
refactor: move direction indicator data to player
IsaacThoman Jan 13, 2025
e9edbc3
ctf demo
IsaacThoman Jan 14, 2025
1a7c661
revert: undo item renderer changes
IsaacThoman Jan 14, 2025
052a9be
fix: don't generate an extra broken flag
IsaacThoman Jan 14, 2025
a6214e6
fix: pick up items even when also touching item you already have
IsaacThoman Jan 14, 2025
e3c0fdc
style: add colors to gameMsgs
IsaacThoman Jan 14, 2025
83ef136
lint: no explicit 'any'
IsaacThoman Jan 14, 2025
142e31c
chore: decrease default cleanup delay
IsaacThoman Jan 14, 2025
d5040d9
chore: adjust msg color, move directionIndicator below text
IsaacThoman Jan 14, 2025
8bbc837
feat: everyone to spectate winner on win
IsaacThoman Jan 15, 2025
479d2b6
Revert "fix: let user use default name in chat"
IsaacThoman Jan 15, 2025
35b228b
fix: don't leave crosshair in blank name
IsaacThoman Jan 15, 2025
478ed0b
Merge pull request #222 from candirugame/revert-218-fix-dont-require-…
IsaacThoman Jan 15, 2025
b147059
Merge branch 'dev' into feat-ctf-gamemode
IsaacThoman Jan 15, 2025
6b5fbde
clear all world items on CTF win reset
IsaacThoman Jan 15, 2025
d75b541
lint: remove unused
IsaacThoman Jan 15, 2025
e674132
feat: add sky color to serverInfo
IsaacThoman Jan 15, 2025
c6278d6
feat: add possum heaven
IsaacThoman Jan 15, 2025
5c58301
balance: slightly faster item spawns, slower disconnect
IsaacThoman Jan 15, 2025
62c3c33
Merge pull request #214 from candirugame/feat-ctf-gamemode
IsaacThoman Jan 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/client/core/Networking.ts
Original file line number Diff line number Diff line change
@@ -196,6 +196,7 @@ export class Networking {
this.localPlayer.playerSpectating = remotePlayer.playerSpectating;
this.localPlayer.gameMsgs = remotePlayer.gameMsgs;
this.localPlayer.gameMsgs2 = remotePlayer.gameMsgs2;
this.localPlayer.doPhysics = remotePlayer.doPhysics;
continue;
}
if (remotePlayer.chatActive) {
76 changes: 39 additions & 37 deletions src/client/input/CollisionManager.ts
Original file line number Diff line number Diff line change
@@ -61,7 +61,7 @@ export class CollisionManager {
this.prevPosition.copy(localPlayer.position);
const jump: boolean = this.inputHandler.jump;

localPlayer.gravity += deltaTime * -30;
if (localPlayer.doPhysics) localPlayer.gravity += deltaTime * -30;
localPlayer.inputVelocity.y += localPlayer.gravity;
localPlayer.inputVelocity.y = (localPlayer.inputVelocity.y + this.inputHandler.prevInputVelocity.y) * .25;
localPlayer.position.add(localPlayer.inputVelocity.clone().multiplyScalar(deltaTime));
@@ -73,45 +73,47 @@ export class CollisionManager {

this.collided = false;

bvh.shapecast({
intersectsBounds: (box: THREE.Box3) => {
return box.intersectsSphere(this.colliderSphere);
},

intersectsTriangle: (tri: THREE.Triangle) => {
// Get delta between the closest point and center
tri.closestPointToPoint(this.colliderSphere.center, this.deltaVec);
this.deltaVec.sub(this.colliderSphere.center);
const distance: number = this.deltaVec.length();

if (distance < this.colliderSphere.radius) {
// Move the sphere position to be outside the triangle
const radius: number = this.colliderSphere.radius;
const depth: number = distance - radius;
this.deltaVec.multiplyScalar(1 / distance);

tri.getNormal(this.triNormal);
const angle: number = this.triNormal.dot(this.upVector);

if (angle >= CollisionManager.maxAngle) {
localPlayer.position.addScaledVector(this.deltaVec, depth);
localPlayer.inputVelocity.y = 0;
localPlayer.gravity = 0;
this.coyoteTime = 0;
this.collided = true;
} else {
localPlayer.position.addScaledVector(this.deltaVec, depth);
if (localPlayer.doPhysics) {
bvh.shapecast({
intersectsBounds: (box: THREE.Box3) => {
return box.intersectsSphere(this.colliderSphere);
},

intersectsTriangle: (tri: THREE.Triangle) => {
// Get delta between the closest point and center
tri.closestPointToPoint(this.colliderSphere.center, this.deltaVec);
this.deltaVec.sub(this.colliderSphere.center);
const distance: number = this.deltaVec.length();

if (distance < this.colliderSphere.radius) {
// Move the sphere position to be outside the triangle
const radius: number = this.colliderSphere.radius;
const depth: number = distance - radius;
this.deltaVec.multiplyScalar(1 / distance);

tri.getNormal(this.triNormal);
const angle: number = this.triNormal.dot(this.upVector);

if (angle >= CollisionManager.maxAngle) {
localPlayer.position.addScaledVector(this.deltaVec, depth);
localPlayer.inputVelocity.y = 0;
localPlayer.gravity = 0;
this.coyoteTime = 0;
this.collided = true;
} else {
localPlayer.position.addScaledVector(this.deltaVec, depth);
}
}
}

this.colliderSphere.center = localPlayer.position.clone();
return false;
},
this.colliderSphere.center = localPlayer.position.clone();
return false;
},

boundsTraverseOrder: (box: THREE.Box3) => {
return box.distanceToPoint(this.colliderSphere.center) - this.colliderSphere.radius;
},
});
boundsTraverseOrder: (box: THREE.Box3) => {
return box.distanceToPoint(this.colliderSphere.center) - this.colliderSphere.radius;
},
});
}

if (!this.collided) {
this.coyoteTime += deltaTime;
1 change: 1 addition & 0 deletions src/server/DataValidator.ts
Original file line number Diff line number Diff line change
@@ -65,6 +65,7 @@ export class DataValidator {
gameMsgs2: z.array(z.string()),
directionIndicatorVector: this.vector3Schema.nullable().optional(),
highlightedVectors: z.array(this.vector3Schema),
doPhysics: z.boolean(),
}).strict().transform((data) => Player.fromObject(data as Player));

static chatMsgSchema = z.object({
10 changes: 9 additions & 1 deletion src/server/gamemodes/SoloCTFGamemode.ts
Original file line number Diff line number Diff line change
@@ -117,6 +117,8 @@ export class SoloCTFGamemode extends FFAGamemode {
}
}

for (const player of players) player.doPhysics = true;

for (const player of players) {
const extras = this.gameEngine.playerManager.getPlayerExtrasById(player.id);
if (!extras) continue;
@@ -274,11 +276,15 @@ export class SoloCTFGamemode extends FFAGamemode {
this.winner = winner;
this.gameEngine.serverInfo.skyColor = '#FFFFFF';
// Schedule to unset the win announcement flag after the respawn delay and reset the game
winner.doPhysics = false;
winner.gravity = 1.5;
winner.forced = true;
setTimeout(() => {
this.resetAfterWin();
this.isAnnouncingWin = false;
this.winner = null;
}, config.game.respawnDelay * 1000);
console.log(`🏆 ${winner.name} has won the Solo CTF game!`);
}

private doWinAnnouncement() {
@@ -308,7 +314,6 @@ export class SoloCTFGamemode extends FFAGamemode {
this.gameEngine.setGameMessage(player, ``, 1, config.game.respawnDelay);
}
}
console.log(`🏆 ${winner.name} has won the Solo CTF game!`);
}

/**
@@ -325,6 +330,9 @@ export class SoloCTFGamemode extends FFAGamemode {
// Remove spectate status
player.playerSpectating = -1;

//make player do physics again
player.doPhysics = true;

// Clear direction indicators
player.directionIndicatorVector = undefined;

1 change: 1 addition & 0 deletions src/server/managers/PlayerManager.ts
Original file line number Diff line number Diff line change
@@ -60,6 +60,7 @@ export class PlayerManager {
player.gameMsgs = existingPlayerData.player.gameMsgs;
player.gameMsgs2 = existingPlayerData.player.gameMsgs2;
player.playerSpectating = existingPlayerData.player.playerSpectating;
player.doPhysics = existingPlayerData.player.doPhysics;
player.updateTimestamp = Date.now() / 1000;

const updatedData: PlayerWithExtras = {
1 change: 1 addition & 0 deletions src/shared/Player.ts
Original file line number Diff line number Diff line change
@@ -34,6 +34,7 @@ export class Player {
public lastDamageTime?: number; //server-controlled
public directionIndicatorVector?: THREE.Vector3 = undefined; //server-controlled
public highlightedVectors: THREE.Vector3[] = []; //new THREE.Vector3(5.92, 1.21, -4.10)
public doPhysics: boolean = true; //server-controlled

static fromObject(data: Player): Player {
const instance = new Player();