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 / Create Space (for a total newb)

Author
Message
crazy clown
20
Years of Service
User Offline
Joined: 21st Jul 2004
Location:
Posted: 29th Jul 2004 10:25 Edited at: 29th Jul 2004 10:48
Hey all, I am totally new to Darkbasic, I've done programming before but I have very little experience with things like textures. I've searched on this but I can't get a definitive answer. I need to create "outer space" I know this is a common task, I have programs like Universe, POVRay with galaxy include file, and others, all which work well, but I don't understand how to put the bmp files into darkbasic, either to texture and object or a skysphere... anyways once i get the bmp, how do I create space? what exactly are the commands you need? I mean don't just give me the complete code, but I am not sure how top texture a skysphere or anything. anyways, any help would be appreciated. Thanks

I've tried "texture backdrop" and it gives me "command obsolete"
crazy clown
20
Years of Service
User Offline
Joined: 21st Jul 2004
Location:
Posted: 29th Jul 2004 10:40
On a side note, I also have another problem with the Camera following the spaceship. It is always the correct distance from the object, but when the object rotates (turns right) the camera doesn't move, when it should rotate so the back of the spaceship is always what we (the camera) see. how should I do this?
Ocean Runner
21
Years of Service
User Offline
Joined: 18th May 2003
Location: United States
Posted: 29th Jul 2004 12:49
to make a skybox, first make a sphere:

then, to texture it:

1 is the image number. To load an image use:


"Computers in the future may weigh no more then
1.5 tons. - Popular Mechanics, 1949
crazy clown
20
Years of Service
User Offline
Joined: 21st Jul 2004
Location:
Posted: 30th Jul 2004 00:19
when you create a sphere and texture it, doesnt that only texture the outside? so if i want the entire game to take place inside the sphere, how do I make it texture the inside? do i have to invert it?
Dgamer
21
Years of Service
User Offline
Joined: 30th Sep 2002
Location:
Posted: 30th Jul 2004 00:25 Edited at: 30th Jul 2004 00:26
Set object Cull Object#, 0

That should do it, probably.

This sig has been dullified!
zircher
21
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 30th Jul 2004 00:35
You can also invert it, either method would work.

Quote: "On a side note, I also have another problem with the Camera following the spaceship. It is always the correct distance from the object, but when the object rotates (turns right) the camera doesn't move, when it should rotate so the back of the spaceship is always what we (the camera) see. how should I do this? "


I'm a big fan of the SET CAMERA TO FOLLOW command. [off the top of my head...]

rem objID = ship's model/object ID number

objX# = object position x(objID)
objY# = object position y(objID)
objZ# = object position z(objID)
objYangle# = object angle y(objID)
camDistance# = 10.0
camHeight# = 10.0

SET CAMERA TO FOLLOW objX#,objY#,objZ#, objYangle#, camDistance#, camHeight#, 1.0, 0
POINT CAMERA objX#,objY#,objZ#
--
TAZ

The "it" is a kind of force that gives rise to technology, something undefined, but inhuman, mechanical, lifeless, a blind monster, a death force. - ZatAoMM
crazy clown
20
Years of Service
User Offline
Joined: 21st Jul 2004
Location:
Posted: 30th Jul 2004 03:01 Edited at: 30th Jul 2004 03:12
Wow thanks guys! All of your suggestions worked. However, the ship seems to blink on and off, I can barely see it sometimes. Its like just the outline blinks on or something. Is there anyway I can fix this, like maybe making it draw the ship last or something?

another feature that I would like to add is something to keep the ship and all other objects (enemy ship(s), asteroids etc.) inside the world. My idea was that If it hit one side of the sphere it would come back on the opposite end, kind of like those space games where when your ship went off one side of the screen it came back on the other. anyways thanks again!!
zircher
21
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 30th Jul 2004 05:57 Edited at: 30th Jul 2004 05:59
Without seeing your code, it's hard to say what is doing that. Is the last instruction before your LOOP a SYNC command?

Wrap around is pretty easy, you just run a FOR/NEXT loop for all your objects and if they exceed a boundry you slap them with a big offset.

For example, let's say that all your objects are between objectID 10 and 200. And, they must stay in a 800x800x800 cube (measured in world units.)


--
TAZ

The "it" is a kind of force that gives rise to technology, something undefined, but inhuman, mechanical, lifeless, a blind monster, a death force. - ZatAoMM
crazy clown
20
Years of Service
User Offline
Joined: 21st Jul 2004
Location:
Posted: 30th Jul 2004 08:38
No, there is no sync command... should there be? also, what if I want a sphere, not a cube for the objects to stay in, is that impossible?
zircher
21
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 31st Jul 2004 03:01
Most programmers will use the SYNC commands to give them more control over the display. Look up SYNC, SYNC RATE, and SYNC ON/OFF. The first one goes at the end up your main loop after you have positioned and rotated everything to your liking and want to update the screen. The latter two usually go near the top of your program in the initialization part of your source code.

Spheres are not that hard. Assuming a sphere centered at 0/0/0, you only need to flip the coordinates of the object to mirror it.


--
TAZ

The "it" is a kind of force that gives rise to technology, something undefined, but inhuman, mechanical, lifeless, a blind monster, a death force. - ZatAoMM
crazy clown
20
Years of Service
User Offline
Joined: 21st Jul 2004
Location:
Posted: 3rd Aug 2004 12:06 Edited at: 3rd Aug 2004 13:02
Hey guys, I still can't figure out why I am getting this "outline" look on the ships when I use a textured sphere. Is it something to do with the "Set object Cull" and the "away facing polygons" thing?
also, the 3rd person camera works decently, but to get the desired affect, I want a 3rd person camera that is always facing the back of my ship no matter what. Is there some simple code I can use to do this? I know there is "set Camera to follow" and that code that zircher gave works better than before, but I can still turn my ship so that the front is facing me, and when I tilt the ship up, the camera view doesn't change, whereas I should still be looking at the back of the ship... I hope i am explaining this well enough. basically a third person camera that Is always looking at the back of my object. back to the problems with the ships becoming outlines and disappering when I put the textured sphere in: would making a skybox instead help? I'm trying to figure out how I can do that. Thanks all for any help you can give me. I will try to take a screenshot of the sphere problem. Also, I can easily post my code if you want.

Edit: Does DB only take one resolution for bmp? i can't get it to load a 640x480 but a lower resolution works. is this a setting or something? thanks
zircher
21
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 4th Aug 2004 01:25
If set camera to follow does not do the job, you'll need to project your camera location out the back of the ship, position the camera there, and then use the point camera back at the ship.

DB/DBP have some differences in the relative motion commands. In DBP, you can rotate a dummy object to match the player's orientation, you can then position the dummy object to sync with the player object, then you can use move object and a move object up to relative place the dummy object behind the the player. Now you can use the dummy object's location to place the camera and point it.

Wolf wrote a DLL called EZRotate that might also help since it is more clever than DB/DBP's basic euler rotation system.
--
TAZ

"Do you think it is wise to provoke him?" "It's what I do." -- Stargate SG-1

Login to post a reply

Server time is: 2024-09-22 19:21:53
Your offset time is: 2024-09-22 19:21:53