[DEV] 2Moons/SmartMoons 3.0 - Next Gen Update (PHP 8.4, Twig Engine & Aerospace Design)

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Guten Morgen . Frohe Ostern erst mal.
      Habe die letzte Version mit allen neuen Änderungen zum Test install.
      Server nur PHP 8,2 aber kein Problem konnte ohne Problem alles Starten.
      AiBot hängt in der ersten Ausbaustufe fest schließt den Bau von solar nicht ab.
      Display Spoiler

      public function runBot(array $botRow, int $universeId): void
      {
      $botId = (int)($botRow['id'] ?? 0);
      $ownerId = (int)($botRow['id_owner'] ?? 0);
      $typeId = (int)($botRow['bot_type'] ?? 0);
      $personalityName = (string)($botRow['personality'] ?? 'balanced');


      if ($botId <= 0 || $ownerId <= 0 || $typeId <= 0) {
      $this->log("SKIP invalid botRow (botId={$botId}, ownerId={$ownerId}, typeId={$typeId})");
      return;
      }


      $settings = $this->getBotSettings($typeId);
      if (!$settings) {
      $this->log("SKIP botId={$botId} ownerId={$ownerId}: settings missing for typeId={$typeId}");
      $this->scheduleNext($botId, 900);
      return;
      }


      // Load Personality
      $personalityClass = (defined('ROOT_PATH') ? ROOT_PATH : '') . 'includes/classes/bot/BotPersonality.class.php';
      if (file_exists($personalityClass)) {
      require_once $personalityClass;
      $personality = BotPersonality::get($personalityName);
      } else {
      $personality = null;
      }


      if (empty((int)($settings['enabled'] ?? 1))) {
      $this->log("SKIP botId={$botId}: disabled by setting");
      $this->scheduleNext($botId, 1800);
      return;
      }


      $user = $this->getUser($ownerId);
      if (!$user) {
      $this->log("SKIP botId={$botId}: user missing ownerId={$ownerId}");
      $this->scheduleNext($botId, 1200);
      return;
      }


      $planet = $this->getMainPlanet($ownerId, $universeId);
      if (!$planet) {
      $this->log("SKIP botId={$botId}: main planet missing ownerId={$ownerId} uni={$universeId}");
      $this->scheduleNext($botId, 1200);
      return;
      }


      // Starter-Hilfe nach Reset
      $planet = $this->healEmptyPlanet($planet, $universeId);


      // Eigene Bot-Bauqueue abschließen
      $planet = $this->processBotBuildingQueue($planet, $user);


      // Heartbeat like a real player
      $this->touchActivity($ownerId, $botId);


      $this->log("BOT#{$botId} ({$user['username']}) type={$typeId} personality={$personalityName} tick start");


      // 0) Alliance management
      $this->doAllianceActions($user, $universeId, $settings);


      // 1) Economy
      $didAny = false;
      $maxActions = max(1, (int)($settings['max_actions_per_tick'] ?? 4));
      $actionsLeft = $maxActions;


      if ($actionsLeft > 0) {
      $didAny = $this->doEconomyActions($user, $planet, $settings, $personality, $actionsLeft) || $didAny;
      }


      // 2) Fleet
      if ($actionsLeft > 0) {
      $didAny = $this->doFleetActions($user, $planet, $botRow, $settings, $personality, $actionsLeft) || $didAny;
      }


      // 3) ACS
      $canAcs = !empty((int)($settings['can_acs'] ?? 1));
      $acsChance = (int)($settings['acs_chance_percent'] ?? 30);
      if ($canAcs && $actionsLeft > 0 && mt_rand(1, 100) <= $acsChance) {
      if ($this->doAcsRaid($user, $planet, $settings, $personalityName)) {
      $didAny = true;
      }
      }


      // Persist
      $this->persistUserAndPlanet($user, $planet);


      // Next schedule
      $delay = $this->getNextDelaySeconds($settings, $didAny);
      $this->scheduleNext($botId, $delay);


      $this->log("BOT#{$botId} ({$user['username']}) tick end didAny=" . ($didAny ? "1" : "0") . " nextIn={$delay}s");
      }


      private function processBotBuildingQueue(array $planet, array &$user): array
      {
      global $resource;


      if (empty($planet['b_building_id']) || empty($planet['b_building'])) {
      return $planet;
      }


      if ((int)$planet['b_building'] > TIMESTAMP) {
      return $planet;
      }


      $queue = @unserialize($planet['b_building_id']);
      if (!is_array($queue) || empty($queue) || !isset($queue[0][0], $queue[0][4])) {
      $this->log("BOT QUEUE PROCESS: invalid queue on planetId={$planet['id']}, clearing");
      $planet['b_building'] = 0;
      $planet['b_building_id'] = '';


      $this->db->update(
      "UPDATE %%PLANETS%% SET b_building = 0, b_building_id = '' WHERE id = :pid",
      [':pid' => (int)$planet['id']]
      );
      return $planet;
      }


      $elementId = (int)$queue[0][0];
      $mode = (string)$queue[0][4];


      if (!isset($resource[$elementId])) {
      $this->log("BOT QUEUE PROCESS: unknown elementId={$elementId} on planetId={$planet['id']}, clearing");
      $planet['b_building'] = 0;
      $planet['b_building_id'] = '';


      $this->db->update(
      "UPDATE %%PLANETS%% SET b_building = 0, b_building_id = '' WHERE id = :pid",
      [':pid' => (int)$planet['id']]
      );
      return $planet;
      }


      $column = $resource[$elementId];


      if ($mode === 'build') {
      $planet[$column] = (int)($planet[$column] ?? 0) + 1;
      $planet['field_current'] = (int)($planet['field_current'] ?? 0) + 1;
      $this->log("BOT QUEUE PROCESS: completed build elementId={$elementId} planetId={$planet['id']} newLevel=" . (int)$planet[$column]);
      } else {
      $planet[$column] = max(0, (int)($planet[$column] ?? 0) - 1);
      $planet['field_current'] = max(0, (int)($planet['field_current'] ?? 0) - 1);
      $this->log("BOT QUEUE PROCESS: completed destroy elementId={$elementId} planetId={$planet['id']} newLevel=" . (int)$planet[$column]);
      }


      array_shift($queue);


      if (empty($queue)) {
      $planet['b_building'] = 0;
      $planet['b_building_id'] = '';
      } else {
      $planet['b_building_id'] = serialize(array_values($queue));
      $planet['b_building'] = (int)($queue[0][3] ?? 0);
      }


      try {
      $this->db->update(
      "UPDATE %%PLANETS%% SET
      {$column} = :lvl,
      field_current = :fc,
      b_building = :bb,
      b_building_id = :bq
      WHERE id = :pid",
      [
      ':lvl' => (int)$planet[$column],
      ':fc' => (int)$planet['field_current'],
      ':bb' => (int)$planet['b_building'],
      ':bq' => (string)$planet['b_building_id'],
      ':pid' => (int)$planet['id'],
      ]
      );
      } catch (Throwable $t) {
      $this->log("BOT QUEUE PROCESS failed planetId={$planet['id']}: " . $t->getMessage());
      }


      return $planet;
      }


      Damit startet der Aibot
      Ach so log einträge müst ihr euch anpassen war nur für mich .
      MFG
    • Sooo bald geht es weiter.
      Ich habe gerade sehr hart an einem anderen Projekt noch gearbeitet, aber das ist fast abgeschlossen.
      Dann geht es bei 2MoonsCE weiter.
      SmartMoons – Community Beta
      Modernes 2Moons mit
      KI-Bots, PHP8.3 & 8.4, Twig
      UI/UX-Optik (clean + futuristisch)
      Jetzt testen & mithelfen
      Bitte
      /Bugs/Ideen per SupportTicket posten – ich bin dankbar für jeden Hinweis ❤️
    • Ich baue gerade an meinem ganz eigenen Weltraum-Game, welches mit Node.js läuft.

      2MoonsCE wird bald weitergemacht.

      Ihr könnt es gern unter Nexus Wars testen. Ich bin auf euer Feedback gespannt.
      SmartMoons – Community Beta
      Modernes 2Moons mit
      KI-Bots, PHP8.3 & 8.4, Twig
      UI/UX-Optik (clean + futuristisch)
      Jetzt testen & mithelfen
      Bitte
      /Bugs/Ideen per SupportTicket posten – ich bin dankbar für jeden Hinweis ❤️
    • Welches meinst du?

      Meinst du das ? Nexus War

      Oder das 2moons
      SmartMoons – Community Beta
      Modernes 2Moons mit
      KI-Bots, PHP8.3 & 8.4, Twig
      UI/UX-Optik (clean + futuristisch)
      Jetzt testen & mithelfen
      Bitte
      /Bugs/Ideen per SupportTicket posten – ich bin dankbar für jeden Hinweis ❤️
    • Nexus bleibt mein Spiel ich überlege ob ich es irgendwann mal zum Download zur Verfügung stellen.

      2MoonsCE gibt es auf GitHub ich habe den Link auch gepostet. Hier im thread.
      SmartMoons – Community Beta
      Modernes 2Moons mit
      KI-Bots, PHP8.3 & 8.4, Twig
      UI/UX-Optik (clean + futuristisch)
      Jetzt testen & mithelfen
      Bitte
      /Bugs/Ideen per SupportTicket posten – ich bin dankbar für jeden Hinweis ❤️
    • Vor deiner letzten Antwort ist der aktuelle Download zu 2moonsCE
      SmartMoons – Community Beta
      Modernes 2Moons mit
      KI-Bots, PHP8.3 & 8.4, Twig
      UI/UX-Optik (clean + futuristisch)
      Jetzt testen & mithelfen
      Bitte
      /Bugs/Ideen per SupportTicket posten – ich bin dankbar für jeden Hinweis ❤️
    • Hallo zusammen,
      ich möchte euch kurz über eines meiner aktuellen Projekte informieren.
      Neben 2MoonsCE arbeite ich seit einiger Zeit auch an einem komplett eigenen Browsergame namens Nexus War. Da Nexus War ein eigenständiges Projekt ist und ich dafür langfristig eine eigene Community aufbauen möchte, habe ich ein separates Forum erstellt.
      Forum: forum.makeit.uno
      Dort findet ihr unter anderem:
      • Nexus War (Downloads & Entwicklung)
      • Plugins & Erweiterungen
      • Themes
      • Tutorials
      • Feature-Vorschläge
      • Bugreports
      • Community & Support
      Natürlich wird dort auch 2MoonsCE unterstützt und zum Download angeboten.
      Wichtig ist mir aber zu betonen:
      2MoonsCE gehört für mich weiterhin zur 2Moons-Community.
      Deshalb werde ich selbstverständlich auch weiterhin hier im 2Moons-Forum aktiv sein, 2MoonsCE weiterentwickeln, Fragen beantworten, Fehler beheben und neue Versionen veröffentlichen.
      Mein eigenes Forum soll die bestehende Community nicht ersetzen, sondern eine zusätzliche Plattform für meine eigenen Projekte und zukünftigen Entwicklungen sein.
      Wer Interesse an Nexus War, zukünftigen Projekten oder einer MultiGame-Community hat, ist herzlich eingeladen, einmal vorbeizuschauen.
      Ich freue mich auf euer Feedback und wünsche euch weiterhin viel Spaß mit 2MoonsCE!
      Viele Grüße
      0wum0
      SmartMoons – Community Beta
      Modernes 2Moons mit
      KI-Bots, PHP8.3 & 8.4, Twig
      UI/UX-Optik (clean + futuristisch)
      Jetzt testen & mithelfen
      Bitte
      /Bugs/Ideen per SupportTicket posten – ich bin dankbar für jeden Hinweis ❤️
    • Hello everyone,
      I'd like to share a quick update about one of my current projects.
      Besides 2MoonsCE, I've been working on my own browser game called Nexus War. Since Nexus War is a completely independent project and I want to build a dedicated community around it, I have launched a separate forum.
      Forum: https://forum.makeit.uno
      There you'll find:
      • Nexus War (downloads & development)
      • Plugins & extensions
      • Themes
      • Tutorials
      • Feature requests
      • Bug reports
      • Community & support
      Of course, 2MoonsCE will also be available there with downloads and support.
      However, I'd like to make one thing very clear:
      In my opinion, 2MoonsCE belongs to the 2Moons community.
      Because of that, I will continue developing 2MoonsCE, publishing updates, fixing bugs, answering questions, and actively supporting the project here in the official 2Moons forum.
      My own forum is not intended to replace this community, but rather to provide an additional home for my own projects, Nexus War, and future browser game developments.
      If you're interested in Nexus War, future projects, or a growing multi-game community, you're more than welcome to join us.
      Thank you for your continued support of 2MoonsCE, and I hope to see you around!
      Best regards,
      0wum0
      SmartMoons – Community Beta
      Modernes 2Moons mit
      KI-Bots, PHP8.3 & 8.4, Twig
      UI/UX-Optik (clean + futuristisch)
      Jetzt testen & mithelfen
      Bitte
      /Bugs/Ideen per SupportTicket posten – ich bin dankbar für jeden Hinweis ❤️