Wrath of Zeus
Made by Torchlight Games for CSE 125 SP24
Loading...
Searching...
No Matches
Static Public Member Functions | Data Fields
GameConfig Struct Reference

#include <config.hpp>

Static Public Member Functions

static GameConfig parse (int argc, char **argv)
 

Data Fields

struct {
   struct {
      std::string   directory
 Path of the directory (contained in the repository directory) that contains maze map files. More...
 
      bool   procedural
 whether or not to generate and use a procedurally generated maze More...
 
      std::string   maze_file
 Name of the maze file within the maze maps directory that the server should load. More...
 
   }   maze
 
   bool   disable_enemies
 
game
 Game config options. More...
 
struct {
   std::string   server_ip
 IP that the server is being hosted on. E.g. "127.0.0.1" for localhost. More...
 
   int   server_port
 Port that the server is running on. This should be a value between 2302-2400, or 6073 so that it can be accepted through the firewall on lab computers. More...
 
network
 Shared config settings for the network. More...
 
struct {
   std::string   lobby_name
 Name of the server's lobby. More...
 
   bool   lobby_broadcast
 Whether or not the server should broadcast that the server is. More...
 
   int   max_players
 max number of players this server allows More...
 
   bool   disable_dm
 whether or not the server will spawn a DM More...
 
   bool   skip_intro
 whether or not to skip the intro cutscene More...
 
server
 Config settings for the server. More...
 
struct {
   std::string   default_name
 Default name of the client. More...
 
   bool   lobby_discovery
 Whether or not the client should listen for server lobby broadcasts. More...
 
   bool   fullscreen
 
   bool   draw_bboxes
 
   bool   fps_counter
 
   bool   presentation
 
   int   render
 
client
 Config settings for the client. More...
 

Detailed Description

Struct which is a 1:1 mapping with the expected file format of the config.json file, so that our code only has to reference this struct instead of having to know the exact string indices to use to index into the nlohmann::json object.

Member Function Documentation

◆ parse()

GameConfig GameConfig::parse ( int  argc,
char **  argv 
)
static

Parses the config file and returns back a representation of the file with all options specified. If the first command line argument specifies a different config file, then it load that, but if no argument is specified then it tries to look relative to the executable. It expects the directory to look like

group3/

  • config.json
  • build/
    • bin/
      • client
      • server

So it looks relative from the binary location and assumes that the config.json is at the root of the repository.

Parameters
argcNumber of command line arguments.
argvCommand line arguments

Field Documentation

◆ 

struct { ... } GameConfig::client

Config settings for the client.

◆ default_name

std::string GameConfig::default_name

Default name of the client.

◆ directory

std::string GameConfig::directory

Path of the directory (contained in the repository directory) that contains maze map files.

◆ disable_dm

bool GameConfig::disable_dm

whether or not the server will spawn a DM

◆ disable_enemies

bool GameConfig::disable_enemies

◆ draw_bboxes

bool GameConfig::draw_bboxes

◆ fps_counter

bool GameConfig::fps_counter

◆ fullscreen

bool GameConfig::fullscreen

◆ 

struct { ... } GameConfig::game

Game config options.

◆ lobby_broadcast

bool GameConfig::lobby_broadcast

Whether or not the server should broadcast that the server is.

◆ lobby_discovery

bool GameConfig::lobby_discovery

Whether or not the client should listen for server lobby broadcasts.

◆ lobby_name

std::string GameConfig::lobby_name

Name of the server's lobby.

◆ max_players

int GameConfig::max_players

max number of players this server allows

◆ 

struct { ... } GameConfig::maze

◆ maze_file

std::string GameConfig::maze_file

Name of the maze file within the maze maps directory that the server should load.

◆ 

struct { ... } GameConfig::network

Shared config settings for the network.

◆ presentation

bool GameConfig::presentation

◆ procedural

bool GameConfig::procedural

whether or not to generate and use a procedurally generated maze

◆ render

int GameConfig::render

◆ 

struct { ... } GameConfig::server

Config settings for the server.

◆ server_ip

std::string GameConfig::server_ip

IP that the server is being hosted on. E.g. "127.0.0.1" for localhost.

◆ server_port

int GameConfig::server_port

Port that the server is running on. This should be a value between 2302-2400, or 6073 so that it can be accepted through the firewall on lab computers.

◆ skip_intro

bool GameConfig::skip_intro

whether or not to skip the intro cutscene


The documentation for this struct was generated from the following files: