Skip to content

The Dungeon Master #89

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 73 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
9401579
some initial DM code
EddieJ03 May 10, 2024
1759308
Merge branch 'dev' of https://github.com/ucsd-cse125-sp24/group3 into…
EddieJ03 May 11, 2024
aa4255c
finally have a dunegon master view and can move WASD (but no jump)
EddieJ03 May 11, 2024
28803c9
Dungeon Master View (First Player To Enter is DM)
EddieJ03 May 11, 2024
d52ca16
SO MANY DEV CHANGES YAAAAAAA
EddieJ03 May 12, 2024
c671ff0
bug fixes & updates
EddieJ03 May 12, 2024
fa22dcc
dungeon master is bounded
EddieJ03 May 12, 2024
4ecb1db
satisfy linter
EddieJ03 May 12, 2024
01f6183
satisfy linter
EddieJ03 May 12, 2024
cf400ac
if DM dropped, reconnect as DM
EddieJ03 May 13, 2024
9b067f9
pulled in dev changes
EddieJ03 May 13, 2024
7cac23e
do not render inventory GUI stuff if DM
EddieJ03 May 13, 2024
7095806
Turn off 1,2,3,4,q,e if DM
EddieJ03 May 13, 2024
bb70db6
DM zoom in and out done
EddieJ03 May 13, 2024
df8373e
restrict Y zoom in/out range and have field in config to toggle btwn …
EddieJ03 May 13, 2024
f3d8152
Add in config.json
EddieJ03 May 13, 2024
6a40da3
merged in dev changes
EddieJ03 May 14, 2024
dea1bbb
remove duplicate SpikeTrap
EddieJ03 May 14, 2024
d44ef5d
Merge branch 'dev' of https://github.com/ucsd-cse125-sp24/group3 into…
EddieJ03 May 14, 2024
e3acc67
new dev changes
EddieJ03 May 14, 2024
2aca373
Delete y-pos print for DM and add out/ to .gitignore
EddieJ03 May 14, 2024
fd0982a
DM world position click
EddieJ03 May 16, 2024
4d83d48
Merge branch 'dev' of https://github.com/ucsd-cse125-sp24/group3 into…
EddieJ03 May 16, 2024
d363e68
finally got the right grid cell on click!
EddieJ03 May 16, 2024
de7f390
get in some initial highlight backbone code
EddieJ03 May 16, 2024
1a59666
can now click floor and highlight red (not walls though :()
EddieJ03 May 18, 2024
12ae394
DM can spam floorspike traps now
EddieJ03 May 18, 2024
3e285f9
pulled in recent dev changes
EddieJ03 May 18, 2024
29bf5be
we now have HOHPOC, or more commonly referred to as: highlight on hov…
EddieJ03 May 18, 2024
2846169
more refined highlighting & trap placement
EddieJ03 May 18, 2024
cd7899e
Cap number of trap placements by DM
EddieJ03 May 18, 2024
f8dd5d8
DM Trap Inventory Hotbar In Place!
EddieJ03 May 19, 2024
1229003
Got walls to be highlighted (some inconsistencies though, need debugg…
EddieJ03 May 19, 2024
8636250
disappearing traps are in!
EddieJ03 May 19, 2024
f1948a4
Improved DM Hotbar
EddieJ03 May 19, 2024
cf9c7d9
cooldown + a weird bug
EddieJ03 May 20, 2024
6df183d
fix troll seg fault :pray:
Tyler-Lentz May 20, 2024
cdd73e5
Skip floor creation if CellType is OutsideTheMaze
EddieJ03 May 20, 2024
85cc9ba
only update movable objects
EddieJ03 May 20, 2024
ff36c0e
some bug fixes
EddieJ03 May 20, 2024
f399a9f
merged in dev
EddieJ03 May 20, 2024
0864c92
compilation fixes
EddieJ03 May 20, 2024
f11b143
fix player ceiling render
EddieJ03 May 21, 2024
3378b9f
DM movement speedup
EddieJ03 May 21, 2024
dbaccc4
DM selection bug
EddieJ03 May 21, 2024
e0e4238
crosshair DM
EddieJ03 May 21, 2024
e026fb5
DM has torchlights
EddieJ03 May 22, 2024
e1c04b8
turn off torchlights for DM
EddieJ03 May 22, 2024
c5b9032
have highlight moving when WASD, but need to fix the highlight showing
EddieJ03 May 22, 2024
410fe39
fix incorrect placement because of second setWorldPos call & fixed NA…
gilkeidar May 22, 2024
8465d7a
have highlight (mostly) keepup when WASD is held
EddieJ03 May 22, 2024
7839596
better DM highlight on WASD movement
EddieJ03 May 22, 2024
f81b8dd
some more movement highlight fixes
EddieJ03 May 23, 2024
6753bd8
only send one TrapPlacement event if multiple WASD pressed and/or zoo…
EddieJ03 May 23, 2024
d38bfb6
satisfy linter
EddieJ03 May 23, 2024
85879ae
dang it I missed one. Also i forgot to only send WASD movement if p i…
EddieJ03 May 23, 2024
915a04a
in progress fucked up merge
Tyler-Lentz May 23, 2024
5e7c72e
fix crash on place trap for DM
Tyler-Lentz May 23, 2024
7fccd57
fix ceiling not rendering for player
Tyler-Lentz May 23, 2024
c9892ab
YIPEE!
Tyler-Lentz May 23, 2024
abd7443
fix lint
Tyler-Lentz May 23, 2024
00bad8c
completely necessary merge :smile:
Tyler-Lentz May 23, 2024
45dc809
fix wall and werror breaking windows
Tyler-Lentz May 23, 2024
61d207e
partial performance fixes: misc tiny optimizations & no longer place …
Tyler-Lentz May 23, 2024
74d31eb
reenable first player dm
Tyler-Lentz May 23, 2024
9349bd3
Various fixes / optimizations
Tyler-Lentz May 23, 2024
a506896
general cleanup & remove extraneous comments
Tyler-Lentz May 23, 2024
a3916c8
more misc fixes and touchups
Tyler-Lentz May 23, 2024
17a5730
fix wall color for DM, revert to one big big floor to improve perform…
EddieJ03 May 23, 2024
934e360
Fix stupid ass networking "optimization"
Tyler-Lentz May 23, 2024
d6f8cd7
fix gui & add orb position display
Tyler-Lentz May 23, 2024
bf85969
dm wall textures
gilkeidar May 23, 2024
d48153d
fix item drop in walls
Tyler-Lentz May 23, 2024
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 .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
build/
out/
.vscode/
.vs/
.cache/
Expand Down
6 changes: 3 additions & 3 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"game": {
"maze": {
"directory": "maps",
"procedural": false,
"procedural": true,
"maze_file": "test/itemRoom.maze"
}
},
Expand All @@ -13,12 +13,12 @@
"server": {
"lobby_name": "Hope you're doing well!",
"lobby_broadcast": true,
"max_players": 1
"max_players": 6
},
"client": {
"default_name": "Conan O'Brien",
"lobby_discovery": true,
"window_width": 1500,
"window_width": 2000,
"draw_bboxes": false
}
}
19 changes: 17 additions & 2 deletions include/client/camera.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class Camera {
* @param xpos New x-coordinate for the cursor.
* @param ypos New y-coordinate for the cursor.
*/
void update(float xpos, float ypos);
virtual void update(float xpos, float ypos);

/**
* @brief Moves the camera based on the axis, direction, and speed. Factors in the current
Expand Down Expand Up @@ -85,7 +85,11 @@ class Camera {

glm::vec3 getPos();

private:
glm::mat4 getProjection();

glm::mat4 getView();

protected:
// Perspective controls
float FOV; // Field of View Angle (degrees)
float aspect; // Aspect Ratio
Expand All @@ -110,5 +114,16 @@ class Camera {
float speed;

glm::mat4 viewProjMat;

glm::mat4 projection;
glm::mat4 view;
};

class DungeonMasterCamera : public Camera {
public:
DungeonMasterCamera();
~DungeonMasterCamera();

void update(float xpos, float ypos) override;
};

12 changes: 11 additions & 1 deletion include/client/client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ class Client {

AudioManager* getAudioManager();

void setWorldPos();

private:
/**
* @brief Processes all data received from the server and updates the SharedGameState.
Expand All @@ -185,7 +187,8 @@ class Client {
SharedGameState gameState;

/* Shader objects for various */
std::shared_ptr<Shader> cube_shader;
std::shared_ptr<Shader> cube_shader;
std::shared_ptr<Shader> dm_cube_shader;
std::shared_ptr<Shader> model_shader;
std::shared_ptr<Shader> light_source_shader;
std::shared_ptr<Shader> solid_surface_shader;
Expand Down Expand Up @@ -225,6 +228,11 @@ class Client {
bool is_held_left = false;
bool is_held_space = false;

bool is_held_i = false;
bool is_held_o = false;

bool is_pressed_p = false;

bool is_left_mouse_down = false;

/* Mouse position coordinates */
Expand All @@ -241,6 +249,8 @@ class Client {
basic_resolver_results<class boost::asio::ip::tcp> endpoints;
std::shared_ptr<Session> session;

glm::vec3 world_pos; // stored world pause, calculated before the GUI is rendered

std::array<boost::optional<SharedObject>, MAX_POINT_LIGHTS> closest_light_sources;
};

2 changes: 1 addition & 1 deletion include/client/cube.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Cube : public Renderable {
explicit Cube(glm::vec3 newColor);
~Cube();

void draw(std::shared_ptr<Shader> shader,
void draw(Shader* shader,
glm::mat4 viewProj,
glm::vec3 camPos,
std::array<boost::optional<SharedObject>, MAX_POINT_LIGHTS> lightSources,
Expand Down
12 changes: 9 additions & 3 deletions include/client/model.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,19 @@ class Mesh : public Renderable {
* @param modelView determines the scaling/rotation/translation of the
* mesh
*/
void draw(std::shared_ptr<Shader> shader,
void draw(Shader* shader,
glm::mat4 viewProj,
glm::vec3 camPos,
std::array<boost::optional<SharedObject>, MAX_POINT_LIGHTS> lightSources,
bool fill) override;


std::optional<glm::vec3> solidColor;
Material material;
private:
std::vector<Vertex> vertices;
std::vector<unsigned int> indices;
std::vector<Texture> textures;
Material material;

// render data opengl needs
GLuint VAO, VBO, EBO;
Expand All @@ -120,7 +123,7 @@ class Model : public Renderable {
* @param Shader to use while drawing all the
* meshes of the model
*/
void draw(std::shared_ptr<Shader> shader,
void draw(Shader* shader,
glm::mat4 viewProj,
glm::vec3 camPos,
std::array<boost::optional<SharedObject>, MAX_POINT_LIGHTS> lightSources,
Expand Down Expand Up @@ -217,6 +220,9 @@ class Model : public Renderable {
* in that dimension
*/
void setDimensions(const glm::vec3& dimensions);

void overrideSolidColor(std::optional<glm::vec3> color);

private:
std::vector<Mesh> meshes;
Bbox bbox;
Expand Down
2 changes: 1 addition & 1 deletion include/client/renderable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class Renderable {
* meshes of the model
* @param
*/
virtual void draw(std::shared_ptr<Shader> shader,
virtual void draw(Shader* shader,
glm::mat4 viewProj,
glm::vec3 camPos,
std::array<boost::optional<SharedObject>, MAX_POINT_LIGHTS> lightSources,
Expand Down
9 changes: 8 additions & 1 deletion include/server/game/constants.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

/* GridCell Constants */
#define DEFAULT_GRIDCELL_WIDTH 3
#define DM_Z_DISCOUNT 0.2

// Player Stat Constants
#define INITIAL_HEALTH 100
Expand Down Expand Up @@ -70,4 +71,10 @@

/* Default model sizes */
#define BEAR_DIMENSIONS glm::vec3(14.163582, 17.914591, 10.655818)
#define FIRE_PLAYER_DIMENSIONS glm::vec3(8.008834, 10.069769, 2.198592)
#define FIRE_PLAYER_DIMENSIONS glm::vec3(8.008834, 10.069769, 2.198592)

/* DM Constants */
#define MAX_TRAPS 10
#define TRAP_INVENTORY_SIZE 10
#define TRAP_TIME 10
#define TRAP_COOL_DOWN 5
23 changes: 23 additions & 0 deletions include/server/game/dungeonmaster.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#pragma once

#include "server/game/constants.hpp"
#include "server/game/object.hpp"
#include "server/game/creature.hpp"
#include "shared/game/sharedobject.hpp"


class DungeonMaster : public Creature {
public:
SharedTrapInventory sharedTrapInventory;

DungeonMaster(glm::vec3 corner, glm::vec3 facing);
~DungeonMaster();

virtual SharedObject toShared() override;

int getPlacedTraps();

void setPlacedTraps(int placedTraps);
private:
int placedTraps;
};
42 changes: 3 additions & 39 deletions include/server/game/gridcell.hpp
Original file line number Diff line number Diff line change
@@ -1,44 +1,8 @@
#pragma once

enum class CellType {
Empty,
Wall,
Pillar,
Spawn,
Enemy,
SpikeTrap,
FireballTrap,
FloorSpikeHorizontal,
FloorSpikeVertical,
FloorSpikeFull,
FakeWall,
ArrowTrapUp,
ArrowTrapDown,
ArrowTrapLeft,
ArrowTrapRight,
HealthPotion,
NauseaPotion,
InvisibilityPotion,
TorchDown,
TorchUp,
TorchLeft,
TorchRight,
InvincibilityPotion,
FireSpell,
HealSpell,
TeleportSpell,
Dagger,
Sword,
Hammer,
RandomWeapon,
RandomPotion,
RandomSpell,
Orb,
OutsideTheMaze,
TeleporterTrap,
Exit,
Unknown
};
#include "shared/game/celltype.hpp"

bool isWallLikeCell(CellType type);

/**
* @brief Returns CellType given a character (maps character representation to
Expand Down
15 changes: 14 additions & 1 deletion include/server/game/object.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ struct Physics {
glm::vec3 corner, glm::vec3 facing,
glm::vec3 dimensions = glm::vec3(1.0f)):
shared{.corner=corner, .facing=facing, .dimensions=dimensions},
movable(movable), velocity(glm::vec3(0.0f)), velocityMultiplier(glm::vec3(1.0f)), nauseous(1.0f),
movable(movable), feels_gravity(true), velocity(glm::vec3(0.0f)), velocityMultiplier(glm::vec3(1.0f)), nauseous(1.0f),
collider(collider)
{}

Expand All @@ -55,6 +55,13 @@ struct Physics {
*/
bool movable;


/**
* @brief true if the object that contains this Physics struct feels gravity and
* false otherwise
*/
bool feels_gravity;

/**
* @brief 3-D vector that denotes this object's current velocity.
*/
Expand Down Expand Up @@ -94,6 +101,12 @@ class Object {
*/
SpecificID typeID {};

/**
* @brief Movable ID (used to index into the movable
* objects vector in ServerGameState)
*/
MovableID movableID{};

/**
* @brief Identifies this object's type (derived class)
*/
Expand Down
30 changes: 30 additions & 0 deletions include/server/game/objectmanager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "server/game/object.hpp"
#include "server/game/player.hpp"
#include "server/game/enemy.hpp"
#include "server/game/dungeonmaster.hpp"
#include "server/game/solidsurface.hpp"
#include "server/game/torchlight.hpp"
//#include "server/game/grid.hpp"
Expand Down Expand Up @@ -101,6 +102,12 @@ class ObjectManager {
*/
Player* getPlayer(SpecificID playerID);

/**
* @brief Get the Dungeon Master pointer
* @return A pointer to the Dungeon Master
*/
DungeonMaster* getDM();

/**
* @brief Attempts to retrieve the Enemy with the given SpecificID.
* @param enemyID SpecificID of the Enemy to retrieve
Expand Down Expand Up @@ -130,6 +137,14 @@ class ObjectManager {
*/
SmartVector<Object*> getObjects();

/**
* @brief Get a list of all objects in this game instance at the current
* timestep that are MOVABLE.
* @return SmartVector of Object pointers of all objects in the game
* instance that are MOVABLE.
*/
SmartVector<Object*> getMovableObjects();

/**
* @brief Get a list of all items in this game instance at the current
* timestep.
Expand Down Expand Up @@ -281,6 +296,16 @@ class ObjectManager {
*/
SmartVector<Object *> objects;

/**
* @brief SmartVector of Object pointers to all objects in the current
* timestep of this game instance that are MOVABLE.
*
* The objects smart vector is indexed by each Object's global EntityID;
* that is, the Object pointer at index x points to the Object with global
* EntityID x.
*/
SmartVector<Object*> movableObjects;

/* Type-specific object smart vectors */

/**
Expand Down Expand Up @@ -340,4 +365,9 @@ class ObjectManager {
* ObjectType::Exit.
*/
SmartVector<Exit*> exits;

/**
* @brief The Dungeon Master
*/
DungeonMaster * dm;
};
Loading
Loading