Saturday, May 19, 2012

Interstellar Highways

Well, I'm graduating college tomorrow, but that's not important.  What is important is Wormholes!  Here's a picture to start us off:


That's taken from the starmap, displaying bridge-type wormholes between several systems.  I'll get into more detail about the wormhole types in a bit.  Right now the starmap shows all generated bridge wormholes, but in the future it will only display wormholes the player has "explored".  As the player travels to each system, its wormholes are generated along with the rest of the system.  Those wormholes do not get marked as "explored" until the player has traveled through them.  Once they are explored they'll show up on the starmap, so the player can keep track of how to get where.

Wormholes will serve as a means of faster-than-light travel between solar systems, in order to cut down on how much waiting the player will have to do.  However, they don't have to use the wormholes.  Though it's not implemented at the moment, eventually you will be able to just point your ship at a star and fly there.

Wormholes In The Wild

Wormholes will appear in the game as spheres through which you can see the destination system.  I really hate the stereotypical funnel look, I think it's silly.  This is the effect I'm going for (screenshot from EVE Online):

However, since I'm not very good at writing shaders yet, I think it will fall far short of my expectations.

They will be labeled as ERB-########### (standing for Einstein-Rosen Bridge).   They will also orbit their primary like planets.  Wormholes can appear around both planets and stars, and will orbit their parent body like any other moon or planet.

Wormholes will exert a strong gravitational pull.  Small objects such as ships and stations can enter orbit with a wormhole with great care.  Because of this gravitational pull, navigating a successful jump can be tricky.  You need to make sure you have enough speed when entering the wormhole so that you can escape the gravity on the other side.  Speed and direction will be preserved through wormholes.

Ships can scan wormholes for their energy signature (the type of energy they're scanning for is yet to be determined.  I still have to do some research on this to figure out what's realistic).  The type of energy will give hints (only hints!) about the type of wormhole, though you won't be sure until you travel through it! 

Wormhole Types

There are two types of wormholes which I'm implementing.  If I can think of more, I will make more.  At the moment, these are all I've come up with.

Type 1: The Bridge (Stable)

The first, and simplest, type of wormhole is the Bridge.  Two wormholes form a static link between two star systems, and that link will never close.  You can travel back and forth between those systems without losing your way.

They appear on the starmap due to their stable nature.

Type 2: The Unstable

If you've ever seen one of these guys, you know exactly what I'm going for here:



Imagine that the bottom of the wacky waving inflatable tube man is the wormhole you're passing through.  Now, imagine that the top is the exit wormhole.

The entrance of an unstable wormhole is always located in the same system, but its exit is constantly shifting.  Two ships passing through more than a few seconds apart may end up on completely opposite ends of the galaxy.

Traveling through an unstable wormhole is a huge gamble, because there's no easy way back.  However, it may be the quickest way to your ideal system.  When traveling through these, cross your fingers.

These types of wormholes also play a large role in the plot of the game, as they are how you got to this strange galaxy in the first place.

Tuesday, May 1, 2012

Starfield Builder


I've been working on a module lately which will generate a starfield from the point of view of any system in the galaxy.  The shot above is a composite of pieces of the skybox taken from a system inside the outer ring of a galaxy of 100,000 stars.  I had to let the galaxy generator run all night to get that database.

In the center you can see the core of the galaxy, and on either side you can see the outer ring arcing away from us.  I think it's a pretty spectacular view, to be honest.

Here is what the galaxy looks like from above, for reference:


The system that starfield is for is in the upper right-hand corner, midway through the ring.  You'll notice the core is a rather well-defined circle, and I'm planning on fixing that soon.

I'm considering tasking one of my servers to generate a 1,000,000 star galaxy over the next few days (or weeks, depending on how long it takes), but I'm really not sure what that would do.

Capital AI


After the students had such a hard time with the docking, I decided to work on the AI a little bit for myself as a fun little challenge.  What I ended up constructing was a basic planning AI which can dock with the station given any set of waypoints.

First, it waits until the station's air traffic controller contacts it and asks for intent.  It then asks for docking permission, and when it's been cleared (and given a set of waypoints to the docking point) it generates its plan.

It loops through each waypoint and determines its distance.  If it's more than 20km away, it will burn the main engine to get there.  Otherwise, it travels there on maneuvering thrusters.  Once it's at the second to last waypoint, it aligns for docking and slowly travels towards the docking point.  When it's in range, it calls the docking solver which returns and error or success code.  Based on this code, it determines what to do next.

If the dock succeeded, it does nothing else.

If it failed, it checks the error to see what went wrong.  If it was out of range, it attempts to re-approach.  If the angle was too steep, it attempts to re-align and then approach.