Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / how to make stars?

Author
Message
game master 07
17
Years of Service
User Offline
Joined: 26th Feb 2007
Location: Maryland
Posted: 14th Apr 2007 21:56 Edited at: 14th Apr 2007 21:57
I am making a space game but cannot figure out a way to make stars in dbp wihout a skybox or skycube with a space texture. I want to make just simple points of lights over a black background. I tried a skybox and skycubes with space textures but they dont come out good. Is there a code that will let me create little points of light that look like stars?

gm07
Scorpyo
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: italy
Posted: 14th Apr 2007 22:44
something like this:


Gil Galvanti
19
Years of Service
User Offline
Joined: 22nd Dec 2004
Location: Texas, United States
Posted: 14th Apr 2007 22:48
what you said you had done should also work fine, if you get a decent texture, maybe just a touched up and larger version of something like this:



game master 07
17
Years of Service
User Offline
Joined: 26th Feb 2007
Location: Maryland
Posted: 14th Apr 2007 22:53
thanks but what i really would like is some code where instead of a texture it is dpp itself crating and rendering little points of light everywhere to make them look like stars. I have seen star codes here on the forum but there not still. They are either warp effects or 2d side scrolling backgrounds. what i want to do is make something like them but still.

gm07
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 14th Apr 2007 23:27
Just knocked this together for you if it's any help.

It was done in DBC as I've just upgraded my system and not got around to installing DBP again yet. It should work fine but I've added a couple of Rems in the only two places which might be different in Pro...



TDK_Man

game master 07
17
Years of Service
User Offline
Joined: 26th Feb 2007
Location: Maryland
Posted: 15th Apr 2007 00:14
Hey thanks TDK. Is there a way to make it so that the sphere is black and those dots are white? And how do you scale the dots to make them little points.Also is there away to make them little circles instead of squares. If someone helps me out with that than it would be perfect!

gm07
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 15th Apr 2007 00:25
With TDK's code you could turn the backdrop on and color it 0 to get a black background.



LB
game master 07
17
Years of Service
User Offline
Joined: 26th Feb 2007
Location: Maryland
Posted: 15th Apr 2007 00:40
Ok that helps a little but how can I make those square dots white and can I scale them and make them little points? Also can they be made into little circles instead of sqaures?

gm07
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 15th Apr 2007 00:50
Quote: "Is there a way to make it so that the sphere is black and those dots are white?"


I'm not sure what you are seeing in DBPro because as I say, I haven't got it installed. When I run it in DBC, I see this:



and as you can see, the sphere is black and it does have white stars.

Quote: "how do you scale the dots to make them little points"


That could be down to the way DBP textures the sphere, although I did purposely use Blur Bitmap to make the distant stars a little blurry for effect. Try removing the Blur Bitmap command.

Quote: "Also is there away to make them little circles instead of squares"


As per the image above, I don't get that problem. Post an image of what you get so we know what you are talking about...

TDK_Man

game master 07
17
Years of Service
User Offline
Joined: 26th Feb 2007
Location: Maryland
Posted: 15th Apr 2007 00:55
That is what i want but that is not what it looks like at least in DBP. Here is the pic of what I am getting from your code.

gm07

Attachments

Login to view attachments
game master 07
17
Years of Service
User Offline
Joined: 26th Feb 2007
Location: Maryland
Posted: 15th Apr 2007 01:04
I just tried deleting the blur command but it the dots are still black and the sphere is still blue. Here is my new pic.

gm07

Attachments

Login to view attachments
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 15th Apr 2007 01:26
@ game master 07

I don't get it. You said
Quote: "Ok that helps a little "
with regarding to turning the backdrop on and coloring it 0. Now you are saying
Quote: "the dots are still black and the sphere is still blue"
. If the backdrop is on and colored 0, it should be a black background with stars.

LB
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 15th Apr 2007 01:27
Wow! Big difference...

I hope you don't think I'd post code to create stars if I knew it would look like that! Lol.

So, I wonder what the problem is?

Let's see, OK first of all, let's change the backdrop colour with

Backdrop On
Color Backdrop RGB(0,128,0)

If the sphere then looks Green instead of blue then we know that in DBP your sphere is transparent and you are looking through the sphere at the backdrop.

If this is the case, check out the SET OBJECT command to see if anything has changed in DBP (that's why I put the Rem in so you could see the settings for DBC's Set Object command).

(Don't remove it though, or you'll get a black screen but no stars as the Cull flag let's you see the texture from inside the sphere).

TDK_Man

TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 15th Apr 2007 01:29
LBFN

I don't think the backdrop has anything to do with the problem in this particular case.

If you are inside a textured sphere, you shouldn't be able to even see the backdrop.

I think that DBPro's Set Object command has changed from DBC and that his sphere is actually transparent.

TDK_Man

game master 07
17
Years of Service
User Offline
Joined: 26th Feb 2007
Location: Maryland
Posted: 15th Apr 2007 01:45 Edited at: 15th Apr 2007 01:45
Hey I was looking over the code and I found out the problem. It is the dot command. And i was looking in the help of dpp and it said the way to change the color is to type in the rgb color value. But what is the
color white in RGB color numbers?

gm07
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 15th Apr 2007 01:57
@ TDK
I turned the backdrop on and colored it 0 and the backdrop showed up as black and the stars appeared like they should. Maybe it should not have, but it indeed worked for me.

@ game master 07
You could change the color white with rgb(255,255,255),0 but I don't think it will make that much difference in the brightness of the stars.

LB
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 15th Apr 2007 01:58 Edited at: 15th Apr 2007 02:05
I've been looking into this too!

It's nothing to do with the Dot command. It looks like in DBPro, the 1 and 0 flags in the Set Object command have reversed.

Try changing all the 0's to 1's and all the 1's to 0's on the Set Object line and let me know what happens.

Oh yes, white is RGB(255,255,255), but you don't want all the stars to be the same shade of white or they will all look the same distance away - just like white dot's on a black sphere to be precise.

A mixture of pale colours, white and light grey adds a bit of 'depth' to the texture which is exactly what the snippet I supplied does...

[Edit] LBFN: Doh! Every time I post, the screen refreshes and I see a post from you that wasn't there when I started - I'm not ignoring your posts!

The default backdrop is blue. His sphere is transparent so setting the backdrop to black looks like it has worked, but it hasn't - the sphere is still transparent.

As mentioned above, in DBC you set the Transparency flag to 1 to make the sphere not transparent. In DBP doing the same makes the sphere transparent - exactly the opposite. You just need a 0 instead of 1.

Alter the Set Object line and it doesn't matter what colour the backdrop is, you won't see it!

TDK_Man

LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 15th Apr 2007 02:16
@ TDK
You are correct, setting the transparency flag to 0 works.

LB
game master 07
17
Years of Service
User Offline
Joined: 26th Feb 2007
Location: Maryland
Posted: 15th Apr 2007 02:20 Edited at: 15th Apr 2007 02:24
Ok before i meant to say the ink command not dot command. I have tried
evrey command variation I can think of. Here are some of my changes that I tried but still wont change the stars white.
I tried


I tried it the way it was originally but with the backdrop and color set to black like you said LBFN but it was just a black screen I got.

I also tried changing this little part to



but it still would not work. This is just driving me crazy!!
Oh and I also tried setting the transparency to 1 but it just looked like little black streaks in dpp.

gm07
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 15th Apr 2007 02:56
Have you not been reading what I have been saying? If you don't then it will never work.

Quote: "It should work fine but I've added a couple of Rems in the only two places which might be different in Pro..."


Why then do you still have in your program:

Get Image 1,0,0,512,512: Rem <<< Add ,1 on the end when running in DBPro

instead of:

Get Image 1,0,0,512,512,1: Rem <<< Add ,1 on the end when running in DBPro

and

Set Object 1,1,1,0

instead of

Set Object 1,0,0,1

Don't mess with anything else, just take the original snippet and make the two above changes!

TDK_Man

game master 07
17
Years of Service
User Offline
Joined: 26th Feb 2007
Location: Maryland
Posted: 15th Apr 2007 03:07
I did do that but it just looked the same. Also I found a better way of doing it anyway. What I did is used a sky cube code from one of the examples and replaced the textures with all star pics and that actually worked. Sorry for the trouble.

gm07
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 15th Apr 2007 05:34
@ TDK

It seems like a moot point now, but in order to work correctly, the set object command should be:

set object 1,1,0,0

LB
Dabbler
17
Years of Service
User Offline
Joined: 3rd Mar 2007
Location: Minnesota
Posted: 15th Apr 2007 06:43
Just a thought.

I have had problems with graphics breaking up inside a sky sphere.
The problem cleared up when I changed the camera near range from 0 to 1.

Mabey it cannot be that easy of a fix, but your screen image is similar to the image I had.

Good luck.


Whatever...
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 15th Apr 2007 08:32
LBFN

Moot point indeed!

The switches for SET OBJECT are Object Number, Wireframe, Transparency and Cull. In DBC 1 is off and 0 is on so it needs to be:

Set Object 1,1,1,0 - which works fine.

If in DBP the transparency is on with a 1, then 0 is off which makes your

set object 1,1,0,0

wireframe on, transparency off and cull off. This shouldn't work as you should get a wireframe sphere and with culling off you won't see the texture from inside the sphere. Very strange...

Dabbler:

Quote: "The problem cleared up when I changed the camera near range from 0 to 1."


But DBC doesn't let you set the camera near range to 0.

TDK_Man

Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 15th Apr 2007 20:28
TDK's code for DBPRo:



TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 15th Apr 2007 20:51
Thanks for that Sixty Squares.

Personally, I don't like turning objects inside out, so I purposely avoided doing it.

There's probably nothing wrong with the method - it's just not 'natural' - if you know what I mean.

TDK_Man

game master 07
17
Years of Service
User Offline
Joined: 26th Feb 2007
Location: Maryland
Posted: 15th Apr 2007 22:32 Edited at: 15th Apr 2007 22:36
Hey SS thanks for that to. But I changed mine to a skybox and did try using space textures again. For some reasone skyboxes work better for space scenes than skyspheres. Skyspheres work good for outdoor scenes with a sky and clouds texture. I am not sure why. Also SS that code you made only covers half of the sphere and not all of it. How come? TDK aren't you supposed to turn objects inside out if you want to see the texture from the inside? You know like what the cull command is for?

gm07
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 15th Apr 2007 23:00
Quote: "Also SS that code you made only covers half of the sphere and not all of it. How come?"


Half the sphere?? It covers all of it over here...

TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 15th Apr 2007 23:18
Quote: "TDK aren't you supposed to turn objects inside out if you want to see the texture from the inside? You know like what the cull command is for?"


That's exactly what the Cull flag is used for - so you don't have to turn objects inside out by using a negative size value.

By default, surfaces you can't normally see are not drawn by DB - like the inside of objects. Setting the cull flag using the Set Object command makes these normally invisible surfaces visible - along with any associated texture.

It's the same process that lets you put an 'invisible' cube at the same location as the camera so you can use the collision commands on the cube to stop the camera from passing through things.

TDK_Man

game master 07
17
Years of Service
User Offline
Joined: 26th Feb 2007
Location: Maryland
Posted: 16th Apr 2007 02:20 Edited at: 16th Apr 2007 02:34
Ok I have different problem I would like help with. I have made an fps
style camera movement code. But my problem is that you cant strafe and hold down the forward or backward key at the same time. How could I change my code to make it so I can. Here is my code.


oh I also thought you guys would like to see my result with my skycube. I used a model of a Cylon Basestar from Battlestar Galactica to put in the scene. I am making a BSG free fan game.




gm07
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 16th Apr 2007 02:37 Edited at: 16th Apr 2007 02:39
Okay. Use the KEYSTATE( scancode for key you want to check for)
Every key on the keyboard has a scancode. To see what they are, have a look at the picture I have attached.

So, your code would be the following. Oh and SET CAMERA RANGE does not need to be in the loop. All you have to do is call it once and it will stay like that until you change it.




(Picture looks cool btw, but I can't see it as an FPS )

Attachments

Login to view attachments
game master 07
17
Years of Service
User Offline
Joined: 26th Feb 2007
Location: Maryland
Posted: 16th Apr 2007 02:45 Edited at: 16th Apr 2007 02:45
Thanks for the help SS. It is not going to be an fps but a space combat game with an fps view like star wraith or Freespace 2!

gm07

Login to post a reply

Server time is: 2024-09-25 21:29:03
Your offset time is: 2024-09-25 21:29:03