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
BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 15th Nov 2008 01:44
Quote: "Weren't you going to enter this? I was hoping to see what cool stuff everyone else was going to come up with. "


Was but it has been a busy couple weeks, haven't had any time to program. Will hopefully get in on the next one though.

Ever notice how in Microsoft word, the word "microsoft" is auto corrected to be "Microsoft" but "macintosh" just gets the dumb red underline?
steve paul thomas
16
Years of Service
User Offline
Joined: 4th Nov 2008
Location: United Kingdom
Posted: 15th Nov 2008 02:00 Edited at: 15th Nov 2008 02:03
Wow! Nice demos, Latch.

Tool 1 (although a bit slow on my computer) is a good visual demonstration of Sin and Cos. I'll be keeping this handy as will help me visualise Sin and Cos for future projects

Tool 2 - Would a Dark Light be commonly used for shadows? I haven't looked at lighting yet.

Tools 3 and 4 are impressive, actually 4 is very impressive!

Tool 5 - Neat clock


@BN2 Productions

OK
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 15th Nov 2008 02:19 Edited at: 15th Nov 2008 02:28
Quote: "Tool 1 (although a bit slow on my computer) is a good visual demonstration of Sin and Cos"


That always suprizes me when I read something runs slow... My computer is pretty old with a 1.5 ghz processor so I wonder what slow means. I put an fps check in the trig demo and it runs at about 42 frames per second. Most of the 2d drawing is occuring directly on the screen in real time (circle is a big resource gobbler) so it's a slow program. Not to mention the toolbar is drawn also each iteration (I may change that to off-screen drawing at some point).

A dark light can be used for shadows but I don't know about commonly. It can shadow an area, but trying to adjust it to cast individual shadows for multiple objects could be resource consuming and not real easy. One or two objects is doable. It can be a cool effect to show something blocking a light source - an area becomes shrouded in darkness.

Enjoy your day.
steve paul thomas
16
Years of Service
User Offline
Joined: 4th Nov 2008
Location: United Kingdom
Posted: 15th Nov 2008 02:55 Edited at: 15th Nov 2008 02:58
Hmm...Sorry I don't think I worded that right. What I meant was, that the mouse pointer movement seems to be affected (On an AMD 1.8Ghz). But like you said:

Quote: "
Most of the 2d drawing is occuring directly on the screen in real time (circle is a big resource gobbler) so it's a slow program. Not to mention the toolbar is drawn also each iteration (I may change that to off-screen drawing at some point)."


So no problem

Although thinking about it, instead of drawing the circle each time,would there be a speed increase by:

1) Drawing circle once.
2) Getting the image.
3) Using sprite or paste image.

?
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 15th Nov 2008 03:30 Edited at: 15th Nov 2008 03:51
Yup. Almost anything that can be drawn ahead of time and just pasted should be faster! But, I'm not gonna change it now. Also, look up tables and the like for sin, cos, tan - speeds things up a lot. I could calculate the sin and cos and put them into arrays dim to 360 ahead of time. Then instead of calling the calculation sin(angle) etc., I could just use the array mysin#(angle) etc. Big speed increase. That could be applied to the anolog clocks that are appearing in this challenge as well.

Speaking of which, I've changed the clock in my demo:



Enjoy your day.
steve paul thomas
16
Years of Service
User Offline
Joined: 4th Nov 2008
Location: United Kingdom
Posted: 15th Nov 2008 04:05 Edited at: 15th Nov 2008 04:14
Quote: "Yup. Almost anything that can be drawn ahead of time and just pasted should be faster!"


Something for me to remember

Quote: "Also, look up tables and the like for sin, cos, tan - speeds things up a lot. I could calculate the sin and cos and put them into arrays dim to 360 ahead of time. Then instead of calling the calculation sin(angle) etc., I could just use the array mysin#(angle) etc. Big speed increase. That could be applied to the anolog clocks that are appearing in this challenge as well."


I'd heard the term "look up tables" before, but had no idea what they were. I think I get the idea

Clock version 2 is impressive. Interesting way of making a reflection. Like it

Actually whilst we're on the subject of Sin and Cos. I was wondering if you know how an image can be rotated using them. I couldn't find anything when I searched the forums.

Want to avoid "cheating" using 3d objects.

Was thinking about some spinning sprites!
Irojo
16
Years of Service
User Offline
Joined: 21st May 2008
Location: Eating toast.
Posted: 15th Nov 2008 04:20
Quote: "Was thinking about some spinning sprites! "


He who makes a function for spinning sprites shall be my hero.


I download memory.
steve paul thomas
16
Years of Service
User Offline
Joined: 4th Nov 2008
Location: United Kingdom
Posted: 15th Nov 2008 04:24 Edited at: 15th Nov 2008 05:12
During my searches I discovered that DB Pro has a command called Rotate Sprite, so its easy for those users. Just wondering how us DBC people would achieve the same thing through code only (without using Paint Shop Pro/Photoshop/GIMP,etc)

I see also that both Latch and Irojo have visited this subject before. Was just wondering did you have any kind of success.

@Irojo

Can think of lots of uses for this. The most obvious being a top-down racing game (e.g. Micro Machines), but also swinging ropes, rotating the screen and other silly effects like you might have seen on the Super Nintendo.

A search using Google found:
http://pixwiki.bafsoft.com/mags/5/articles/circle/sincos.htm

Hmmm...how to translate this to DB?
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 15th Nov 2008 05:09
For rotating an entire image with math, you have to account for the diagonal size because you could rotate the pixels "out of frame" meaning you would require a larger image area than what you started with; or you could crop or clip the image so it fits into it's original area and fill the matting (the area from where the image was rotated out of) with a transparent color (like black) or some other color.

I used 3D plains at one point. That works well.

I also created a DLL with a series of functions for rotating images, alpha blending, screen capture, backbuffer capture and stuff like that. Doing the same with code in DBC is possible, but sloooooowwww especially for real time. "Cheating" using 3D is probably the only practical real time way to do it without an external dll except if you just need a snapshot. Take a look at

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

Anyway, I'm a culprit in straying the discussion away from the challenges...

Enjoy your day.
steve paul thomas
16
Years of Service
User Offline
Joined: 4th Nov 2008
Location: United Kingdom
Posted: 15th Nov 2008 05:19 Edited at: 15th Nov 2008 05:19
Oops Sorry everyone, I'll post future questions like this in a new thread. Thanks for the explanation, Latch.
Digger412
17
Years of Service
User Offline
Joined: 12th Jun 2007
Location:
Posted: 15th Nov 2008 05:30
I've looked at a few of the entries, awesome work guys. I'm still pretty new, otherwise I may have attempted this challenge.

@Irojo

Couldn't you do something with sin and cos to move each individual pixel in a circular fashion? It may take a while, but if you turn sync on then set it to 0 and get the image of the sprite after all of it's pixels are moved by one and make that into a sprite (probably want a for-next loop so that you can capture each rotation individually), all you'd have to do then is reset your sync and show the sprites in order. This is all pure speculation, I have no clue whatsoever if it would work.
NanoGamez guy
18
Years of Service
User Offline
Joined: 13th Jan 2007
Location: Closer than you think...
Posted: 15th Nov 2008 14:36
Challenge Over!


Here's the results:

Phaelax:
Not really an entry for this challenge because it was only a clock, still, nice graphical effect.

Ashingda:
Really cool fake OS, reminds me of windows 98. It looked like a really good start to an entry, shame nothing worked!

Irojo:
Very nice animations and use of graphical commands. I really liked the ninja game because it was challenging but fun, and also quite addictive. Although the jumping wasn't quite right, sometimes you could do triple and even quadruple jumps, and other times you could only do single jumps. The drawing program was quite hard to use with the user having to remember all the keys to press. However, once you got going, there was quite a lot you could do, such as 2D and 3D drawing, and a random art splatter effect. The tools menu had only one working button, and that was the binary translator. It was fun seeing what you name was in binary, and it also automatically copied it to the clipboard, although it didn't tell you that it was doing that. You could also switch between fullscreen and windowed mode.

Steve Paul Thomas:
Very tidy looking interface with nice little fish game going on in the main part of the screen. This was mainly something nice to look at and not particularly interactive (apart from the occasional fish feeding). Although it was quite it was quite nice to watch . Perhaps you could restrict the feeding so that it could only be dropped at the top of the tank?

Latch:
Very cool toolbar that could manipulated very easily. I was also clear how many different ways you could change it. A nice demonstration of how sine and cosine work, it was so smooth, I could watch it for hours! It was very interesting watching the light demo, I had never looked at lights before. A very fast and interesting fill effect, although it didn't really fill it, but produced and effect similar to the inside of a tree . It was also very nice to watch the cloth matrix demo, and the clock with the reflection was nice effect. The toolbar was very good and the demos were great, however, it wasn't very interactive.

The runner up is:


And the winner is:


Congratulations to the winner and over to you to set the next challenge.


"To succeed is not enough, others must fail" - Gore Vidal
steve paul thomas
16
Years of Service
User Offline
Joined: 4th Nov 2008
Location: United Kingdom
Posted: 15th Nov 2008 15:53 Edited at: 15th Nov 2008 16:27
@NanoGamez guy

Quote: "Very tidy looking interface with nice little fish game going on in the main part of the screen. This was mainly something nice to look at and not particularly interactive (apart from the occasional fish feeding). Although it was quite it was quite nice to watch. Perhaps you could restrict the feeding so that it could only be dropped at the top of the tank?"


Thanks for your comments Thats a good idea about restricting the feeding to just the top of the tank. Have just tried it out with the mouse and it makes the game more challenging. (I should have thought of that! Silly me )

Good challenge and happy to have participated

@Irojo
Well done!

Also about what Nano said:

Quote: "It was fun seeing what you name was in binary, and it also automatically copied it to the clipboard, although it didn't tell you that it was doing that."


Just thinking, it might be a good idea to ask the user if they want to copy to clipboard. Just to give them a choice as they might be holding something there that you would overwrite.Something a bit like this:



That or have a button. Just an idea for you
BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 15th Nov 2008 20:08
Congrats Irojo!

Ever notice how in Microsoft word, the word "microsoft" is auto corrected to be "Microsoft" but "macintosh" just gets the dumb red underline?
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 15th Nov 2008 20:20
Congratulations Irojo !

Enjoy your day.
Irojo
16
Years of Service
User Offline
Joined: 21st May 2008
Location: Eating toast.
Posted: 15th Nov 2008 21:23 Edited at: 17th Nov 2008 00:59
Thanks Everyone! I'm really busy today (guests), but I'll have the next challenge in 24 hours.

If that works with anyone.

Will respond to previous posts when I get the chance.


I download memory.
Ashingda 27
17
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 15th Nov 2008 22:05
Grats Irojo, gonna give us another intresting challenge?
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 16th Nov 2008 01:55
Quote: "He who makes a function for spinning sprites shall be my hero."


Rotate Image - from your friendly neighborhood latch

Enjoy your day.
Irojo
16
Years of Service
User Offline
Joined: 21st May 2008
Location: Eating toast.
Posted: 16th Nov 2008 22:41 Edited at: 16th Nov 2008 22:42
Sorry I took so long....

Challenge: User-defined platforms

About:
This isn't just your average program. Instead of the usual platformer game, you are required to make a game, (or just an example program), where the user, using the mouse, creates a platform for the character to travel on.

Further Explaining:
The user makes a line, the line becomes 'solid' ground.

Deadline: 29th Of November

Good luck!


I download memory.
BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 16th Nov 2008 23:11
This could be fun. Good challenge!

Ever notice how in Microsoft word, the word "microsoft" is auto corrected to be "Microsoft" but "macintosh" just gets the dumb red underline?
Irojo
16
Years of Service
User Offline
Joined: 21st May 2008
Location: Eating toast.
Posted: 17th Nov 2008 00:59
Thanks BN2.

Will check that out Nano!


I download memory.
Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 18th Nov 2008 00:25
Cool challenge. The website has been updated with previous challenges. As usual, let me know if any code entries appear incomplete.


BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 18th Nov 2008 04:27 Edited at: 18th Nov 2008 04:27
Quick Question:

Does the character have to interact on its own (ie the player doesn't control it, just draws the environment) or can it be player controlled?

Ever notice how in Microsoft word, the word "microsoft" is auto corrected to be "Microsoft" but "macintosh" just gets the dumb red underline?
Irojo
16
Years of Service
User Offline
Joined: 21st May 2008
Location: Eating toast.
Posted: 18th Nov 2008 04:36 Edited at: 18th Nov 2008 04:37
@BN2
Either.
I think player controlled would be preferable.
Good luck with the challenge!

@Phaelax
I'm glad to see it's updated, and thanks!


I download memory.
Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 20th Nov 2008 00:02
Here's the beginning to my platform editor.





Irojo
16
Years of Service
User Offline
Joined: 21st May 2008
Location: Eating toast.
Posted: 20th Nov 2008 00:18
Cool!

I'm glad you are entering. Looking good so far. I think I see where you are going with it. Clever solution.


I download memory.
Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 20th Nov 2008 00:41 Edited at: 20th Nov 2008 00:42
Made a quick update to the website's home page: http://zimnox.com/dbcc/?page=home. Now you guys can always check to see who's in the lead and who submitted the most challenge entries.

For you newer folks at the DBC code challenge, note that 4 out of the 5 top winners are also in the top 5 contributors. So it pays to keep trying....(a whole lot in Latch's case)

More updates are coming, as soon as I find my USB stick with my database backup on it.


Irojo
16
Years of Service
User Offline
Joined: 21st May 2008
Location: Eating toast.
Posted: 20th Nov 2008 01:01
Cool updates!

How much did Obese Pay ya?

(He and I both have 2 wins)

I'm just kidding. Soon I shall pass him. Muahahhaha...


I download memory.
Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 20th Nov 2008 01:06
he payed me in pieces of eight


Irojo
16
Years of Service
User Offline
Joined: 21st May 2008
Location: Eating toast.
Posted: 20th Nov 2008 01:10
Aha! I knew it. Darn him.... and he probably promised to leave alone your goats...


I download memory.
NanoGamez guy
18
Years of Service
User Offline
Joined: 13th Jan 2007
Location: Closer than you think...
Posted: 20th Nov 2008 17:27
@Irojo
Unfortunately, I won't be entering this, because I have exams .

@Phaelax
Nice updates! Perhaps you could have a win percentage table, that would mean that newcomers could easily get on it.


"To succeed is not enough, others must fail" - Gore Vidal
Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 21st Nov 2008 16:54
@Nano,
You mean is like your percentage of wins compared to entries? Let's see, you'd be at 38% right now, which might be our highest. TDK comes in at 33%. Hmm, I take that back. Comrade Robski is the overall top winner at 80%. 4 out of 5 of his entries have won. Technically, you could claim he has a 100% chance of winning when entering because the entry that didn't win was beaten by his own entry in the same challenge.
So next time we hear Comrade Robski entering, we should all just give up!

Ok, two updates to mention. First, is the website. I've made several additions to it, including a codebase section which is still being developed. Some of the download links for demos and tutorials may not work yet. Secondly, I had an update to my platform designer, but I forgot to put the file on my laptop before I left this morning so it's currently at home. Incidently, I seem to have created a method of line of sight over a grid which I was previously stuck on a year ago while trying to create a 2D raycasting engine (think Wolfenstein3D). It seems so simple now and have already thought of other practical uses for it.


Irojo
16
Years of Service
User Offline
Joined: 21st May 2008
Location: Eating toast.
Posted: 21st Nov 2008 17:30 Edited at: 21st Nov 2008 17:32
The website looks awesome.
I can't wait to see your solution to the Program!

I noticed in the "Forum Signature" Contest, you don't have any stars for who won.


I download memory.
Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 22nd Nov 2008 03:10
Ok, fixed.

I have so many projects I'm doing all at once right now. The challenge, the website, a java project, and now i'm starting to look at procedural music generation in db(not sure if i'll get anywhere with it).


Irojo
16
Years of Service
User Offline
Joined: 21st May 2008
Location: Eating toast.
Posted: 22nd Nov 2008 03:25
Cool.


The music generation sounds interesting...


I download memory.
steve paul thomas
16
Years of Service
User Offline
Joined: 4th Nov 2008
Location: United Kingdom
Posted: 22nd Nov 2008 17:45
Quote: "...and now i'm starting to look at procedural music generation in db(not sure if i'll get anywhere with it)."


I was wondering about a similar thing, but just a basic WAV generation. Figured it could probably be done with memblocks and the "sound from memblock" command (enhancement pack).

Uh ...bit beyond me at the moment,though. Still a noob and trying to learn other stuff like file I/O (so not in the challenge this time).
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 22nd Nov 2008 21:31
Somewhere on these challenges I posted an example with rain and thunder using a noise generator. I did it without memblocks for the sake of the challenges. I also have versions with memblocks. I can't remember if I posted the source or just the exe. But anyway, for sound I went the route of creating a series of waveform generators (sin/triangle , sawtooth, pulse, toned noise, and white noise). Once you create one generator, any other is just a variation. If you look at the sin/cos demo I posted from the last challenge, the sine wave being drawn there relates directly to sound generation. If you take each of those Y values between a wavelength (between two peaks) and repeat them 440 times within a second, that would be the pitch A. The shape of the wave between those peaks determines the quality of the sound. Sine produces a round flute like sound. Dump that into a memblock or a file with the proper header and you have your sound.

Enjoy your day.
steve paul thomas
16
Years of Service
User Offline
Joined: 4th Nov 2008
Location: United Kingdom
Posted: 22nd Nov 2008 21:45
@Latch
Very cool, perhaps that may have inspired people who finish early to add dynamically generated sounds to their entries?

P.S. I'm not in this challenge, but like to keep up with whats going on here
Irojo
16
Years of Service
User Offline
Joined: 21st May 2008
Location: Eating toast.
Posted: 22nd Nov 2008 22:05
8 Days left! Phaelax will win by default if no other entrants.


I download memory.
Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 23rd Nov 2008 05:32
I found an old DB snippet on my PC using DLL calls to play MIDI instruments, and an updated DBP patch broke the original function I used for creating sound effects in my code-only space invaders(dbp challenge). So I wanted to make some music for the game and see how far I can get without external media.


BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 24th Nov 2008 22:57 Edited at: 24th Nov 2008 23:00
Here is my entry thus far, almost have the drawing section done. Hopefully I will be able to finish.

The player is the Y and the goal is to create the necessary platforms to be able to get the *'s. Will probably switch these out later with real graphics.

To use it, just select the tile on the left that you want to draw and then click the tile. WARNING: DON'T CLICK ON THE GREEN AREA THAT DOESN'T HAVE A TILE FOR IT, IT WILL CRASH.




Ever notice how in Microsoft word, the word "microsoft" is auto corrected to be "Microsoft" but "macintosh" just gets the dumb red underline?
Ashingda 27
17
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 24th Nov 2008 23:55 Edited at: 24th Nov 2008 23:57
Hey BN2 It ran pretty slow, try adding this to your Main Loop, it will help with the speed.

create bitmap 1,640,480
Do
REM State variable controls where the program should go for a main loop
REM 3=Menu
REM 1=The level design (gets images 1-30,000)
REM 2=The game (gets images 30,001-60,000)
IF state=1 THEN GOSUB S1_Lvl_Design
IF state=2 THEN GOSUB S2_Play
copy bitmap 1,0
SYNC
CLS
LOOP
BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 25th Nov 2008 01:29
Hmm didn't get any kind of performance issue here. Will run some tests, what kind of frame rate were you getting?

Ever notice how in Microsoft word, the word "microsoft" is auto corrected to be "Microsoft" but "macintosh" just gets the dumb red underline?
Ashingda 27
17
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 25th Nov 2008 01:48 Edited at: 25th Nov 2008 01:49
I was getting a 5 then after the bitmap commands I got a 63, It could be a difference of machine issue.
Irojo
16
Years of Service
User Offline
Joined: 21st May 2008
Location: Eating toast.
Posted: 25th Nov 2008 02:00
I got 27-29 FPS.


I download memory.
BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 25th Nov 2008 04:36 Edited at: 25th Nov 2008 22:18
5?? Will look into it.

Updated Code, almost done with it now, found a framerate that seemed to work nice for me (33 actually, after that, it got to be too fast).

The game will just keep on going with more and more stars for every level you complete.



Ever notice how in Microsoft word, the word "microsoft" is auto corrected to be "Microsoft" but "macintosh" just gets the dumb red underline?
Irojo
16
Years of Service
User Offline
Joined: 21st May 2008
Location: Eating toast.
Posted: 26th Nov 2008 22:49
Running out of time...

Phaelax, you said you updated your code. It'd be nice if you post it so I can judge that.
Thanks.

-Irojo


I download memory.
Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 26th Nov 2008 23:43
Ok, big updates to the website. Demos are up, though they're just the same old ones I had on my site before, and the code base is up with 27 code snippets. They've all been tested in DBC 1.13 and DBP 6.6 and marked accordingly for their compatibility. I turned on line numbers in Geshi when you view code. The only issue I've seen with the line numbers is with Chrome and Safari, selecting the code selects the numbers as well. FF, IE, Opera all work fine with it.

I'll get my updated platform editor posted here soon as I can, but it may not be until Saturday as I'm leaving town in the morning and a certain someone's dog ate the power adapter to my laptop.


BN2 Productions
21
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 26th Nov 2008 23:46
Quote: "certain someone's dog ate the power adapter to my laptop"


PSH! We've ALL used the "my dog ate my homework" excuse, you can come clean with us...

Ever notice how in Microsoft word, the word "microsoft" is auto corrected to be "Microsoft" but "macintosh" just gets the dumb red underline?
Irojo
16
Years of Service
User Offline
Joined: 21st May 2008
Location: Eating toast.
Posted: 27th Nov 2008 00:17
Phaelax-

Nice updates. What's with the username and password in the top right hand corner?

@BN2

Heh heh!


I download memory.

Login to post a reply

Server time is: 2025-05-17 23:35:36
Your offset time is: 2025-05-17 23:35:36