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
Show file tree
Hide file tree
Changes from all commits
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
Binary file added assets/arrow.blend
Binary file not shown.
Binary file added assets/arrow.blend1
Binary file not shown.
1 change: 0 additions & 1 deletion deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 8 additions & 5 deletions docs/Items.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
## Items

Item ID list with implementation info
| ID | Class | Item Description | Inventory | World |
|----|--------------|---------------------------------------|-------------|-------|
| 0 | ItemBase.ts | Base item template (freaky green cube)| ✅ | ✅ |
| 1 | BananaGun.ts | Banana gun | ✅ | ✅ |
| 1 | FishGun.ts | Fish gun >:) | ✅ | ✅ |

| ID | Class | Item Description | Inventory | World |
| -- | ------------ | -------------------------------------- | --------- | ----- |
| 0 | ItemBase.ts | Base item template (freaky green cube) | ✅ | ✅ |
| 1 | BananaGun.ts | Banana gun | ✅ | ✅ |
| 2 | FishGun.ts | Fish gun >:) | ✅ | ✅ |
| 4 | FlagItem.ts | FlagItem used in CTF | ✅ | ✅ |
42 changes: 42 additions & 0 deletions docs/blender-texture-resolution.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Reduce Texture Resolution of a Blender File

The following python script reduces the resolution of all textures in a Blender file by 50%.

```python
import bpy

def resize_image(image, scale_factor=0.5):
# Calculate new dimensions
new_width = int(image.size[0] * scale_factor)
new_height = int(image.size[1] * scale_factor)

# Ensure the image is packed or has a file path
if image.packed_file:
image.unpack(method='USE_ORIGINAL')

# Get the file path
filepath = bpy.path.abspath(image.filepath)

# Skip images without a valid file path
if not filepath:
print(f"Skipping image '{image.name}' because it has no valid file path.")
return

# Scale the image
image.scale(new_width, new_height)

# Save the resized image
image.filepath_raw = filepath
image.file_format = 'PNG' # Change format if needed
image.save()

def main():
# Iterate over all images in the Blender file
for image in bpy.data.images:
if image.size[0] > 0 and image.size[1] > 0:
print(f"Processing image: {image.name}")
resize_image(image)

if __name__ == "__main__":
main()
```
18 changes: 13 additions & 5 deletions docs/gltf-compression.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,46 @@
# GLTF Compression

### use gltf-pipeline for compression

https://github.com/CesiumGS/gltf-pipeline

Can be installed using npm:

```bash
npm install -g gltf-pipeline
```

### sane person compression if it's already stylized:

```bash
gltf-pipeline -i input.glb -o output.glb --draco.compressionLevel 10 --texcomp.quality 50 --texcomp.powerOfTwoImage true
```

This command:

1. Uses Draco compression with maximum level (10)
2. Reduces the precision of various attributes (position, normal, texture coordinates, color, and other generic attributes) by specifying fewer bits for each. This effectively removes data points. 3.
2. Reduces the precision of various attributes (position, normal, texture coordinates, color, and other generic
attributes) by specifying fewer bits for each. This effectively removes data points. 3.
3. Applies the --optimize.simplify flag, which attempts to simplify the geometry while preserving the overall shape.

You can adjust the quantization bits (the numbers after each quantize...Bits option) to be even lower for more aggressive simplification. For example:
You can adjust the quantization bits (the numbers after each quantize...Bits option) to be even lower for more
aggressive simplification. For example:

```bash
--draco.quantizePositionBits 8 --draco.quantizeNormalBits 6 --draco.quantizeTexcoordBits 6 --draco.quantizeColorBits 6 --draco.quantizeGenericBits 6
```


### really abysmal compression to "stylize" something normal
(used for possum and banana so far)- uses 8 for quantization leading to gross blocky look sometimes unintended with holes

(used for possum and banana so far)- uses 8 for quantization leading to gross blocky look sometimes unintended with
holes

```bash
gltf-pipeline -i possum.glb -o simplified_possum.glb --draco.compressionLevel 10 --draco.quantizePositionBits 6 --draco.quantizeNormalBits 4 --draco.quantizeTexcoordBits 4 --draco.quantizeColorBits 4 --draco.quantizeGenericBits 4 --optimize.simplify
```

#### not sure what this one does, added a bunch more flags might break things lmk tho

```bash
gltf-pipeline -i possum.glb -o simplified_possum.glb --draco.compressionLevel 10 --draco.quantizePositionBits 6 --draco.quantizeNormalBits 4 --draco.quantizeTexcoordBits 4 --draco.quantizeColorBits 4 --draco.quantizeGenericBits 4 --optimize.simplify --optimize.pruneUnused --optimize.mergeInstances --optimize.mergeMaterials --optimize.stripJoints
```
```
Binary file added public/models/arrow.glb
Binary file not shown.
Binary file added public/models/flamingo.glb
Binary file not shown.
Binary file added public/models/pizza.glb
Binary file not shown.
Binary file added public/models/simplified_flamingo.glb
Binary file not shown.
Binary file added public/models/simplified_pizza.glb
Binary file not shown.
1 change: 0 additions & 1 deletion src/client/core/Game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ export class Game {
this.networking.updatePlayerData();
this.chatOverlay.onFrame();
this.inventoryManager.onFrame();
this.healthIndicator.onFrame();
this.renderer.onFrame(this.localPlayer);
if (this.networking.getServerInfo().mapName) {
this.mapLoader.load('/maps/' + this.networking.getServerInfo().mapName + '/map.glb');
Expand Down
6 changes: 6 additions & 0 deletions src/client/core/Inventory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Networking } from './Networking.ts';
import { ItemBase, ItemType } from '../items/ItemBase.ts';
import { FishGun } from '../items/FishGun.ts';
import { Player } from '../../shared/Player.ts';
import { FlagItem } from '../items/FlagItem.ts';

export class Inventory {
private inventoryItems: ItemBase[] = [];
Expand Down Expand Up @@ -63,6 +64,11 @@ export class Inventory {
this.inventoryItems.push(fish);
break;
}
case 4: {
const flag = new FlagItem(this.renderer, i, ItemType.InventoryItem);
this.inventoryItems.push(flag);
break;
}
default: {
const testItem = new ItemBase(
ItemType.InventoryItem,
Expand Down
25 changes: 23 additions & 2 deletions src/client/core/Networking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ interface ServerInfo {
version: string;
gameMode: string;
playerMaxHealth: number;
skyColor: string;
}

interface LastUploadedLocalPlayer {
Expand Down Expand Up @@ -68,6 +69,7 @@ export class Networking {
version: '',
gameMode: '',
playerMaxHealth: 0,
skyColor: '#000000',
};

this.setupSocketListeners();
Expand Down Expand Up @@ -104,7 +106,9 @@ export class Networking {
});

this.socket.on('serverInfo', (data) => {
this.serverInfo = data;
this.serverInfo = {
...data,
};
this.onServerInfo();
});
}
Expand Down Expand Up @@ -176,17 +180,34 @@ export class Networking {
}
if (remotePlayer.health < this.localPlayer.health) this.damagedTimestamp = Date.now() / 1000;
this.localPlayer.health = remotePlayer.health;
this.localPlayer.highlightedVectors = remotePlayer.highlightedVectors.map(
(vec) => new THREE.Vector3(vec.x, vec.y, vec.z),
);
this.localPlayer.directionIndicatorVector = remotePlayer.directionIndicatorVector
? new THREE.Vector3(
remotePlayer.directionIndicatorVector.x,
remotePlayer.directionIndicatorVector.y,
remotePlayer.directionIndicatorVector.z,
)
: undefined;

this.localPlayer.idLastDamagedBy = remotePlayer.idLastDamagedBy;
this.localPlayer.inventory = remotePlayer.inventory;
this.localPlayer.playerSpectating = remotePlayer.playerSpectating;
this.localPlayer.gameMsgs = remotePlayer.gameMsgs;
this.localPlayer.gameMsgs2 = remotePlayer.gameMsgs2;
this.localPlayer.doPhysics = remotePlayer.doPhysics;
continue;
}
if (remotePlayer.chatActive) {
this.messagesBeingTyped.push(`${remotePlayer.name}: ${remotePlayer.chatMsg}`);
}
}
if (
this.getServerInfo().version && this.localPlayer.gameVersion !== this.getServerInfo().version
) {
this.localPlayer.gameMsgs = ['&c Your client may be outdated. Try refreshing the page.'];
}
}

private playersAreEqualEnough(player1: Player, player2: LastUploadedLocalPlayer | null) {
Expand Down Expand Up @@ -217,7 +238,7 @@ export class Networking {
const chatMessage = {
message: msg,
id: this.localPlayer.id,
name: this.localPlayer.name,
name: this.getRemotePlayerData().find((player) => player.id === this.localPlayer.id)!.name,
};
if (msg.length < 1) return;
if (chatMessage.message.startsWith('>')) chatMessage.message = '&2' + chatMessage.message;
Expand Down
4 changes: 4 additions & 0 deletions src/client/core/RemoteItemRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Renderer } from './Renderer.ts';
import { ItemBase, ItemType } from '../items/ItemBase.ts';
import { BananaGun } from '../items/BananaGun.ts';
import { FishGun } from '../items/FishGun.ts';
import { FlagItem } from '../items/FlagItem.ts';

// Custom types
type Vector3Data = {
Expand Down Expand Up @@ -89,8 +90,11 @@ export class RemoteItemRenderer {
return new BananaGun(this.renderer, this.networking, 0, ItemType.WorldItem);
case 2:
return new FishGun(this.renderer, this.networking, 0, ItemType.WorldItem);
case 4:
return new FlagItem(this.renderer, 0, ItemType.WorldItem);
default:
// Return a generic item
console.log('Unknown item type:', itemType);
return new ItemBase(
ItemType.WorldItem,
this.renderer.getEntityScene(),
Expand Down
Loading
Loading