diff --git a/client/src/app/scenograph/modes/multiplayer.js b/client/src/app/scenograph/modes/multiplayer.js index 48c5599e..8e1d66c7 100644 --- a/client/src/app/scenograph/modes/multiplayer.js +++ b/client/src/app/scenograph/modes/multiplayer.js @@ -6,7 +6,7 @@ * Internal libs and helpers. */ import l from '@/helpers/l.js'; -import Player from "@/scenograph/objects/player"; +import Valiant from "@/scenograph/objects/aircraft/valiant"; export default class Multiplayer { @@ -80,7 +80,7 @@ export default class Multiplayer { * Add a new remote player to the client session. */ async add_player( data ) { - let newPlayer = new Player(); + let newPlayer = new Valiant(); await newPlayer.load(); newPlayer.socket_id = data.socket_id; newPlayer.mesh.position.x = 0; diff --git a/client/src/app/scenograph/objects/aircraft/raven.js b/client/src/app/scenograph/objects/aircraft/raven.js index 8f925cb8..5563e3b0 100644 --- a/client/src/app/scenograph/objects/aircraft/raven.js +++ b/client/src/app/scenograph/objects/aircraft/raven.js @@ -1,7 +1,7 @@ /** * Enemy bot. * - * Currently hardcoded to use the Pirate aircraft. + * Currently hardcoded to use the Raven aircraft. */ import * as THREE from 'three'; @@ -11,9 +11,9 @@ import * as THREE from 'three'; import l from '@/helpers/l.js'; import { brightenMaterial, proceduralMetalMaterial } from '@/scenograph/materials.js'; import Pirate from '#/game/src/actors/pirate'; -import Raven from '#/game/src/objects/aircraft/raven'; +import * as RavenBase from '#/game/src/objects/aircraft/raven'; -export default class Raven { +export default class Raven extends RavenBase { // AI seeing distance. sight_radius; diff --git a/client/src/app/scenograph/objects/aircraft/valiant.js b/client/src/app/scenograph/objects/aircraft/valiant.js index 6a992f7f..b6277a7f 100644 --- a/client/src/app/scenograph/objects/aircraft/valiant.js +++ b/client/src/app/scenograph/objects/aircraft/valiant.js @@ -1,7 +1,7 @@ /** * Valiant Aircraft * - * Provides a valiant aircraft that can be added and updated in the game world. + * Provides a Valiant aircraft that can be added and updated in the game world. */ import * as THREE from 'three'; @@ -12,9 +12,9 @@ import { TrailRenderer } from '@/../vendor/TrailRenderer.js'; */ import l from '@/helpers/l.js'; import { brightenMaterial, proceduralMetalMaterial } from '@/scenograph/materials.js'; -import Valiant from '#/game/src/objects/aircraft/valiant.js'; +import * as ValiantBase from '#/game/src/objects/aircraft/valiant.js'; -export default class Player { +export default class Valiant extends ValiantBase { // Camera distance. camera_distance; diff --git a/client/src/app/scenograph/scenes/overworld.js b/client/src/app/scenograph/scenes/overworld.js index dc10a935..77248e00 100644 --- a/client/src/app/scenograph/scenes/overworld.js +++ b/client/src/app/scenograph/scenes/overworld.js @@ -10,9 +10,10 @@ import l from '@/helpers/l.js'; import SceneBase from "@/scenograph/scenes/base"; /** - * Scene objects + * Objects */ -import Bot from "@/scenograph/objects/bot"; + +// Scenery import CargoShips from "@/scenograph/objects/cargo_ships"; import Extractors from "@/scenograph/objects/extractors"; import Ocean from "@/scenograph/objects/ocean"; @@ -20,8 +21,10 @@ import Platform from "@/scenograph/objects/platform"; import Refineries from "@/scenograph/objects/refineries"; import Sky from "@/scenograph/objects/sky"; import Sky2 from "@/scenograph/objects/sky2"; -import Player from "@/scenograph/objects/player"; +// Aircraft +import Raven from "@/scenograph/objects/aircraft/raven"; +import Valiant from "@/scenograph/objects/aircraft/valiant"; /** * Preloader objects @@ -87,8 +90,8 @@ export default class Overworld extends SceneBase { // l.current_scene.objects.sky.animate // ); - // Setup Player - l.current_scene.objects.player = new Player(); + // Setup Player, currently hardcoded to Valiant aircraft + l.current_scene.objects.player = new Valiant(); await l.current_scene.objects.player.load(); l.current_scene.scene.add( l.current_scene.objects.player.mesh @@ -145,9 +148,8 @@ export default class Overworld extends SceneBase { // } - // Setup Bot - // @todo: refactor to support more - l.current_scene.objects.bot = new Bot(); + // Setup Bot, currently hardcoded to Raven + l.current_scene.objects.bot = new Raven(); await l.current_scene.objects.bot.load(); l.current_scene.scene.add( l.current_scene.objects.bot.mesh diff --git a/game/package-lock.json b/game/package-lock.json new file mode 100644 index 00000000..0a671de2 --- /dev/null +++ b/game/package-lock.json @@ -0,0 +1,22 @@ +{ + "name": "game", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "game", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "yuka": "^0.7.8" + } + }, + "node_modules/yuka": { + "version": "0.7.8", + "resolved": "https://registry.npmjs.org/yuka/-/yuka-0.7.8.tgz", + "integrity": "sha512-G/pFcMZh2Azz7Yy500NSV1jQ0Ru7h9hTNyEW+HjRXcdzjJIyp/3mCGspnx7VJVP06zxORqK6mkl5TywLqVUnVg==", + "license": "MIT" + } + } +} diff --git a/game/package.json b/game/package.json new file mode 100644 index 00000000..694c37ff --- /dev/null +++ b/game/package.json @@ -0,0 +1,18 @@ +{ + "name": "game", + "version": "1.0.0", + "main": "index.js", + "directories": { + "test": "tests" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC", + "description": "", + "dependencies": { + "yuka": "^0.7.8" + } +} diff --git a/game/src/objects/aircraft/base.ts b/game/src/objects/aircraft/base.ts index 4c4c477f..f7b4979c 100644 --- a/game/src/objects/aircraft/base.ts +++ b/game/src/objects/aircraft/base.ts @@ -14,6 +14,7 @@ export default class BaseAircraft { public maxBackward: number = 2.0; public maxUp: number = 3.7 * 2.5; public maxDown: number = 3.7 * 5; // gravity? + // @todo: Introduce max turn speed for the vehicle public heading: number = 0; public altitude: number = 0; public horizon: [number, number] = [0, 0];