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 Discussion / The DB Classic Programming Challenge Thread

Author
Message
Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 27th Jan 2008 19:32
Quote: "x<<13"

I think in the perlin noise examle, it is code written in C and the << is called a left shift operator. This shifts all bits of a number left by the number following <<.

So in the case of x=9
0000000000001001

x<<4 would equal

0000000010010000

144

Basically you multiply the number by 2^of the shift value:

x<<4 = x*2^4 = 9*2^4 = 144

so how about x<<13 ?
x<<13 = x*2^13 = 9*2^13 = 73728

Bit shifting is way faster than multiplication or division.

Enjoy your day.
Robert The Robot
19
Years of Service
User Offline
Joined: 8th Jan 2007
Location: Fireball XL5
Posted: 1st Feb 2008 10:13
OK, the Challenge is over!

There seems to have been a lot of entries this time - I'm downloading them now, and I'll pop back later today to announce the winner!

On our way 'ome, on our way 'ome!
Robert The Robot
19
Years of Service
User Offline
Joined: 8th Jan 2007
Location: Fireball XL5
Posted: 1st Feb 2008 20:01
Hi guys, I'm back!! I've run through all the entries and it's been a tough decision. Sinani's game was brilliant (in spite of the invincible enemies), with a great sand texture. TDK's underwater world was spectacular, with phenomenal game physics and Fantastic bubble streams!

However, the Winner would have to be...
<cue drum roll>
<Dramatric Pause>

Latch!

The fish mesh entry was spectacular - the mesh construction was impressive and the textures were awesome! But I can't help feeling that the fish were surpassed by the "WIP" with the Manta Ray sub. A colourful environment, nifty camera movement, and a stunning sub (especially when you activate the V1.20 commands!!!)

Roll on the next challenge!
(Though I know I won't stand a chance...)

Apparently, there are 10 types of people in this world - those who understand binary, and those who have friends.
TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 2nd Feb 2008 02:38
Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 2nd Feb 2008 06:36
Thanks Robert the Robot!

Thanks TDK!

Ok, before I make this an official challenge I'd like to get some feedback on the idea.

I've created a humanoid 3d figure with movable limbs. The figure is created in the form of a function. The challenge will be to add sets of keyframe animations to the function so that the figure will be able to move in different ways. There will be a a few required animations for the challenge, like being idle, walking, and running etc. Additional animations not listed (when the challenge is official) will be awarded extra points.

This challenge should be open to everyone and doable by pretty much everyone. There are really only two commands necessary to complete the challenge:

Rotate Limb
Set Object Keyframe

Ultimately, any of the animation sets of frames should be able to be called using Play Animation <obj>,<start frame>,<end frame>.

So if the character was looping through the idle set, it should be able to launch into the animation for running or walking by calling the appropriate frames.

To win the challenge, you'll basically need patience and a good eye.

Any opinions on this as a challenge?

Enjoy your day.
Sinani201
19
Years of Service
User Offline
Joined: 16th Apr 2007
Location: Aperture Science Enrichment Center
Posted: 2nd Feb 2008 07:07
I'm not sure if it would be a good challenge for noobs... as we don't want to lead them to diving into 3D when they should be starting small in 2D. I think it would be a great challenge for non-noobs.

Seriously, how do you make the little blue text come up below your message?
Libervurto
19
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 2nd Feb 2008 15:12
@Latch
I'm up for giving it a go

Pixelator
18
Years of Service
User Offline
Joined: 8th Jul 2007
Location: here
Posted: 2nd Feb 2008 20:15
honestly latch, i have been dbc coding for a while and i still don't know how to do this. An easier challenge would be appreciated.

Your signature has been erased by a mod. Reduce the size!
Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 2nd Feb 2008 23:23
Just to be clear, there really isn't much 3d programming that has to be done. The model will be provided (in the form of a function). The limbs are listed in the function with variable names like chest, head, luparm, ruparm, etc to be easily identified. All the challenger has to do is rotate the limb(s) and set key frames for each pose. Say, for example, I want to make the figure wave it's right arm. The code might look like:



Since I set the keyframe for this animation starting at 1000 and ending at 1019, I could play it with



Even though I only set 3 keyframes (1000,1010,1019) DarkBasic will interpolate, or computationally guess at, the frames in between so the animation plays smoothly.

Any more feedback on this proposed challenge?

Enjoy your day.
Libervurto
19
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 3rd Feb 2008 03:20
If you post the function it may be easier to see what we'll have to do

Zombie 20
19
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 3rd Feb 2008 17:28
well if its 3d, I'm out but i'll observe and watch the masters spar.


Coffee coffee coffee coffee coffee coffee cappacino, JAVA!
Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 3rd Feb 2008 18:21 Edited at: 3rd Feb 2008 18:27
sigh....
Putting the animation challenge back in the cupboard.

The Weather Challenge

The challenge is to make a weather effect. Can be 2d or 3d. Could be snow, rain, a tornado, rough waves in the open sea, anything you want - it just has to be some kind of understandable depiction of a weather condition.

2 weeks on this one.
Deadline Monday - 18 February 2008 Midnight GMT

@Zombie
You better enter this one, buddy! You owe me.

Enjoy your day.
Link102
21
Years of Service
User Offline
Joined: 1st Dec 2004
Location: On your head, weeeeee!
Posted: 3rd Feb 2008 19:24
I gues fog doesn't count?

Sinani201
19
Years of Service
User Offline
Joined: 16th Apr 2007
Location: Aperture Science Enrichment Center
Posted: 3rd Feb 2008 19:46 Edited at: 3rd Feb 2008 20:07
Isn't "The Weather Challlenge" from the DBPro board? This should be fun... I'll probably do rain...

Seriously, how do you make the little blue text come up below your message?
Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 3rd Feb 2008 20:50
@link102
Booooo! It took me a minute to get that one!

@Sinani201
This challenge didn't come from there... I was messing around with trying to create a texture of moving ripples. When I put a bunch of them together, it kinda looked like rain hitting the ground so voila - weather challenge.

Enjoy your day.
Robert The Robot
19
Years of Service
User Offline
Joined: 8th Jan 2007
Location: Fireball XL5
Posted: 4th Feb 2008 12:11
Hey, sounds good. I'll be joining in...

Apparently, there are 10 types of people in this world - those who understand binary, and those who have friends.
Pixelator
18
Years of Service
User Offline
Joined: 8th Jul 2007
Location: here
Posted: 4th Feb 2008 23:22
@rob's siggy

there are 100 types of people, the two you listed and those who dont have friends and don't under stand bianary and those who understand bianary but don't know how to spell it. (im in category 100 )

Your signature has been erased by a mod. Reduce the size!
Tone3e
19
Years of Service
User Offline
Joined: 17th Feb 2007
Location: here
Posted: 5th Feb 2008 00:53
I like how the challenges are getting more general. Personally I liked the previous idea, but I will look around and see if I can get an I dea on what to do for weather. I am thinking a tornado, because somewhere I saw something about it, now I just have to find it.

[center]
Come see the WIP!center]
Zombie 20
19
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 7th Feb 2008 15:20
Latch- Yea i'll join, see what I can drugde up, I surprise even me sometimes.


Coffee coffee coffee coffee coffee coffee cappacino, JAVA!
Link102
21
Years of Service
User Offline
Joined: 1st Dec 2004
Location: On your head, weeeeee!
Posted: 10th Feb 2008 17:19 Edited at: 11th Feb 2008 15:26
hmmm. no post in a while

I heavily modified tdk's particle system to make rain


Libervurto
19
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 11th Feb 2008 03:40 Edited at: 11th Feb 2008 03:45
@link
nice
I don't like the line in the splash though

I haven't started work on mine yet but I have Tues and Wed off so yay!
I'm going to do a mountaintop with rolling clouds.
The mountain-scape gives me a chance to try out procedural algorithms (slowly starting to understand basic ones), no idea how I'm going to make fluffy clouds but I'll see

@Tonee
if you make a tornado as a sort of cone with a texture, make sure it spirals up, if you do flat loops it wont look like it's moving much

Tone3e
19
Years of Service
User Offline
Joined: 17th Feb 2007
Location: here
Posted: 11th Feb 2008 22:11
Well here is a start. Its supposed to make a crater in the sand as the tornado goes through it. I borrowed someone's code for the tornado but I forgot who. it think it was latch.


[center]
Come see the WIP!center]
Link102
21
Years of Service
User Offline
Joined: 1st Dec 2004
Location: On your head, weeeeee!
Posted: 11th Feb 2008 22:28
replace

with

to get the desired result

Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 11th Feb 2008 23:16
Hey! These are pretty cool entries!

@link102
I took your death match arena from a previous challenge and added Comrad Robski's lightning to it and one of my own rain functions. I'll have to make it into an exe and post it for fun when I get a chance.

@Tone3e
Nice tornado - I think that's Phaelax's tornado. I like the trench digging idea - nice touch! Link's addition makes it a little more subtle.

Enjoy your day.
Link102
21
Years of Service
User Offline
Joined: 1st Dec 2004
Location: On your head, weeeeee!
Posted: 11th Feb 2008 23:35
sorry for the offtopic but
here's the lastest version of that game, I think you'll find it usefull.


Libervurto
19
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 12th Feb 2008 01:26
I've made this mountain which is good enough for my purposes.


The lighting seems non-existent when I turn off wireframe on the matrix, how do I change that? Is it because it's white?
I will have a go at making a texture for it.

I also need to make a sky box, a sun and a rolling cloud blanket.
For the clouds I was thinking of using a ton of plains that rotate and move slowly around the mountain but I'm worried it will look really cardboardy. Has anyone got any tips for making realistic, fluffy clouds?

Link102
21
Years of Service
User Offline
Joined: 1st Dec 2004
Location: On your head, weeeeee!
Posted: 12th Feb 2008 19:25
use this (call once):


Libervurto
19
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 12th Feb 2008 21:01
I actually tried that but nothing happened
Do I need to change other things like lighting and the colour of the matrix?

I have been trying out some things to make a more realistic mountain
here is a page I found which explains a 2D mountain range
I tried to copy this but somewhere along the lines I made a boob
If anyone is bored can you guys have a look at my code and tell me what I did wrong
thanks

Oh, here is the page http://www.gameprogrammer.com/fractal.html

Link102
21
Years of Service
User Offline
Joined: 1st Dec 2004
Location: On your head, weeeeee!
Posted: 12th Feb 2008 21:53 Edited at: 12th Feb 2008 22:02
the matrix's wireframe should be turned off and you'll have to call Normalise(1) after the matrix is created. try uncommenting the *5

and for the boob thing, are you looking for something like this?

randomize it and flip some around a bit

Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 12th Feb 2008 23:22 Edited at: 12th Feb 2008 23:25
@Obese

If you are using DBC 1.20, the lighting is really tricky to figure out especially when it comes to matrices. It seems that:

1. Coloring Ambient light black (color ambient light 0) seems to get the affect I want most of the time. Control the intensity with SET AMBIENT LIGHT %

2. All lights have to be created in order. All lights have to be set in order. Remember, there is a default light 0 that also needs to be set in most cases.

3. Set the normals



Enjoy your day.
Libervurto
19
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 12th Feb 2008 23:24 Edited at: 12th Feb 2008 23:51
@Link
That's pretty good but kind of bypasses what I'm trying to learn, thanks anyway though

I've sorted it out a bit, it looks great for a while and then it goes really blocky. What am I doing wrong?


@Latch
Thanks bud
I'm surprised how good the mountains look, that was just a placeholder function but I think I'll use it (will still try to learn the procedural stuff though)

Is there a quick and dirty way to colour the mountain instead of making a texture?

Insert Name Here
19
Years of Service
User Offline
Joined: 20th Mar 2007
Location: Worcester, England
Posted: 12th Feb 2008 23:33
I haven't programmed for a while, so I don't know how this'll turn out...

But here it is: My crappy snow effect.




This image is purely work in progress.
Libervurto
19
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 12th Feb 2008 23:37
@Alex
Snowflakes only look like that magnified
I like it but they fall too straight to look realistic, try adding in a wind variable that moves all the snowflakes around a little bit.
I just had a thought: you could have a hidden object flying around and if it collides with any snowflakes it pushes them away from it, might make for a good wind effect

Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 13th Feb 2008 00:29
@INH

Not bad! I wonder if you could make the matrix rise in areas slowly as if the snow is accumulating...

@OB
Quote: "Is there a quick and dirty way to colour the mountain instead of making a texture?"


Real quick and dirty? Color a light:



Less quick and dirty: a very small texture



Enjoy your day.
Link102
21
Years of Service
User Offline
Joined: 1st Dec 2004
Location: On your head, weeeeee!
Posted: 13th Feb 2008 00:53 Edited at: 13th Feb 2008 01:14
you mean
right?

Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 13th Feb 2008 01:11
I originally did it like that, then I wanted to show the gradation to give an idea on how you can give fake lighting effects by stretching the color bewteen itself and black.

Enjoy your day.
Link102
21
Years of Service
User Offline
Joined: 1st Dec 2004
Location: On your head, weeeeee!
Posted: 13th Feb 2008 01:18 Edited at: 13th Feb 2008 01:19
o, so you mean like
(not tested)

------------

ok, I've updated my rain script. It now only spawns infront of the player, resulting in more rain and less lagg. but whenever I quickly turn the camera, the rain needs a bit of time to catch up on me (since it its only repositioned every time it spawns).
my idea to calculate the angle that the player is looking and the angle of the raindrop versus the player. Then if it isn't within the spawn area move it 45 degrees (wich is to the other side of the spawn area).
a picture to clarify:


but I can't figure out how to calculate the angle's. how do I get around the 0 being next to 360 degrees?

Tone3e
19
Years of Service
User Offline
Joined: 17th Feb 2007
Location: here
Posted: 13th Feb 2008 02:20
I am not sure but couldnt you just use the wrapvalue function? I thin k thats what your asking. Anyways thanks for helping me with the code and for the complements I am planning on adding more to my entry.

[center]
Come see the WIP!center]
Link102
21
Years of Service
User Offline
Joined: 1st Dec 2004
Location: On your head, weeeeee!
Posted: 13th Feb 2008 02:30
well, wrapvalue creates the problem

Libervurto
19
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 13th Feb 2008 03:18
@Link
360 is 0 degrees isn't it?

Anyway, the wrapvalue actually works to your advantage. All you need to do is +/- 45 degrees to your rain drop's angle (depending on which way the camera is rotating) and wrap the value.
Then all you have to do is come up with the maths to convert the angle and distance into a 3D coordinate.
I would like to pay you back for helping me but I am too tired to do this

Zombie 20
19
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 13th Feb 2008 06:56 Edited at: 13th Feb 2008 06:56
well since I don't have an IDE to play with I'll do this on the spot, mind you its not gonna be good. I thought this one up at work, my attempt is to make rain fall and create ripples, i'm going to have a lot commented and parts will be missing since I can't test it but here goes.



So yea its short, its bad, but I don't have an editor and I thought it up yesterday, I'm sure with work and help files open I could make it better, but that is my basic premise. Please don't be harsh if you comment.


Coffee coffee coffee coffee coffee coffee cappacino, JAVA!
Insert Name Here
19
Years of Service
User Offline
Joined: 20th Mar 2007
Location: Worcester, England
Posted: 13th Feb 2008 11:07 Edited at: 13th Feb 2008 11:09
@Zombie

Sorry, it didn't work. You spelled 'Randomize' wrong, and it didn't like the 'Line1=' thing. Once I'd sorted it out I just got a line on the screen.


@Everyone

I added a function to rise the snow, and if the matrix gets too high I've made it drop down too, now the snow never runs out, and it falls slightly more realistically too. Oh, and I added more snowflakes.




This image is purely work in progress.
Zombie 20
19
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 13th Feb 2008 11:45
INH- Well thanks for testing it just the same, at least now I know not to try and store my line in a variable, I'll think of something else. Good luck with your snow.


Coffee coffee coffee coffee coffee coffee cappacino, JAVA!
TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 15th Feb 2008 03:41
I've been experimenting with clouds myself for my entry.

How are these for just before a storm?...



They are using self-generated media (the hard part) and are animated.

TDK_Man

Latch
19
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 15th Feb 2008 09:57
@zombie
Keep working at it!

@link102

You may be able to get the results you want with OBJECT IN SCREEN(). In the following example, you can move the camera around with the arrow keys. Once the sphere is out of view, it will reposition randomly in front of the camera:



If I used TURN OBJECT instead of YROTATE, the angles wouldn't be correct for NEWXVALUE and NEWZVALUE.

@INH
I like the swirling flakes. The matrix rising is very subtle.

@TDK
Interesting! Is that the bottom of a matrix for the clouds?

Enjoy your day.
Insert Name Here
19
Years of Service
User Offline
Joined: 20th Mar 2007
Location: Worcester, England
Posted: 15th Feb 2008 13:45 Edited at: 15th Feb 2008 13:46
TDK: That is wonderfully beautiful for DB-made media...

How did you get the smooth round parts for the hills below? All of my matrices look jerky and blocked.

You can write crap in DBPro as well as DBC - it just crashes quicker! -TDK

TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 15th Feb 2008 15:21
Quote: "Is that the bottom of a matrix for the clouds?"


No - just particles (about 130 of them are used to fill the sky). Actually, the still picture doesn't do them justice - they look a bit better when you see them moving and darken as the rain starts.

Quote: "How did you get the smooth round parts for the hills below?"


I just wrote a smoothing routine.

In fact, in my entry I've created a RandomWorld() function which anyone can 'pinch' if they have a use for it - I just got fed up of writing the same code over and over again.

It creates a flat or random smooth matrix (like the one shown above) with the specified dimensions - along with a skysphere.

The rain is done, but now to see if I can do my hail and snow before I run out of time...

TDK_Man

Insert Name Here
19
Years of Service
User Offline
Joined: 20th Mar 2007
Location: Worcester, England
Posted: 15th Feb 2008 16:58
Hmm, I'm having difficulty placing the snow all over the matrix as opposed to just in front of the camera. If I try there are too many particles.

I may come back to this.

You can write crap in DBPro as well as DBC - it just crashes quicker! -TDK

Libervurto
19
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 15th Feb 2008 18:13 Edited at: 15th Feb 2008 18:23
Hi guys,
I'm really showing how much of a noob am I with 3D here
I'm trying to make a sky sphere but it wont show, the best I can get is the backdrop goes black
I've got quite a nice fog effect going but it's all a bit dead at the moment


[edit]
OOPS!
It wasn't a 3D problem it was a maths problem, I forgot that if you divide by an integer DB returns an integer.
I still can't get it to look like sky though

Insert Name Here
19
Years of Service
User Offline
Joined: 20th Mar 2007
Location: Worcester, England
Posted: 15th Feb 2008 22:30
That is really cool OBese!

You can write crap in DBPro as well as DBC - it just crashes quicker! -TDK

Login to post a reply

Server time is: 2026-06-08 04:30:03
Your offset time is: 2026-06-08 04:30:03