diff --git a/game.html b/game.html
index fcc70d0..e1fa317 100644
--- a/game.html
+++ b/game.html
@@ -10,7 +10,7 @@
Score: 0
- Version 1.1
+ Version 1.2c
diff --git a/game.js b/game.js
index 3b221f7..f504d5a 100644
--- a/game.js
+++ b/game.js
@@ -115,6 +115,7 @@ const spheres = [];
// wall segments
const borders = [];
let time = Date.now() / 1000.0;
+let averageFps = 60.0;
function logger(text) {
console.log(text);
@@ -216,7 +217,7 @@ init_gn();
// setup three.js: materials, geometries, scene, lighting and camera
let scene, renderer;
scene = new THREE.Scene();
-const camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.1, 10000);
+const camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.1, 5000);
// obstacle geometry and material
const geometrySphere = new THREE.SphereGeometry(11, 32, 32);
@@ -348,6 +349,7 @@ function animate() {
let now = Date.now() / 1000.0;
let delta = now - time;
time = now;
+ averageFps = (4 * averageFps + 1.0 / delta ) / 5.0;
requestAnimationFrame(animate);
@@ -439,6 +441,9 @@ function animate() {
removed = 0;
document.getElementById("score").innerText = score;
}
+ if (averageFps < 30.0 && renderer.getPixelRatio() == window.devicePixelRatio) {
+ renderer.setPixelRatio(window.devicePixelRatio / 2);
+ }
// create new wall segments on demand
if (borders.length == 0 || borders[borders.length - 1].position.z - camera.position.z > -1200) {
diff --git a/main.css b/main.css
index a284b69..527846e 100644
--- a/main.css
+++ b/main.css
@@ -46,6 +46,6 @@ button {
position: absolute;
bottom: 10px;
right: 10px;
- font-size: small;
+ font-size: x-small;
z-index: 1;
}