Pre-Order the Game!

Desura Digital Distribution

Tuesday, March 26, 2013

Finished with Gateways!

I've fixed and finished all four algorithms for connecting gateways (Maximum Spanning didn't really make sense, but if popular demand requires, I can add it later).  Here's what I really like about this new approach is that it allows for isolated islands across the expanse.  This is what happens if a star is randomly allowed between 1 to 4 starlanes:


Note the 5 stars on top right area that's connected together, but not to the rest of the galaxy?  Yeah, they didn't have spare starlanes to connect to the rest of the galaxy.

This is what happens if you change the amount to 2 to 4 starlanes per star:


All stars are connected  This new approach is actually better than my old implementation of starlanes, in that it don't have those random extremely long starlanes.

I also got rid of the 2D engine's capture of mouse, and instead used Windows mouse events to handle clicking and moving.  It performs exactly the same, but with three benefits: No more weird mouse jerking when FPS is low, it don't change the mouse speed when entering the screen, and it should fix some incorrect mouse position issues that some people reported.

I also updated the background stars to use the new BBSprite, and it've boosted the performance a bit!  In case you're wondering "Isn't that a bit too many nebulaes?", the galaxy generation script is very simple and has 33% chance of spawning compared to a star or black hole.  I plan to tweak it in the future so there's only one nebula of each type, up to 6 nebulaes, in a cluster galaxy.

4 comments:

  1. Though algorithm in my game doesn't roll for exact number of starlanes on each star I too got that having 1 starlane on too many stars created small disjunct star clusters instead of big cluster with dead ends.

    Regarding the performance, no hardware acceleration technology should have a problem displaying such scene. We are talking about hundreds of primitives (polygons), FPS should never drop below 150 Hz.

    ReplyDelete
  2. When I first did the starlanes, how I did it was to generate a list of all possible starlanes using a certain algorithm that finds adjacent stars without creating intersections. After this list of possible starlanes are generated, I then pick a random starting star, then execute a minimum spanning algorithm that connects all the stars using the list of possible starlanes. At this point, it'd look more like strings of stars connecting to the starting star. I then pick 20% of the remaining starlanes that haven't been added and add them to add more possible connections and to reduce the number of "strings". This approach will give you a lot of dead-ends without stranding star locations, if that's what you wanted.

    The new approach now generates a number of possible starlanes per star, and I connect them, which don't guarantee that all stars will be connected.

    ReplyDelete
  3. Nice approach, I'll give it a try.

    ReplyDelete
  4. You can look at history of changes in my game's google code site and see the code for determining adjacent stars if you want to see how it's done. There's several methods for doing this, but I found this to be the simplest to implement for me.

    ReplyDelete