From 4c3998369a4cd06b895bce53cb34b577bfa4bbe0 Mon Sep 17 00:00:00 2001 From: hxtree <19890291+hxtree@users.noreply.github.com> Date: Wed, 11 Dec 2024 00:28:37 -0600 Subject: [PATCH] feat: flesh in game engine --- .../src/core/GameEngine/GameEngine.ts | 12 ++ .../src/{core => pages}/data/Field.json | 0 .../src/{core => pages}/data/Sewer.json | 0 .../src/{core => pages}/data/TrainCar.json | 0 .../src/{core => pages}/data/TrainRoom.json | 0 .../{core => pages}/data/TrainStorageCar.json | 0 .../{core => pages}/data/actors/chubbs.json | 0 .../data/actors/malace-tsia.json | 0 .../data/actors/meeku-oni.json | 0 .../data/areas/sewer-system.json | 0 .../data/areas/train-station.json | 0 .../player-client/src/pages/game-state.json | 124 ------------------ clients/player-client/src/pages/home.page.tsx | 13 +- .../__tests__/test-data/package-output.json | 6 +- 14 files changed, 27 insertions(+), 128 deletions(-) create mode 100644 clients/player-client/src/core/GameEngine/GameEngine.ts rename clients/player-client/src/{core => pages}/data/Field.json (100%) rename clients/player-client/src/{core => pages}/data/Sewer.json (100%) rename clients/player-client/src/{core => pages}/data/TrainCar.json (100%) rename clients/player-client/src/{core => pages}/data/TrainRoom.json (100%) rename clients/player-client/src/{core => pages}/data/TrainStorageCar.json (100%) rename clients/player-client/src/{core => pages}/data/actors/chubbs.json (100%) rename clients/player-client/src/{core => pages}/data/actors/malace-tsia.json (100%) rename clients/player-client/src/{core => pages}/data/actors/meeku-oni.json (100%) rename clients/player-client/src/{core => pages}/data/areas/sewer-system.json (100%) rename clients/player-client/src/{core => pages}/data/areas/train-station.json (100%) delete mode 100644 clients/player-client/src/pages/game-state.json diff --git a/clients/player-client/src/core/GameEngine/GameEngine.ts b/clients/player-client/src/core/GameEngine/GameEngine.ts new file mode 100644 index 00000000..4f700b63 --- /dev/null +++ b/clients/player-client/src/core/GameEngine/GameEngine.ts @@ -0,0 +1,12 @@ +import React from 'react'; + +export type GameEngineProps = { + data: any; + updateData: (newData: any) => void; +}; + +export const GameEngine: React.FC = () => { + // if input up then try to move up + + return null; +}; diff --git a/clients/player-client/src/core/data/Field.json b/clients/player-client/src/pages/data/Field.json similarity index 100% rename from clients/player-client/src/core/data/Field.json rename to clients/player-client/src/pages/data/Field.json diff --git a/clients/player-client/src/core/data/Sewer.json b/clients/player-client/src/pages/data/Sewer.json similarity index 100% rename from clients/player-client/src/core/data/Sewer.json rename to clients/player-client/src/pages/data/Sewer.json diff --git a/clients/player-client/src/core/data/TrainCar.json b/clients/player-client/src/pages/data/TrainCar.json similarity index 100% rename from clients/player-client/src/core/data/TrainCar.json rename to clients/player-client/src/pages/data/TrainCar.json diff --git a/clients/player-client/src/core/data/TrainRoom.json b/clients/player-client/src/pages/data/TrainRoom.json similarity index 100% rename from clients/player-client/src/core/data/TrainRoom.json rename to clients/player-client/src/pages/data/TrainRoom.json diff --git a/clients/player-client/src/core/data/TrainStorageCar.json b/clients/player-client/src/pages/data/TrainStorageCar.json similarity index 100% rename from clients/player-client/src/core/data/TrainStorageCar.json rename to clients/player-client/src/pages/data/TrainStorageCar.json diff --git a/clients/player-client/src/core/data/actors/chubbs.json b/clients/player-client/src/pages/data/actors/chubbs.json similarity index 100% rename from clients/player-client/src/core/data/actors/chubbs.json rename to clients/player-client/src/pages/data/actors/chubbs.json diff --git a/clients/player-client/src/core/data/actors/malace-tsia.json b/clients/player-client/src/pages/data/actors/malace-tsia.json similarity index 100% rename from clients/player-client/src/core/data/actors/malace-tsia.json rename to clients/player-client/src/pages/data/actors/malace-tsia.json diff --git a/clients/player-client/src/core/data/actors/meeku-oni.json b/clients/player-client/src/pages/data/actors/meeku-oni.json similarity index 100% rename from clients/player-client/src/core/data/actors/meeku-oni.json rename to clients/player-client/src/pages/data/actors/meeku-oni.json diff --git a/clients/player-client/src/core/data/areas/sewer-system.json b/clients/player-client/src/pages/data/areas/sewer-system.json similarity index 100% rename from clients/player-client/src/core/data/areas/sewer-system.json rename to clients/player-client/src/pages/data/areas/sewer-system.json diff --git a/clients/player-client/src/core/data/areas/train-station.json b/clients/player-client/src/pages/data/areas/train-station.json similarity index 100% rename from clients/player-client/src/core/data/areas/train-station.json rename to clients/player-client/src/pages/data/areas/train-station.json diff --git a/clients/player-client/src/pages/game-state.json b/clients/player-client/src/pages/game-state.json deleted file mode 100644 index d7367af8..00000000 --- a/clients/player-client/src/pages/game-state.json +++ /dev/null @@ -1,124 +0,0 @@ -{ - "properties": { - "backgroundColor": "dark" - }, - "actors": [ - { - "actorId": "MEEKU_ONI", - "height": 85, - "movement": { - "isInMotion": true, - "currentPosition": { - "x": 1, - "y": 5, - "z": 1 - }, - "targetPosition": { - "x": 4, - "y": 5, - "z": 1 - }, - "movementDuration": { "seconds": 2 }, - "targetPositionReached": false, - "startTimestamp": "2021-07-01T12:00:00.000Z" - }, - "animation": { - "startingFrame": 0, - "totalFrames": 4, - "animationDuration": 1.0, - "frameDuration": 0.1, - "isAnimating": false, - "startTime": 0, - "currentAnimation": "walking" - }, - "spriteMapRegistry": { - "idle": "/game-assets/sprites/meeku-oni/idle-1x1.png", - "walking": "/game-assets/sprites/meeku-oni/walk-10x4.png" - } - } - ], - "dialogues": [ - { - "actorId": "MEEKU_ONI", - "text": "It's pretty slippery." - } - ], - "spriteMapRegistry": { - "t": "/game-assets/sewer/tileset-4x4.png", - "w": "/game-assets/sewer/wall-8x1.png", - "b": "/game-assets/sewer/barrel-1x1.png", - "r": "/game-assets/sewer/rat-3x1.png", - "s": "/game-assets/sewer/spill-1x1.png" - }, - "grid": [ - [ - ["0","0","t5_wave1","t5_wave3","t5_wave2","0","0","0","0","0","0","t3"], - ["0","0","t5_wave2","t5_wave1","t5_wave2","0","0","0","0","0","0","t1"], - ["0","0","t5_wave1","t5_wave2","t5_wave2","0","0","0","0","0","0","t2"], - ["0","0","t5_wave1","t5_wave3","t5_wave1","0","0","0","0","0","0","t3"], - ["0","0","t5_wave2","t5_wave1","t5_wave2","0","0","0","0","0","0","t1"], - ["0","0","t5_wave3","t5_wave1","t5_wave1","0","0","0","0","0","0","t3"], - ["0","0","t5_wave1","t5_wave2","t5_wave1","0","0","0","0","0","0","t3"], - ["t3","t1","t5_wave2","t5_wave3","t5_wave1","t3","t3","t2","t3","t1","t2","t3"], - ["t5_wave1","t5_wave2","t5_wave1","t5_wave1","t5_wave2","t5_wave1","t5_wave1","t5_wave2","t5_wave1","t5_wave1","t5_wave2","t5_wave3"], - ["t5_wave2","t5_wave1","t5_wave1","t5_wave2","t5_wave1","t5_wave1","t5_wave2","t5_wave3","t5_wave1","t5_wave2","t5_wave1","t5_wave1"], - ["t5_wave3","t5_wave2","t5_wave1","t5_wave1","t5_wave3","t5_wave1","t5_wave1","t5_wave2","t5_wave1","t5_wave3","t5_wave2","t5_wave2"] - ], - [ - ["t2","t1","t1","t11","0","t1","t3","t3","t3","t3","t3","t2"], - ["t1","t1","t1","t11","0","t3","t3","t2","t3","t1","t2","t3"], - ["t1","t3","t1","t11","0","t1","t1","t1","t2","t3","t3","t2"], - ["t1","t2","t1","t11","0","t3","t1","t2","t3","t1","t2","t1"], - ["t3","t1","t1","t11","0","t2","t1","t1","t1","t1","t1","t1"], - ["t3","t1","t1","t7","t7","t1","t1","t2","t1","t3","t2","t3"], - ["t3","t1","t3","t7","t7","t3","t3","t1","t1","t1","t1","t1"], - ["t3","t1","t1","t11","0","t1","t1","t2","t3","t1","t2","t3"], - ["t10","t10","t10","0","0","t10","t10","t10","t10","t10","t10","t10"] - ], - [ - ["w1","w3","w1","w6","w6","w1","w2","w3","w1","w5","w5","w1"], - ["w2","0","0","0","0","b1","b1","0","0","0","0","w1"], - ["w2","0","0","0","0","0","0","0","r1_look1","0","0","w1"], - ["w2","s1","0","0","0","0","0","0","0","0","0","w1"], - ["w1","0","0","0","0","0","0","0","0","0","0","w1"], - ["w4","0","0","0","0","0","0","0","0","0","0","w1"], - ["w4","0","0","0","0","0","0","0","0","0","0","w1"], - ["w1","w1","w1","0","0","w1","w2","w1","w3","w1","w2","w1"] - ] - ], - "gridAnimations": { - "look1": { - "currentAnimation": "look1", - "startingFrame": 0, - "totalFrames": 3, - "frameDuration": { "seconds": 10 }, - "isAnimating": true - }, - "wave1": { - "currentAnimation": "water-ripples", - "startingFrame": 0, - "totalFrames": 2, - "frameDuration": { "seconds": 3.3 }, - "isAnimating": true - }, - "wave2": { - "currentAnimation": "water-ripples", - "startingFrame": 1, - "totalFrames": 2, - "frameDuration": { "seconds": 2.7 }, - "isAnimating": true - }, - "wave3": { - "currentAnimation": "water-ripples", - "startingFrame": 0, - "totalFrames": 2, - "frameDuration": { "seconds": 4.75 }, - "isAnimating": true - } - }, - "cameraPosition": { - "x": 0, - "y": 0, - "z": 0 - } -} diff --git a/clients/player-client/src/pages/home.page.tsx b/clients/player-client/src/pages/home.page.tsx index 45ccd187..8d215f25 100644 --- a/clients/player-client/src/pages/home.page.tsx +++ b/clients/player-client/src/pages/home.page.tsx @@ -1,12 +1,23 @@ +import React, { useState } from 'react'; import { IsometricCanvas, IsometricCanvasProps } from '../core/IsometricCanvas'; -import gameState from './game-state.json'; +import gameState from './data/Sewer.json'; import { InputProvider } from '../context/Input/InputProvider'; import { Keyboard } from '../core/Keyboard/Keyboard'; +import { GameEngine } from '../core/GameEngine/GameEngine'; export default function HomePage() { + const [gameData, setGameData] = useState({ input: '', playerPosition: 0 }); + + const updateGameData = (newData: any) => { + setGameData(newData); + }; + return ( + + + {/** TODO use gameData={gameData} */} {/* @ts-expect-error needed for types temp */} diff --git a/tools/create-artifact/src/__tests__/test-data/package-output.json b/tools/create-artifact/src/__tests__/test-data/package-output.json index e52b3f7a..01533fd2 100644 --- a/tools/create-artifact/src/__tests__/test-data/package-output.json +++ b/tools/create-artifact/src/__tests__/test-data/package-output.json @@ -1,6 +1,6 @@ { "name": "@galaxyops/create-artifact", - "version": "4.2.0", + "version": "4.3.0", "license": "MIT", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -28,7 +28,7 @@ "@pnpm/find-workspace-dir": "~6.0.3" }, "devDependencies": { - "@galaxyops/eslint-config": "3.1.1", + "@galaxyops/eslint-config": "3.2.0", "eslint": "8.57.0", "@pnpm/types": "^8.5.0", "@types/fs-extra": "^9.0.13", @@ -39,6 +39,6 @@ "@types/archiver": "~5.3.2", "@types/jest": "29.5.12", "jest": "29.7.0", - "@galaxyops/base-nodejs": "0.1.0" + "@galaxyops/base-nodejs": "0.2.0" } } \ No newline at end of file