Welcome to The Hub! Est. 2026

The Hub is the heart and soul of Topline, where our community gathers!

All official game rules, information, and guides can be found here!
User avatar
By Elowrae
#8
  • Topline runs as a slighly excellerated time scale. 1 Real Year = 2 Game Years.
  • The current game year and season is displayed in the header of each webpage for easy reference.
  • Animals age on January 1st and July 1st.

Function to fetch current Game Time:
Code: Select all
function game_year_info(DateTime $now): array
{
	
	$startDate = '2018-01-01'; // the actual date of when the first game year accured
	$gameEpochYear = 1; // the number of the first game year
    // -------------------------
    // Game-year start (Jan 1 / Jul 1)
    // -------------------------
    $realYear  = (int)$now->format('Y');
    $realMonth = (int)$now->format('n');

    if ($realMonth <= 6) {
        $start = new DateTime("$realYear-01-01 00:00:00");
    } else {
        $start = new DateTime("$realYear-07-01 00:00:00");
    }

    // -------------------------
    // Game year number (monotonic)
    // -------------------------
    $epoch = new DateTime($startDate);

    $epochYear  = (int)$epoch->format('Y');
    $epochHalf  = ((int)$epoch->format('n') <= 6) ? 0 : 1;

    $currentHalf = ($realMonth <= 6) ? 0 : 1;

    $gameYear =
       $gameEpochYear
        + (($realYear - $epochYear) * 2)
        + ($currentHalf - $epochHalf);

    // -------------------------
    // Season (360-day internal year)
    // -------------------------
    $end = (clone $start)->modify('+6 months');

    $secondsPerDay = 86400;

    $elapsedDays = intdiv(
        max(0, $now->getTimestamp() - $start->getTimestamp()),
        $secondsPerDay
    );

    $spanDays = max(1, intdiv(
        $end->getTimestamp() - $start->getTimestamp(),
        $secondsPerDay
    ));

    // Scale real progress → 360-day internal year
    $gameDay0 = (int)floor(($elapsedDays / $spanDays) * 360);
    $gameDay0 = max(0, min(359, $gameDay0));

    if ($gameDay0 <= 89) {
        $season = 'Winter';
    } elseif ($gameDay0 <= 179) {
        $season = 'Spring';
    } elseif ($gameDay0 <= 269) {
        $season = 'Summer';
    } else {
        $season = 'Fall';
    }

    return [
        'year'        => $gameYear,            // use this if you only want the year
        'season'      => $season,
        'year_start'  => $start->format('Y-m-d'),
    ];
}
Display Year & Season:
Code: Select all
$gt = game_year_info(new DateTime());
echo "Year {$gt['year']} — {$gt['season']}";
or just the year as a integer:
Code: Select all
$gameYear = game_year_info(new DateTime())['year'];
Zennie liked this
Show Hosting

Topline's show system is quite robust and allows f[…]

Game Time

Topline runs as a slighly excellerated time sca[…]

Competition & Honor System

The Basics All results, points, and earning[…]

Merit Program

Merits are our version of active member incenti[…]

Frequently Asked Questions

Can you add x breed or discipline? Breeds and di[…]

General Rules & Guidelines

Member Expectations You must be at least si[…]

Come and Join Us!