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 get the Matrix ID

Author
Message
azzido
16
Years of Service
User Offline
Joined: 16th May 2008
Location:
Posted: 26th Dec 2009 17:57
Sorry for my bad english.

I am using PB + PureGDK but i think the Commands are nearly the same as in DarkBasic Pro.

I´ve got following Problem:

I create some Matrixes from a Database. So it is possible for me to walk over the Matrix 1 to Matrix 2 to Matrix 3.

My Problem ist to get the Matrix ID on witch i stand on?

Someone any Ideas?
Kira Vakaan
15
Years of Service
User Offline
Joined: 1st Dec 2008
Location: MI, United States
Posted: 27th Dec 2009 09:25
Well, in DBPro, I think you could use the get ground height function. Just call that function on each of the three matrixes and the ones you aren't standing on should return a 0. I'm not at my main development computer right now, so I can't test it, but if I'm remembering that function correctly, it should work.
azzido
16
Years of Service
User Offline
Joined: 16th May 2008
Location:
Posted: 27th Dec 2009 10:37
Thx for the post. Its a beginning to find a solution.

The Problem is, when i have nearly 1000 Matrixes i must check them dynamicly - mhmm

isn´t there a command to get the matrix i stand on? But i will try if i can do this with get ground height.

thx a lot
Kira Vakaan
15
Years of Service
User Offline
Joined: 1st Dec 2008
Location: MI, United States
Posted: 28th Dec 2009 00:48
I see. I'm not sure. I'd like to mess around with it when I get back to my computer, but I don't remember a command to do that. Good luck
=PRoF=
21
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 28th Dec 2009 02:15
I would keep the matrix ID's in and array, and work out which matrix I was stood on by comparing that array against the players x and z co'ords.

Virtual Nomad
Moderator
18
Years of Service
User Offline
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 28th Dec 2009 02:16 Edited at: 28th Dec 2009 02:17
how are the matrices placed?

are they in a grid? ie,:
[7][8][9]
[4][5][6]
[1][2][3]...

are they lined up next to eachother? ie,:
[1][2][3]...

do they all have the same dimensions? ie, all 512x512?

if so, some simple math will help. just let us know how it's set up.

otherwise, if you've got them staggered and scattered about, ie:

[9]
[6][7][8]
[2][3][4][5]
[1]

then, it will be a bit trickier, but how they're placed is what matters first.

frankly, i don't see a need for ~1,000 (literal) matrices at all. depending on their sizes and your camera range, you should consider storing all the height values in an array and utilize 3-4 (at most, but i think 1 should be enough). again, it depends on the details mentioned above.

Virtual Nomad @ California, USA
AMD Phenom™ X4 9750 Quad-Core @ 2.4 GHz . 8 GB PC2-6400 RAM
ATI Radeon HD 3650 @ 512 MB . Vista Home Premium 64 Bit
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 30th Dec 2009 18:42
Well unless your matrices overlap, this is a simple matter of checking your current position.

Even with a staggered layout it would be rather simple. Build an array to store each matrix' position. There are commands for retrieving the matrix position but not it's width and depth, so we'll need to store this.

If your matrices are in a staggered design like Nomad said, then this is how I'd do it:


If they're laid out in a more predictable grid, and of the same size, then it would be a simple matter of dividing the current position by the width and depth of a matrix.

Example, assuming matrices are all the same size and displayed in a 3x3 grid:

[1][2][3]
[4][5][6]
[7][8][9]

col = posX / matWidth + 1
row = posZ / matDepth

matrixId = row*3 + col

col will be between 1 and 3. row will be between 0 and 2.

I also don't think having 1000 matrices is the best method. Ten would probably be more than enough, you don't want build more stuff into memory than you have to.


> SELECT * FROM users WHERE clue > 0
> 0 rows returned
azzido
16
Years of Service
User Offline
Joined: 16th May 2008
Location:
Posted: 6th Jan 2010 17:23
Thx for the ideas.

I used several matrixes above to create layers.

Maybe i can use another methode to create mountains or is it possible to multitexture a matrix? i don´t know how?

thx
Scorpyo
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: italy
Posted: 6th Jan 2010 23:46
I think I see what you are trying to do: layer matrixes on top of each other to simulate landscape.

You can use a single matrix and a single texture by splitting the whole texture with:

prepare matrix texture matrix number,image number,n of horizontal tiles,n of vertical tiles.

study the attached example.

Nevertheless you are going to delve yourself into a rather painful task if you need detailed scenery.

Why don't you use advanced terrain with a greyscale heightmap, a supertexture and a detail texture.

cheers

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-09-28 14:26:55
Your offset time is: 2024-09-28 14:26:55