Compare commits

..

67 Commits

Author SHA1 Message Date
b70bdfb955 Add README 2025-05-21 10:19:08 +02:00
6de586ba01 meta 2025-05-20 17:02:24 +02:00
d0446e680d rename laby to loadingMaze 2024-03-20 16:41:00 +01:00
852394c54c perspective rotation 2024-03-20 16:38:26 +01:00
4717ec0877 loading perspective 2024-03-15 02:47:24 +01:00
9ac5c35c90 rotating loading maze 2024-03-14 21:37:05 +01:00
1fb8296bcd Merge branch 'master' of https://git.malingrey.fr/adrien/daedalus 2024-03-13 03:20:26 +01:00
1b8e4b2676 little fixes 2024-03-13 03:18:35 +01:00
dd8361cf33 - new loading screen
- huge loading time reducing by simplifiying ocean
2024-03-13 02:29:02 +01:00
4f20dce37f loading circle before instructions 2024-02-26 23:59:36 +01:00
eb36acac39 fov 2024-02-24 15:14:35 +01:00
ebe7c41578 use webp textures 2024-02-22 23:18:34 +01:00
97172aedf3 use cdn.jsdelivr.net 2024-02-22 23:16:43 +01:00
6ddf3b2949 use avif to reduce textures size 2024-02-19 15:18:55 +01:00
4722783018 remove hex tiling 2023-11-20 01:44:03 +01:00
96d485aabb format 2023-11-20 00:30:56 +01:00
d53b6a97c9 rename pressedMouseButtons 2023-11-18 16:33:38 +01:00
eb5b39529a combine ao roughness and metalness maps in one file for ground material 2023-11-18 16:31:40 +01:00
af8fdfd30e cleanup 2023-11-18 15:49:36 +01:00
2adbecea71 cleanup 2023-11-18 15:49:35 +01:00
9187d8d9ef Merge pull request 'use three-hex-tiling for ground material' (#1) from hexTiling into master
Reviewed-on: #1
2023-11-18 12:48:30 +01:00
a0b2aa96ad use three-hex-tiling for ground material 2023-11-18 12:45:50 +01:00
cb1b0bb541 import hexTiling 2023-11-18 11:38:19 +01:00
6e51b2f115 fix favicon and click 2023-10-15 09:50:36 +02:00
738e92c16b "you are here" in favicon (idea from Yves) 2023-10-11 20:44:26 +02:00
938160f053 deeper ground 2023-08-09 20:46:26 +02:00
75a173d0af threejs V155 2023-07-30 15:01:43 +02:00
3bb43edcee cursor 2023-07-30 14:32:25 +02:00
b318adb469 learn to swim 2023-07-29 17:46:07 +02:00
cee4d886c0 new texture again 2023-07-28 22:35:12 +02:00
cd313b363c tunning 2023-07-28 19:12:02 +02:00
acca8eb92b use Poly textures 2023-07-28 19:10:13 +02:00
75f70a1bac instancedMesh.count 2023-07-13 21:05:40 +02:00
5a85c0cae2 three v154 2023-07-08 17:41:27 +02:00
3f84ddd8df debug 2023-06-30 02:02:31 +02:00
f95f23562e fix Uncaught TypeError? 2023-06-30 01:45:06 +02:00
8732caef73 rename mazeCollisionner 2023-06-29 22:12:41 +02:00
dde4848101 collisions 2023-06-29 22:07:24 +02:00
2d12cf2a47 fix mal de mer 2023-06-29 22:05:08 +02:00
ba41eb9893 200px loading preogress circle 2023-06-29 22:04:54 +02:00
dd2104648e move on mouse button pressed 2023-06-29 18:14:20 +02:00
bed8224c79 new loading progress circle 2023-06-29 16:45:40 +02:00
cb1e89c732 progressCircle 2023-06-29 00:29:36 +02:00
6079d802f2 loading progress circle 2023-06-28 17:37:52 +02:00
bff47a6bbe material tweaks 2023-06-28 15:25:11 +02:00
7bc2344d32 fix sideGroundMaterial 2023-06-28 08:58:42 +02:00
c8982cb0cb fix sideGroundMaterial 2023-06-28 08:56:47 +02:00
6c9fed62b0 less light 2023-06-28 03:21:32 +02:00
51ac2cf0f0 raft world octree 2023-06-28 03:02:53 +02:00
6b5760ac3f format 2023-06-28 02:51:24 +02:00
960103b162 skybox 2023-06-28 02:48:30 +02:00
e89dcb8937 MeshStandardMaterial 2023-06-28 01:07:52 +02:00
596a227eaf better shadow 2023-06-27 20:02:09 +02:00
4afc42ec2f betterrer collisions 2023-06-27 19:20:54 +02:00
eb3ae6f00c better collisions 2023-06-27 18:50:09 +02:00
f582e68d89 tweaks 2023-06-27 02:41:16 +02:00
4c68d9dc83 raft side material 2023-06-27 02:00:53 +02:00
83d6a84c6f lights 2023-06-27 01:13:41 +02:00
6ae40737d3 larger raft 2023-06-27 00:50:42 +02:00
215e15a945 PBR Materials 2023-06-27 00:44:39 +02:00
be609f4137 less mouse sensibility 2023-06-25 22:28:39 +02:00
b073a7d5da escape restart 2023-06-25 22:22:53 +02:00
8b21e6ce14 renderer.setAnimationLoop(animate) 2023-06-24 00:17:22 +02:00
da93c41e43 renderer.setAnimationLoop 2023-06-23 23:53:22 +02:00
52ced3f0f1 physicallyCorrectLights 2023-06-23 21:03:59 +02:00
4275a9933b module import 2023-06-21 01:58:08 +02:00
9ca6c3a2e9 loading bar 2023-06-21 01:42:31 +02:00
67 changed files with 674 additions and 492 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
textures/old/

View File

@ -1,28 +1,29 @@
import * as THREE from 'three'; import * as THREE from 'three';
const mazeGeometry = new THREE.BoxGeometry( 1, 1, 1 );
export default class MazeMesh extends THREE.InstancedMesh { export default class MazeMesh extends THREE.InstancedMesh {
constructor( width, length, material ) { constructor( width, length, height, material ) {
super( mazeGeometry, material, width*length - 2 ); super(
new THREE.BoxGeometry( 1, height, 1 ),
material,
width*length - 2
);
this.length = length this.length = length
this.width = width this.width = width
this.map = new Array(length).fill().map(() => new Array(width).fill(1)) this.map = new Array(length).fill().map(() => new Array(width).fill(1))
this.start = new THREE.Vector3(width/2, .1, length/2) this.start = new THREE.Vector3(width/2, .1, length/2)
this.exit = new THREE.Vector3(Math.floor(width/2), 0, 1) this.exit = new THREE.Vector3(Math.floor(width/2), 0, 1)
this.count = length * width - 2
this.dig(this.exit) this.dig(this.exit)
this.dig(new THREE.Vector3(Math.floor(width/2), 0, 0)) this.dig(new THREE.Vector3(Math.floor(width/2), 0, 0))
this.build ( this.exit ) this.build ( this.exit )
let matrix = new THREE.Matrix4() let matrix = new THREE.Matrix4()
let i=0 this.count = 0
this.map.forEach((row, z) => { this.map.forEach((row, z) => {
row.forEach((isWall, x) => { row.forEach((isWall, x) => {
if (isWall) { if (isWall) {
matrix.setPosition( x + .5 - width/2, 0.5, z + .5 - length/2) matrix.setPosition( x + .5 - width/2, 0.5, z + .5 - length/2)
this.setMatrixAt( i, matrix ); this.setMatrixAt( this.count, matrix );
i++ this.count++
} }
}) })
}) })
@ -53,6 +54,7 @@ export default class MazeMesh extends THREE.InstancedMesh {
isWall(position) { isWall(position) {
if (0 <= position.x && position.x < this.width && if (0 <= position.x && position.x < this.width &&
0 <= position.y &&
0 <= position.z && position.z < this.length) { 0 <= position.z && position.z < this.length) {
return this.map[Math.floor(position.z)][Math.floor(position.x)] return this.map[Math.floor(position.z)][Math.floor(position.x)]
} else { } else {
@ -60,6 +62,10 @@ export default class MazeMesh extends THREE.InstancedMesh {
} }
} }
collision(position) {
return this.isWall(this.worldToLocal(position))
}
toString() { toString() {
return this.map.map(row => return this.map.map(row =>
row.map(isWall => isWall? "██":" ").join("") row.map(isWall => isWall? "██":" ").join("")

5
README.md Normal file
View File

@ -0,0 +1,5 @@
# Daedalus
3D Maze Web game made with Three.js library
![screenshot](https://git.malingrey.fr/adrien/daedalus/raw/branch/master/thumbnail.png)

BIN
favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 762 B

View File

@ -2,43 +2,15 @@
header('Content-Type: image/x-icon'); header('Content-Type: image/x-icon');
const SIZE = 16; const SIZE = 16;
const WALL = 1;
const GROUND = 0;
$favicon = imagecreatetruecolor(SIZE, SIZE); $x = filter_input(INPUT_GET, "x", FILTER_SANITIZE_NUMBER_INT);
$wallColor = imagecolorallocate($favicon, 165, 80, 30); $y = filter_input(INPUT_GET, "y", FILTER_SANITIZE_NUMBER_INT);
$groundColor = imagecolorallocate($favicon, 203, 162, 133);
imagefill($favicon, 0, 0, $wallColor); $favicon = imagecreatefrombmp("favicon.ico");
$maze = array(); $red = imagecolorallocate($favicon, 255, 0, 0);
for ($y = 0; $y < SIZE; $y++) { imagesetpixel($favicon, $x, $y, $red);
$maze[$y] = array();
for ($x = 0; $x < SIZE; $x++) {
$maze[$y][$x] = WALL;
}
}
function dig($position) {
global $maze;
global $favicon;
global $groundColor;
$directions = [[0, 1], [0, -1], [1, 0], [-1, 0]];
shuffle($directions);
foreach ($directions as $direction) {
$step1 = [$position[0] + $direction[0], $position[1] + $direction[1]];
$step2 = [$step1[0] + $direction[0], $step1[1] + $direction[1]];
if (0 <= $step2[1] and $step2[1] < SIZE and 0 <= $step2[0] and $step2[0] < SIZE and $maze[$step2[1]][$step2[0]] == WALL) {
$maze[$step1[1]][$step1[0]] = GROUND;
imagesetpixel($favicon, $step1[0], $step1[1], $groundColor);
$maze[$step2[1]][$step2[0]] = GROUND;
imagesetpixel($favicon, $step2[0], $step2[1], $groundColor);
dig($step2);
}
}
}
dig([1, 1]);
imagebmp($favicon); imagebmp($favicon);
imagedestroy($favicon); imagedestroy($favicon);
?> ?>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 501 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 115 KiB

View File

@ -1,19 +1,28 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="fr"> <html lang="fr">
<head> <head>
<title>Daedalus</title>
<meta charset=utf-8 /> <meta charset=utf-8 />
<title>Daedalus</title>
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"> <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<link rel="shortcut icon" type="image/x-icon" href="favicon.php"/> <link rel="shortcut icon" type="image/x-icon" href="favicon.ico" id="favicon"/>
<meta property="og:title" content="Daedalus"/>
<meta property="og:type" content="game"/>
<meta property="og:url" content="https://adrien.malingrey.fr/jeux/daedalus/"/>
<meta property="og:image" content="https://adrien.malingrey.fr/jeux/daedalus/thumbnail.png"/>
<meta property="og:image:width" content="250"/>
<meta property="og:image:height" content="250"/>
<meta property="og:description" content="Retrouvez la sortie"/>
<meta property="og:locale" content="fr_FR"/>
<meta property="og:site_name" content="adrien.malingrey.fr"/>
<link rel="stylesheet" href="style.css"> <link rel="stylesheet" href="style.css">
<!-- Import maps polyfill --> <!-- Import maps polyfill -->
<!-- Remove this when import maps will be widely supported --> <!-- Remove this when import maps will be widely supported -->
<script async src="https://unpkg.com/es-module-shims@1.6.3/dist/es-module-shims.js"></script> <script async src="https://cdn.jsdelivr.net/npm/es-module-shims@1.8.3/dist/es-module-shims.min.js"></script>
<script type="importmap"> <script type="importmap">
{ {
"imports": { "imports": {
"three": "https://unpkg.com/three@0.152.2/build/three.module.js", "three": "https://cdn.jsdelivr.net/npm/three@0.169.0/build/three.module.min.js",
"three/addons/": "https://unpkg.com/three@0.152.2/examples/jsm/" "three/addons/": "https://cdn.jsdelivr.net/npm/three@0.169.0/examples/jsm/"
} }
} }
</script> </script>
@ -142,10 +151,20 @@
</script> </script>
</head> </head>
<body> <body>
<div id="loading">
<div id="loadingMazeShadow">
<table id="loadingMazeTable"></table>
</div>
<div id="loadingMessage">Construction du labyrinthe : <span id="progress">0</span>%</div>
<div>
Se déplacer : ↑←↓→, ZQSD ou clic<br/>
Sauter : ESPACE<br/>
Regarder : Souris
</div>
</div>
<div id="container"></div> <div id="container"></div>
<span id="message"><a href="" title="Rejouer">Libre !</a></span> <span id="message"></span>
<script type="module" src="main.js"></script>
<script type="module" src="./main.js"></script>
</body> </body>
</html> </html>

929
main.js

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,74 @@
body { body {
margin: 0; margin: 0;
background-color: #000; background-color: #041626;
color: #fff; font-size: 1.3em;
font-family: Monospace;
font-size: 13px;
line-height: 24px;
overscroll-behavior: none; overscroll-behavior: none;
cursor: progress;
}
#loading {
width: fit-content;
color: #2c5c88;
font-size: 1.3em;
top: 20vh;
margin: auto;
font-family: sans-serif;
}
#loadingMessage {
margin-bottom: 0.5em;
}
@keyframes perspective {
from {
transform: rotateX(0deg) perspective(0px);
filter: drop-shadow(0px 00px 0px #0f2437);
}
to {
transform: rotateX(40deg) perspective(150px);
filter: drop-shadow(0px 10px 0px #0f2437);
}
}
#loadingMazeShadow {
width: 230px;
height: 230px;
margin-left: auto;
margin-right: auto;
margin-top: 20vh;
margin-bottom: 5vh;
animation: perspective 30s;
}
@keyframes rotation {
from {
transform: rotateZ(0deg);
}
to {
transform: rotateZ(360deg);
}
}
#loadingMazeTable {
border-collapse: collapse;
animation: rotation 60s infinite;
border: none;
}
#loadingMazeTable td {
width: 10px;
height: 10px;
transition: background-color 1s;
border: none;
padding: 0;
}
.wall {
background-color: transparent;
}
.ground {
background-color: #214464;
} }
#container { #container {
@ -30,21 +93,22 @@ body {
position: absolute; position: absolute;
left: 0; left: 0;
width: 100%; width: 100%;
font-size: 10vh;
font-family: Georgia, serif;
background: transparent; background: transparent;
justify-content: center; justify-content: center;
z-index: 1; z-index: 1;
color: gray;
font-family: serif;
} }
#message a { #message a {
color: gray; color: inherit;
text-decoration: none;
} }
#message.escaped { #message.escaped {
display: flex; display: block;
opacity: 100%; opacity: 100%;
font-size: 4vh;
text-align: center;
top: 30vh; top: 30vh;
animation: escaped 5s; animation: escaped 5s;
} }

View File

@ -0,0 +1,3 @@
This asset was made with Poly, an AI-generated design asset marketplace that lets you find and create incredibly life-like, detailed, and artistic assets for your next project, in seconds.
Get started for free at https://withpoly.com

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 209 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 324 KiB

View File

@ -0,0 +1,23 @@
{
"prompt_text": "cobblestone wall with grass and flowers between rocks",
"patch": {
"ext": "png",
"dtype": "uint8",
"width": 512,
"height": 512,
"url": "https://static-dev.withpoly.com/v3-voronoi/textures/patches/486f8eed-0dfd-4bdc-9dee-3776fc72b1f1.png",
"patch_id": "GVpEsGuQ8S"
},
"seamless_prompt_text": "cobblestone wall with grass and flowers between rocks",
"seamless_patch_scale": 0.98,
"upscale_prompt_text": "cobblestone wall with grass and flowers between rocks",
"upscale_resolution": 4096,
"is_seamless": true,
"pbr_mode": "organic",
"pbr_use_render_as_color": true,
"pbr_generate_normal": true,
"pbr_generate_height": true,
"pbr_generate_ao": true,
"pbr_generate_roughness": true,
"pbr_generate_metallic": false
}

View File

@ -0,0 +1,3 @@
This asset was made with Poly, an AI-generated design asset marketplace that lets you find and create incredibly life-like, detailed, and artistic assets for your next project, in seconds.
Get started for free at https://withpoly.com

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 372 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 595 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 542 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 803 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 475 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

View File

@ -0,0 +1,23 @@
{
"prompt_text": "wood, planks, wooden, green paint, painted wood, paint, scrathes, raw wood, peeling paint",
"patch": {
"ext": "png",
"dtype": "uint8",
"width": 512,
"height": 512,
"url": "https://static-dev.withpoly.com/v3-voronoi/textures/patches/0ddfc901-a5dd-40f0-993b-8de3ccefb7f7.png",
"patch_id": "a79eceALs5"
},
"seamless_prompt_text": "wood, planks, wooden, green paint, painted wood, paint, scrathes, raw wood, peeling paint",
"seamless_patch_scale": 0.8,
"upscale_prompt_text": "wood, planks, wooden, green paint, painted wood, paint, scrathes, raw wood, peeling paint",
"upscale_resolution": 4096,
"is_seamless": true,
"pbr_mode": "matte",
"pbr_generate_color": true,
"pbr_generate_normal": true,
"pbr_generate_height": true,
"pbr_generate_ao": true,
"pbr_generate_roughness": true,
"pbr_generate_metallic": false
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 566 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 396 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 160 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 252 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

View File

Before

Width:  |  Height:  |  Size: 243 KiB

After

Width:  |  Height:  |  Size: 243 KiB

BIN
textures/waternormals.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB