Skip to content

Commit

Permalink
#32
Browse files Browse the repository at this point in the history
- Added package.json to game folder
- Completing renames for refactor
  • Loading branch information
paulbrzeski committed Jan 10, 2025
1 parent 95ed21f commit dd18431
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 16 deletions.
4 changes: 2 additions & 2 deletions client/src/app/scenograph/modes/multiplayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions client/src/app/scenograph/objects/aircraft/raven.js
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -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;

Expand Down
6 changes: 3 additions & 3 deletions client/src/app/scenograph/objects/aircraft/valiant.js
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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;
Expand Down
18 changes: 10 additions & 8 deletions client/src/app/scenograph/scenes/overworld.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,21 @@ 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";
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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
22 changes: 22 additions & 0 deletions game/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions game/package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
1 change: 1 addition & 0 deletions game/src/objects/aircraft/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down

0 comments on commit dd18431

Please sign in to comment.