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 / an question DBC V1.08

Author
Message
Alien 001
21
Years of Service
User Offline
Joined: 4th Jul 2005
Location: Gateshead UK
Posted: 14th Sep 2006 13:19
I have starting an while back on an game like GTA:SA . I'm haveing trouble with the map. I would like to use an bump image for the ground height. I would like some example please.

I think that i have found an way in DBC to have an map larger that the GTA:SA map. The only limit of the amount of hard drive space.
Alien 001
21
Years of Service
User Offline
Joined: 4th Jul 2005
Location: Gateshead UK
Posted: 15th Sep 2006 12:04
I just work it out last night. Here is some screen shots. and 2 demos to download. is it just me bump map as very slow to load.

Small map. ( The hill )


large map X2


Notes: if you want to see how long it takes to load an map from the bitmaps just delete the .dat files.
Ginga
20
Years of Service
User Offline
Joined: 3rd Jul 2006
Location: Dorset, England
Posted: 15th Sep 2006 16:19
i didnt even know you could use bumb mapping with DBC, i mite have to experiment with this.
DB newbie
20
Years of Service
User Offline
Joined: 13th Nov 2005
Location: um..... i dont remember.
Posted: 15th Sep 2006 17:16
i did not know eaither.cool...hey if you want faster fps use an object as your landscape...liek with Ted or something...it will go alot faster.

<img src="http://www.boomspeed.com/egraphics/75as4.gif" border="0" title="Adopt_one_today_from_pickle-green.com/egraphics!">
Ginga
20
Years of Service
User Offline
Joined: 3rd Jul 2006
Location: Dorset, England
Posted: 16th Sep 2006 02:03
ok.. errm.. pretty nifty, but how do u make a bump map? i dont even know wot one is hehe
Alien 001
21
Years of Service
User Offline
Joined: 4th Jul 2005
Location: Gateshead UK
Posted: 16th Sep 2006 11:58
An bump map is useing an image colour for the matrix height. The speed problem is with the point(X,Y) command. I have found an faster was by useing an PCX function. Even on very large images very fast. E.g. 4,000 by 4,000 it takes less time than 80 by 80 useing the point command.

example of the code does not work.



I will post an other demo next week. By then i should have work out an other problem or two. the problem is with the height of the matrix DBC does not like over 30,000 for the height. Also i have to workout how to add object to an matrix. Useing an ingame object editor.
Ginga
20
Years of Service
User Offline
Joined: 3rd Jul 2006
Location: Dorset, England
Posted: 17th Sep 2006 21:10 Edited at: 17th Sep 2006 22:04
Well, I've been dabbling with Bump Mapping a Matrix, and im pleasently surprised. Took me a while to get it wrking, as the point command take an AGE to complete, i made a seperate program to get all the point info and export it to anotha file, which yo ucan load up very quickly.

Heres what i've got on a 50x50 image.

STARTING IMAGE:


SCREENSHOT:


As you can see, im a total Noob with Bump mapping, i'll try to do a smoother one later.

*-* EDIT *-*
Decided to upload my code DBC

Changing the Matrix Depth/Width alters how intense the height is.
There are 2 project files within the Zip, Bump.dba and BumpSave.dba

If you wish to use ur own bumps to view, (supports 50x50 fine atm) copy your bmp into the project folder, and change the filename/path in 'BumpSave.dba' and run. Once that is done, load up 'Bump.dba' and again, change the Filename, and voila.

LMB = forward
RMB = bkwards
Mouse = look

Got a few images u can mess around wid already.

O one last thing, it works on the BLUE varient of RGB, so make sure thats what you change for the height.

Lemme know what ya fink. (Sorry Alien for knicking part of ur thread)
Alien 001
21
Years of Service
User Offline
Joined: 4th Jul 2005
Location: Gateshead UK
Posted: 18th Sep 2006 14:12
Ginga i will try your code to night.

I have tryed to load an image then saveing it to an file. But i have found out it is very slow. When you want to load that file. Also the times it takes to get the height from an large bimap useing the point command. That is why i used an PCX function to get the height data. I can not rember who made it. I think it some one from darkforge. All the credit to that person for make that function.

Check out the download for an new Large map. 1000X1000 with an loading time around 2 sec then 1 second for setting the matrixs height. Still a bit slow, need to work out some speed problems. Like the background colour and the GUI. you start at grid 0/0 rember that angle of 0 is north.

tell me what you think of the demo.
Alien 001
21
Years of Service
User Offline
Joined: 4th Jul 2005
Location: Gateshead UK
Posted: 19th Sep 2006 11:40 Edited at: 19th Sep 2006 11:44
Ginga nice little demos.
has anyone tried my last download?
Ginga
20
Years of Service
User Offline
Joined: 3rd Jul 2006
Location: Dorset, England
Posted: 19th Sep 2006 16:38
yeah i tried it. Not bad, works better than mine. After 15 mins of reading the values i got bored and stopped it. Spose i could use lots of little matrices. or just wait longer to get the info.
Alien 001
21
Years of Service
User Offline
Joined: 4th Jul 2005
Location: Gateshead UK
Posted: 20th Sep 2006 11:38
Here is an new demo. I have adde anlot of stuff. like under water effect. An map to show where you are. An object editor. Here is some screen shots. It takes about 18sec to load.

This one shows the obects that i have added.


This one show the object editor.


What should i do next?
Ginga
20
Years of Service
User Offline
Joined: 3rd Jul 2006
Location: Dorset, England
Posted: 20th Sep 2006 12:58
how about a map editor where u specifiy the height of each 'pixel' and it wil lset the RGB property as needed . i was working on something similar but i culdnt figure sumit out so i gave up hehe.
Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 20th Sep 2006 14:11
This stuff seems pretty interesting. I was just working on a bump map thingy... I got around speed problems by extracting the color data directly out of the bitmap and saving it as converted height info in a memblock. In theory, my program's supposed to add additional matrices as the size of the bitmap goes up. It does it fine until the number of matrix tiles goes beyond 200x200. Then it squishes things... oh well - i'll figure it out sooner or later.

@Ginga... You're talking about creating the image by giving the heights of points?

Not too complicated, I think. Let's say the highest peak you want is 1000. And you want the highest color to be white. So whenever in your editor you want a height of 1000, the corresponding color should be white.



In your program, whenever you enter a height value from 0 black(lowest) to 1000 white (highest), multiply it by 16777 to get the combined color value for the pixel. In this example, you'd have a range of 1001 colors representing different heights.

If you want get the individual values back use rgbr() rgbb() rgbg() (with your value x color factor)

Enjoy your day.
Alien 001
21
Years of Service
User Offline
Joined: 4th Jul 2005
Location: Gateshead UK
Posted: 21st Sep 2006 13:52
Ginga... About the map editor i find it is easy to just use an drawing program like paint shop pro. I could do it but i have to made an function to save the data in pcx format. Also i have to work out the problem with the function that load the file.

Latch... i did not use an memblock for the demo. Just an verible to hold the height. Dim map_Bump(1001,1001). I have tried what you have said but i find it is easyer to just use the blue value then * by 75. e.g. 255*75 = 19200

I tell you an secret about the Demo. I used 9 matrix for the land and 9 for the water. in an 3 by 3 grid. you stay on the very middle one. I have tried to add an car to the demo so you can drive around. But i can not get it to work. i want is to be like an GTA game when i have finished it.
Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 21st Sep 2006 20:47
@Alien

Using the array is easier for just storing the height. I was originally storing a series of different sized bytes for different uses (including the height) and since DBC doesn't offer a Structure data type, I used a memblock for this purpose.

I previewed you demo... Excellent! I think your approach was similar to mine. The only difference - you got yours to work! (Mine works but only under certain circumstances! It has something to do with a loop that chooses the next matrix in the proper order when using a certain size bitmap!)

What exactly did you need help with? The car physics? Depending on the level of "realism" you want, without a physics engine, that could be a lot of work. Did you check out Binary Moon's Tutorial? The hover crafts move around rather nicely.

Enjoy your day.
Alien 001
21
Years of Service
User Offline
Joined: 4th Jul 2005
Location: Gateshead UK
Posted: 22nd Sep 2006 11:45
I made an little demo last night. Here are some screen shots & an demo. The physics are not right but it will do for an start. About the memblock i do not have the commands in the verion that i have. DBC Version 1.08.

Person moveing


Person collision


driveing the car around the map.


I will have to change my bump map system to handle the 3PV and the car.
Ginga
20
Years of Service
User Offline
Joined: 3rd Jul 2006
Location: Dorset, England
Posted: 22nd Sep 2006 16:37
cool demo! Now jus had some funky music and sound FX and sweetness! i culd use sumit like this wen i get FPS creator for my bday. got 1 hell of a story idea that i was gunna do wid dbc but FPS wil lb easier
Alien 001
21
Years of Service
User Offline
Joined: 4th Jul 2005
Location: Gateshead UK
Posted: 23rd Sep 2006 11:45
Latch... I look at the Binary Moon's Tutorial. I think i will useing some thing like that for the car physics.

Ginga... I did not add any music or sound because it is an demo.

I have just add the 3 person view to my bump map demo. In the next day or two i will be add the car.
Alien 001
21
Years of Service
User Offline
Joined: 4th Jul 2005
Location: Gateshead UK
Posted: 25th Sep 2006 12:27
Here is demo with the code. Still an little problem with the code.

Latch... you were haveing problem with you demo have an look at mine it should help.

I will have to start from the very beginning to get rid of the bug. I think.
Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 26th Sep 2006 03:21 Edited at: 26th Sep 2006 05:14
[Edit] A CGI error keeps coming up when I try to upload my file. I'll try again later or tomorrow.

[Edit] Very Impressive demo! I like how the water's edge is uneven along the land. I see you handled using multiple matrices differetly than I. It looks like you define them all at once - unless I got that wrong. My approach is to only create them as needed and they become automatically sized based on some maximum that can be set. What bug are you talking about? I noticed the screen flashing from time to time. Is that it?

Alien,

Here's a demo of the height map program I mentioned before. I wrote it out on paper in about an hour after reading your thread. It didn't translate from paper to computer as perfectly as I had hoped!

Anyway, I will download your demo and maybe it can help me to find out why I'm having trouble with bitmaps of 140x140 and greater.

Enjoy your day.
Alien 001
21
Years of Service
User Offline
Joined: 4th Jul 2005
Location: Gateshead UK
Posted: 26th Sep 2006 13:23 Edited at: 26th Sep 2006 13:33
The demo does define the matrix all at one ( only 9 ). It changes the matrix Height when you move from matrix number 5. Also change the camra position. You are right the bug is screen flashing. It happens when the matrixs is updated and you are drive the car.

Latch... I hope the demo will help you.
Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 27th Sep 2006 03:33
Hi Alien,

Well, I went through your source a little bit more. Your method is different enough from mine that it didn't really help solve my problem.

I was however able to solve the problem with mine. Two variables: height and width, were just a little short - so everytime through the loop, the matrix size got a little smaller. The error doesn't really show up until the terrain gets bigger and bigger by which time the little errors have added up into BIG errors.

I've included an updated demo.

Well, it's fixed - and now any size bitmap will generate a terrain. I have to modify and add a few things:

1. Texturing
2. Using non square matrix dimensions
3. Applying the technique to objects so instead of matrices I can use shapes that can be saved
4. Finish my dirext x exporter function to add the ability to save a terrain as an x file

I hadn't even thought about a bump map progran until you wrote this thread. I always pictured it as a complicated and unfriendly process, but it's actually pretty easy! It's just the fine tuning that's tough.

Anyway back to your source: there seems to be a lot of redundancy - the same thing keeps being done over and over again. Why does it seem that you reposition the player every time a new matrix is crossed? Then the matrix is updated...

Doesn't the player just move in 3d space, not really relative to the matrix, so it's position would always be in relation to the 3d world?

I suppose to get the y height of the car, you need to get the ground height of the matrix underneath the car but that could be solved with something like the following if your first matrix started at 0,0,0:



Then multiply updown*matrix z dimension and subtract that from the world z coordinates to get you matrix z position.

Do the same with the x and you've got your matrix x position. Now you'd have your matrix number, your x and z to solve for y ground height.

[Edit]

Once again I'm getting uploading error messages. I'll have to try again later.

Enjoy your day.
Alien 001
21
Years of Service
User Offline
Joined: 4th Jul 2005
Location: Gateshead UK
Posted: 27th Sep 2006 11:52
Latch...

Quote: "Doesn't the player just move in 3d space, not really relative to the matrix, so it's position would always be in relation to the 3d world?
"


If you just move the player with out change the player position and the matrix height. You will see the edge of the matrix. Also The Map is larger than the matrix. so to move around the map the player position and the matrix has to be change.

Login to post a reply

Server time is: 2026-07-08 00:23:28
Your offset time is: 2026-07-08 00:23:28