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 / How to make a 4D matrix?

Author
Message
Manticore Night
22
Years of Service
User Offline
Joined: 23rd Oct 2003
Location: Ouinnipeg
Posted: 9th Dec 2005 05:35
Hi I've been using DB for a while now, and I was wondering if it's possible to make a 4D matrix. I found the code for a 2D one("DIM ARRAY(ELEMENTS, ELEMENTS IN ELEMENTS)"). Can you just keep going and input the ELEMENTS IN ELEMENTS IN ELEMENTS,ELEMENTS IN ELEMENTS IN ELEMENTS IN ELEMENTS...etc?

[center]It's amazing how much TV has raised us. (Bart Simpson)

He's back! With 20% less intelligence!
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 9th Dec 2005 09:45 Edited at: 9th Dec 2005 09:48
Matrix...don't know..but Dim works....

dim array(a,b,c,d)

These will soon get fairly huge though.

SimSmall
21
Years of Service
User Offline
Joined: 7th Aug 2004
Location: United Kingdom
Posted: 9th Dec 2005 12:16
Dimension 1: Left/Right
Dimension 2: Up/Down
Dimension 3: Forward/Backward

What exactly would your 4th dimension be?

...maybe one day I'll finish a project
TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 9th Dec 2005 13:10 Edited at: 9th Dec 2005 13:14
SimSmall:

Array dimensions aren't specifically tied to world dimensions, so the fourth subscript doesn't mean a fourth dimension in that way. Arrays are just groups of data.

You could have

DIM TroopHealth(5,5,30,25)

where the first element is the country (5 countries in the war), the second element is the garrison (up to 5 per country), the third element is the unit, (up to 30 per garrison) and the last element is the soldier in the unit, (up to 25 per unit).

So, if France was country 2,

TroopHealth(2,3,5,7)

could be for example, the health of the 7th man in the 5th unit in France's 3rd garrison. A bit of a strained example, but it illustrates the point.

As Pincho says, these can get quite big and start using a lot of memory - especially with strings. The above Dim alone creates 18750 elements and uses nearly 38K of memory as a two-byte integer array.

TDK_Man

SimSmall
21
Years of Service
User Offline
Joined: 7th Aug 2004
Location: United Kingdom
Posted: 9th Dec 2005 13:52
Quote: "How to make a 4D matrix?"


I have many of my own 4 dimension arrays...

...maybe one day I'll finish a project
TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 9th Dec 2005 15:59 Edited at: 9th Dec 2005 16:01
Oops! :blush:

I saw DIM ARRAY(ELEMENTS, ELEMENTS IN ELEMENTS) in his post and for some reason got it into my head that a 4-dimensional array was what he was asking about.

Sorry about that!

In that case, he's probably talking about a mathematical matrix rather than a terrain matrix?

Actually Manticore, are we even talking DB Classic here anyway?

TDK_Man

Dodic
20
Years of Service
User Offline
Joined: 6th Nov 2005
Location: SNM (Serbia&Montenegro)
Posted: 9th Dec 2005 17:50
hm... 4th dimension is time actually...

so , what he realy means is unknown and only thing we can do is wait for him to explain what he`s thinking about.

i make free 3d models , then you tell me some stuff about usseles posts and then something heppen...
blanky
21
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: ./
Posted: 9th Dec 2005 21:34
A 4D matrix would require one of the parameters being 'time', which... could result in an interesting piece of code

16-colour PNGs pwn.
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 9th Dec 2005 23:18
Quote: "A 4D matrix would require one of the parameters being 'time', which... could result in an interesting piece of code "


I don't consider the 4th Dimension as time (as the world does)... time is a universal constant that flows through all dimensions. Time is in the 1st, 2nd, and 3rd Dimensions... so the 4th cannot be "time" but have "time" just like the first 3 Dimensions.


TravisP
22
Years of Service
User Offline
Joined: 30th Jun 2004
Location: Behind you, with a knife!
Posted: 9th Dec 2005 23:47 Edited at: 9th Dec 2005 23:48
Quote: "I was wondering if it's possible to make a 4D matrix."

Can you specify what the 4th dimension is?
Some scientists believe it is time, amaze us with your genius.

headcrab 53
20
Years of Service
User Offline
Joined: 14th Jul 2005
Location:
Posted: 10th Dec 2005 00:00
Quote: "Quote: "I was wondering if it's possible to make a 4D matrix."
Can you specify what the 4th dimension is?
Some scientists believe it is time, amaze us with your genius."


The 4th dimension is what you see when you use too many drugs.

Windows XP Service Pack 2 -- Pentium 4 HT 3.0 ghz
1 GB DUAL DDR RAM -- NVIDIA GeForce 6600 GT 128 MB (PCI Express)
TravisP
22
Years of Service
User Offline
Joined: 30th Jun 2004
Location: Behind you, with a knife!
Posted: 10th Dec 2005 00:04
Quote: "The 4th dimension is what you see when you use too many drugs.
"

Thats the first 3 distorted or your thinking of the 3.5th demension.

headcrab 53
20
Years of Service
User Offline
Joined: 14th Jul 2005
Location:
Posted: 10th Dec 2005 00:07
Quote: "Thats the first 3 distorted or your thinking of the 3.5th demension."


Maybe the 4th dimension is filled with insight into the future, and whenever you have a vision of the future you're seeing the 4th dimension

Windows XP Service Pack 2 -- Pentium 4 HT 3.0 ghz
1 GB DUAL DDR RAM -- NVIDIA GeForce 6600 GT 128 MB (PCI Express)
Dodic
20
Years of Service
User Offline
Joined: 6th Nov 2005
Location: SNM (Serbia&Montenegro)
Posted: 10th Dec 2005 01:08
i mean he menth 3d

and i do considere 4th dimention time becouse time doesn`t "flows"
in all dimensions , time is "BEYOND" our dimensions , it`s seperate and it`s strait line , so siencist call it fourth dimention , and as ainstain toled us(not me , humans..) , if you could drive a space ship with a certain (great.....) speed and angle you could "curve" the timeline witch would cose you to find in certain time , but if you go to past , you will lose your memories as you go to the past , so you wont remember how you got in space ship at all , and if you go to future , you will "remember" stuff all the sudden.. But ainstains teory of relativity is also full of "holes" so , it`s close to truth , but as the x files say "truth is somewhere out there - my past user name) . so there are many stories of paranormal stuff going on , especialy on area 51 , for witch american goverment still claimes that it doesn`t exist , eaven if russian (and hwo knows witch else) satelite captured good , clear pictures of it , and also when you came there is a sind : "military base , don`t get near" (something like that) , so it`s not realy a "well" kept secret , and only god knows what they`r doing there..some people hwo lives and works on a fuel station near area 51 , saw a light coming "throo" their door and i (i dont know) maby stayd there a little , and then it gone , so there are also "TRUTH" stories about people hwo got back from area 51 with savier injuries and theyr skin started turning off the bounes... and they sad that they cant talk becouse american goverment say that they`l go to "prison" , prison ? well if i knew i was dieng from something wierd becouse of them , prisont wouldn`t stop me i belive..


p.s. sorry i`we got a "little" caryed away , it happens sometimes..

i make free 3d models , then you tell me some stuff about usseles posts and then something heppen...
Orangina Man
20
Years of Service
User Offline
Joined: 9th Dec 2005
Location:
Posted: 10th Dec 2005 01:09
The forth dimension is the dimension around which the other three are curved in this universe - like how a 2D object could be curved around a sphere. We cannot see it though, because we only see in 2.5D.
TravisP
22
Years of Service
User Offline
Joined: 30th Jun 2004
Location: Behind you, with a knife!
Posted: 10th Dec 2005 02:05
Quote: "Maybe the 4th dimension is filled with insight into the future, and whenever you have a vision of the future you're seeing the 4th dimension"

surrreeee, *throws covenant in the crazy people house*

Manticore Night
22
Years of Service
User Offline
Joined: 23rd Oct 2003
Location: Ouinnipeg
Posted: 10th Dec 2005 07:01
Quote: "Some scientists believe it is time, amaze us with your genius."
Um.. the 4D array guy was right, any multidimentional array is a matrix(atleast that's what they taught me in Computer Science in school). I'm not a genius, infact I don't even know what to call that loud box overthere.

Logically any 3D matrix matrix is an array(X=1st dimension,Y=2st dimension, and Z=3st dimension). But I got the code I'll need so thanks. Anyway you could simulate the <<Time>> dimension just by scrolling a matrix. But that's not what I'm trying to do.

I'll shut up now,
Manticore

[center]It's amazing how much TV has raised us. (Bart Simpson)

He's back! With 20% less intelligence!
nojbox87
21
Years of Service
User Offline
Joined: 26th Jun 2005
Location: England
Posted: 11th Dec 2005 00:04
put simply...there is no 4th dimension to a matrix but there can be in an array
Manticore Night
22
Years of Service
User Offline
Joined: 23rd Oct 2003
Location: Ouinnipeg
Posted: 11th Dec 2005 00:39
A matrix IS an array.

[center]It's amazing how much TV has raised us. (Bart Simpson)

He's back! With 20% less intelligence!
TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 11th Dec 2005 02:20
nojbox87:

Manticore Night is talking about a mathematical matrix - not a DB terrain matrix - they are completely different!

TDK_Man

Sephnroth
23
Years of Service
User Offline
Joined: 10th Oct 2002
Location: United Kingdom
Posted: 11th Dec 2005 07:22 Edited at: 11th Dec 2005 07:40
This problem is caused by dbp naming their first terrain features in the original language a "matrix" - realllly bad idea SimpleTerrain would of been a better name. or landscape, or something, but not a reconised mathematical container

So yes, Manticore, you can continue adding elements in elements as people have said. Do watch your memory usage though for REALLY big ones. but dim Mat4(4, 4, 4, 4) would be fine.

HOWEVER, hit F1 and look at the 3D Maths section of the help and you may be pleasently surprised. If you dont need to make your mat4 as an array then you can use:

make matrix4(mat id)

to create a 4 dimensional matrix. you will also find commands in there for working with it; adding, multiplying, etc and commands to copy the world/view/etc matrix data into it if you ever need that stuff for some fancy code.

@everyone else - get versed with the 3d maths commands, it will stop misunderstandings like this

###EDIT###

3d maths command set? Next time I will pay attention to what forum im in, i thought i was browsing the dbp board --; sorry, I dont think dbc has the 3d maths command set so you WILL have to dim your own 4d array for it. I'll leave my original post intact so people can see the error i made, i'll feel like a tit and hopfully wont do it again

Me!
20
Years of Service
User Offline
Joined: 26th Jul 2005
Location:
Posted: 11th Dec 2005 10:03
as mentioned above, a matrix is an array of numbers in several dimensions, DB uses the term matrix for simple terrains and the movie industry uses matrix to refer to a computer simulated world run by sentient machines, it`s confusing , before using DB I could refer to arrays and matrixes interchangably, now I have to be carefull not to mention numeric arrays in posts, as Sephnroth said the DB matrix should have been called landscape or ground or something.

@Sephnroth: is there a tutorial specificaly for the DB 3D math set?, I would be interested to look through it if you know of one (tried a search but couldn`t find anything)



Windows: 32 bit extension/graphical shell for a 16bit patch to an 8bit OS originally coded for a 4bit CPU, written by a 2bit company that can't stand 1bit of competition, now available in 64bits.
Dodic
20
Years of Service
User Offline
Joined: 6th Nov 2005
Location: SNM (Serbia&amp;Montenegro)
Posted: 11th Dec 2005 21:04
You are right , i agree , he menth probably on matemathical matrix , but becouse i`m from yugoslavia , i don`t realy know what it is.

i make free 3d models , then you tell me some stuff about usseles posts and then something heppen...
Captain America
21
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Here
Posted: 30th Dec 2005 07:21 Edited at: 7th Jan 2006 05:55
OK 4th dimension, you have entered into my territory now!

The 4th dimension is also known as Tetraspace, and contrary to many peoples beliefs it is in fact, not time.
The fourth dimension is all space that one can get to by traveling in a direction perpendicular to three-dimensional space.

Normally when somebody hears this very complicated definition they try to comprehend how its even possible for that direction of travel to exist.

I have drawn up what would be an island in Tetraspace for you:


The directions of travel are:
forward & backward
left & right
and
up & down
and
another direction of movement that we cannot comprehend.

So beings in the 4th dimension can walk up!
Does that help clear things up a little bit?

The 4th dimension can be thought of as Space.
When Astronauts go for spacewalks in space, and walk around their spaceship they are essentially experiencing what the 4th is like.
Except they cant live without their spacesuits.
If we lived in Tetraspace we could breath normally while 'flying' 100 miles above land, but in tetra space there would be no 100 miles above land because there is no gravity to hold you down.

So a world in tetraspace would look like this:



And you could travel from land mass to land mass much like we walk from street to street.

As Dodic stated previously time is not a dimension itself, but rather it is beyond our dimensions, a straight line, acting as a track much like a rollercoster would travel on. We are limited, so far, of just going forward, and rembering what has occured in the past. We are sorta of like sitting backwards in the rollercoster because we are only aware of the past, and cannot see into the future.



Now I could go on all night about this stuff, because it interests me so much, but i will not.

I hope this helped some people out even though it is so COMPLETELY off topic, but i couldn't resist talking about the dimensions and time.

I have made a game out of something like this, but i lost it when my hard drive crashed a couple months ago. It helped alot when trying to understand the 4th dimension. But ive been to lazy to remake it, so you'll have to use your imagination.

-Captain-


Cheers,
Capt. America
Captain America
21
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Here
Posted: 30th Dec 2005 07:43
opps


Cheers,
Capt. America
Relativity
21
Years of Service
User Offline
Joined: 29th Mar 2005
Location: Position is relative.
Posted: 5th Jan 2006 02:05
Captain America,

I am fascinated by your description of tetraspace, but am a little confused by it. We can travel left, right, forward, backward, up, and down in three dimensions; however, we are bound, for the most part, to two dimensional travel on Earth's surface. Are you suggesting that these tetra-beings are bound to a tetra-planet, so that it they were not bound they would have two more directions to go in?

Tetraspace is a hypothetical fourth SPATIAL dimension, and, according to current theory, does not have any place in most phenomena, or else gravity would be much greater (although if you get into the nitty-gritty of physics, multi-dimensional space does exist).

Furthermore, I would like to disagree with your assessment on the time's qualification as a dimension. First off, dimensions are simply a category of information (i.e. a 4D array) and is not limited to space. Furthermore, in both the Special and General Theories of Relativity, the concept of time as a dimension and being subject to the same influences as the other three dimensions (i.e. curving or bending) is integral to the theories. Furthermore, when an event is specied in space, not only do the three spatial coordinates of the event have to be there to tell where the event occurred, but a fourth coordinate, time, has to be present to tell when the even occurred.

The force will be with you. Always.
The crazy
21
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Behind you
Posted: 5th Jan 2006 03:58 Edited at: 5th Jan 2006 03:58
[href]http://en.wikipedia.org/wiki/Fourth_dimension[[/href]
I found this kind of interesting

Your signature has been erased by a mod because it's larger than 600x120...
Captain America
21
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Here
Posted: 7th Jan 2006 05:53
SithSpawn

After doing futher research I need to revise my statement that Time is not a dimension itself. Because Time is in fact a dimension, because, as you previously stated, it can be bent/curved. Einstein's theory of reletivity states that if a dude rode on a rocket ship, at the speed of light, for a long time and then turned around and came back to earth. He would not be as old as every body else even if they were the same age as him when he left. If this is true, which i think it is, then time must be a dimension and was bent when the dude on the rocket ship was traveling.

And also yes beings in Tetraspace are bound to a 4 dimensional plane of existance, and cannot move out of it, just as we cannot move out of our dimension. Atleast to my knowledge no human can travel between dimensions.


Cheers,
Capt. America

Login to post a reply

Server time is: 2026-07-11 11:58:52
Your offset time is: 2026-07-11 11:58:52