Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); New blog post: Simulator Enhancements (03/13/24)

Author Topic: True Endless Space background idea  (Read 8506 times)

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
True Endless Space background idea
« on: December 04, 2012, 07:07:20 PM »

Basically, the current background's just a static bitmap with some quads that move at various speeds relative to the player's current velocity.  It's OK, but it just doesn't feel right, because the background doesn't move and the quads slide over it.

Had a crazy idea about how to make it do true parallax with endless variety; it's So Crazy, It Just Might Work.

Basically:

1.  Use two Mandelbrot Sets with different seed values, generating number values from 0-255.
2.  As the ship travels, it's at a different point XY relative to the sets.
3.  For each value generated by the two sets, a stellar object quad may be generated at the local coordinates, using simple rules:

A stellar object would be defined in a JSON as a name, bitmap file reference, a size range, random color range using two ranges RGBA (optional) and any number of number pairs between 0-255.  

So for example, a really common star might be:

"common_star":{
"texture":"graphics/planets/common_star.png",
"size_range":[5.5,15],
"color_range":[255,255,255,255, 255,255,100,200],
"fractal_locations":[1,16, 231,45, 78,108],
}

To further simplify things, the fractal_locations field could just be an integer; this plus a random seed generated at game start (and saved thereafter) could be used to generate the number pairs at the start of the game or when reloading a save.  Personally I like that idea, because it means controlling frequency's pretty easy.

How it would work:

When a point XY on the background's visible, calculating the position values via the Mandelbrot sets is straightforward and probably cheap enough to be done in real time.  If the two values equal the value of the common_star object, the quad's generated by the engine and is drawn.  Therefore the player moves past stars, creating parallax and a good sense of motion.  The density of the grid checked could, of course, be varied for performance purposes, etc.

Anyhow, that's my Crazy Idea.  It'd allow for almost infinite variety to the background, true parallax behavior and while a few more quads would have to get rendered to generate a convincing starfield, because we only have to draw the ones that are currently visible, it could probably be kept reasonably cheap, and it could be culled selectively at higher zoom levels if performance became an issue.

[EDIT]Ooh, and one last twist: a third set, or some sort of translation of the values of the two sets, or even absolute values XY transformed... could be used to generate a rotation value.  So for clouds and stuff, it could be "static" in the sense that it'll look the same when you go there tomorrow, but it'll be rotated "randomly".  That'd also be really handy for "star clusters" for distant point stars.

Ooh, and... it'd probably be possible to mandate the field values in cell XY (real space) via an editor or code, so that perhaps someday we could "paint" cloudy areas on the System maps, etc., etc., and heck, if there was a way to get that cell value, there could be battles "in a nebula", etc. with different battlefield conditions, just like for asteroids...
« Last Edit: December 04, 2012, 07:21:51 PM by xenoargh »
Logged
Please check out my SS projects :)
Xeno's Mod Pack

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: True Endless Space background idea
« Reply #1 on: December 04, 2012, 08:20:03 PM »

Here's a visualization:

Two fractals:


Some random combinations of hit pairs produced this set of "stars" (method used in Photoshop differs mathematically though):

Same two base images, different hit pair set (used a slightly different methodology):


Bear in mind that the two fractals would be at different scales, so there would be very little chance of obvious tiling.

Just for funsies, combined the two after doing some random color / blur:

Now imagine, that's just stars in a couple of sets defined in a .json.  Then add in some cloud quads:
« Last Edit: December 04, 2012, 08:40:04 PM by xenoargh »
Logged
Please check out my SS projects :)
Xeno's Mod Pack

Gothars

  • Global Moderator
  • Admiral
  • *****
  • Posts: 4403
  • Eschewing obfuscatory verbosity.
    • View Profile
Re: True Endless Space background idea
« Reply #2 on: December 05, 2012, 01:35:11 PM »

Let me just say something because I'd hate it if nobody would react on a enthusiastic and obviously well thought out suggestion like this. I can't really say anything about the technical stuff, but I know that a generated map can never hold a candle to hand painted art. And a background of stars is something that would realistically hardly change between engagements, except if they are many light years apart.
I feel that some more backgrounds are needed too, but I'm sure they will come along together with other art and campaign progress.



Logged
The game was completed 8 years ago and we get a free expansion every year.

Arranging holidays in an embrace with the Starsector is priceless.

Wyvern

  • Admiral
  • *****
  • Posts: 3786
    • View Profile
Re: True Endless Space background idea
« Reply #3 on: December 05, 2012, 01:55:58 PM »

Actually, generated star maps can be quite nice.  For example, the one I used here: http://damurxac.deviantart.com/art/The-Nightmare-11766758 - though I'll admit, someone else wrote the starfield generator I used; I seem to recall it being based on gaussian noise, but I never did pry into the details of how it worked.
Logged
Wyvern is 100% correct about the math.

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: True Endless Space background idea
« Reply #4 on: December 05, 2012, 02:57:13 PM »

@Gothars:  it's not whether the backgrounds are pretty; it's that they don't parallax with the ship's motion at all.  So Alex threw in the "space dust" to create a welcome sense of motion when there aren't other ships on the screen.  That's all well and good, but it'd be even nicer if the background moved a bit, preserving the idea that we're looking down through a camera at a ship that's moving against a distant scene.  

Think about it for a second; if we are in a plane looking down at a car, we're seeing it move against the ground.  If we look at another plane high above the earth from another plane flying at the same speed and heading, the ground appears to be moving, not the plane- this creates the sense of motion.  

The problem with merely moving the background, though, is that it's a bitmap, and either it's sufficiently large that we don't notice tiling or it's tiling nicely but, as a result, it's pretty bland.  The first is doable but has performance / compatibility issues, the second's safe but bland.  

This is one method of getting around it.  Another method would be to use multiple background layers on big quads using a lot of translucency, placed and rotated randomly.  That would allow for arty rendering of the background, but big translucent quads are fairly expensive and would present some other issues.  There are other methods, too, such as old-skool pixel-by-pixel procedural stars, etc.

The point though is pretty simple:  when I'm flying a ship and I don't have another object on the screen in this game, I don't have a useful frame of reference.  It doesn't feel fast.  

It also would give us reference points; if your enemies just crossed that red cluster of stars, you know about where they are and about how fast they're traveling, intuitively.
Logged
Please check out my SS projects :)
Xeno's Mod Pack

Gothars

  • Global Moderator
  • Admiral
  • *****
  • Posts: 4403
  • Eschewing obfuscatory verbosity.
    • View Profile
Re: True Endless Space background idea
« Reply #5 on: December 05, 2012, 03:19:54 PM »

Those are stars, they are incomparable further away from the action than the ground is from a plane. You would not see any shift at all while moving. Just look up at the night sky, it stays completely still as you walk around.

I think if they were moving in the game you would either feel as if you'd fly with 10xC or as if the stars were fake lights a few hundred kilometers in the background.

e/ thinking about it, the first one will be true for interstellar travel, so maybe something like this method could be adapted there?
« Last Edit: December 05, 2012, 03:24:03 PM by Gothars »
Logged
The game was completed 8 years ago and we get a free expansion every year.

Arranging holidays in an embrace with the Starsector is priceless.

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: True Endless Space background idea
« Reply #6 on: December 05, 2012, 06:09:45 PM »

Au contraire ;) 

Look at the video closely; the stars aren't moving, but the spacecraft is.  If we reverse the case, it looks the same.  Either way, it's the motion of the spacecraft occluding the distant objects that creates the sense of fluid motion.

Besides which, parallax is a really old and effective game graphics technique.  It's not like any of this is new, I just proposed a whacky way to go about it that would lower the need to spend art budget (and more importantly, time; remember that David's just one guy) on this issue.  Sure, David can do 10, 20, 40 awesome backgrounds, but if instead he just had to do a few smaller assets and the rest was code...

Logged
Please check out my SS projects :)
Xeno's Mod Pack

Gothars

  • Global Moderator
  • Admiral
  • *****
  • Posts: 4403
  • Eschewing obfuscatory verbosity.
    • View Profile
Re: True Endless Space background idea
« Reply #7 on: December 05, 2012, 06:56:08 PM »

Uhm, the camera is not moving in that video. If you don't move the camera in Starfarer it looks exactly the same. But I'm sure you don't want a fixed camera for SF now, do you?

In reality you would have indeed no sense of motion in deep space. Only very fine instruments could pick up the minimal position shifts (or rather red/blue-shifts) of distant stars. Close objects like debris and nebula are the only (semi) realistic way to convey a sense of motion.
« Last Edit: December 05, 2012, 07:02:13 PM by Gothars »
Logged
The game was completed 8 years ago and we get a free expansion every year.

Arranging holidays in an embrace with the Starsector is priceless.

xenoargh

  • Admiral
  • *****
  • Posts: 5078
  • naively breaking things!
    • View Profile
Re: True Endless Space background idea
« Reply #8 on: December 05, 2012, 07:14:29 PM »

Well, short of setting up a render with a ship and background stuff, I guess I'll give you the point, but it's irrelevant.

However, I don't want realism; I want my eyes and inner ear to see velocities properly.  

It's hard to do without a frame of reference.

For example, in Freelancer, they had space dust, but it was motion-blurred at higher speeds, giving a greater sense of motion.  This was in turn borrowed from the old Wing Commander series, etc.

But most of the great 2D space games of the past just did parallax stars.  

Star Control II, for example, used multiple pixel "layers" to create parallax and a sense of motion against the background, and it works wonderfully.
Logged
Please check out my SS projects :)
Xeno's Mod Pack