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
Ric
14
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 11th Feb 2005 06:17 Edited at: 1st Feb 2007 17:42



Like a challenge? Then this is the place for you !

The challenges in this thread are designed to improve your coding skills, either by having a go at the current challenge yourself, or by learning from other peoples attempts. These challenges are both educational and fun!

Challenges are set regularly, and everyone is welcome to participate, whether you're a complete novice or an advanced programmer. These challenges are about coding techniques. The idea isn't necessarily to create a fully fledged game - the challenge may concentrate on a particular area of game design, and should therefore be achievable within a matter of days.

There are some rules you need to know about. Firstly, your entry must be written in DBPro without the use of any external media.

There are 10 rules in total. You can see all of the rules, and additional information about what is meant by 'no media' here.

A searchable database containing the all of the code snippets from these challenges can be found at www.dbp-site.com - thanks to Nicholas Thompson for creating this great resource.

Have fun, and get coding!

Attachments

Login to view attachments
Ric
14
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 11th Feb 2005 06:19 Edited at: 6th Feb 2006 23:38
Challenge 1:

* Make a weather effect. Could be a rainbow, lightning, snow, etc etc .....

* Time limit: 2 days (until Saturday night).

___________________________________________________________________

Here's my attempt at a tornado!



BillR
15
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 11th Feb 2005 13:32
Ric - Thanks for putting up the challenge thread - nicely done!

I like your tornado, learned something from it already!

I have been playing around with your tornado code, learning how it works, breaking it, fixing it, the usual programming kind of stuff.

I will try to think of something to enter....hmmm...nothing yet...
TEH_CODERER
15
Years of Service
User Offline
Joined: 12th Nov 2003
Location: Right behind you!
Posted: 12th Feb 2005 04:47
Pretty nice but it doesn't look particularly tornadoish.
I'll try and make an entry now.

[url]andrewneale2004@yahoo.com[/url]
http://www.freewebs.com/elbsoftware/index.htm
Ric
14
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 12th Feb 2005 04:58 Edited at: 12th Feb 2005 06:53
Quote: "it doesn't look particularly tornadoish"


OK, so it's not quite 'The Day After Tomorrow' quality, but it's a start ........

<edit> Code is updated above to make it more tornadoish!


Phaelax
DBPro Master
15
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 12th Feb 2005 05:46
Why do your comp entrys never work for me Ric? It just quits as soon as I run it.

"eureka" - Archimedes
spooky
16
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 12th Feb 2005 05:56
Same here. Just quits as soon as it starts. I might even try and work out what the problem is.

Boo!
spooky
16
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 12th Feb 2005 06:07
I can get it to work if I replace the *pointer command with;

ink color_value,0 : dot x,y

Presume value given to pointer command is invalid and writing to bits of memory it shouldn't.

Boo!
BillR
15
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 12th Feb 2005 06:14
Worked fine for me.

Nice job Ric, good thing judges can't win, that means you can only win every other time!.....LOL

Hey, I just like figuring out how you do this stuff....and sometimes I even understand....LOL again!
BillR
15
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 12th Feb 2005 06:20
Now I see...

You and G Man ganged up on us, good stuff man.

Still figuring it out....
Phaelax
DBPro Master
15
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 12th Feb 2005 06:37
Yea, I think it has something to do with the pointer, because my program will crash at random times for no reason.

Here's my entry, SplineBow!
Use the mouse to move various points* of the spline system to change the shape of the rainbow. Rain particles fall and die when hitting the rainbow.

*note last endpoint of system does allow you to move it. why? cause im lazy.

Code could be more efficient by storing the hermite vectors in an array so they aren't recalculated in the particle routine.



"eureka" - Archimedes
Coding Fodder
15
Years of Service
User Offline
Joined: 25th Sep 2003
Location: Somewhere in my cerebralcortex
Posted: 12th Feb 2005 06:52 Edited at: 12th Feb 2005 09:29
Hmm Ric. Very nice. One problem though you do have a tendancy to write to illeagle pixels. It must not be a problem on some hardware but it crashes mine.

For people who can't run rics code. Add a check to see if

if y#(particle)>0 and x#(particle)>0

before calling set_locked_pixel.


I have been having some trouble on this project. I wanted to get away from particles as we have already done that. So I am stuck with trying to make something Truely 3D. It has kinda gotten out of hand.

If anyone needs a nice place for their weather to happen go ahead and use this pile of copy and pastes from other code of mine.

[Edit] removed code and placed silly entry below

If you look at the last few lines you will realize what rotten cheater I am. No media hah.

Really though we should put limits on data statements. I think you should be allowed some finite amount of data. some 3-D things are just too hard without media.

I will try to add the real weather code later on.

Something really catchy that makes people stop and think about the meaning of life and say to themselves "My but thats clever"
Phaelax
DBPro Master
15
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 12th Feb 2005 06:59
memblock matrix?

ric's code runs now with that check. Nice work.

"eureka" - Archimedes
Cryptoman
15
Years of Service
User Offline
Joined: 24th Nov 2003
Location: Utah Mountains
Posted: 12th Feb 2005 07:00
That's some pretty nice stuff Ric. Runs nicely.


Ric
14
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 12th Feb 2005 07:07 Edited at: 12th Feb 2005 07:13
I've updated my code (second to top post) to stop it colouring pixels off the screen - hopefully it will work now.

Great to see some more entries coming in! That's one weird rainbow, Phaelax - nobody has ever written collision detection for a rainbow before! It's neat code though.

I've nothing against data statements. The no media rule was really to make testing other peoples code hassle free, and to place the emphasis on the code rather than the gloss - but I'd say use 'em if you want.

Nice terrain you've got there CF - looking forward to seeing some weather on it!


Coding Fodder
15
Years of Service
User Offline
Joined: 25th Sep 2003
Location: Somewhere in my cerebralcortex
Posted: 12th Feb 2005 07:13
@ ric my only objection to data statements is the abuse of them. I could put in a nice thunder clap if I am willing to make everyone on dial up wait a couple minutes for the page to load. I am on dial up myself and it would kinda be a pain if someone put a cartography shop map in data statements.

Something really catchy that makes people stop and think about the meaning of life and say to themselves "My but thats clever"
Ric
14
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 12th Feb 2005 07:17 Edited at: 12th Feb 2005 07:27
lol ! I've updated rule 2 - hopefully people will respect the word 'reasonable'!

Just noticed the water on your terrain CF - looks nice, although it seems to disappear at certain camera angles, as the lighting changes.


Suicidal Sledder
14
Years of Service
User Offline
Joined: 17th Aug 2004
Location: Tikrit, Iraq
Posted: 12th Feb 2005 08:10
Here's a sort of lightning thingy...


"See?!?! Port IS left and starboard is RIGHT!!" - Hobbes
Cryptoman
15
Years of Service
User Offline
Joined: 24th Nov 2003
Location: Utah Mountains
Posted: 12th Feb 2005 08:40
Pretty cool lighting sledder. This weather stuff is all over my head. Nice to see some examples. I don't do well with 3d.


Suicidal Sledder
14
Years of Service
User Offline
Joined: 17th Aug 2004
Location: Tikrit, Iraq
Posted: 12th Feb 2005 08:42
Thx for the complement Trs80

"See?!?! Port IS left and starboard is RIGHT!!" - Hobbes
Coding Fodder
15
Years of Service
User Offline
Joined: 25th Sep 2003
Location: Somewhere in my cerebralcortex
Posted: 12th Feb 2005 09:33 Edited at: 12th Feb 2005 09:35
Well here is my rediculous entry. I really wasted most of my time making an alphablended terrain of sorts. My first. please discount that in judging as it is not weather related.



Just walk around with the arrow keys playing god with the lightning. If someone can get the sprite to scale with distance that would be tremendous.

[edit] oops call down your lightnings with the mouse.

Something really catchy that makes people stop and think about the meaning of life and say to themselves "My but thats clever"
Phaelax
DBPro Master
15
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 12th Feb 2005 09:34 Edited at: 12th Feb 2005 09:35
that lightning gives me a headache. How bout adding some lightning bolts that branch off?

I had a good idea involving clouds, but my perlin noise generator isn't finished yet.

"eureka" - Archimedes
Coding Fodder
15
Years of Service
User Offline
Joined: 25th Sep 2003
Location: Somewhere in my cerebralcortex
Posted: 12th Feb 2005 09:42
yah it is way too regular and streight. I am kinda limited in the media department tough. I am trying to think of a way to randomize it.

Something really catchy that makes people stop and think about the meaning of life and say to themselves "My but thats clever"
Ric
14
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 12th Feb 2005 09:58
Quote: "my perlin noise generator "


That sounds pretty cool.

CF: That could be a really comical game! Kill the bad guys with lightning ..... oh hold on, has that been done before?


Phaelax
DBPro Master
15
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 12th Feb 2005 10:11 Edited at: 12th Feb 2005 10:11
grr, DB really needs some "filled-in" 2d commands.

Quote: "oh hold on, has that been done before?"

quake, unreal, etc...

"eureka" - Archimedes
Ric
14
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 12th Feb 2005 10:18





Coding Fodder
15
Years of Service
User Offline
Joined: 25th Sep 2003
Location: Somewhere in my cerebralcortex
Posted: 12th Feb 2005 10:34 Edited at: 12th Feb 2005 10:37
What kind of filled in commands do you need? I can supply those.



Ric, I was thinking little scurrying rodents. Sorry I have not played any of the afore mentioned games.

Something really catchy that makes people stop and think about the meaning of life and say to themselves "My but thats clever"
Phaelax
DBPro Master
15
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 12th Feb 2005 11:33
The ellipse mostly, so I could make some cheap looking clouds. I can add the other radius to your function, thx.

Here's a different example. Rain demo. Use the mouse to move the ball through the air and watch the rain repel off. I get 26fps on this. Over 80fps if I remove this little bit:



Full example:


"eureka" - Archimedes
Coding Fodder
15
Years of Service
User Offline
Joined: 25th Sep 2003
Location: Somewhere in my cerebralcortex
Posted: 12th Feb 2005 12:42
hey neat, I like the little drops with tails.

Something really catchy that makes people stop and think about the meaning of life and say to themselves "My but thats clever"
RiiDii
14
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 12th Feb 2005 19:31
Here's my entry. Please forgive the blank screen and the long wait at the beginning. I decided to do random stuff since no media is allowed, and... well... I have to still improve how quickly it gets done.

PLANET STORM:


"Droids don't rip your arms off when they lose." -H. Solo

REALITY II
Phaelax
DBPro Master
15
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 12th Feb 2005 20:17
Ok, I give up. Give the prize to Riidii. It was kinda cool, then I saw the lightning. Nice touch.

"eureka" - Archimedes
Ric
14
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 12th Feb 2005 23:02
@Phaelax - Rain, or 'sperm under a microscope' - either way it's pretty cool.

@RiiDii - well, I saw the blank screen, went to have a beer, came back saw a blank screen again, went off and did some shopping, make some phone calls, watched a footy match, came back and ..... wow! That's really nice, and quite amazing considering there's no media and only around 100 lines. Love the lightning - it looks totally realistic. And the clouds. And the nebulae in the background too - nice. Two commands I've never used before are 'fade' and 'blur bitmap' - I will now, though. Winner so far.


Phaelax
DBPro Master
15
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 13th Feb 2005 00:16
I used blur bitmap too!

"eureka" - Archimedes
Cryptoman
15
Years of Service
User Offline
Joined: 24th Nov 2003
Location: Utah Mountains
Posted: 13th Feb 2005 00:35
That's really cool RiDii.


Ric
14
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 13th Feb 2005 00:40
Quote: "I used blur bitmap too! "


Er .... where?


Coding Fodder
15
Years of Service
User Offline
Joined: 25th Sep 2003
Location: Somewhere in my cerebralcortex
Posted: 13th Feb 2005 00:53
Very nice riidii worth the wait. I am going to have to throw in the towel on this one. Tough challenge ric. weather is quite difficult.

Something really catchy that makes people stop and think about the meaning of life and say to themselves "My but thats clever"
Phaelax
DBPro Master
15
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 13th Feb 2005 01:02
oops, at least I did use it in a previous snippet that I later decided to not upload. Ok, nevermind.

"eureka" - Archimedes
Ric
14
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 13th Feb 2005 02:15
Well, I think it's been a great start to the challenge thread, and it's impressive what people can do in just a couple of days. Definitely tougher than I expected it would be, making weather effects!

Assuming nobody comes up with a last minute effort, I think it's safe to say Rii wins this one - Congrats! You become the new challenge setter for challenge number 2 .......... game on.




RiiDii
14
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 13th Feb 2005 02:43
Thank you, and thanks for the comments! @Ric lol! And nice thread by the way!

I'll post a challenge shortly (any suggestions?).

While trying to speed that puppy up, I was writing my own blur command based on some theories from another thread. Then I hit a bug! Take a look at this code (I've reduced the bug to it's simplest form, so the code is not worth much).

Ompc, the code breaks at Line 17: Create Bitmap 2,MW,MH, regardless of the order the functions are called in. The only difference is Line 14: percent#=(Rnd(10)+75)/100. Very odd. Any ideas why this is happening?



"Droids don't rip your arms off when they lose." -H. Solo

REALITY II
Ric
14
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 13th Feb 2005 03:46
Stick a .0 on the end of 100, to turn the result into a float. Otherwise, it's calculating your percentage to be 0, because it's rounding to the nearest integer, which is resulting in an illegal bitmap area.

Possible themes for challenges: maths, graphics, AI, physics, effects, mini games, etc........




TEH_CODERER
15
Years of Service
User Offline
Joined: 12th Nov 2003
Location: Right behind you!
Posted: 13th Feb 2005 04:35
I vote AI.

[url]andrewneale2004@yahoo.com[/url]
http://www.freewebs.com/elbsoftware/index.htm
Mobiius
Valued Member
15
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 13th Feb 2005 06:36
AI, me too!

1800+ XP - GeforceFX 5600 - 256MbDDR - 60Gb Hdd - XP Pro (SP2)
Chris64
14
Years of Service
User Offline
Joined: 16th Oct 2004
Location: San Diego
Posted: 13th Feb 2005 08:26
Very nice demo's! I started to get into this...but unfortunately time is running out.

Here's my little cheezy tornado...you can drive it around with the arrow keys.



My vote would probably go to RiiDii...Although I had to modify the screen resolution to make it work on my PC. Who is AI?
Coding Fodder
15
Years of Service
User Offline
Joined: 25th Sep 2003
Location: Somewhere in my cerebralcortex
Posted: 13th Feb 2005 09:39
Chris- Riidii already won. Sorry no one gets a vote. the winner is decided by the person who sets the challenge. AI is a possible area that the next challenge could be in. If Riidii so chooses.

hey your code is pretty neat. A little cartoony but thats a plus with me.

Something really catchy that makes people stop and think about the meaning of life and say to themselves "My but thats clever"
RiiDii
14
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 13th Feb 2005 09:45 Edited at: 13th Feb 2005 13:18
AI it is. Remember to keep it simple. Even basics like gravity and collisions are considered AI? Looking for creativity though. I'll try to post soon, but my connection is down right now (using another pc).

Edit: Sorry - forgot to include a deadline. AI can be a little tough so, maybe 4 days (Wednesday)? I have an AI demo over in the code snippets if anyone cares to check it out. I put the basics of that together in about 3 days. Also: forgot to mention - great challenges and challengers here. I for one am learning a ton on this post alone already.

"Droids don't rip your arms off when they lose." -H. Solo

REALITY II
Ric
14
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 13th Feb 2005 21:15
Challenge 2:

* Write an AI routine

* Time Limit: Wednesday night (16/2/05)

___________________________________________________________________

Challenge setter: RiiDii


Ric
14
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 13th Feb 2005 21:21
This one should be interesting - AI is a very broad theme. I feel a little game coming on ..... !

As far as I'm concerned, AI means anything which has the appearance of human-like behaviour. So gravity/collisions aren't classed as AI - they come under the category of Physics - things which behave according to the rules of forces and motion etc. And for Chris ("Who is AI?"), AI stands for Artificial Intelligence.


RiiDii
14
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 14th Feb 2005 01:17
Here's my entry (not).

http://forum.thegamecreators.com/?m=forum_view&t=47243&b=6

Okay - it has media files, but it doesn't need them. I started with a cube chasing balls around on a white matrix with white obsticals.

"Droids don't rip your arms off when they lose." -H. Solo

REALITY II
TEH_CODERER
15
Years of Service
User Offline
Joined: 12th Nov 2003
Location: Right behind you!
Posted: 14th Feb 2005 02:41
Quote: "Here's my little cheezy tornado"

In my opinion that was the best entry!

[url]andrewneale2004@yahoo.com[/url]
http://www.freewebs.com/elbsoftware/index.htm
Ric
14
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 14th Feb 2005 08:44 Edited at: 14th Feb 2005 09:19
Well, I had a think about what sort of AI I'd do for this challenge - and was basically trying to think of anything other than Pong AI. Anyway, I started coding, and it kind of began to write itself - and now there's no going back. Just so you know then - my entry is going to be Pong! I'll try at least to make it a good one!


Login to post a reply

Server time is: 2019-01-22 18:01:04
Your offset time is: 2019-01-22 18:01:04