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.

DarkBASIC Discussion / Top-down space sim in 3D: How to do a starfield?

Author
Message
Erwin_Br
19
Years of Service
User Offline
Joined: 13th Nov 2005
Location: The Netherlands
Posted: 13th Nov 2005 22:59
Hi, I'm new to Dark Basic. I've just completed the Binary Moon tutorial and now I'm ready to start my own game. However, I'm already stuck.

See, I want to make a top-down space shooter, with a parallax starfield. First, I thought about using 2D stars using the DOT command. The dots would be deleted when they went out of the screen and recreated at the other side of the screen. I used an example found on this site, but unfortunately you need to clear the screen (CLS) every time the position changes, so my 3D object (the ship) doesn't appear on the screen.

My question: How do I create a top-down space shooter using 3D objects and a 3D starfield? The game is basically 2D, because the ship will rotate at a fixed position, but I want to use 3D objects.

--Erwin
Pincho Paxton
22
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 14th Nov 2005 09:21
You could use 3 plains textured with a starfield. Then just move them, or scroll the texture. When they reach the edge of the screen, you take the first plain, and move it to the end of the last plain. So you have a conveyor belt type of thing.

Erwin_Br
19
Years of Service
User Offline
Joined: 13th Nov 2005
Location: The Netherlands
Posted: 15th Nov 2005 00:08
Do get screenheight and get screenwidth work in a 3D world? Or do I need to calculate the distance from the spaceship? I'm having a little trouble with figuring out the coordinates to use.

I was thinking about individual planes for stars instead of a big textured one, but I have to find a way to wrap them around the screen, like the conveyor belt 'style' you mentioned. In a 2D game this would be easy (with only an X and Y position to use), but what about 3D?

--Erwin

Login to post a reply

Server time is: 2025-05-22 13:33:44
Your offset time is: 2025-05-22 13:33:44