Yes, more mapping. This is turning out the be a very important element for the game because you can’t trade between stations if you can’t get to the stations, right?

Above, you see the newly minted — and working — planetary layout. I have five planets in this iteration: 1 temperate, 1 rock, 2 gas, and 1 ice. Unfortunately, my generation code put 2 planets in the same orbit, which is not something I am against, but I don’t know if it’s scientifically feasible, considering those two planets are close to one another. Maybe if they were on alternate sides of the star I’d feel better about it. But you can click on the planet and get the details panel display that you see above. Right now, it just displays the type (Terrestrial, since I clicked the green planet) and the orbit, but it has 2 buttons here: Land and Dock. Land will allow you to land on the planet if it’s a terrestrial type, but Dock will only show if there’s a station in orbit around the planet. I just roughed in the button to make it visible; I haven’t gotten to the station work yet.

Here’s the jump gate-clicked version of the same. It looks just like it always has.

This is the fourth attempt at making a map, and while it might be the messiest, it’s also the one that works the best. It’s using straight-up HTML5 canvas drawing because it works with minimal fuss. The only issue is that HTML5 canvas as no element event handling. That means that I can draw a planet, but the DOM doesn’t know it’s there, so I can’t wire up anything to listen for when you click a “planet” or a “jump gate”. Instead, I have to listen for the click on the canvas itself, and then run a translation that calculates the position of where you clicked. With that translation, I have to compare the X and Y values to a range of top-left and bottom-right values to see if the click happened within the bounds of what was rendered. If the values fall into a bounding box value, I use the associated code to determine which item you clicked, and what details data to load into the panel. While this works, I’m not too happy about it; I’d rather wire up a listener to each item and have it call the appropriate handler, but I guess it’s doable considering we don’t have that many planets or jumpgates.

Scopique

Owner and author.

Leave a Reply

Your email address will not be published. Required fields are marked *