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 Professional Discussion / Saving a BlitzTerrain as X?

Author
Message
Mugen Wizardry
User Banned
Posted: 8th Aug 2011 18:38 Edited at: 8th Aug 2011 18:50
Hi all! I'm in a bit of a jam! How do you save a BlitzTerrain as X, 3DS, and DBO?

My purpose is faster loading times, and better looking maps with DBO and X and 3DS.

ANY help is GREATLY appreciated!

Thank you!

~MW~

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!
KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 8th Aug 2011 20:42
I don't think you'll get faster loading times. If that's mainly what you're after there are commands to save the terrain in .blitz format, which you can then load later, and that is faster than creating them each time. That only saves the raw terrain.

Making them look better is a bit tricky though. Someone made a system for tiling textures on BlitzTerrain......ahh, here it is..

http://forum.thegamecreators.com/?m=forum_view&t=169921&b=8

It's a lot of code to sift through, and difficult to adapt to an existing project, but it looks pretty good. There are some errors in it for lighting and the cloud motion though.

I highly recommend getting L3DT even if it's the free version. It's VERY useful in creating some outstanding terrains for BT.

Mugen Wizardry
User Banned
Posted: 8th Aug 2011 20:47
I have L3DT Pro. Problem is, without Blitz Terrains, I can't get a REALLY good tile quality

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!
Mugen Wizardry
User Banned
Posted: 8th Aug 2011 22:05 Edited at: 8th Aug 2011 22:06
I NEED THAT quality for my terrain models :/ I'd like to save it to an X file / 3DS file / DBO file.

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!
KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 8th Aug 2011 22:15
You can use the BlitzTerrain commands to create objects, but the number of objects is based on the Level of Detail you choose, and the tile setting. So for a very large terrain, you'll end up with quite a lot of objects, and they might be fairly high poly depending on the LoD.

Once you've created the objects. Save them as X or DBO, and also save their positions so you can put them back in the same places when you load them again.

Mugen Wizardry
User Banned
Posted: 8th Aug 2011 22:18
could you show me a little example of how to achieve this? I would be GREATFUL.

Thank you SO much

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!
Mugen Wizardry
User Banned
Posted: 8th Aug 2011 22:22
Also how to combine them into 1 mesh with the perfect textured tiles still in tact?

Thank you SO much again!

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!
KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 8th Aug 2011 22:26
The command to look for is BT MakeSectorObject. You'll have to get the sector count of the terrain, and step through in a loop to create an object for each Sector.

Mugen Wizardry
User Banned
Posted: 8th Aug 2011 22:38 Edited at: 8th Aug 2011 22:39
Here's what I have to load my terrain up into super-high quality sectors:



Here's what I have in the main loop so far:



CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!
KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 8th Aug 2011 23:00
That's a good start. I don't remember if the sector index starts at 0 or 1, but if you make the objects visible you'll be able to tell what's missing.

Then all you have to do is save the objects, and then save in a text file or something each object's X, Y and Z position.

Remember also that in the BT BuildTerrain command, you specified an Object number for the terrain. This is a DBPro object number so don't get it mixed up in the sector object numbers.

Maybe change the one line to,

BT MakeSectorObject 1, 0, x, x+499

so your sector objects will be numbered 500 to 500+BT GetSectorCount

Mugen Wizardry
User Banned
Posted: 8th Aug 2011 23:04
ok, im lost after what i just posted. i know how to get all the sectors and cut them up. what i do NOT know, is how to get their positions, and position each sector in their correct positions, then save all of them. if u could show me a simple example of how to do it, im sure not only i, but ALOT of ppl would benefit from it im sure there are ALOT of ppl who would like to have this ability to save their perfect terrains too

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!
KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 8th Aug 2011 23:13
Once you have the objects created, it's just simple DBPro object commands.

X# = object position x(ObjectID)
Y# = object position y(ObjectID)
Z# = object position z(ObjectID)

Then use the file commands to store these float values in a file to be used to load the terrain objects. You could even store,

- The filename of the object
- it's X position
- Y position
- Z position
- Texture filename

Then when you are ready to use it you have all the information you need to load it all and put it exactly where you want it with the right textures.

I'm sorry I can't do more. I'm neck deep in coding after being gone for 3 weeks on vacation, and I've set a deadline for being at least close to being done with the current project by the end of the month.

Mugen Wizardry
User Banned
Posted: 8th Aug 2011 23:15 Edited at: 8th Aug 2011 23:15
how do i then save them after that? and u dont have to apologize ^^

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!
KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 8th Aug 2011 23:19
Save Object("filename", ObjectID)

According to the help file, the only format supported in this command is DBO.

Mugen Wizardry
User Banned
Posted: 8th Aug 2011 23:25 Edited at: 8th Aug 2011 23:27
ok, here's what i have now, but its saying object 2 doesnt exist ><

EDIT:

CRASHES at sector 64 being written ><



CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!
Mugen Wizardry
User Banned
Posted: 8th Aug 2011 23:28
If I could JUST get the bloody save function to work right ><

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!
KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 8th Aug 2011 23:56
Try changing the for line to this,

For X = 0 to BT GetSectorCount(1, 0) - 1

Mugen Wizardry
User Banned
Posted: 9th Aug 2011 00:02
this SORTA works. but only saves 63 dbo files in the verts folder.



Is that the right amount, considering my terrain code is:



CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!
Mugen Wizardry
User Banned
Posted: 9th Aug 2011 00:34
Here's what I have so far, it renames the files to x+1. so 1 to 64.

is this correct, assuming the terrain detail is 128.0?

the terrain code:



the save code:



CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!
KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 9th Aug 2011 00:44
The DetailTile command only influences the detail texture if you specify one. The TerrainSplit command, which in your case defaults to 8 when you don't specify it, is what you would be looking at.

It's creating 64 objects (8 * 8 = 64) numbered from 0 to 63. So it's probably right. There should be 64 files.

You can increase this number to get more objects, but I wouldn't decrease it, as that becomes to many polys in one object for DBPro to handle.

Mugen Wizardry
User Banned
Posted: 9th Aug 2011 00:49
ok, here's what I have so far, I am now able to read in the ACTUAL txt file (theres a debug txt file, and a non-debug txt file), I am now able to read the positions of each sector.

HOWEVER, when I try to position it, it DOES work, but I see NOTHING. what I want to do is position the terrain created from sectors 50 units (y#+50) ABOVE my WORKING terrain so I cant see ONE difference.

Here's the code:



CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!
KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 9th Aug 2011 00:55
Change Set Object Cull to 0 so it will render both the top and bottom.

You may have to give them a color or texture to get them to show up too.

Set Object Color(ObjectID, 128, 128, 128) should do it.

Mugen Wizardry
User Banned
Posted: 9th Aug 2011 01:07
Here's the code so far, I have done what you said, but still to no avail:



CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!
Mugen Wizardry
User Banned
Posted: 9th Aug 2011 01:12
What am I missing?

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!
KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 9th Aug 2011 01:13
Um, why are you using strings for the positions? They are floats.

Mugen Wizardry
User Banned
Posted: 9th Aug 2011 01:14
Because when I tried to make it write floats as a float in plain english, it encrypted my floats >< i want to be able to read the floats.

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!
KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 9th Aug 2011 01:19
Then when you read them back in, you need to use VAL() to make them into a numeric value. I'm surprised the compiler let you get away with that.

It didn't encrypt them, a float takes up 4 bytes of data, you are just seeing the ASCII codes that represent each byte in the float.

Also, you wrote the object's sector number in the file, but when you read it back you didn't read that, so it's throwing off your position data.

Mugen Wizardry
User Banned
Posted: 9th Aug 2011 01:25 Edited at: 9th Aug 2011 01:26
Ok, it's not quite working. Something is crashing it, but I can't quite put my finger on it. It crashes after it reads objnum.



Yes, I global'd objnum

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!
Mugen Wizardry
User Banned
Posted: 9th Aug 2011 01:26
I'm SO close. :/

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!
Mugen Wizardry
User Banned
Posted: 9th Aug 2011 01:32
I just cant put my finger on it... I've thought about it. gone to and from the drawing board, and everything else. its CLOSE. I can FEEL it.

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 9th Aug 2011 01:48 Edited at: 9th Aug 2011 01:55
As KISTech said you need to use val():


EDIT: Two minor points for you to consider:-
1-Read people's replies
2-Use the "Edit Post" link

Mugen Wizardry
User Banned
Posted: 9th Aug 2011 01:54 Edited at: 9th Aug 2011 01:55
thanks baxslash. i actually got it to load amazingly. Now what I need is for you to tell me if the object in the red circle matches EXACTLY with EVERY piece in the green circle.

I attached the image

Thanks guys!

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 9th Aug 2011 01:57
I would say not because the bottom right corner of the smaller object turns upward whereas the larger one doesn't.

Mugen Wizardry
User Banned
Posted: 9th Aug 2011 02:03
ok, well here's the code, i dont know whats going on



CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 9th Aug 2011 10:31
Quote: "Read people's replies"

You didn't read my reply or KISTech's or if you did you didn't pay any attention.

1-Read them
2-Do what we both suggested
3-run the code again

HINT: Look at the help file for "READ STRING"

Mugen Wizardry
User Banned
Posted: 9th Aug 2011 13:29
ok i read it. how do i turn objnum into a string? (on$) ?

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 9th Aug 2011 13:43 Edited at: 9th Aug 2011 13:45
OK.

1-"read string 1, on$" - this reads the string from the text file and assigns it to the variable "on$"

2-"objnum=VAL(on$)" - this turns the string into a value which is then assigned to the integer variable "objnum"

If the value read in line one is a float value it will be rounded into an integer in line two. EDIT: Unless objnum has been declared as a global float of course!

Does that clarify?

Mugen Wizardry
User Banned
Posted: 9th Aug 2011 13:46
Somewhat. Here's what I have so far. I KNOW I did it wrong. But I must correct my mistakes.

Here's the code:



CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 9th Aug 2011 13:55
When you write numeric values as strings you have to read them back in as strings and then convert them. All of them.


Mugen Wizardry
User Banned
Posted: 9th Aug 2011 14:33 Edited at: 10th Aug 2011 15:04
EDIT: Ok, it works now. I debugged it. NOW. How do I make it so it has the SAME amount of detail tiles as the 1 I loaded before I split up the sectors and recompiled the map?



It MUST have a detailmap, and texture map, along with the correct of amount of detail for each tile.

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!
Mugen Wizardry
User Banned
Posted: 9th Aug 2011 15:00
i keep looking, but cant quite place my finger on it

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 9th Aug 2011 15:01
You are converting the strings before you read a value in. Put this:
objnum=val(on$)
xpos#=val(xp$)
ypos#=val(yp$)
zpos#=val(zp$)

...after this:
read string 1, on$
read string 1, xp$
read string 1, yp$
read string 1, zp$

...like this:
read string 1, on$
read string 1, xp$
read string 1, yp$
read string 1, zp$
objnum=val(on$)
xpos#=val(xp$)
ypos#=val(yp$)
zpos#=val(zp$)

...the way I showed it.

Mugen Wizardry
User Banned
Posted: 9th Aug 2011 15:16
Ok. the read works. But now we have a problem with the write. ><

I did what you said.

Here's what I have so far:



CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 9th Aug 2011 15:21
Quote: "But now we have a problem with the write."

What is the problem?

It would really help if you could try to be more specific

Mugen Wizardry
User Banned
Posted: 9th Aug 2011 15:57 Edited at: 9th Aug 2011 15:58
well for starters, this is what its returning in the file its supposed to be reading from:



its still not returning the decimal OR the object number. the object number is apparently always 0.

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 9th Aug 2011 16:13
Have you checked that the dbo files it is looking for exist?

Try printing the file name and check whether it's correct and exists...

Mugen Wizardry
User Banned
Posted: 10th Aug 2011 00:29
yes, they do exist.

inside of a folder i called "verts".

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!
Mugen Wizardry
User Banned
Posted: 10th Aug 2011 00:35
i will NOT quit on this code. not after i have come SO far. i absolutely REFUSE to give up.

CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!
Mugen Wizardry
User Banned
Posted: 10th Aug 2011 00:38 Edited at: 10th Aug 2011 00:57
Ok, so here's what I have so far.



EDIT: I've included what each line (at least what I THINK) is doing:



CHECK OUT SOME MUSIC FROM MY NEW TECHNO CD! TECHNOKINESIS
http://www.youtube.com/watch?v=4a8KedfgVv0
ALSO, CHECK OUT MY NEW TECHNO CD AT Amazon.com!
KISTech
18
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 10th Aug 2011 01:10
You're using

BT GETSECTORPOSITIONX()

to get the position, when you just created a DBPro object.

Change that to

xp# = object position x(x+499)

along with the other 2 axis.

Login to post a reply

Server time is: 2026-07-10 18:42:31
Your offset time is: 2026-07-10 18:42:31