Announcement

Collapse

Welcome to the New Server!

Apolyton.net is now pointing to the new server. Please let us know if you spot any oddities or have any suggestions for what to add to the site!
See more
See less

Civilization: Beyond Earth Virtues Screen

Collapse
This is a sticky topic.
X
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Civilization: Beyond Earth Virtues Screen

    connect_errno) { $output = "Connect failed: " . $mysqli->connect_error; } else { $query = "SELECT * FROM civbe_virtues ORDER BY id ASC"; if ($virtues = $mysqli->query($query)) { $query = "SELECT * FROM civbe_synergies ORDER BY id ASC"; if ($synergies = $mysqli->query($query)) { $output = apDisplayVirtuePicker($virtues,$synergies); $synergies->free(); } /* free result set */ $virtues->free(); } } $mysqli->close(); //file_put_contents($file, $output); } else $output = file_get_contents($file); return $output; function apDisplayVirtuePicker($virtues, $synergies) { $width = 1006; $height = 653; $treeWidth = 230; $tierHeight = 182; $firstX = 119; $firstY = 114; $firstTopSynergyX = 115; $firstTopSynergyY = 69; $firstSideSynergyX = 44; $firstSideSynergyY = 94; $synergyX = 75; $synergyY = 9; $normalX = 60; $normalY = 62; $virtueWidth = 45; $virtueHeight = 43; $synergyWidth = 24; $synergyHeight = 24; $firstTierCounterY = 105; $firstTierCounterX = 70; $tierCounterHeight = 9; $tierCounterWidth = 16; $tierHeight = 182; $tierWidth = 16; $tierGap = 3; $firstCatCounterX = 89; $firstCatCounterY = 95; $catCounterWidth = 15; $catCounterHeight = 11; $catWidth = 225; $catHeight = 11; $catGap = 5; $output = ' '; //$virtuesEnabled = array(); $virtuesLeadTo = array(); $virtuesPrereq = array(); $virtuesLookup = array(); $virtueOutput = ''; while ($virtue = $virtues->fetch_assoc()) { //$virtuesEnabled['virtue' . $virtue['id']] = $virtue['enabled']; $virtuesLeadTo['virtue' . $virtue['id']] = $virtue['enables']; $virtuesPrereq['virtue' . $virtue['id']] = $virtue['prereqs']; $virtuesLookup[$virtue['virtue']] = 'virtue' . $virtue['id']; $category = strtolower($virtue['cat']); if($category === 'might') $tree = 0; else if($category === 'prosperity') $tree = 1; else if($category === 'knowledge') $tree = 2; else if($category === 'industry') $tree = 3; if($virtue['tier'] === '3') $tierClass = ' tier3'; else if($virtue['tier'] === '2') $tierClass = ' tier2'; else if($virtue['tier'] === '1') $tierClass = ' tier1'; else $tierClass = ''; $treeOffset = $firstX + ($tree * $treeWidth); $tierOffset = $firstY + (($virtue['tier'] - 1) * $tierHeight); $xPos = $treeOffset + (($virtue['col'] - 1) * $normalX); $yPos = $tierOffset + (($virtue['row'] - ((($virtue['tier'] - 1) * 3)) - 1) * $normalY); //echo $virtue['virtue'] . ' yPos(' . $yPos . '): toff(' . $tierOffset . ') + (row(' . $virtue['row'] . ') - (((tier(' . $tierOffset . ' - 1) * 3)) - 1) * normalY(' . $normalY . ')
    '; if($virtue['num'] === '1') $isEnabled = ' class="glowBorderEnabled"'; else $isEnabled = ''; $virtueOutput .= '
    ' . $virtue['virtue'] . '

    ' . $virtue['description'] . '
    '; } $synergyOutput = ''; while ($synergy = $synergies->fetch_assoc()) { $type = strtolower($synergy['type']); if($type === 'tier') $num = $synergy['tier']; else $num = ''; $yPos = $firstTopSynergyY; if($type === 'tier') { $xPos = $firstSideSynergyX; $yPos = $firstSideSynergyY + (($synergy['tier'] - 1) * ($tierHeight + 2)) + (($synergy['num'] - ($synergy['virtues'] / 2)) * $synergyY); } else if ($type === 'might') { $xPos = $firstTopSynergyX + (($synergy['tier'] - 1) * $synergyX); } else if ($type === 'prosperity') { $xPos = $firstTopSynergyX + (($synergy['tier'] - 1) * $synergyX) + $treeWidth; } else if ($type === 'knowledge') { $xPos = $firstTopSynergyX + (($synergy['tier'] - 1) * $synergyX) + (2 * $treeWidth); } else if ($type === 'industry') { $xPos = $firstTopSynergyX + (($synergy['tier'] - 1) * $synergyX) + (3 * $treeWidth); } if($synergy['tier'] == 3) $tierClass = ' tier3'; else $tierClass = ''; $synergyOutput .= '
    Synergy: ' . $synergy['name'] . '

    ' . $synergy['kicker'] . '
    '; } $output .= '
    Culture Icon
    Total:
    0
    Next:
    20
    '; $output .= $virtueOutput . $synergyOutput . '
    '; return $output; } function apConvertLeadsTo($array,$lookup) { $newArray = array(); foreach($array as $key => $val) { if($val != '') { $virtues = explode(',',$val); $newArray[$key] = ''; $comma = ''; foreach($virtues as $virtue) { $newArray[$key] .= $comma . $lookup[$virtue]; $comma = ','; } } else { $newArray[$key] = ''; } } return apArrayToJsArray($newArray); } function apArrayToJsArray($array) { $output = '{'; $comma = ''; foreach($array as $key => $val) { $output .= $comma . "'" . $key . "': '" . $val . "'"; $comma = ', '; } $output .= '};'; return $output; } function apBaseUrl() { return 'http://cache.apolyton.net/'; //return 'http://127.0.0.1/apolyton.net/'; } ?>

    Features:

    - Culture Counters for Total and Next Cost.
    - Synergy counters keep track of progress towards synergies
    - Number overlay keeps track of the order of virtues picked
    - Hover text provides Virtue information
    - Highlight (Chrome, Opera) and glowing borders (All) for Virtues selected.
    - Highlight for Virtues with prerequisites selected. (Chrome, Opera)
    - Highlight for Synergies reached. (Chrome, Opera)
    - Responsive to theme width at page load. (Not all cases)

    In the Works:

    - Hover text formatting as in-game.
    - Text output of choices.
    - Firefox and Internet Explorer compatibility.
    - Fully responsive design.
    - Embedding for 3rd party sites.
    - Screencapture and image link.
    - Social sharing options.

    ... and more
    Last edited by Aeson; September 13, 2014, 01:05.
    "tout comprendre, c'est tout pardonner"

  • #2
    Do you know if the prereqs are "and" or "or"?

    Comment


    • #3
      I'd say 'and', going with Civ 5 social policy trees.
      Indifference is Bliss

      Comment


      • #4
        Great work! Of course, by release a lot of it will probably be outdated.
        Do not fear, for I am with you; Do not anxiously look about you, for I am your God.-Isaiah 41:10
        I praise you because I am fearfully and wonderfully made - Psalms 139.14a
        Also active on WePlayCiv.

        Comment


        • #5
          Originally posted by Nikolai View Post
          Great work! Of course, by release a lot of it will probably be outdated.
          It updates dynamically (almost) from a database which also fills out the tables on the wiki, and once the game is released will hopefully be updated straight from the XML, so change is ok!
          Last edited by Aeson; September 6, 2014, 20:34.
          "tout comprendre, c'est tout pardonner"

          Comment


          • #6
            Originally posted by Kuciwalker View Post
            Do you know if the prereqs are "and" or "or"?
            From an older video it looks like they are "or":

            Click image for larger version

Name:	or-virtues.jpg
Views:	1
Size:	150.1 KB
ID:	9101208

            It would make sense to be "or" to facilitate decisions like going for the Tier 3 Synergy bonus ASAP vs grabbing good non-essentials along that path or going for earlier Tier Synergies.
            "tout comprendre, c'est tout pardonner"

            Comment


            • #7
              Prosperity synergy 3 is the only problem I have with it. It pops up, but without telling you the bonus.
              I don't know what I've been told!
              Deirdre's got a Network Node!
              Love to press the Buster Switch!
              Gonna nuke that crazy witch!

              Comment


              • #8
                As far as I can tell, Prosperity Synergy 3 isn't yet known. The name of Prosperity 3 (the bar-graph Virtue) hasn't yet been shown either. The other unknown left is the Tier 2b Synergy bonus.

                (Added in Tier 1b and 1c and fixed an oversight with Tier 3 this morning thanks to Inhalaattori at CFC)
                "tout comprendre, c'est tout pardonner"

                Comment


                • #9
                  Added in the counters for the Synergies and some logic for highlighting/selecting based on requirements. There's still some errors with selection that I'm tracking down. Refreshing the page gives a clean slate if it gets too messed up.
                  "tout comprendre, c'est tout pardonner"

                  Comment


                  • #10
                    Ok, all the bugs I'm aware of have been squashed, so let me know when you spot some more
                    "tout comprendre, c'est tout pardonner"

                    Comment


                    • #11
                      A big THANKS to Kevin Schultz from Firaxis for filling in the last 3 bonuses!

                      Prosperity 3 name - Homesteading
                      Prosperity Synergy 3 - +50% Orbital Coverage radius from Cities
                      Tier 2B – Choose 1 Free Affinity Level
                      "tout comprendre, c'est tout pardonner"

                      Comment


                      • #12
                        Wow, this is pretty cool. Nice job!

                        Comment


                        • #13
                          Nice
                          Indifference is Bliss

                          Comment


                          • #14
                            Very good stuff, good work!
                            Captain of Team Apolyton - ISDG 2012

                            When I was younger I thought curfews were silly, but now as the daughter of a young woman, I appreciate them. - Rah

                            Comment


                            • #15
                              Originally posted by Kuciwalker View Post
                              Do you know if the prereqs are "and" or "or"?
                              It's OR. If it was AND then Nature's Bounty wouldn't be connected to Gift Economy and Mind Over Matter, because Mind Over Matter already requires Nature's Bounty. It would be redundant.

                              Comment

                              Working...
                              X