Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ add_executable(${PROJECT_NAME}
src/game/components/enemy.cpp
src/game/components/health.cpp
src/game/components/player.cpp
src/game/components/projectile.cpp
src/game/components/weapon.cpp
src/game/game-registration.cpp
src/game/systems/collision-system.cpp
Expand Down
Binary file added assets/gltf/bullet/bullet.glb
Binary file not shown.
Binary file added assets/gltf/drone/arcade_corki.glb
Binary file not shown.
File renamed without changes.
Binary file added assets/gltf/monster/drmundo.glb
Binary file not shown.
Binary file modified assets/sounds/gun_shot.wav
Binary file not shown.
Binary file added assets/sounds/gun_shot_2.mp3
Binary file not shown.
201 changes: 77 additions & 124 deletions config/app.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"width": 1280,
"height": 720
},
"fullscreen": false
"fullscreen": true
},
"scene": {
"renderer": {
Expand Down Expand Up @@ -41,6 +41,10 @@
"plane": "assets/models/plane.obj",
"sphere": "assets/models/sphere.obj"
},
"sounds": {
"gunshot-player": "assets/sounds/gun_shot.wav",
"gunshot-enemy": "assets/sounds/gun_shot_2.wav"
},
"samplers": {
"default": {},
"pixelated": {
Expand All @@ -55,64 +59,10 @@
}
},
"materials": {
"ground": {
"type": "textured",
"shader": "textured",
"pipelineState": {
"faceCulling": {
"enabled": false
},
"depthTesting": {
"enabled": true
}
},
"tint": [1.0, 1.0, 1.0, 1.0],
"texture": "grass",
"sampler": "ground_tiled",
"uvScale": [96.0, 96.0]
},
"drone": {
"type": "tinted",
"shader": "tinted",
"pipelineState": {
"faceCulling": {
"enabled": false
},
"depthTesting": {
"enabled": true
}
},
"tint": [0.85, 0.9, 1.0, 1.0]
},
"monster": {
"type": "tinted",
"shader": "tinted",
"pipelineState": {
"faceCulling": {
"enabled": false
},
"depthTesting": {
"enabled": true
}
},
"tint": [1.0, 1.0, 1.0, 1.0]
},
"metal": {
"type": "tinted",
"shader": "tinted",
"pipelineState": {
"faceCulling": {
"enabled": false
},
"depthTesting": {
"enabled": true
}
},
"tint": [0.45, 0.4, 0.5, 1.0]
},
"glass": {
"type": "textured",
"shader": "textured",
"projectile-player": {
"type": "lit",
"shader": "lit",
"transparent": true,
"pipelineState": {
"faceCulling": {
"enabled": false
Expand All @@ -123,63 +73,48 @@
"blending": {
"enabled": true,
"sourceFactor": "GL_SRC_ALPHA",
"destinationFactor": "GL_ONE_MINUS_SRC_ALPHA"
"destinationFactor": "GL_ONE"
},
"depthMask": false
},
"transparent": true,
"tint": [1.0, 1.0, 1.0, 1.0],
"texture": "glass",
"sampler": "pixelated"
"sampler": "default",
"tint": [1.0, 0.95, 0.84, 0.92],
"albedo": [1.0, 0.88, 0.62],
"metallic": 0.0,
"roughness": 0.12,
"ambientOcclusion": 1.0,
"emission": [6.0, 3.8, 1.2]
},
"grass": {
"type": "textured",
"shader": "textured",
"pipelineState": {
"faceCulling": {
"enabled": false
},
"depthTesting": {
"enabled": true
}
},
"tint": [1.0, 1.0, 1.0, 1.0],
"texture": "grass",
"sampler": "default"
},
"monkey": {
"projectile-enemy": {
"type": "lit",
"shader": "lit",
"transparent": true,
"pipelineState": {
"faceCulling": {
"enabled": false
},
"depthTesting": {
"enabled": true
}
},
"tint": [1, 1, 1, 1],
"textureAlbedo": "monkey",
"sampler": "default"
},
"moon": {
"type": "textured",
"shader": "textured",
"pipelineState": {
"faceCulling": {
"enabled": false
},
"depthTesting": {
"enabled": true
}
"blending": {
"enabled": true,
"sourceFactor": "GL_SRC_ALPHA",
"destinationFactor": "GL_ONE"
},
"depthMask": false
},
"tint": [1.0, 1.0, 1.0, 1.0],
"texture": "moon",
"sampler": "default"
"sampler": "default",
"tint": [1.0, 0.62, 0.38, 0.9],
"albedo": [1.0, 0.48, 0.25],
"metallic": 0.0,
"roughness": 0.16,
"ambientOcclusion": 1.0,
"emission": [5.5, 1.7, 0.5]
}
},
"models": {
"drone": "assets/gltf/mech_drone/mech_drone.glb",
"drone": "assets/gltf/drone/arcade_corki.glb",
"monster": "assets/gltf/monster/drmundo.glb",
"map": "assets/gltf/map/map.glb",
"gun": "assets/gltf/weapons/rifle.glb"
}
Expand All @@ -197,6 +132,13 @@
"highlight": [1.0, 1.0, 1.0, 0.12]
}
},
"crosshair": {
"armLengthFrac": 0.012,
"armThicknessFrac": 0.0025,
"gapFrac": 0.006,
"shadowColor": [0.02, 0.03, 0.05, 0.92],
"fillColor": [0.95, 0.98, 1.0, 0.94]
},
"enemySpawner": {
"spawnPoints": [
[30.0, 0.0, 30.0],
Expand All @@ -214,20 +156,19 @@
"enemies": [
{
"name": "Monster",
"mesh": "cube",
"material": "monster",
"model": "monster",
"rotation": [0.0, 0.0, 0.0],
"scale": [0.65, 0.65, 0.65],
"scale": [0.008, 0.008, 0.008],
"components": [
{
"type": "Enemy",
"enemyType": "Brute",
"moveSpeed": 3.8,
"turnSpeed": 5.5,
"aggroRange": 120.0,
"attackRange": 2.0,
"attackRange": 2.5,
"attackDamage": 10.0,
"attackCooldown": 1.2,
"attackCooldown": 0.3,
"scoreValue": 100
},
{
Expand All @@ -237,18 +178,16 @@
{
"type": "Collider",
"layer": "enemy",
"shape": "Capsule",
"radius": 0.5,
"height": 1.5
"shape": "Model",
"model": "monster"
}
]
},
{
"name": "Drone",
"mesh": "cube",
"material": "drone",
"model": "drone",
"rotation": [0.0, 0.0, 0.0],
"scale": [1.2, 1.2, 1.2],
"scale": [0.008, 0.008, 0.008],
"components": [
{
"type": "Enemy",
Expand All @@ -272,7 +211,18 @@
{
"type": "Collider",
"layer": "enemy",
"radius": 0.8
"shape": "Model",
"model": "drone"
},
{
"type": "Weapon",
"cooldown": 1.8,
"bulletSpeed": 22.0,
"bulletDamage": 8.0,
"bulletLifetime": 4.0,
"bulletScale": 0.2,
"muzzleOffset": [0.0, 0.0, -0.8],
"fireSound": "gunshot-enemy"
}
]
}
Expand All @@ -293,7 +243,8 @@
{
"type": "Free Camera Controller",
"rotationSensitivity": 0.01,
"fovSensitivity": 0.3
"aimFovY": 30,
"aimSpeed": 8.0
},
{
"type": "PlayerMovement",
Expand All @@ -307,14 +258,15 @@
"dashDistance": 5.0,
"dashCooldown": 1.0,
"groundLevel": 0.0,
"playerHeight": 2,
"playerHeight": 1.8,
"jumpForce": 9.0
},
{
"type": "Player"
},
{
"type": "Post Process Effects Component"
"type": "Health",
"maxHealth": 100.0
},
{
"type": "Collider",
Expand All @@ -324,8 +276,17 @@
"shape": "Capsule"
},
{
"type": "Health",
"maxHealth": 100.0
"type": "Weapon",
"cooldown": 0.18,
"bulletSpeed": 100.0,
"bulletDamage": 20.0,
"bulletLifetime": 2.5,
"bulletScale": 0.12,
"muzzleOffset": [0.45, -0.45, -2.0],
"fireSound": "gunshot-player"
},
{
"type": "Post Process Effects Component"
}
],
"children": [
Expand All @@ -337,14 +298,6 @@
{
"type": "Model Renderer",
"model": "gun"
},
{
"type": "Weapon",
"damage": 25.0,
"range": 100.0,
"fireRate": 0.15,
"maxAmmo": 30,
"reloadTime": 1.5
}
],
"children": [
Expand Down
5 changes: 4 additions & 1 deletion src/common/components/free-camera-controller.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
#include "free-camera-controller.hpp"

#include <glm/gtc/constants.hpp>

namespace our {
// Reads sensitivities & speedupFactor from the given json object
void FreeCameraControllerComponent::deserialize(const nlohmann::json& data) {
if (!data.is_object()) return;
rotationSensitivity = data.value("rotationSensitivity", rotationSensitivity);
fovSensitivity = data.value("fovSensitivity", fovSensitivity);
aimFovY = data.value("aimFovY", 30.0f) * (glm::pi<float>() / 180.0f);
aimSpeed = data.value("aimSpeed", aimSpeed);
}
} // namespace our
6 changes: 4 additions & 2 deletions src/common/components/free-camera-controller.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@
namespace our {

// This component denotes that the FreeCameraControllerSystem will move the owning entity using user inputs.
// It will also control the camera field of view accroding to the scrolling of the mouse wheel
// This component is added as a slightly complex example for how use the ECS framework to implement logic.
// For more information, see "common/systems/free-camera-controller.hpp"
// For a more simple example of how to use the ECS framework, see "movement.hpp"
class FreeCameraControllerComponent : public Component {
public:
// The senstivity paramter defined sensitive the camera rotation & fov is to the mouse moves and wheel scrolling
float rotationSensitivity = 0.01f; // The angle change per pixel of mouse movement
float fovSensitivity = 0.3f; // The fov angle change per unit of mouse wheel scrolling

// Aim-down-sight
float aimFovY = glm::radians(30.0f);
float aimSpeed = 8.0f;

// The ID of this component type is "Free Camera Controller"
static std::string getID() {
Expand Down
Loading