'Moscow - Yaroslavsky Station', 'lat' => 55.7558, 'lon' => 37.6173, 'description' => 'Begin the world\'s longest railway journey at Moscow\'s historic station.', 'image' => 'images/siberian1.jpg'],
['name' => 'Nizhny Novgorod - Volga Pearl', 'lat' => 56.2965, 'lon' => 43.9361, 'description' => 'Historic city at the confluence of the Volga and Oka rivers.', 'image' => 'images/siberian2.jpg'],
['name' => 'Yekaterinburg - Gateway to Siberia', 'lat' => 56.8389, 'lon' => 60.6057, 'description' => 'Russia\'s fourth-largest city on the border of Europe and Asia.', 'image' => 'images/siberian3.jpg'],
['name' => 'Omsk - Siberian Fortress', 'lat' => 54.9885, 'lon' => 73.3242, 'description' => 'Historic fortress city on the Irtysh River with grand architecture.', 'image' => 'images/siberian4.jpg'],
['name' => 'Novosibirsk - Heart of Siberia', 'lat' => 55.0084, 'lon' => 82.9357, 'description' => 'Russia\'s third-largest city and scientific center of Siberia.', 'image' => 'images/siberian5.jpg'],
['name' => 'Krasnoyarsk - Yenisei City', 'lat' => 56.0153, 'lon' => 92.8932, 'description' => 'Beautiful city on the mighty Yenisei River surrounded by nature reserves.', 'image' => 'images/siberian6.jpg'],
['name' => 'Irkutsk - Paris of Siberia', 'lat' => 52.2978, 'lon' => 104.2964, 'description' => 'Cultural capital near Lake Baikal with stunning wooden architecture.', 'image' => 'images/siberian7.jpg'],
['name' => 'Lake Baikal - The Sacred Sea', 'lat' => 53.5587, 'lon' => 108.1650, 'description' => 'The world\'s deepest and oldest freshwater lake, a UNESCO World Heritage site.', 'image' => 'images/siberian8.jpg'],
['name' => 'Chita - Gateway to Mongolia', 'lat' => 52.0340, 'lon' => 113.5006, 'description' => 'Historic outpost and junction of the Trans-Manchurian Railway.', 'image' => 'images/siberian9.jpg'],
['name' => 'Vladivostok - Pacific Terminus', 'lat' => 43.1332, 'lon' => 131.9113, 'description' => 'Complete your epic journey at Russia\'s Pacific port city.', 'image' => 'images/siberian10.jpg']
];
$dataFile = 'transsiberian_data.json';
$gameData = file_exists($dataFile) ? json_decode(file_get_contents($dataFile), true) : ['players' => []];
$playerId = $_COOKIE['convaya_id'] ?? null;
$playerName = $_COOKIE['convaya_name'] ?? '';
$currentPlayer = null;
if ($playerId && isset($gameData['players'][$playerId])) {
$currentPlayer = $gameData['players'][$playerId];
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$action = $_POST['action'] ?? '';
if ($action === 'join') {
$name = trim($_POST['name'] ?? '');
if ($name) {
$playerId = uniqid('player_');
$gameData['players'][$playerId] = [
'name' => $name,
'discovered' => [],
'joined' => date('Y-m-d H:i:s'),
'lat' => null,
'lon' => null
];
file_put_contents($dataFile, json_encode($gameData, JSON_PRETTY_PRINT));
setcookie('convaya_id', $playerId, time() + 86400 * 365, '/');
setcookie('convaya_name', $name, time() + 86400 * 365, '/');
header('Location: ' . $_SERVER['PHP_SELF']);
exit;
}
}
if ($action === 'update_position' && $playerId) {
$lat = floatval($_POST['lat'] ?? 0);
$lon = floatval($_POST['lon'] ?? 0);
if ($lat && $lon && isset($gameData['players'][$playerId])) {
$gameData['players'][$playerId]['lat'] = $lat;
$gameData['players'][$playerId]['lon'] = $lon;
$gameData['players'][$playerId]['last_update'] = date('Y-m-d H:i:s');
foreach ($treasures as $index => $treasure) {
$distance = haversine($lat, $lon, $treasure['lat'], $treasure['lon']);
if ($distance < 50 && !in_array($index, $gameData['players'][$playerId]['discovered'])) {
$gameData['players'][$playerId]['discovered'][] = $index;
}
}
file_put_contents($dataFile, json_encode($gameData, JSON_PRETTY_PRINT));
}
header('Content-Type: application/json');
echo json_encode(['success' => true, 'discovered' => $gameData['players'][$playerId]['discovered']]);
exit;
}
}
function haversine($lat1, $lon1, $lat2, $lon2) {
$R = 6371;
$dLat = deg2rad($lat2 - $lat1);
$dLon = deg2rad($lon2 - $lon1);
$a = sin($dLat/2) * sin($dLat/2) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * sin($dLon/2) * sin($dLon/2);
$c = 2 * atan2(sqrt($a), sqrt(1-$a));
return $R * $c;
}
if ($currentPlayer) {
$discovered = $currentPlayer['discovered'] ?? [];
$progress = (count($discovered) / count($treasures)) * 100;
?>
Route Stops
$treasure):
$isDiscovered = in_array($index, $discovered);
?>
Join the Adventure
Enter your name to start tracking your journey across Russia
Route Preview