[MOD] My Planets 3D Visualization

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

    • [MOD] My Planets 3D Visualization

      Hello friends~.
      This mod visually improves your planet by rendering it in 3D.
      Your planet is displayed relative to the sun in the center, and if there is a moon or debris field on the planet, it is intuitively indicated next to the planet.
      You can also issue fleet commands immediately, and rotate, zoom in/out, and move the solar system using the mouse.

      Information is displayed at the bottom when you click on a planet, moon, or debris field.
      Fleet commands (transport, deploy, harvest) are also available.

      See screenshot

      After everything is complete, the access address is yoursite/game.php?page=myplanet3d

      1.
      Create ShowMyplanet3dPage.class.php.
      includes/games/ShowMyplanet3dPage.class.php

      PHP Source Code

      1. <?php
      2. /**
      3. * 2Moons - Three.js Solar System & Planet Resource Scanner Page
      4. *
      5. * @link https://github.com/jkroepke/2Moons
      6. *
      7. * Make by noonn
      8. */
      9. class ShowMyplanet3dPage extends AbstractGamePage
      10. {
      11. public static $requireModule = 0;
      12. function __construct()
      13. {
      14. parent::__construct();
      15. }
      16. function show()
      17. {
      18. global $USER,$PLANET, $resource,$reslist;
      19. $db = Database::get();
      20. $order =$USER['planet_sort_order'] == 1 ? 'DESC' : 'ASC';
      21. $sql = "SELECT * FROM %%PLANETS%% WHERE id_owner = :userID AND destruyed = '0' AND planet_type = '1' ORDER BY ";
      22. switch($USER['planet_sort'])
      23. {
      24. case 2:
      25. $sql .= 'name '.$order;
      26. break;
      27. case 1:
      28. $sql .= 'galaxy '.$order.', system '.$order.', planet '.$order;
      29. break;
      30. default:
      31. $sql .= 'id '.$order;
      32. break;
      33. }
      34. $PlanetsRAW = $db->select($sql, array(
      35. ':userID' => $USER['id']
      36. ));
      37. $PLANETS = array();$PlanetRess = new ResourceUpdate();
      38. foreach ($PlanetsRAW as$CPLANET)
      39. {
      40. list($USER, $CPLANET) =$PlanetRess->CalcResource($USER,$CPLANET, true);
      41. $PLANETS[] =$CPLANET;
      42. unset($CPLANET);
      43. }
      44. $planetList = array();
      45. foreach($PLANETS as$Planet)
      46. {
      47. $id =$Planet['id'];
      48. $moonSQL = "SELECT * FROM %%PLANETS%% WHERE galaxy = :galaxy AND system = :system AND planet = :planet AND planet_type = '3' AND destruyed = '0' LIMIT 1;";
      49. $moonRAW = $db->selectSingle($moonSQL, array(
      50. ':galaxy' => $Planet['galaxy'],
      51. ':system' => $Planet['system'],
      52. ':planet' => $Planet['planet']
      53. ));
      54. $moonData = null;
      55. if ($moonRAW) {
      56. list($USER,$moonRAW) = $PlanetRess->CalcResource($USER, $moonRAW, true);
      57. $moonData = array(
      58. 'id' => $moonRAW['id'],
      59. 'name' => $moonRAW['name'],
      60. 'galaxy' => $moonRAW['galaxy'],
      61. 'system' => $moonRAW['system'],
      62. 'planet' => $moonRAW['planet'],
      63. 'diameter' => $moonRAW['diameter'],
      64. 'temp' => $moonRAW['temp_min'],
      65. 'tempmax' => $moonRAW['temp_max'],
      66. 'metal' => floor($moonRAW['metal']),
      67. 'crystal' => floor($moonRAW['crystal']),
      68. 'deuterium' => floor($moonRAW['deuterium'])
      69. );
      70. }
      71. $debrisSQL = "SELECT der_metal, der_crystal FROM %%PLANETS%% WHERE galaxy = :galaxy AND system = :system AND planet = :planet LIMIT 1;";
      72. $debrisRAW = $db->selectSingle($debrisSQL, array(
      73. ':galaxy' => $Planet['galaxy'],
      74. ':system' => $Planet['system'],
      75. ':planet' => $Planet['planet']
      76. ));
      77. $debrisData = null;
      78. if ($debrisRAW && ($debrisRAW['der_metal'] > 0 || $debrisRAW['der_crystal'] > 0)) {
      79. $debrisData = array(
      80. 'id' => $Planet['id'],
      81. 'galaxy' => $Planet['galaxy'],
      82. 'system' => $Planet['system'],
      83. 'planet' => $Planet['planet'],
      84. 'metal' => floor($debrisRAW['der_metal']),
      85. 'crystal' => floor($debrisRAW['der_crystal'])
      86. );
      87. }
      88. $planetList[$id] = array(
      89. 'id' => $id,
      90. 'name' => $Planet['name'],
      91. 'image' => $Planet['image'],
      92. 'galaxy' => $Planet['galaxy'],
      93. 'system' => $Planet['system'],
      94. 'planet' => $Planet['planet'],
      95. 'diameter' => $Planet['diameter'],
      96. 'temp' => $Planet['temp_min'],
      97. 'tempmax' => $Planet['temp_max'],
      98. 'field_curr' => $Planet['field_current'],
      99. 'field_max' => CalculateMaxPlanetFields($Planet),
      100. 'metal' => floor($Planet['metal']),
      101. 'crystal' => floor($Planet['crystal']),
      102. 'deuterium' => floor($Planet['deuterium']),
      103. 'moon' => $moonData,
      104. 'debris' => $debrisData
      105. );
      106. }
      107. $this->tplObj->loadscript('galaxy.js');
      108. $this->assign(array(
      109. 'jsonPlanetList' => json_encode($planetList, JSON_UNESCAPED_UNICODE),
      110. 'dpath' => $USER['dpath'],
      111. 'gal' => $PLANET['galaxy'],
      112. 'sys' => $PLANET['system'],
      113. 'pla' => $PLANET['planet'],
      114. ));
      115. $this->display('page.myplanet3d.default.tpl');
      116. }
      117. }
      Display All

      2. tpl file attached

      page.myplanet3d.default.tpl
      templates/game/page.myplanet3d.default.tpl



      --------------------------------------------------------------------------------------
    • looks good ive been working on a live galaxy in the overview page ive redone alot in the eve online style and the buildings page
      Images
      • buildings.png

        2.47 MB, 1,920×1,080, viewed 37 times
      • overview.png

        1.29 MB, 1,920×1,080, viewed 40 times
    • I tried implementing the galaxy in 3D, but the visibility was so poor that I gave up.
      ^^ :rolleyes:
      --------------------------------------------------------------------------------------