docker. minor updates that don't really need any message.
This commit is contained in:
parent
29ba1c29d7
commit
19bea535ec
3
.dockerignore
Normal file
3
.dockerignore
Normal file
@ -0,0 +1,3 @@
|
||||
**/.git
|
||||
**/.DS_Store
|
||||
**/node_modules
|
20
Dockerfile.client
Normal file
20
Dockerfile.client
Normal file
@ -0,0 +1,20 @@
|
||||
# build
|
||||
FROM node:18-alpine as build
|
||||
|
||||
COPY . /app
|
||||
WORKDIR /app/client
|
||||
|
||||
RUN npm install --save-dev
|
||||
RUN npm run build
|
||||
|
||||
|
||||
# serve via nginx
|
||||
FROM nginx:latest
|
||||
|
||||
RUN rm /etc/nginx/conf.d/default.conf
|
||||
COPY nginx.conf /etc/nginx/conf.d/
|
||||
|
||||
COPY --from=build /app/client/dist /usr/share/nginx/html
|
||||
|
||||
EXPOSE 80
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
9
Dockerfile.server
Normal file
9
Dockerfile.server
Normal file
@ -0,0 +1,9 @@
|
||||
FROM oven/bun
|
||||
|
||||
COPY . /app
|
||||
|
||||
WORKDIR /app/server
|
||||
|
||||
RUN bun install
|
||||
|
||||
CMD bun run /app/server/src/main.ts
|
@ -10,7 +10,7 @@
|
||||
<body>
|
||||
<noscript>
|
||||
<div style="text-align: center">
|
||||
<h1>yeah, unfortunately you need javascript :)</h1>
|
||||
<h1>yeah, unfortunately you need javascript :3</h1>
|
||||
</div>
|
||||
</noscript>
|
||||
<div id="app"></div>
|
||||
|
25
docker-compose.yml
Normal file
25
docker-compose.yml
Normal file
@ -0,0 +1,25 @@
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
client:
|
||||
build:
|
||||
dockerfile: Dockerfile.client
|
||||
networks:
|
||||
- webapp
|
||||
ports:
|
||||
- 1337:80
|
||||
restart: always
|
||||
container_name: jumpstorm-client
|
||||
hostname: client
|
||||
|
||||
server:
|
||||
build:
|
||||
dockerfile: Dockerfile.server
|
||||
networks:
|
||||
- webapp
|
||||
restart: always
|
||||
container_name: jumpstorm-server
|
||||
|
||||
networks:
|
||||
webapp:
|
||||
driver: bridge
|
@ -92,7 +92,7 @@ export class Player extends Entity {
|
||||
const distance = Math.sqrt(
|
||||
Math.pow(center.y - myCenter.y, 2) + Math.pow(center.x - myCenter.x, 2)
|
||||
);
|
||||
const clientServerPredictionCenterThreshold = 30;
|
||||
const clientServerPredictionCenterThreshold = 20;
|
||||
if (distance < clientServerPredictionCenterThreshold) center = myCenter;
|
||||
|
||||
[
|
||||
|
@ -67,9 +67,6 @@ export class Grid implements RefreshingCollisionFinderBehavior {
|
||||
const yBoxes = Math.ceil(
|
||||
this.gridDimension.height / this.cellDimension.height
|
||||
);
|
||||
const xBoxes = Math.ceil(
|
||||
this.gridDimension.width / this.cellDimension.width
|
||||
);
|
||||
|
||||
const translated: Coord2D = {
|
||||
y: center.y - this.topLeft.y,
|
||||
|
@ -32,7 +32,7 @@ export class NetworkUpdate extends System {
|
||||
this.messageProcessor = messageProcessor;
|
||||
|
||||
this.entityUpdateInfo = new Map();
|
||||
this.nextPublishInterval = 0;
|
||||
this.nextPublishInterval = this.getNextUpdateInterval();
|
||||
}
|
||||
|
||||
public update(dt: number, game: Game) {
|
||||
|
19
nginx.conf
Normal file
19
nginx.conf
Normal file
@ -0,0 +1,19 @@
|
||||
server {
|
||||
listen 80;
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html/;
|
||||
index index.html;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
location /api {
|
||||
proxy_pass http://server:8080;
|
||||
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $host;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user