Conquer Space 0.0.0
A space themed grand strategy game set in the near future, with realistic orbital mechanics, and an emphasis on economics and politics.
Public Member Functions | Static Public Attributes | Private Attributes | Static Private Attributes | List of all members
cqsp::core::components::StarDate Class Reference

Holds and calculates the tick that is on going. Date is the number of hours that has been ongoing since the start of the day. Here is some rough thinking for what interval things should be done at. 1 tick: Combat ticks, planetary and ship movement? 25 ticks: (about a day) Economic activity, though I don't think it's such a good idea to put them in such a tight interval. 25 * 5 = 125 ticks: (about 5 days) 25 * 25 = 625 ticks: (about 26 days) Construction progress, pop growth, social changes, will also be the interval that would be used for the reference value 25 ^ 3 / 2 ~= 15625 ticks: (about 312 days) Momentous things and things that take a long time, such as planet's climates changing We will not do days and years, because these are specific to only earth, and we would like to portray the different cultural differences resulting from different orbital periods and rotational periods from planets, and it would be rather human-centric to assume other civilizations would use our calendar. As a result, I plan to introduce a system that allows the creation of different types of calendars. That would come later, though More...

#include <stardate.h>

Public Member Functions

void IncrementDate ()
 
uint64_t GetDate () const
 
double ToSecond () const
 
double ToDay () const
 
std::string ToString () const
 
std::string ToString (double offset) const
 
int GetYear () const
 
int GetMonth () const
 
int GetDay () const
 
int GetHour (double offset=0.0) const
 
int GetMinute () const
 
int ToTicks (double seconds)
 
void SetDate (unsigned int _date)
 
double operator() () const
 

Static Public Attributes

static const int TIME_INCREMENT = 60 * 10
 
static constexpr float MINUTE = 0.1f
 
static constexpr int HOUR = static_cast<int>(60 * MINUTE)
 
static constexpr int DAY = 24 * HOUR
 
static constexpr int WEEK = DAY * 7
 
static const int YEAR = DAY * 365
 

Private Attributes

uint64_t date = -1
 

Static Private Attributes

static const int start_date = 2000
 

Detailed Description

Holds and calculates the tick that is on going. Date is the number of hours that has been ongoing since the start of the day. Here is some rough thinking for what interval things should be done at. 1 tick: Combat ticks, planetary and ship movement? 25 ticks: (about a day) Economic activity, though I don't think it's such a good idea to put them in such a tight interval. 25 * 5 = 125 ticks: (about 5 days) 25 * 25 = 625 ticks: (about 26 days) Construction progress, pop growth, social changes, will also be the interval that would be used for the reference value 25 ^ 3 / 2 ~= 15625 ticks: (about 312 days) Momentous things and things that take a long time, such as planet's climates changing We will not do days and years, because these are specific to only earth, and we would like to portray the different cultural differences resulting from different orbital periods and rotational periods from planets, and it would be rather human-centric to assume other civilizations would use our calendar. As a result, I plan to introduce a system that allows the creation of different types of calendars. That would come later, though

However, this can bring some issues with statistics, because it can be hard for the player to know how much they are gaining over some year, especially as we calculate over the period that is irregular with a year. We can do that by calculating the ratio between the interval and the calendar time. Not sure how well that would work though.

Member Function Documentation

◆ GetDate()

uint64_t cqsp::core::components::StarDate::GetDate ( ) const
inline

◆ GetDay()

int cqsp::core::components::StarDate::GetDay ( ) const

◆ GetHour()

int cqsp::core::components::StarDate::GetHour ( double  offset = 0.0) const
Parameters
offsetThe hour offset

◆ GetMinute()

int cqsp::core::components::StarDate::GetMinute ( ) const

◆ GetMonth()

int cqsp::core::components::StarDate::GetMonth ( ) const

◆ GetYear()

int cqsp::core::components::StarDate::GetYear ( ) const

◆ IncrementDate()

void cqsp::core::components::StarDate::IncrementDate ( )
inline

◆ operator()()

double cqsp::core::components::StarDate::operator() ( ) const
inline

◆ SetDate()

void cqsp::core::components::StarDate::SetDate ( unsigned int  _date)
inline

◆ ToDay()

double cqsp::core::components::StarDate::ToDay ( ) const
inline

◆ ToSecond()

double cqsp::core::components::StarDate::ToSecond ( ) const
inline

◆ ToString() [1/2]

std::string cqsp::core::components::StarDate::ToString ( ) const

◆ ToString() [2/2]

std::string cqsp::core::components::StarDate::ToString ( double  offset) const

◆ ToTicks()

int cqsp::core::components::StarDate::ToTicks ( double  seconds)
inline

Member Data Documentation

◆ date

uint64_t cqsp::core::components::StarDate::date = -1
private

◆ DAY

constexpr int cqsp::core::components::StarDate::DAY = 24 * HOUR
staticconstexpr

◆ HOUR

constexpr int cqsp::core::components::StarDate::HOUR = static_cast<int>(60 * MINUTE)
staticconstexpr

◆ MINUTE

constexpr float cqsp::core::components::StarDate::MINUTE = 0.1f
staticconstexpr

◆ start_date

const int cqsp::core::components::StarDate::start_date = 2000
staticprivate

◆ TIME_INCREMENT

const int cqsp::core::components::StarDate::TIME_INCREMENT = 60 * 10
static

◆ WEEK

constexpr int cqsp::core::components::StarDate::WEEK = DAY * 7
staticconstexpr

◆ YEAR

const int cqsp::core::components::StarDate::YEAR = DAY * 365
static

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