As you can see, the ships are arranged so the biggest ships are in the middle, with smaller at top and bottom. The algorithm works like this: Sort the list of ships from smallest to largest. Fit as many ships as possible on the frontmost column (facing the enemy) starting from smallest, but place the largest ships in middle. If more ships than the column space, then put the rest of the bigger ships on the next column, a bit farther from the enemy, and so forth until all ships are placed. This took me a while to finally figure out, but when I figured it out, the solution was so simple I'm kicking myself for not thinking of it sooner.
I've also tweaked the camera class so it can work with either the galaxy viewing, space combat, or ground combat. As a result, I can move around the space battlefield and zoom in/out.
I've also figured out a simple solution to the UI problem with the new game screen, so things are looking up! I think I will leave the space combat screen as is for now, and finish up the new game/main menu, and add transistions between different screens. Then I'll reimplement the galaxy screen from the older version, and hopefully it'd be kinda playable.
No comments:
Post a Comment