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 / Creating a Level Editor

Author
Message
AndrewT
18
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 6th Jul 2009 17:11
Quote: "apply them to your selected object and it should be dragged along with the mouse."


Ya, but is the object dragged along a certain axis? I think what Sasuke wants is for the object to follow the mouse AND for it to be dragged along a certain axis. Using your code it won't be restrained to an axis, it will simply follow the mouse.

i like orange
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 6th Jul 2009 17:42
Restraining it to an axis is really just a case of deciding what to do with the movement values.

If you wanted to move an object along the X axis, affect it's X position with the X movement vector. It's all a matter of user spec, we don't know how he'd plan to limit the axis - personally I'd have toggle buttons for X Y and Z, and just change the toggle to suit whether or not I want to affect the axis. I would probably use a ground pick object, so dragging in X and Z, then have a shift+click drag for the Y axis. The thing is, we don't know a lot about Jason's engine, we don't know how he needs things to snap, or what sort of scale - which is why I suggesting the PICK OBJECT method, because it lends itself to a few different techniques.

It would only ever work fully with 3D dragging, on all 3 axis I mean if the plain was orientated to the camera, that way the X, Z and Y axis would all be changed.


Health, Ammo, and bacon and eggs!
AndrewT
18
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 6th Jul 2009 17:59
Quote: "Restraining it to an axis is really just a case of deciding what to do with the movement values."


If you use your method and only apply movement on one axis, then the object won't remain under the mouse.

i like orange
Clbembry
18
Years of Service
User Offline
Joined: 10th Dec 2006
Location: Minnesota
Posted: 6th Jul 2009 18:05
How are you making the GUI? BlueGUI?

Just wondering.

AndrewT
18
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 6th Jul 2009 18:08 Edited at: 6th Jul 2009 18:08
Quote: "How are you making the GUI? BlueGUI?

Just wondering."


Sasuke's a GUI master, so I'm sure he has some super incredible GUI coded for this editor.

EDIT:

Yep, he does. Look further up on this page.

i like orange
Clbembry
18
Years of Service
User Offline
Joined: 10th Dec 2006
Location: Minnesota
Posted: 6th Jul 2009 18:15
Steam based GUI? So I take it he's making his own plug-ins?

AndrewT
18
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 6th Jul 2009 18:22
Quote: "Steam based GUI? So I take it he's making his own plug-ins?"


Further up:



I think he's writing it in DBP, but he may be making a plugin instead.

i like orange
Clbembry
18
Years of Service
User Offline
Joined: 10th Dec 2006
Location: Minnesota
Posted: 6th Jul 2009 18:25
In DBP So there won't be the option to re-size the window then.

AndrewT
18
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 6th Jul 2009 18:28
It looks like the editor is fullscreen, so I suppose the ability to resize the window doesn't really matter.

i like orange
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 6th Jul 2009 19:23
Quote: "If you use your method and only apply movement on one axis, then the object won't remain under the mouse."


Ahh, I see what you mean - personally I'd find it quite usefull to line up an object that way. For example, if you wanted to drag an object so it was in line on the Z axis but not the X - doing it that way would mean you could drag the object then move the mouse to the object you want to line up with, and the X axis would stay the same.

This is for dragging objects though, to actually affect an axis I would check for clicking on an X Y or Z axis, then affect whatever axis is selected with the mousemovex() etc functions. If the camera was moved in the same way, then the axis could be used to shift objects into position quite accurately.

So really I'm talking about 2 seperate techniques, either clicking on the object then moving it based on PICK OBJECT and a big plain - plus having the 3 axis gadget work more accurately. Dragging the object would be nice and quick, the 3 axis gadget would be nice and accurate. Having an axis to rotate an object is ideal, as you can simply check if the shift key is pressed then rotate instead the axis of moving. I think having both methods is the best idea, because you need the accuracy plus it has to be fast - most objects would be placed at a terrain height, so having them drag over the terrain is easily done, just use the terrain object as the PICK OBJECT. You might have to position 500 trees quickly, or position a ham radio on a desk in exactly the right position.

I think the main point is that the PICK OBJECT command can make life really easy when making a level editor, being able to click anywhere on an object and get the 3D position and object clicked can be used in a lot of very useful editing techniques.


Health, Ammo, and bacon and eggs!
AndrewT
18
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 6th Jul 2009 19:36
Quote: "Ahh, I see what you mean - personally I'd find it quite usefull to line up an object that way."


I agree with you there, but by the way Sasuke worded the question it sounded as if he wanted the object to stay under the mouse. I think I've misunderstood him though. My method would move the object on a plain that's aligned with a specific axis, whereas it sounds like he simply wants to restrain the movement of the object to one axis.

i like orange
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 6th Jul 2009 19:52 Edited at: 6th Jul 2009 19:52
Yah, but one major concern was the orientation, so if you move the mouse up, the object moves forward.

There is one technique I've found to do this, untested, but something like this:

camy#=camera angle y()
movex#=mousemovex()
movez#=mousemovey()
x#=object position x(1)
y#=object position y(1)
z#=object position z(1)
x#=newxvalue(x#,camy#+90.0,movex#)
z#=newzvalue(z#,camy#+90.0,movex#)
x#=newxvalue(x#,camy#,movez#)
z#=newzvalue(z#,camy#,movez#)
position object 1,x#,y#,z#

What that does is treat the X and Z movement seperately with the camera Y angle in mind. So moving the mouse sideways means the movex# speed is increased - then the camera Y angle plus 90 degrees is used to straffe the object. Then the actual camera angle is used with the movez# speed.

The plain under the mouse idea makes this kinda redundant I think because it has so many benefits, but it is an option.


Health, Ammo, and bacon and eggs!
Sasuke
19
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 6th Jul 2009 21:43
Finally, figured out the problem, there seems to be a bug or what I believe to be a bug with mousemove and thats the reason it wasn't working. Heres an example of the bug:



Now if you chuck this in front of update sprite, mousemove stutters:
text 0,0,str$(mousemovex())
text 0,0,str$(mousemovey())

If you chuck this in front of update sprite, mousemove does nothing:
x = mousemovex()
y = mousemovey()

Solved this by storing mousemove in variables an only using those variables. Can someone confirm this please, i'm using U73 btw.

AndrewT, "GUI master", wow, thanks

Finally got the gizmo working like I wanted so I'll upload it in a minute, though i'm doing it via PSP so it will take a minute. Few things, to select an object just click on it, the drag speed is based on the distance from the camera so the closer you are the slower it will drag, also you can select the drag pointers through objects, you'll see, gimme a sec to upload this.

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
AndrewT
18
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 6th Jul 2009 21:51 Edited at: 6th Jul 2009 21:54
Quote: "Solved this by storing mousemove in variables an only using those variables. Can someone confirm this please, i'm using U73 btw."


This isn't really a bug, it's just part of the way DBP works. MouseMoveX/Y/Z() returns the amount that the mouse has moved since the last time it was called. So if call MouseMoveX() twice in a row, it will return 0 the second time because the amount of time that has passed between the function calls is too small for any significant mouse movement to have occurred.

i like orange
Sasuke
19
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 6th Jul 2009 21:56
I see, ok. btw I think I did word what I wanted wrongly, so sorry for that. Anyway here it is, full source attached.

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
Sasuke
19
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 7th Jul 2009 03:12
No opinions... no worries, I'll just continue adding the rest of the functionality to the move gizmo, then refine the code and start work on the rotate/scale gizmos.

I was wondering, what else do gizmo's need. I took a look at a few other editors and saw some features and also some differences, in one when you moved an axis a value would appear next to the gizmo showing how much it had move, in another when you rotate the object the move gizmo axies would also rotate, basically the direction the gizmo would move in changes (though I'm not that much of a fan of this method, it makes lining up objects when there rotated difficult, though the option would be nice for some, so maybe I could add alignment type), Uniform or non-uniform scale. Is there any others that might be worth adding?

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
Sasuke
19
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 8th Jul 2009 00:29 Edited at: 8th Jul 2009 00:31
Update:

Went mad and decided to rework it to include a selection system. Now you can select objects by group via two drag types, rectangular or paint. Gizmo now works off selection position instead of object position, the advantage of this is I can move groups of objects instead of one. Still working on rotate and scale, but shouldn't take too long, also the code need refining I know but I just need it work first, fix up later.

Same as before, heres the full project attached, tell me what you think

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
Sasuke
19
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 9th Jul 2009 21:25
If someone would be willing to test/look at my last attached file then can I ask you this. Do you think the move gizmo should be able to select in a similar way as the standard object selection type?

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
AndrewT
18
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 9th Jul 2009 21:30
I really liked it! IMO it'd be good to allow selections while the move gizmo is enabled.

The only thing that bugged me was that you can't move when the right mouse button isn't held. I know that's how you intended it, and that's how it's done in many editors--it just kind of bothers me.

i like orange
Sasuke
19
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 9th Jul 2009 21:36
Quote: "The only thing that bugged me was that you can't move when the right mouse button isn't held. I know that's how you intended it, and that's how it's done in many editors--it just kind of bothers me."


Same here, I think it feels odd because it feels more like your in game than a editor. Anyway cheers for the test, won't take to long to add it to the move gizmo aswell as the rotate and scale gizmo.

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
Image All
19
Years of Service
User Offline
Joined: 30th Dec 2005
Location: Home
Posted: 9th Jul 2009 23:26
are you going to support voxel terrains?


Remember those old guys? They made epic renders, I think one of them was called DaVinci, and all they used was MS Paint. Sometimes it's just skill....
Sasuke
19
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 27th Jul 2009 22:23 Edited at: 27th Jul 2009 22:35
Waypoint Interpolation


Pic: 400 waypoints with 400 pathfollewers assigned.

I've made a waypoint system and I can easily set them up via the editor, currently I've only got linear interpolation (straight line) but I would like to add cubic and bezier. Making the cured 3d line should be easy but working out the curve in 3d is where I'm stuck. I've looked around here and on google but can only find examples of 2d curves. So does anyone have any idea on working out a curve in 3D?

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
N3wton
16
Years of Service
User Offline
Joined: 3rd Jun 2009
Location: Leeds, UK
Posted: 27th Jul 2009 22:40
Your editor looks so hot, how did you make the gui? i'm just amazed by how stunning it is, do you use a plugin ir is it sprite based?

yours
N3wton

Sasuke
19
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 27th Jul 2009 23:14
The Gui is made entirely in DBP and uses sprites, also I use bitmaps in a clever way to boost performace. I was thinking of writing a tutorial but thought if I wrote one everyone would have stunning Gui. It would be like giving away a game engine for free. If you go on my profile, take a look at my steam based gui, theres a small demo showing scrolling box and I also made a valve style in game menu (though not completed).

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
jason p sage
18
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 27th Jul 2009 23:19
Susuke - you rule!

Your signature has been erased by a mod - Please reduce it to 600x120 maximum size
Sasuke
19
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 27th Jul 2009 23:28
Wow jason, been awhile since I last heard from you, bet your having too much physic fun in DGDK, thanks for the comment

Note: ahhh! Burnt my dinner, be back when I've cleared the smoke out of my kitchen.

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
Roxas
19
Years of Service
User Offline
Joined: 11th Nov 2005
Location: http://forum.thegamecreators.com
Posted: 27th Jul 2009 23:39
You should use cubic splines.

jason p sage
18
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 27th Jul 2009 23:45
has been awhile - I've been coding like a mad man too - but nothing that would wow the folks here - more business stuff... but Jegas is working on a few game related things also - not the right place to talk about em And I'm strapped for time - back to the code I go (cgi, freepascal, quickbooks, vtigercrm, cgi, http, tcp/ip, processmaker, webserver code, brain about to explode LOL )

Your signature has been erased by a mod - Please reduce it to 600x120 maximum size
Math89
21
Years of Service
User Offline
Joined: 23rd Jan 2004
Location: UK
Posted: 28th Jul 2009 00:59 Edited at: 28th Jul 2009 00:59
Bezier works the same way in 3D than in 2D, just add an extra z component. If I remember correctly, IanM has got a few Bezier commands in one of his dlls.
I do not recommend using any other kind of curves than Bezier since most of them do not interpolate the first and last points. Anyway, the problem with curves is that you need to add some intermediary points in order to get something else than a straight line. And, since the shortest path between two waypoints is a straight line, there is no real need for a curve...
Sasuke
19
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 28th Jul 2009 05:25 Edited at: 28th Jul 2009 05:42
Wow, this was easier than I thought (unless I made this wrong). Anyway i've attached a txt file with the code for 3D B-Splines. Would use code tags, but i'm using a PSP. So if someone could chuck it in code tag in the next post I would be very grateful. Tell me what you think?

Math, my waypoint system works a bit different to others, beacuse there are script classes that require a sort of path to follow for example a cinematic camera, instead of making seperate systems, I combineded them into my waypoint system, so any script class with a sub class of pathfollower can be assigned to a waypoint.

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
Maindric
16
Years of Service
User Offline
Joined: 22nd Jul 2009
Location:
Posted: 28th Jul 2009 06:43


There ya go.

Also, I has a question. If you were on a comp to type in the code, why did you have to use a PSP?

Also, this prog looks nice, I will def track this.

Math89
21
Years of Service
User Offline
Joined: 23rd Jan 2004
Location: UK
Posted: 28th Jul 2009 08:43
Since your code gives a bezier, you should name it bezier in order to avoid any confusion. You can also optimize it by using multiplications instead of exponents (because you might need a lot of curves with a lot of iterations).
Sasuke
19
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 28th Jul 2009 17:56 Edited at: 28th Jul 2009 18:00
Maindric, cheers for posting the code, also I don't have the net at home (yet), but there's a wifi spot down the street from a near by office, so I use my PSP and iTouch to post here.

Math, Good points, thanks.

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
Sasuke
19
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 28th Jul 2009 23:28 Edited at: 28th Jul 2009 23:29
Just wondering, have I optimized this right or how well have I optimized this, I took anything that repeats and precalculated before using it in the main sum, so:

These are float btw.
AltSeg = 1-Segment
Power3a = AltSeg*AltSeg*AltSeg
Power2a = AltSeg*AltSeg
Power3b = Segment*Segment*Segment
Power2b = Segment*Segment

PointVector.x = PV1.x*Power3a + 3*DV1.x*Power2a*Segment + 3*DV2.x*AltSeg*Power2b + PV2.x*Power3b
And so on...

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
Math89
21
Years of Service
User Offline
Joined: 23rd Jan 2004
Location: UK
Posted: 29th Jul 2009 00:35
Well, you could say that Power3b is actually equal to Power2b*Segment, which saves one multiplication (same with power3a). But seriously, I'm not sure it would make a noticeable difference.

If you need even more speed, you can use my DLL which handles cubic bezier curves (the dll, ini and dba are attached). I haven't tested it that much, but it should be able to handle more than 4 points on each curve (but the amount of points must be a multiple of 4).
Sasuke
19
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 30th Jul 2009 22:09 Edited at: 30th Jul 2009 22:12
Cheers for the DLL, but I think i'm fine with this at the moment. I've add them into my engine and they work great with my waypoint system, heres a pic:



A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
Sasuke
19
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 18th Aug 2009 01:29
Can someone test this please, basically I would like know if the main taskbar feels, looks and acts right. You can move the camera by holding the right mouse button and WASD to move.

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
Sasuke
19
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 18th Aug 2009 01:32 Edited at: 18th Aug 2009 01:40
Quickly made something in the editor earlier:



A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 18th Aug 2009 20:18
I like it, nice and quick with the mouseovers, and it looks clean too. If I had to suggest one thing, it would be to change the bit where it says Scope Ed, so that the bar there is a little different, just so it's clearer where the drop menus start. Maybe just a different colour would be enough to distinguish it more.


Health, Ammo, and bacon and eggs!
Sasuke
19
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 20th Aug 2009 03:38
Oh yeah, good point, nice catch, also cheers for testing

When I was thinking of making a Gui tutorial a while back, I was trying to work out how to explain how drop down menus with sub menus work. I came to the conclusion that it's pointless to explain it to someone that doesn't have an incredible understanding of arrays. Same for other Gui elements I guess.

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.

Login to post a reply

Server time is: 2025-08-09 01:38:36
Your offset time is: 2025-08-09 01:38:36