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 / dark basic professional matrix editor problem

Author
Message
The thing
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location: Somewhere in the U.K
Posted: 8th Mar 2004 20:13
Hi I have made a matrix editor to make landscapes for my games. Please can someone help me get my matrixs into my games. I could type out all of the matrix code manually but that would take forever. I was thinking that someone could add a saving feature into my matrix editor and load the matrixs into my games. Or add a copying feature into my editor so I can paste the matrix code into the dark basic professional editor. Can someone please help.

here is the source code

C.M.M
BearCDPOLD
20
Years of Service
User Offline
Joined: 16th Oct 2003
Location: AZ,USA
Posted: 9th Mar 2004 02:45
This is where you design your own special file format. Think of it like this:your program needs to be able to read the data in the format and put it into variables which can be then put to some use.

You probably want to start off the file with the size of the matrix, in pixels, pixels per tile, etc. Then every point or row of points on the matrix should have its own little section that describes its height. You don't have to write this out point by point, you could write a for...next loop and use an array to store all the matrix points.

Crazy Donut Productions
Current Project: KillZone
The thing
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location: Somewhere in the U.K
Posted: 9th Mar 2004 21:30
I had a go at making my own file format for my editor and storing the matrix information in an array but it did not work.
I have not had dark basic pro that long. Can you make it for me?
I know that arrays can save data but I can not code one. Arrays are confusing.

C.M.M
BearCDPOLD
20
Years of Service
User Offline
Joined: 16th Oct 2003
Location: AZ,USA
Posted: 10th Mar 2004 01:51
Unfortunately, I cannot write it for you, I'm a Classic user right now, but I'll give you the barebone idea.

First, Arrays. Think of arrays like the first number defines how many drawers are in your file cabinet.

MyArray(10) would have 10 drawers labeled 1 through 10.

You can add more dimensions to the array to organize things. A second number would be the number of dividers in each drawer.

MyArray(10,3) would have 10 drawers with 3 dividers in each drawer. That's a total of 30 spots to store data.

Normally people stick with two dimensional arrays, but if you want to delve deeper here's how to think about it. A third number would place folders inside the dividers.

MyArray(10,3,4) would have 10 drawers with 3 dividers in each drawer, and 4 folders in each divider.

You can have up to 5 dimensions.....but I haven't seen anybody that uses more than 3.

To implement this into a program that saves matrix data you would want a drawer for each point on the matrix. For simplicity's sake let's say there's 10 points.

MatrixPoints#(10)

That is your starting point. Now you need to think about the characteristics of a point on a matrix. Probably the most important thing is that height of the point. Since the height is expressed as one value you only need one divider for each drawer. Special note, if you only want one divider per drawer, you don't even need to add a second dimension.

MatrixPoints#(10) This will serve to store the height of 10 points on a matrix.

But then, how will we know which points to set to what heights? You will need to add more information.

MatrixPoints#(10,3) This separates each drawer with 3 dividers. This leaves the first slot for the X coordinate of the point. The second slot for the Y coordinate of the point. And the third slot for the height of the point.

If you need to add more data you can make more arrays, add more slots to the existing dimensions, or add more dimensions.

Crazy Donut Productions
Current Project: KillZone
CKy
21
Years of Service
User Offline
Joined: 26th Jan 2003
Location:
Posted: 13th Mar 2004 07:05
I am 90% through my own Matrix Editor. Called 'Trix0r', you use your mouse to mould the matrix, place/rotate objects and texture the landscape. I use my own file format ".lev" this is how i load arrays...

Think of saving and loading as Packing and Unpacking. Firstly you need to pack all of your matrix heights into an array, and save it to a file. The above algorithm simply pulls the array back out of the file and fills the entire 64x64 tiled matrix to what ever height was previousely saved in the array.
Hope my info helps?
Spaceman Spiff
20
Years of Service
User Offline
Joined: 27th Jan 2004
Location: Smacking my head on your keyboard.
Posted: 13th Mar 2004 07:46
Hey BCDP great way to explain arrys I totally understand them now!

Uh McMahon why dont you use mat edit or sumthin like that?
The thing
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location: Somewhere in the U.K
Posted: 13th Mar 2004 15:11
I tried matedit but it freezes because my computer is anchient and slow. My computer is about 5 or 6 years old.

here is what i am going to do roughly

i am going to use the save bitmap command to save my matrix data in a bitmap and use different color pixels for the height of the matrix tiles.

then use load bitmap to load my bitmap into my program and then use
the POINT(X,Y) command to get the height of the matrix.

C.M.M
MikeS
Retired Moderator
21
Years of Service
User Offline
Joined: 2nd Dec 2002
Location: United States
Posted: 13th Mar 2004 15:51
Visit my website Curved Basic(through sig). Find your way to the Darkbasic section then tutorials. I have written a full tutorial on saving matrices.



A book? I hate book. Book is stupid.
The thing
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location: Somewhere in the U.K
Posted: 13th Mar 2004 19:05
thanks yellow i finally understand arrays and my editor works.
Your source was very usefull. I think i will add more features into my matrix editor.

C.M.M
The thing
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location: Somewhere in the U.K
Posted: 15th Mar 2004 19:54
goto this forum to get version 0.5 of my editor
http://www.thegamecreators.com/?m=forum_view&t=27607&b=1
credit to yellow for loading and saving features

C.M.M
MikeS
Retired Moderator
21
Years of Service
User Offline
Joined: 2nd Dec 2002
Location: United States
Posted: 16th Mar 2004 01:32
No problem at all Callum.

Glad to help you along with the many others who find it. I remember struggling asking people how to save a matrix. Most of them gave help, yet only said to "use arrays".

And at the time, I didn't know what an array was. So now I've created a tutorial for those in need. (and that's my life story )

A book? I hate book. Book is stupid.

Login to post a reply

Server time is: 2024-09-22 03:02:31
Your offset time is: 2024-09-22 03:02:31