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 / - DBPro Coding Challenges -

Author
Message
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 16th Nov 2005 00:24
I might jump in. I have some ideas for this one.


Open MMORPG: It's your game!
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 16th Nov 2005 01:27
Well, my attempt at the challenge is coming on quite well and it occured to me that I should post the early stages in case anyone thought it was something I had pre-written.

So, there's not a lot working yet and it's very sloppy code...



TDK_Man

TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 16th Nov 2005 01:34 Edited at: 16th Nov 2005 01:36
Oops - forgot a bit of instructions...

It's pretty obvious, but a couple of points worth mentioning are:

In the camera view window, objects are dragged on the X and Z axis with the left mouse button and on the Y axis with the right mouse button. (No camera zoom in any window yet I'm afraid).

In the other three windows, you only drag with the left button along the X and Y screen axis and the small X, Y, Z buttons allow you to restrict movement to either the X or Y axis. The Z button is for when object scaling and rotating are implemented and don't work in movement mode.

Finally, when you create primitives from the drop-down menu, they appear at 0,0,0.

That's about it for now really.

TDK_Man

CPU
21
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Carlsbad, CA
Posted: 16th Nov 2005 03:50
Wow... A lot more a lot quicker than I expected! And looking through all the empty stubs in your code... Well its going to get a lot better!

I do hope your not writing that all in one code file, if you are I'm just going to fall over and die or something like that, I personaly know how hard it is to write a large program in one file, and that was a while ago during the alienware compo... Good luck to ya TDK, And everyone else!

CPU

- Small note -
@TDK - Its great to see you've been updating your website since I last saw it, and your DBC editor - wow - you do a great job, BTW have you ever thought about experimenting with behavior and AI (Sorry, AI gets thrown around a bit to much, when I say AI, I mean more like pathfinding, steering behaviors and things like that)? Its not so much game related as it is algorithm related, just thought I'd ask/mention that.

[center]K-OS Battlefields
IS
///---///---///---UNDER CONSTRUCTION---\\\---\\\---\\\
[center]
Segan
19
Years of Service
User Offline
Joined: 28th Aug 2005
Location: Canada
Posted: 16th Nov 2005 04:10
I'm in this competition... Even though after those two entries already, I'm thinking that I won't have a good chance to win! Anyways, these first competitions for me are to set up a code base and some knowledge of commands that are still unfamiliar... (I have already spent some significant time working my way through a "Clicking in 3D" function.)
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 16th Nov 2005 04:14
TDK, what resolution is your GUI built for? 'Cause part of it goes off screen.


Deadly Night Assassins
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 16th Nov 2005 04:28
Nice start TDK!

I was able to get it run nicely in 800x600x24 Fullscreen mode.


Open MMORPG: It's your game!
Segan
19
Years of Service
User Offline
Joined: 28th Aug 2005
Location: Canada
Posted: 16th Nov 2005 05:15 Edited at: 16th Nov 2005 05:25
Well, I did enough work on my project tonight that I can show my first attempt to all of you.



My main accomplishment is my function that allows me to convert a click on screen into X,Y co-ordinates. I am still working on a way to do this when not looking from strait above the workspace.

So just move around with the arrow keys, and place cubes to your heart's content with the mouse!


Edit: I actually like this version better: After a very minor change, you can now place boxes ANYWHERE

RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 16th Nov 2005 07:26 Edited at: 16th Nov 2005 07:28
Okay - I am quite sure that when this challenge was declared, no one thought they would see an entry quite like this. But here you go. It takes a moment to start up (heh - remember that warning Ric? ).

Anyway, the controls aren't mouse driven yet, but I think I could switch over. For now, use...
Arrowkeys to turn (heh-heh) the "cursor" left/right and move it forward
[a] and [z] moves the cursor up and down respectively
[,] and [.] to scroll through the objects
[Enter] to pick up the object and to place it.

Some other help:
~If your cursor gets stuck, move it forward and it will get pushed back out.
~You have to place the objects adjacent to each other - just use the soft yellow grid to guide you.
~The first object must be placed dead center, again, use the soft yellow grid to guide you.
~The cursor slowly auto-aligns itself to the nearest 90 degree angle, so if your off, just wait a moment and things will get aligned.
~Don't worry about placing the object askew though. Once placed, the objects will orient themselves.
~Build up, down, left, right, forward, and back. You are only limited by the building area.
~The rest I'll let you figure out on your own. The objects only come from one place, but I'm sure you figure out where soon enough.

Have fun.


And I put it into the source code box to make it easier to copy.


Open MMORPG: It's your game!
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 16th Nov 2005 14:01 Edited at: 16th Nov 2005 14:05
Phaelax:

Full Screen Exclusive (800x600x16) is what it's set to in my project manager. Guess I should really add a Set Display Mode line...

RiiDii:

Sorry, but yours won't run for me at all.

No error messages, it just drops back to the IDE. When you run in Debug mode, it gives a Windows error message with the DBPcompiler and wants to send an error message off to MS!

Could it be anything to do with the fact that I'm still using 5.8?

TDK_Man

spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 16th Nov 2005 14:49
RiiDii's code also crashed for me, but most of his code snippets crash for me aswell! It's due to the fact he is drawing DOTs outside his created bitmaps, so where he has DOT RND(1000) you need to change to RND(999) and where he has RND(64), need to change to RND(63).

Apprantly drawing dots outside of bitmaps works on some pcs and not others. I believe this has been resolved in 5.9 but I'm still on 5.8 - I've not got the bottle to upgrade yet - keep reading about various bugs. I'll wait until 6.0 or possibly if a final 5.9 ever materialises, but everyone keeps saying 5.9b3 IS the final one, but hopefully not.

Boo!
Tinkergirl
21
Years of Service
User Offline
Joined: 1st Jul 2003
Location: United Kingdom
Posted: 16th Nov 2005 14:58
!!

Ah! I see now - making those two changes lets me run RiiDii's code now

What a bonkers construction program

TDP's looks amazingly professional - though, I was another who didn't have the right default screen size to see everything on it.

Not got time to run any more this lunchtime, but I'm amazed at how much progress you peeps have managed
CPU
21
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Carlsbad, CA
Posted: 16th Nov 2005 16:39
Very Nice Rii, looks like TDK isn't the undisputed champion yet

Good job to you Segan, I liked the way you could 'paint' the boxes onto the scene, keep up the good work!

Tinkergirl - might we see an entry from you as well?

CPU

[center]K-OS Battlefields
IS
///---///---///---UNDER CONSTRUCTION---\\\---\\\---\\\
[center]
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 16th Nov 2005 18:15
I'm using 5.8 (I do too much coding right now to try and switch to something that may change). And my pc doesn't have a problem drawing a dot outside the bitmap's upper bounds. So here it is. I put in a few if/then limiters as well as limiting the dots, and the rest I just increased the bitmap size by 1x1. Hope it works...




Open MMORPG: It's your game!
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 16th Nov 2005 18:40
And here it is with Save Object working better. Press [s] to save the object, then press [y] to confirm. The object will be combined into a single object with multiple limbs, save, deleted and loaded. The end screen will be the loaded object spinning around. Press [Esc] to quit.




Open MMORPG: It's your game!
Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 16th Nov 2005 23:01


Shall I just give up now?!!!

Impressive work, Rii and TDK. The standard of work in these challenges just keeps getting better!

CPU
21
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Carlsbad, CA
Posted: 16th Nov 2005 23:59
Argg... Again! forum posting bugs...

@Rii - Good job, might want to constrain the camera much tighter to the ship, and PLEASE make the extracting of a block from the dry dock about 5 times faster... One thing you might want to tinker with would be perhaps having the user design the object (as opposed to driving the lifter) and have the ship(s) controled by the computer and build the things on at your commands, just an idea though

@Ric - NOOOO!!!! Don't give up, so what if your not going to have a level editor on the same plain as TDK or the creativity level of Rii, but if you can't match them then emphisize something else about your modeler, Hey maby you only have basic object manipulation, but maby you also have some realy awsome terrain modeling commads, or matrix modeling commands, or even some sort of 'random model/scene' generator (Remember the random city project by Hmm? ) Whatever you do, don't give up!

CPU

[center]K-OS Battlefields
IS
///---///---///---UNDER CONSTRUCTION---\\\---\\\---\\\
[center]
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 17th Nov 2005 00:23
@CPU (and Zotoaster)

Just returned after several days doing other things. Tried to download your Trench Run and neither version worked. I notice Zotoaster got a similar message to me on your split download
Quote: "well, all it does is highlight the "endif" command.. and that's it, it gives me an error and won't let me run it..
"

(on mine it was on line 600 although the compiler said 594) - see attachment.
I also tried your original download (twice, just in case) and got the same errors each time, e.g. "sync" spelled as syn and "if" spelt as "il". Gave up when correction of those gave new errors. What did Zotoaster do to get it working???

Attachments

Login to view attachments
Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 17th Nov 2005 00:28
Hehe - was just an expression .... don't worry, I won't give up that easily!

@Rii - the ship keeps getting lodged ... any way of sharpening up the collision detection?

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 17th Nov 2005 00:30
@Anyone who understands this site

Just checked my last post. Thought I'd followed the instructions. Checked the "VIEW" button and got a barely discernible "view" of my submitted image - but the file obtained from the "DOWNLOAD" button was OK. So something worked!
Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 17th Nov 2005 02:08 Edited at: 22nd Nov 2005 16:42
The image looks fine here, GG.

<Update>

As with Segan, my main struggle so far has been the '3d mouse' aspect - ie converting the 2d mouse cursor into a 3d position. Nevertheless, I think I've got it working quite nicely now, so you can place your objects and reposition them, all at any camera angle. I'm trying to make the controls and process of creating objects quite intuitive - it should be quite easy:

- Position/Reposition objects by clicking and dragging
- Right click and arrow keys to control the camera - 3d game style

Simple as that .... so far!



Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 17th Nov 2005 02:58
@CPU

Ok, found the post about concat symbols. Got it to work. WHY DID YOU DO THAT?
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 17th Nov 2005 03:06
@Ric
Thanks. (Didn't see your reply earlier - was looking at the wrong page.) "Must be something wrong with your computer." Well that's what they usually tell me when I can't get something to work! Don't know whether the argument works the other way round!

About time I had a look at the latest challenge - I seem to be about six months behind everyone else, and the gap is increasing...
(or should it be _ ?).
CPU
21
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Carlsbad, CA
Posted: 17th Nov 2005 05:17
@Green Gandalf - Sorry, there by default enabled by Blue IDE, which I use, I never realy thought about it, just used em because I'm used to turning realy long commands into a couple lines like that... Again my apologies

@Ric - Allow me to give you a little 3D math lesson

Ok, I looked at your code snippit for moving objects, I think it almost works for now, but there's a better way to do it I believe. Allow me to introduce you to similar triangles (might want to get a piece of paper out to follow me, your choice) first draw a right triangle, with the 90 degree corner on the bottom left side, and one short line going up, one longer line going off to the right (from the right angle) and a hyp. connecting to the two lines... Ok now, label the corners, in clockwise order, starting with the right angle, A, B, C, ok? So now we need to remember the rule about similar triangles, if you multiply all the sides of a triangle times a scaler (a single value) it effectively shrinks or grows a triangle, keeping all the angles the same. Now, say we say that line BC (the line from point B to point C, our hyp. ) is equal to 1 unit (makes things easier), we can also know how long line AB is, all we have to do is figure out the up/down of the pick vector which if you have y pointing up would be 'get pick vector y()' and if the z is pointing up would be 'get pick vectory z()' (asuming we set pick vector to a distance of one). Ok, now we know a bit about our triangle, now, extend the line AB down, and extend our hyp. down and to the right and then draw a line parrallel with AC intersecting the extended AB line and our Hyp. line, that'll give us a bigger, yet similar triangle right? Ok, now if we say that the lowest line is at (adding coordinates in) 0 height, and we know how high our camera is (B) we can figure out how long the side of the large triangle is right? Ok, so if we know the length of the side of the large triangle and of the small simmilar triangle we can figure out the ratio between the large and small triangle, and if we can figure out the ratio then we can figure out how much we need to multiply our pick vector by to touch our construction plain, which would be where we need to place our object! All right, now, so we have (short_Tri_Height)/(big_Tri_Height) = (1)/(big_Tri_Hyp) right? (remember, we set the pick distance to one, so our hyp. is only going to be 1 unit) Rearangeing (I realy hope you can figure this part out ) we get (big_Tri_hyp) = ((big_Tri_Height)*(1))/(short_Tri_Height) ok? now this gives us the value big_Tri_Hyp right? but everyone knows that any value times one equals the value right? so if our pick vector is one, that means we can multiply each value (x,y,z) by big_Tri_Hyp and it'll give us a point where it touches the xz (or xy if z is pointing up) plain, all you have to do now is add the cameras x and z value (again if its an xz plain with y pointing up, if not then add the x and y values to it) and wala! You've turned your mouse coordinates into 3D world coordinates, and the best part is it's irrespective of camera angle (x, y, or z) rotation, or screen resolution. Hope you followed that, I'll try to post how to figure out a up/down value from a mouse, but that'll have to wait till I get a bit o sleep.

If you figured that out, more power to ya! If not, then ignore my sensless rant...

CPU

[center]K-OS Battlefields
IS
///---///---///---UNDER CONSTRUCTION---\\\---\\\---\\\
[center]
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 17th Nov 2005 08:12
Quote: "@Rii - the ship keeps getting lodged ... any way of sharpening up the collision detection?"

If it gets lodged (usually when placing the object), just push forward and you'll get pushed back. But yeah - I'll give it a whack.


Ermmm. One of the easiest ways to turn your mouse into 3d world coordinates is probably something like this.




Open MMORPG: It's your game!
Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 17th Nov 2005 10:46 Edited at: 17th Nov 2005 11:01
Doh! Knew my method was a bit dog's-breakfast-like! Thanks guys - think I'll use Rii's method for now as it's mindblowingly simple. I didn't realise the pick object command generated vectors dependent on where abouts in the object you click - I thought the values would always represent the centre of the object. Good news. And I can see the advantage of CPU's method - in that you can generate 3d values regardless of whether the mouse is over an object or not - I'll probably come back to that method another time when I need it to work like that. Thanks. (Good explanation btw, CPU)

CPU
21
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Carlsbad, CA
Posted: 17th Nov 2005 15:22
Ai Rii, but still that doesn't allow you to move an object directly up and down OFF of the plain, for your code to work it has to be touching the plain, which would be the second part of the 'tutorial' I was making but it requires a bit of vector math, if you want it I'll write it up, if not, I'll save my fingers.

CPU

[center]K-OS Battlefields
IS
///---///---///---UNDER CONSTRUCTION---\\\---\\\---\\\
[center]
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 17th Nov 2005 17:27
Certainly would like to see it.


Open MMORPG: It's your game!
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 17th Nov 2005 21:13 Edited at: 17th Nov 2005 22:15
An update from me. Loads still very iffy, but it's showing progress.



Here's the source so far...



A fair bit done, but most isn't yet working properly. You can have a play to see what's working and what isn't.

And here's a file you can load into it...



Paste this into Notepad and save it as CASTLE.TOG in the same folder as the DBA file.

TDK_Man

RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 17th Nov 2005 21:48
Nice looking TDK. I'll have to give it a go later, but the screenies look great!


Open MMORPG: It's your game!
CPU
21
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Carlsbad, CA
Posted: 17th Nov 2005 22:19
Nice TDK! Good job with the interface and such, my only qualm so far is that you don't have a snap function, would be realy handy, But it looks like it's comin right along! Oh, and I noticed that sometimes when moving objects that it doesn't stick right with the mouse, perhaps you need to look at my tutorial to?

@Rii - I'll be getting that second part of that tutorial out soon, I've got Illustrations this time

CPU

[center]K-OS Battlefields
IS
///---///---///---UNDER CONSTRUCTION---\\\---\\\---\\\
[center]
Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 17th Nov 2005 23:57
Looks like I'll be needing that tutorial too. (Would be nice with code snippets too .... gimme da codez! ) I have the objects moving nicely in the x-z plane using Rii's method, but then I'm trying to move them in the y direction using pick screen, and it's all going screwy, because once you lift it off the plane, Rii's method stops working.

Anyway, just working on my lightmapper. Bet TDK doesn't have one of those !!

CPU
21
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Carlsbad, CA
Posted: 18th Nov 2005 00:39
Ok:

Finding a Y value given Mouse XY coords

Ok so we want to say, move an object up and down along the Y axis (for simplicity’s sake I’ll say that the Y axis is going up/down ok? Ok, now the pick screen command gives us a direction vector going away from the camera in line with the screen coordinates, (imagine that at the exact point at which your mouse is that a line extends through your monitor and into the 3D world, but it would only look like a dot because your looking at it strait on right?) now, we have another vector pointing up, remember we want to move the object up and down on the Y axis. Ok, now the ideal way to figure out where the object would be would be if the two rays intersected in 3D space, unfortunately this doesn’t usually happen and we have skew lines (lines that don’t intersect) so, the best way to figure out the height then would be to find the point on the up/down vector where the two lines were the closest together, right? Now if you know this great, if you don’t, allow me to tell you, the closest point on two skew lines will ALWAYS be a line at right angles to both of the lines… Allow me to give you an illustration:



Ok? So, now if we have one line going straight up, and another pointing at a downish angle there not going to intersect, but, if we can find the closest point to the line that the pick screen vector forms, it will still give us an exact answer, irrespective of camera orientation! Now, we know where we want to get to, but getting there takes a bit of vector math to get right (hint: you might have to use the inbuilt DBPro vector commands)…. Ok so, first things first, let me introduce you to my friend, vector cross products, now, this is an amazing operation, but best Illustrated with another picture:



Ok, so this is what cross product does, it take two vectors, (A and B) in this Illustration and returns another vector that is perpendicular to the two original vectors, Now let me think for a second, if vector A is pointing straight up, and if vector B is our pick vector, then Vector A X B (I’ll call it Vector C) then this is giving us a vector that is the same orientation as the line we need that is the shortest distance between these two skew lines! Right, now here’s the tricky part, we somehow have to figure out where along the up down vector this perpendicular line is, and it’s a bit trickier than you might think, I’ll do my best to explain this part, so bare with me.

Ok, first off I need to explain about defining parametric rays, a parametric ray has three parts to it, the first part is a vector telling where this ray is, the second UNIT vector telling the direction of the ray (A unit vector is a vector that is 1 unit long), and a scalar(simple one number value) telling how long the ray is, so if I wrote it out you would have Vector A0 + L*Vector A1 where A0 is your position in 3D space vector, L is how long your ray is and A1 is the unit vector telling the direction of your ray. Ok, hopefully that part made sense, now I need to tell you how to define a plain in 3D, this plain is infinite in size and direction, all we need to know is what orientation the plain is and how far offset it is from the origin. This is the part that I understand the least, but I’ll do my best to explain it and perhaps teach myself about it better. Ok! Anyways, A plain has three parts also, a vector p, which is our test vector, a vector n which is our normal (a normal, for those of you who don’t know, is a vector perpendicular to the plain, in rendering it also tells the computer which way a triangle is facing so that it can cull away facing polygons) and finally we have one more value, d, which is the distance from the origin to the plain. Now the plain is defined so that when you take the dot product (I’ll use [DOT] to signify a dot product operation) of the two vectors they will equal our scalar value d. Writing this out we have: vector P [DOT] vector N = d right? So now we know how to define a plain and a parametric ray… On to the next step!



Now, as you can see in the Illustration, if we can figure out a plain that ‘contains’ our CP vector and our pick screen ray, we can then figure out where our up down ray will be right? So first off we need to figure out a normal (remember, a vector perpendicular to the plain right?) so if you’ll remember we already showed how to get the perpendicular vector of two of them right? So if we take the cross product of our pick screen vector and our new Cross Product Vector we will get another vector perpendicular to those two and perpendicular to the plain, which is our normal, so, now we need to normalize our vector (set it to a distance of one) and there we have our N vector. Ok, so we have our n vector, now we need to figure out d. To figure out d (the height of the plain from the origin) the easiest way to do this if n is normalized is to find the dot product of n and the camera xyz value, (don’t ask me to tell you exactly why this works, its been too long since I’ve figured it out.) anyways, if your using the DBPro vector commands your going to have to do the dot product the hard way, take Nx * CAMx + Ny * CAMy + Nz * CAMz and there you have d.

Ok now’s where we need to solve for the ray intersection to figure out how far up on the Up down Ray we need to move the object. First off, remember we defined the object’s vector parametrically? So we have vector A0 +L * vector A1, A0 is the objects XZ position (remember, we are trying to find the objects Y value!) L is the value we are trying to find, because if we can find L then we know how far up we need to position the object right? So if this: vectorPoints [dot] vectorNormal = d for our plain, and we have (vector A0 +L * vector A1) for our object vector, we only have one value that we don’t know, L, which is what we need to find. So we need to substitute (vector A0 +L * vector A1) in for vectorPoints, and then we can solve for L.
Substituting we get:
(vector A0 +L * vector A1) [DOT] vectorNormal = d
Then expand the Dot product inside parentheses:
vectorA0 [DOT] vectorNormal + L*VectorA1 [DOT] vectorNormal = d
Then we move the part that doesn’t have L in it over to the other side:
L*VectorA1 [DOT] vectorNormal = d - vectorA0 [DOT] vectorNormal
Ok, now we need to divide to get L by itself:
L = (d - vectorA0 [DOT] vectorNormal)/(VectorA1 [DOT] vectorNormal)

And we are done!

Hopefully a few of you can make some sense out of this, if some of you are still really confused I’ll post code snippets for those of you who can’t figure it out, but do try.

Phew... That was a mouthfull, I'll see about Da codz for ya all, I just need to turn them into a usable snippet.

CPU

[center]K-OS Battlefields
IS
///---///---///---UNDER CONSTRUCTION---\\\---\\\---\\\
[center]
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 18th Nov 2005 01:04
@RiiDii

Downloaded your file but it crashed with an "Image does not exist at line 7" runtime error. After examining your code I decided there wasn't anything obviously wrong with it and tried, as an experiment, commenting out the set display mode command at the beginning. The program seemed to work then, although I couldn't seem to do anything except move a small ship around. Probably failed to spot a vital tutorial somewhere.

Also, I wonder if the error is indicating a short-coming of my PC. Is there an easy way to check? I tried printing out system dmem available at the start of your program but everything just hung.

Any suggestions welcome.

What I did manage to see looked good though!


@CPU

Nice vector cross product tutorial. I've found vector cross products to be an easy way of calculating directions which are 90 degrees to two known directions - useful when you are trying to move things sideways, etc.
Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 18th Nov 2005 02:14 Edited at: 18th Nov 2005 02:43
Woah - this thread is getting seriously educational! I will have to spend some time going through both tutorials before I incorporate it into my code, but it looks very useful - thanks CPU. In the mean time, I've been working on my lightmapper - and guess what .... it actually kind of works! Also added top and side views. Here's a screeny so far:



Attachments

Login to view attachments
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 18th Nov 2005 02:52
CPU:
Quote: "I noticed that sometimes when moving objects that it doesn't stick right with the mouse"


Not sure what you mean by that?

I've not noticed anything odd when moving. Can you give me a bit more feedback on what you mean please?

TDK_Man

Segan
19
Years of Service
User Offline
Joined: 28th Aug 2005
Location: Canada
Posted: 18th Nov 2005 03:05
Whoah!!! I'm getting left in the dust!!! But no matter-I will keep plugging along with my entry, whether it has a chance of winning or not...

Oh, and THANKS SO MUCH CPU! Will definately look at those tutorials when I have the chance.
CPU
21
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Carlsbad, CA
Posted: 18th Nov 2005 03:20 Edited at: 18th Nov 2005 03:27
Ok, here's a little demo for ya all, using the techneques featured in the two little tutorials before.



enjoy and use wisely! And if you make a killer game or app with them it'd be great if you could stick me in the credits

CPU

[edit]
Just saw your post TDK, ok its not a big issue, but here's what you do, start it up, go and make a new box, now go over to the bottom left window, turn on x and y movement, now click and hold on the box and try to position the box (without letting go) on the far edge of the window, you'll find that it won't allow it because your mouse is going off the edge of the screen, it's like I said, its not a big deal, but as how good your editor is, I thought I should mention it.

[center]K-OS Battlefields
IS
///---///---///---UNDER CONSTRUCTION---\\\---\\\---\\\
[center]
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 18th Nov 2005 03:53 Edited at: 18th Nov 2005 03:57
Ah... I know what you mean now!

Yes, I was wondering about that. Similar to if you drag an object in the camera window - same problem there - if you move the mouse up too far (out of the window) it stops.

BTW in the cam window, left mouse button moves along the X and Z axis while the right mouse button moves along the Y axis. You can also zoom with the mouse wheel and the right button dragging when not on an object points the camera.

You can rotate the camera by holding down the left and right mouse buttons - but only with the version I have!

I've fixed most of the probs with rotation mode too, but I've hit the old Gimbal problem on the X axis then the object is upside down. Fix object pivot refuses to help as well!

As this is only a challenge and not a 'proper' app, I guess I'm going to have to accept that some things are not going to get fixed in time.

After all, I believe the aim was to make an editor which can make a castle using primitives which are selected using the Pick command.

By the looks of it, most of those attempting it have far, far exceeded the aims of the challenge already!

TDK_Man

CPU
21
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Carlsbad, CA
Posted: 18th Nov 2005 04:07
Definatly agree with that, far exceeded, but that was kinda the point of the chalange anyways, I had to make it simple enough to include everyone, and yet have room enough for those that wanted to expand out like you did

If I remember correctly this was a two week chalange, Perhaps you'll be able to fix some of those little problems, maby if your feeling realy up to it you could write a system that uses quaternons or matrix notation for orientations, but I think you'd have to be realy up to it for something like that to happen

@Ric - very nice job on the lightmapper, if it's making true lightmapps, with almost full lighting capabilities then your going to make it a very, very, tough decision between you three

CPU

[center]K-OS Battlefields
IS
///---///---///---UNDER CONSTRUCTION---\\\---\\\---\\\
[center]
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 18th Nov 2005 04:29
after looking at these, its quite intimidating to start my own


Deadly Night Assassins
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 18th Nov 2005 06:35
I'm quite impressed with myself!

I didn't like the sound of the 'generate some textures' part of the challenge as I thought it would be beyond me.

But, I sort of managed it. They don't look to bad - for me anyway...



TDK_Man

Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 18th Nov 2005 10:49
Darn it TDK - you keep on raising the bar! Nice looking castle.

@CPU - how do you define a 'true' lightmap? It's a true lightmap in that it casts shadows on the ground in the correct place according to the position of the light, and the position, size and shape of the objects. It uses raycasting to calculate the points on the ground the light can't get to, and creates a texture accordingly. What it doesn't do, because I'm probably not clever enough, is cast shadows on other objects. However, with a bit of work, I think I'll be able to get it to cast shadows on a bumpy terrain, and get the bumps in the terrain themselves to cast shadows.

CPU
21
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Carlsbad, CA
Posted: 18th Nov 2005 15:18
@TDK - Nice Job, that's about all I was thinking when I said to 'generate' a texture, there's many examples of different methods with many of the chalanges, it'd just take a bit of looking, nice brick texture by the way!

@Ric - I think I might have overdone the meaning of a 'true' lightmapp, basicly you should be able make the lightmap texture and the object texture seperate, and then combine them to make a multi-textured object, but that itself might be going a bit far for the scope of this chalange (and perhaps your time/abilities) but I'm mostly trying to make sure that once the lightmap is created that the lighting is static, that is, its not calculated every loop. Anyways, your doing a great job already from what it sounds like, I'll just be quiet and let you work

CPU

[center]K-OS Battlefields
IS
///---///---///---UNDER CONSTRUCTION---\\\---\\\---\\\
[center]
Ric
20
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 18th Nov 2005 17:43
@cpu: Yep - the lighting is static. I think I should be able to go part way to blending textures - as I said, though, it's limited to casting shadows on the floor. I can work out where on the objects shadows would be, but I have no idea how to apply the textures to the individual surfaces of the objects. Anyone any thoughts?

Great 3-d mouse stuff btw ... as soon as I've incorporated your 3d mouse code properly into my code, I'll post my updated code. Away for the weekend, though, so I'll be back at it next week!

RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 18th Nov 2005 21:08
This is probably one of the most interesting challenges so far. Great work everyone!

Quote: "The program seemed to work then, although I couldn't seem to do anything except move a small ship around."

Head over to the constructor bay (box with yellow stripe to the left if you are facing the star), and enter the tractor beam. The beam will pull your ship in and you will see module in front of you. Use the "<" and ">" to cycle through the modules and press Enter to select that module. The tractor beam will push you back out slowly. Once disengaged from the tractor beam, manuever the module to the center yellowish glowy box in the center and press Enter to release it. Continue until you have built a starship.

As far as the graphics settings, I just upped those because it looked so much better. But feel free to adjust for your monitor/graphics card. The easiest way is to delete that line and choose the settings from the IDE.


Open MMORPG: It's your game!
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 18th Nov 2005 22:10 Edited at: 18th Nov 2005 22:21
@CPU,
Your example is a bit buggy. I couldn't move along Y-axis at all, it didn't do anything. XZ worked fine. Hitting ctrl or shift made the camera go berzerk.


Since an interface can make or break an application, I'm starting with that first. I know mine looks like TDK's, but I'm designing mine off 3d max.

The DB help file kinda through me off:
Quote: "
set camera aspect
this aspect ratio is calculated by dividing the screen width by the screen
height, normally resulting in an aspect ratio of 0.75"


0.75 is calculated by dividing height by width. So which is wrong, the equation or the value? The value. Divide width by height.






Deadly Night Assassins

Attachments

Login to view attachments
Darkbasic MADPSP
19
Years of Service
User Offline
Joined: 15th Jun 2005
Location: Uk
Posted: 18th Nov 2005 22:53 Edited at: 19th Nov 2005 00:04
here's mine so far




I made it myself so far dbmad no more newb stuff now

Dbpro, Dbc and C++ coder
Desert conflict fps wip board
http://forum.thegamecreators.com/?m=forum_view&t=63878&b=8
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 18th Nov 2005 23:55 Edited at: 19th Nov 2005 00:27
here's my mouse code, but there's a slight inaccuracy.



The first 2 points I get by using pick vector allow me to form a triangle. I then use a proportion to scale the triangle to match the size I want, thus finding the actual distance I need. I use the height of pointA from ground 0 to build my proportion to determine the hypotneuse. thoughts?





Deadly Night Assassins

Attachments

Login to view attachments
Darkbasic MADPSP
19
Years of Service
User Offline
Joined: 15th Jun 2005
Location: Uk
Posted: 18th Nov 2005 23:59 Edited at: 19th Nov 2005 00:01
What does anyone think of mine so far? it's gonna be like that truespace interface. that good mouse code phaelax

Dbpro, Dbc and C++ coder
Desert conflict fps wip board
http://forum.thegamecreators.com/?m=forum_view&t=63878&b=8

Login to post a reply

Server time is: 2024-11-23 22:59:23
Your offset time is: 2024-11-23 22:59:23