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.

Code Snippets / [DBP] - Simple terrain editor

Author
Message
SamKM
14
Years of Service
User Offline
Joined: 25th May 2009
Location:
Posted: 13th Sep 2013 03:06 Edited at: 28th Oct 2013 19:34
Updated 22/10/2013!
Ok, so this is a little bit longer than a code 'snippet', but it's probably better off here than Program Announcements
Basically, I made this program for a project with EVOLVED's Advanced Lighting, since 3D World Studio terrain doesn't seem to work well with it. It has most of the features of the 3D World Studio terrain editor, apart from texture painting, because I have NO idea how to do that
Feel free to play around with the code, edit it, use it however you want, etc! If you just want to use it to make terrains, you can just copy and paste it into a new project, and it should work fine. You can export terrains you've created as .dbo or .x objects.
Hope people find it useful
You'll need Matrix1Utils to compile it

Changelog:


Current version:


Old version:
chafari
Valued Member
17
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 14th Sep 2013 13:14
@SamKM Great editor with so many options...I like it. You could add your terrain appearance using colour diffuse and converting object fvf and vertexdata...I will keep it

I'm not a grumpy grandpa
JosephB
17
Years of Service
User Offline
Joined: 12th Sep 2006
Location:
Posted: 15th Sep 2013 03:09
I had a problem with the following code (around line 102:

rem Change the pen from a circle to a square, and back again... Magic :3
if keystate(15) = 1 and keyhold = 0
set vector3 to object position 3, 2
delete object 2

Should the bolded line be changed to:

rem Change the pen from a circle to a square, and back again... Magic :3
if keystate(15) = 1 and keyhold = 0
set vector3 to matrix position 3, 2
delete object 2

Thanks and very nice.
SamKM
14
Years of Service
User Offline
Joined: 25th May 2009
Location:
Posted: 15th Sep 2013 05:01
Thanks for the comments
Are you sure about the vector thing? You could be right, but... The vector there is supposed to hold the position of object 2 (the pen/editing object), so when it's deleted then recreated, it can be put back in the same place
JosephB
17
Years of Service
User Offline
Joined: 12th Sep 2006
Location:
Posted: 16th Sep 2013 03:39
I found the problem. I had an older version of the matrix1 utilities. No changes needed.

Thanks.
SamKM
14
Years of Service
User Offline
Joined: 25th May 2009
Location:
Posted: 22nd Oct 2013 04:21
Updated the code so you can now create terrains that are actually a usable size, rather than tiny terrains that look low-poly if you stretch them to anything larger!
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 23rd Oct 2013 00:02
Definitely a good start. But the camera needs some work. I found it difficult to navigate since the direction the mouse moves doesn't feel natural unless I'm facing directly down the Z-axis. In other words, it's not rotating with the camera, making the controls feel reversed depending on where I'm looking. It's more noticable when moving between limbs.

Also, it's hard to match up the terrain across limbs since you can only update one at a time. Editing along the edges makes gaps.

SamKM
14
Years of Service
User Offline
Joined: 25th May 2009
Location:
Posted: 23rd Oct 2013 04:32 Edited at: 23rd Oct 2013 04:37
Thanks for trying it out! You're right about the camera controls - they're not great :/
I swear there's an easy way to convert mouse movement into 3d, allowing you to drag an object, but I wasn't sure what it was, so I improvised a bit...
As for the gaps at the limb edges, press F1 to join the edges together
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 23rd Oct 2013 19:57
Quote: "As for the gaps at the limb edges, press F1 to join the edges together"

I must've missed that.

If you search the forum, you should find 2d mouse to 3D code. Since your terrain is an object, you could just use pick object and then x# = camera position x() + get pick vector x().

gwheycs62egydws
14
Years of Service
User Offline
Joined: 17th Aug 2009
Location: The World
Posted: 23rd Nov 2013 20:24
@SamKM

I tried to run you example as just a past code in DBP

but I got a error which I'm guessing is because of conflict between
one of the additions I have


it showed up in line 483
saveinput$ = trim$(saveinput$)

subscript must be integer of DWORD when referring an array at line 783.

that was the error message

one thing i noticed the word " trim$ " was not highlighted
like other commands were

I've collected every addition I thought I would need
the other thing is one of the additions is newer and dose not contain
or could be older but that seems less likely

to move side ways - is to move forward
Since a Strait line gets thin fast
SamKM
14
Years of Service
User Offline
Joined: 25th May 2009
Location:
Posted: 26th Nov 2013 03:45 Edited at: 26th Nov 2013 03:46
Hmm, that's strange
If you remove that line, do the commands 'replace all$' and 'last instr$' underneath it work? If not, you might want to try re installing Matrix1Utils
gwheycs62egydws
14
Years of Service
User Offline
Joined: 17th Aug 2009
Location: The World
Posted: 26th Nov 2013 19:45
@SamKM

ok it works ;o)

this could be expanded for placing objects
and the code saved for such

but when I try to save it keeps saying wrong file extension

i tried x and dbo and ter

nun worked

the color of the text get's a bit washed out
it could have a faint back ground so that it would easier to read

ok because I have anther dll that use the trim$
I changed that in the ini file

so my only problem now is saving

to move side ways - is to move forward
Since a Strait line gets thin fast
gwheycs62egydws
14
Years of Service
User Offline
Joined: 17th Aug 2009
Location: The World
Posted: 26th Nov 2013 20:02
@SamKM

the space bar thing is understandable why it's used
but would be nice to have it auto shift over to the next section

ok dbo and .ter file saving works
but when I do .x I get

Runtime error 7029 - 3d memory error at line 494

the files that were made load perfectly

now all that needed is way to paint on them
and to have a larger land mass

to move side ways - is to move forward
Since a Strait line gets thin fast

Login to post a reply

Server time is: 2024-04-24 04:14:56
Your offset time is: 2024-04-24 04:14:56