Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: FreeTerran on September 12, 2003, 01:13:36 pm

Title: just a better starfield
Post by: FreeTerran on September 12, 2003, 01:13:36 pm
I have some change in the starfield.cpp e.g. bump up the star limit from 2000 to 100000 and this is the result
i'm not done now i will change some things in the next time

(http://swooh.com/peon/FreeTerran/starfield/1.jpg)
(http://swooh.com/peon/FreeTerran/starfield/2.jpg)
(http://swooh.com/peon/FreeTerran/starfield/3.jpg)
Title: just a better starfield
Post by: Fineus on September 12, 2003, 01:25:34 pm
Impressive stuff, but 2 things:

1 - Can you provide the .exe? I'd like to look at it in motion.

2 - That many starts swirling around as the player turns is very distracting. Any way around it?
Title: just a better starfield
Post by: FreeTerran on September 12, 2003, 01:30:07 pm
Yeah the problem is the warp of the stars if you moving faster i will fix it...

and i will put a exe on the net as soon as i have fix it
Title: just a better starfield
Post by: diamondgeezer on September 12, 2003, 01:38:09 pm
More stars = good. And the more you optimise it the better. It doesn't kill the framerate, does it?
Title: just a better starfield
Post by: FreeTerran on September 12, 2003, 01:40:27 pm
Quote
Originally posted by diamondgeezer
It doesn't kill the framerate, does it?

Only about 1 or 2 frames if you move fast
Title: just a better starfield
Post by: FreeTerran on September 12, 2003, 02:27:10 pm
Ok the star warp is fixed here is an build for you guys

http://swooh.com/peon/FreeTerran/starfield/fs2_open_s.rar
Title: just a better starfield
Post by: Flipside on September 12, 2003, 02:28:31 pm
Looks really nice FT, but I think we may have some duplication of work going on here, since Sticks is working on exactly the same sort of thing?

Flipside :D
Title: just a better starfield
Post by: FreeTerran on September 12, 2003, 02:38:53 pm
Hmm sh*t maybe if he works on an other thing we could put the starfield.cpp source together

IMPORTANT NOTE: if you want test the much star thing open your mission with notepad search "$Num stars: " put behind it an 25000 "$Num stars: 25000"
Title: just a better starfield
Post by: Max Sterling on September 12, 2003, 02:58:24 pm
I added more color variety to the star creation code... some random reds and blues now show up. I think its in the new EXE that FT just put up, we worked on it together just now.
Title: just a better starfield
Post by: FreeTerran on September 12, 2003, 03:00:04 pm
Yeah the exe is updated :)
Title: just a better starfield
Post by: phreak on September 12, 2003, 03:16:34 pm
way too many stars. plus i already had some colored star code in fs open
Title: just a better starfield
Post by: FreeTerran on September 12, 2003, 03:20:03 pm
That are not to much.... that is real :doubt:
Title: just a better starfield
Post by: TopAce on September 12, 2003, 03:27:10 pm
I always wanted to see a really [glow=orange]DENSE[/glow]starfield.
Now, it is the thing I have always wanted.
Title: just a better starfield
Post by: Flipside on September 12, 2003, 03:46:23 pm
I suppose to make it 'real' looking you would have to have 'clusters' of stars, whereas FS2 isn't quite random, I think, when placing them, I don't know the code, but does it take measures to make sure the starfield is 'even' or is that just how things turn out?

Flipside :D
Title: just a better starfield
Post by: FreeTerran on September 12, 2003, 03:48:20 pm
Quote
Originally posted by Flipside
I suppose to make it 'real' looking you would have to have 'clusters' of stars, whereas FS2 isn't quite random, I think, when placing them, I don't know the code, but does it take measures to make sure the starfield is 'even' or is that just how things turn out?

Flipside :D

Yeah i and max work on it
Title: just a better starfield
Post by: FreeTerran on September 12, 2003, 03:55:59 pm
Code: [Select]
// following code randomly distributes star points within a sphere volume, which
// avoids there being denser areas along the edges and in corners that we had in the
// old rectangular distribution scheme.
dist_max = (float) (HALF_RND_MAX * HALF_RND_MAX);
for (i=0; i dist = dist_max;
while (dist >= dist_max) {
v.xyz.x = (float) ((myrand() & RND_MAX_MASK) - HALF_RND_MAX);
v.xyz.y = (float) ((myrand() & RND_MAX_MASK) - HALF_RND_MAX);
v.xyz.z = (float) ((myrand() & RND_MAX_MASK) - HALF_RND_MAX);

dist = v.xyz.x * v.xyz.x + v.xyz.y * v.xyz.y + v.xyz.z * v.xyz.z;
}
vm_vec_copy_normalize(&Stars[i].pos, &v);

This is the code that avoid the clusters but i and max donno how we could put it off :( the testing goes on...
Title: just a better starfield
Post by: Flipside on September 12, 2003, 04:06:44 pm
Once again, a purely non-coders point of view, but it looks like it checks each point to make sure it is not too close to any others? So it's roughly 'While Distance is More than or Equal to' and it generates a random average distance for each starfield so they look different? I'm not very up on array generation in anything above Cobol ( a tiny bit) and Pascal.

I suppose my first suggestion would be to remove the checks altogether?

// following code randomly distributes star points within a sphere volume, which
// avoids there being denser areas along the edges and in corners that we had in the
// old rectangular distribution scheme.
   for (i=0; i       {
         v.xyz.x = (float) ((myrand() & RND_MAX_MASK) - HALF_RND_MAX);
         v.xyz.y = (float) ((myrand() & RND_MAX_MASK) - HALF_RND_MAX);
         v.xyz.z = (float) ((myrand() & RND_MAX_MASK) - HALF_RND_MAX);

         dist = v.xyz.x * v.xyz.x + v.xyz.y * v.xyz.y + v.xyz.z * v.xyz.z;
      vm_vec_copy_normalize(&Stars.pos, &v);

Once again, I have applied brute force to this, so chances are it is completely wrong :D Computer Randomness is not 'real' as such, so there is a tendency to create clusters etc if you let it create enough stars :)

Flipside :D
Title: just a better starfield
Post by: IceFire on September 12, 2003, 09:02:37 pm
Is there any way to try and give some kind of pattern to the background?  IE. the galactic rim should be less starry than if you face the core...
Title: just a better starfield
Post by: Liberator on September 12, 2003, 11:55:13 pm
I realize this is a pointless post, but shouldn't the stars be recognizably the same in the same star system?  Granted there would be some derivation based on the location within the observing system but that would be minimal.

We could maybe add some code, and this is complete pie-in-the-sky, but, we could add some code that generates the basic starfield for, say, Delta Serpentis and make an option in FRED that allows the mission designer to choose the system that the mission takes place in.  This would be limited to the canon systems of course.
Title: just a better starfield
Post by: Knight Templar on September 13, 2003, 12:17:06 am
But then we have to decide what canon delta serpintis starfields look like... along with all the other systems..
Title: just a better starfield
Post by: Black Wolf on September 13, 2003, 01:53:59 am
Quote
Originally posted by Knight Templar
But then we have to decide what canon delta serpintis starfields look like... along with all the other systems..


And realistically... who cares?
Denser Starfield = Good.
Clunping Starfield = Good
Identical each time for whatever system you're in = Pointless.
Most people don;t evenb care if the nebulae change colours, let alone whether this tiny point of light is in the same place as it was three missions ago.

However, it might be interesting, if this clumping code cant be worked out, to try doing it with PCXes...
Title: just a better starfield
Post by: CP5670 on September 13, 2003, 03:26:37 am
This definitely looks better and more realistic than before. I had this in mind at one point long ago but forgot to bring up the subject here. Since this is really only a question of upping the limit, it will give mission designers the option to use the higher limit while having older missions work as they did before, so there's no reason not to go for it.

The swirling thing is a neat effect but it does indeed get quite annoying when there are that many stars. Is it possible to do it only for a few of them (randomly selected) without dropping the framerate significantly?

I keep the nebulas the same for all missions in a system, but nobody is really going to notice the star thing unless there is some glaring change.
Title: just a better starfield
Post by: FreeTerran on September 13, 2003, 03:29:50 am
Quote
Originally posted by CP5670
The swirling thing is a neat effect but it does indeed get quite annoying when there are that many stars. Is it possible to do it only for a few of them (randomly selected) without dropping the framerate significantly?

It dosen't drop the framrate at my pc
if you want test it at your machine with framrate i could put an debug build on the net ?
Title: just a better starfield
Post by: FreeTerran on September 13, 2003, 04:33:15 am
What about this guys ? ;)

(http://swooh.com/peon/FreeTerran/starfield/4.jpg)
(http://swooh.com/peon/FreeTerran/starfield/5.jpg)
(http://swooh.com/peon/FreeTerran/starfield/6.jpg)
Title: just a better starfield
Post by: Black Wolf on September 13, 2003, 04:48:38 am
Getting there - could you make the stars bleed a little bit? Really fuse together the groups of stars.
Title: just a better starfield
Post by: FreeTerran on September 13, 2003, 05:00:53 am
Hmm it looks in game other then here try it

http://swooh.com/peon/FreeTerran/starfield/fs2_open_s.rar
Title: just a better starfield
Post by: Black Wolf on September 13, 2003, 05:04:53 am
Can't - no FSO build ever works on this comp - memory issues I think.
Title: just a better starfield
Post by: LAW ENFORCER on September 13, 2003, 06:58:38 am
that is really cool btw... some day people will load up thier old 1998 game and 'patch' it.... then WTF!?!??!?!!!?!?
Title: just a better starfield
Post by: Taristin on September 13, 2003, 07:11:58 am
Now if you could only overlay a small blue glow over those stars, it'd own!
Title: just a better starfield
Post by: kasperl on September 13, 2003, 07:16:28 am
Quote
Originally posted by LAW ENFORCER
that is really cool btw... some day people will load up thier old 1998 game and 'patch' it.... then WTF!?!??!?!!!?!?


there's an idea, get :V: to put a FS_OPEN link up when you update using the launcher.
Title: just a better starfield
Post by: Fineus on September 13, 2003, 08:32:16 am
Quote
Originally posted by Raa Tor'h
Now if you could only overlay a small blue glow over those stars, it'd own!

Funny you should mention that - didn't FS have exactly that kind of glow?

Or indeed it could be done Greg Martins way - I strongly recommend Stealth and other starfield making people look up his work and take a note at what "fantastic" is defined as ;)
Title: just a better starfield
Post by: FreeTerran on September 13, 2003, 09:02:38 am
Code: [Select]
dist_max = (float) (HALF_RND_MAX * HALF_RND_MAX);
for (i=0; i dist = dist_max;
while (dist >= dist_max) {
v.xyz.x = (float) ((myrand() & RND_MAX_MASK) - HALF_RND_MAX);
v.xyz.y = (float) ((myrand() & RND_MAX_MASK) - HALF_RND_MAX);
v.xyz.z = (float) ((myrand() & RND_MAX_MASK) - HALF_RND_MAX);

dist = v.xyz.x [color=red]*[/color] v.xyz.x [color=red]+[/color] v.xyz.y [color=red]/[/color] v.xyz.y [color=red]+[/color] v.xyz.z [color=red]*[/color] v.xyz.z - v.xyz.y [color=red]/[/color] v.xyz.y;
}
vm_vec_copy_normalize(&Stars[i].pos, &v);

the red market code how could i code it that they randomize the operations ? they shall randomize use +, -, * or /[/B]
Title: just a better starfield
Post by: WMCoolmon on September 13, 2003, 12:14:52 pm
Quote
Identical each time for whatever system you're in = Pointless.

If there are recognizable star formations it'd be a nice touch. There have been people who've noticed different colored nebulas. :p
Title: just a better starfield
Post by: Fineus on September 13, 2003, 01:47:01 pm
Seems a bit anal, no? ;)

But if we can do it - we may as well go the whole nine yards and make this open source really special.

When I say we, I mean you.

At least I'm honest.

I'm going now.
Title: just a better starfield
Post by: FreeTerran on September 13, 2003, 01:49:31 pm
the problem is the stars will be in ever mission the same i must write an random script that we have various missions :sigh:
Title: just a better starfield
Post by: Flipside on September 13, 2003, 02:16:48 pm
The only other way is to use some sort of Fractal method, where the seed is defined in Fred for each mission, but that really is a hell of a lot of Math for something that most people won't notice :)

Flipside :D
Title: just a better starfield
Post by: Flaser on September 14, 2003, 06:13:25 pm
I wonder if we could actually map the entier starglobe...

Certain constellations could be mapped for each system, using rho and gamma (horizontal and vertical angle).

Then we should use the same values for the Milky Ways position.
That should define the zone where the cluster generator should work.

The rest of the globe could be filled with various small stars.
Title: just a better starfield
Post by: Nico on September 15, 2003, 01:49:38 am
what use would that be? barely anybody could recognize anything from Sol, if you change the angle seeing those stars from another system, there will be nothing to recognize :p
Title: just a better starfield
Post by: J.F.K. on September 15, 2003, 04:16:54 am
Hey, I've always wanted this... actually, the stars in IW2 (if you remember them) are really good, if you want some direction to go in. But this bunched up stars is definitely a move in the right direction :nod:
Title: just a better starfield
Post by: Fineus on September 15, 2003, 06:28:36 am
Certainly something in the form of a galactic core would be good - it'd be even better if this was implemented into FRED so that the orientation / direction of the core could be changed so that you could simulate moving around the galaxy...
Title: just a better starfield
Post by: kasperl on September 15, 2003, 11:23:11 am
Quote
Originally posted by Flaser
I wonder if we could actually map the entier starglobe...

Certain constellations could be mapped for each system, using rho and gamma (horizontal and vertical angle).

Then we should use the same values for the Milky Ways position.
That should define the zone where the cluster generator should work.

The rest of the globe could be filled with various small stars.


actually, that would be possible, i think.

just, really, really not so usefull.

alternatively, you could try to render the stars as a background using some program which can do this.
Title: just a better starfield
Post by: Flipside on September 15, 2003, 12:06:59 pm
Hmmmmmm... ok, I can understand how this would appeal to certain people, but to be honest, I truly cannot see the point of having specific 'star' setups. They are decoration, quite frankly, I'd much rather see my diskspace and CPU power being used on more tangible aspects of the game. I can gaurantee that if you make the stars random, about 3 people will point it out. If you make them fixed, absolutely no-one will notice.

Flipside :D
Title: just a better starfield
Post by: Flaser on September 15, 2003, 04:07:59 pm
Having fixed constellations is one thing.

Seeing the galaxy as the Milky Way in a variety of ways - being among the core stars where space is almost white is definitly something you will have to notice, while on the Periphery you'd only see the greatest arc of the galaxy ever seen and the sky would be very dark on the other side.
Title: just a better starfield
Post by: kasperl on September 16, 2003, 11:08:44 am
Quote
Originally posted by Flaser
Having fixed constellations is one thing.

Seeing the galaxy as the Milky Way in a variety of ways - being among the core stars where space is almost white is definitly something you will have to notice, while on the Periphery you'd only see the greatest arc of the galaxy ever seen and the sky would be very dark on the other side.


i think this should be something for the MODder, not the coder, to do.


think of creative use of backgrounds.

note, i am not a FREDder or a MODder, but from what i hear and see, i think this should be possible rather easily.
Title: just a better starfield
Post by: Black Wolf on September 16, 2003, 11:13:59 am
You know, you've been

Quote
just another newbie without any modding, FREDding or real programming experience


For over 2 years now. You planning to work on that or anything? :p
Title: just a better starfield
Post by: kasperl on September 16, 2003, 11:24:13 am
Quote
Originally posted by Black Wolf
You know, you've been

 

For over 2 years now. You planning to work on that or anything? :p


dude, i'm here for two years?

****.

and no, i don't plan on working on that, actaully.

i am just working on passing this year without failing any subjects. last year they had to "rethink" some of the grades just to pass me. they did that only because i was a fail on 0,003 of a point, but still, i'd rather make this year with a little breathing room.
Title: just a better starfield
Post by: Kazan on September 16, 2003, 02:31:02 pm
you should vary the star magnitude - ie some stars are nearby some are farther away - and also globular clusters