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
Phaelax
DBPro Master
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 11th Nov 2009 07:19
BN2, a prime generator is simple to create, and testing for prime is even easier. I even had a homework assignment in C++ to create a prime generator years ago. You sure about that contest?

BN2 Productions
20
Years of Service
User Offline
Joined: 22nd Jan 2004
Location:
Posted: 11th Nov 2009 10:01
Well the contest was looking for a formula that ONLY returned primes. Algorithms don't count, but this was years ago, and I might have some details fuzzy on it.

The idea, as I recall, is any number you plug in for X will return a prime number (I assume any integer for X, but didn't look into it much).

Great Quote:
"Time...LINE??? Time isn't made out of lines...it is made out of circles. That is why clocks are round!" -Caboose
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 11th Nov 2009 16:10
You can't write a formula to produce prime numbers. The fact you can't divide them by anything means you can't scale up to find like numbers which is what a formula does.

"With games, we create these elaborate worlds in our minds, and the computer is there to do the bookkeeping." - Will Wright
Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 13th Nov 2009 18:37
ok... People indicated an interest in this challenge and so far only 1 entry. What gives?

Enjoy your day.
demons breath
20
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 13th Nov 2009 20:01
busy week (3 courseworks in, couple of all-nighters trying to cram everything in meaning I'm feeling pretty wiped atm). Ima start tomorrow though.

"The fools may crash down upon us in thunderous waves, but we shall Jeku slap them back from whence they came"
-BiggAdd Oct 28th 2009
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 13th Nov 2009 20:53
We have three days and everyone is keeping their entries til the last minute so their highly technical and superior code doesn't give any clues away to the opposition...

TDK

demons breath
20
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 14th Nov 2009 18:28 Edited at: 15th Nov 2009 14:15
Darn. Went to start and my trial period's over - disc'll be here some time this week but I forgot it when I went home so I'm having it mailed up.

EDIT: I'll try it in DarkGDK and then convert the code over and hope it still runs

"The fools may crash down upon us in thunderous waves, but we shall Jeku slap them back from whence they came"
-BiggAdd Oct 28th 2009
pictionaryjr
15
Years of Service
User Offline
Joined: 12th Mar 2009
Location:
Posted: 16th Nov 2009 02:46 Edited at: 16th Nov 2009 02:48
I'm not really sure what everyone meant by the prime number thing, but here's two things that tell prime numbers that I wipped up.

This one says prime numbers starting from the lowest prime number and going up:



This one you enter a number and it tells you if it is a prime number or not:



EDIT:
BTW 0 and 1 are not prime numbers. Just so everyone knows.
demons breath
20
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 16th Nov 2009 03:52
You could probably save some time by stopping it checking numbers after the halfway point.

For example 100 isn't going to be divisible by anything larger than 50 so your for num=0 to t line in there could be a for num=0 to (t/2)+1 instead, which would mean you had to do a little extra calculating there, but when you got to numbers like 1235897 or something it would save a hell of a lot of time.

"The fools may crash down upon us in thunderous waves, but we shall Jeku slap them back from whence they came"
-BiggAdd Oct 28th 2009
Caleb1994
15
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 16th Nov 2009 04:03
the original challenge was a 'sidescrolling tile based program' note. that is not a game necessarily, just a scrolling map that is tile based. just pointing that out.

New Site! Check it out \/
Phaelax
DBPro Master
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 16th Nov 2009 07:13 Edited at: 16th Nov 2009 08:18
Quote: "I ran this switching bitflipmode between 0 and 1 in the setup.ini file just for fun."

What you mean? I have no ini files for DBC. Nice method though, didn't think bitmap commands would be that fast. I got 60fps with your code Latch.

Drawing squares with BOX I only managed 30fps. Using images, paste image or sprites were less than 6fps. I tried using 3D planes and even that was only 4fps. So at this point I'm not even bothering to paste my code.

Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 16th Nov 2009 13:24 Edited at: 16th Nov 2009 13:26
@Phaelax
Quote: "What you mean? I have no ini files for DBC. Nice method though, didn't think bitmap commands would be that fast. I got 60fps with your code Latch."

Busted! You must not be a sticky reader:

Info about Setup.ini and other useful DBC stuff

I'll bet that 60 fps turns into 700...

I'll attach the setup.ini file here as well so you can grab it. Download it to the same directory as DB.exe.

Enjoy your day.

Attachments

Login to view attachments
Ashingda 27
16
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 16th Nov 2009 20:03
Last day guys! Even if Latch is the only entry I hope we all learned something from this at least.

As I recall, the challenge setter can place an entry too but just won't be judged. The entry list is a bit lonely so I'll do just that.

TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 16th Nov 2009 20:29 Edited at: 16th Nov 2009 23:28
Quote: "the original challenge was a 'sidescrolling tile based program' note. that is not a game necessarily, just a scrolling map that is tile based. just pointing that out."


Good point!

The closing of the challenge is later tonight, and anyone who thinks their prime number program has a cat in hells chance of winning is in for a big shock!...

TDK

Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 16th Nov 2009 22:19
uhhh... I think this challenge is a scrolling 2d screen maker.

Enjoy your day.
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 16th Nov 2009 23:35
Damn forum did it to me again - I went to the last page with the button and responded to the last post at the bottom.

But, I wasn't actually on the last page. If there is only a single post on the 'real' last page, sometimes it doesn't appear for me.

I've edited my last post above to quote the message I thought I was following and all should make sense...

My challenge entry:



Note: As my entry scrolls when you use the cursor keys, I've only put the FPS to display in the routines that actually do the work because when not scrolling, I get 1000 fps.

TDK

pictionaryjr
15
Years of Service
User Offline
Joined: 12th Mar 2009
Location:
Posted: 16th Nov 2009 23:39
btw just so everyone knows, i wasn't entering the challenge i was just showing the whole prime generator and stuff that had a conversation going on.
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 16th Nov 2009 23:50
Ah, I see... hijacking the thread eh?



TDK

pictionaryjr
15
Years of Service
User Offline
Joined: 12th Mar 2009
Location:
Posted: 17th Nov 2009 04:42
haha no. was just commenting on someones comment said something about it and took it as a challenge
Ashingda 27
16
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 17th Nov 2009 08:00
Alright, time's up the Challenge is closed.


We have 2 entries!
Latch
TDK


Latch's entry used bitmaps, a small bitmap with enough space to fit a whole column was filled with the needed tiles and copied to the screen. The screen is then moved one pixels width to the left again by usage of bitmaps as default screen = bitmap 0. I didn't know copying bitmap 0,x1,y1,x2,y2 to 0,x1,y1,x2,y2 was faster than if it was anyother bitmap.


TDK's entry used get/paste image, an interesting approach as I've never seen or think it could be that fast! The image of what's need to be displayed is prepared and stored into an image, then pasted onto the screen as you scroll. The array usage was a bit excessive I must say, but the end resaults sure looks nice.


Testing were done using my 2 computers.
Laptop: Latch = 330fps, TDK = 192fps
PC: Latch = 1000fps, TDK = 214


The 1000fps is no joke nor is it a misreading, the tiles where flying across the screen fast! The funny thing is I cannot reproduce this...


TDK has a more readily usable and graphically appealing entry but latch hits the mark as speed was the real challenge here. So if you ever plan to scroll tiles in the future, bitmaps are the way to go!


Resaults:

Runner-up


Winner
Phaelax
DBPro Master
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 17th Nov 2009 11:54 Edited at: 17th Nov 2009 11:55
These are just some challenge suggestions:

ATM challenge



> SELECT * FROM users WHERE clue > 0
> 0 rows returned
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 17th Nov 2009 12:41 Edited at: 17th Nov 2009 12:44
Congrats Latch!

Quote: "The array usage was a bit excessive I must say, but the end resaults sure looks nice. "


Just to let you know that I chose the method I used so as to create a usable scrolling 'play area' - in case anyone wanted to apply the method to their own 2D Sonic-type game.

Rather than just randomly fill the array with tiles, you can use a tile map (hence the inclusion of a text message). Tiles can be placed randomly, but their positions are stored - so you can scroll backwards as well as forwards and see the same tiles.

I have a scrolling map editor partially finished somewhere...

But, I've not checked Latch's entry out, so his may also have the same functionality.

Even so, this wasn't asked for in the challenge and I did know the fps hit would mean it would have little chance of winning but I still wanted to do it for fun.

TDK

Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 17th Nov 2009 20:01
Thanks! Tdks entry was quite attractive and shows a usable sroller skeleton. I should go back at some point and add some user interactability (word?) and the ability to store a complete map to my entry.

Quote: "I didn't know copying bitmap 0,x1,y1,x2,y2 to 0,x1,y1,x2,y2 was faster than if it was anyother bitmap."

I wonder if it has something to do with video versus system memory. I think it's faster to BLiT (transfer data) between the same type than from one type to the other - but don't quote me on that!

Enjoy your day.
Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 17th Nov 2009 20:37
Falling Objects' Reactions

In 2D, have a minimum of 3 different items fall from the top of the screen to the bottom (they don't have to fall at once). When the item reaches the bottom, it must have some kind of reaction. For example, a ball may bounce. A flower pot might smash. A drop of water may splash.

The graphics can be as simple as a box for each item, but it's always nice when a bit of creativity is thrown in the pot. Each box/shape must have it's own reaction.

The reactions can be whatever you want. You could have the screen flash like an explosion, or simply have the object roll or tumble away.

Judging will based on number of different objects/effects. Variety and creativity add points.

Deadline is Sunday November 22, Midnight GMT (Monday Morning)

Enjoy your day.
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 18th Nov 2009 00:36
nice challenge, I'll enter this one.

"With games, we create these elaborate worlds in our minds, and the computer is there to do the bookkeeping." - Will Wright
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 18th Nov 2009 04:32
Quote: "Deadline is Sunday November 22"


Yay - my birthday!

Phaelax
DBPro Master
20
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 18th Nov 2009 22:48
Cool, what's that put you at, about 46?


> SELECT * FROM users WHERE clue > 0
> 0 rows returned
TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 19th Nov 2009 00:31
Add another five years onto that!

TDK

Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 19th Nov 2009 05:06
@TDK
Quote: "Add another five years onto that! "

Your crystal is obviously broken

"With games, we create these elaborate worlds in our minds, and the computer is there to do the bookkeeping." - Will Wright
Ashingda 27
16
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 20th Nov 2009 01:38 Edited at: 20th Nov 2009 20:24
Here's mines, use the mouse to move around and Right-click for the red ball.

Entry1:
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 20th Nov 2009 02:04
Does there have to be three different reactions or are we just making one reaction and many instances of an object?

"With games, we create these elaborate worlds in our minds, and the computer is there to do the bookkeeping." - Will Wright
Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 20th Nov 2009 17:37
Quote: "Does there have to be three different reactions or are we just making one reaction and many instances of an object"

There should be different reactions for different objects. At least 3 different objects and 3 different reactions.

@Ashingda
Hey that's pretty cool. Strangely soothing... Nice work!

Enjoy your day.
Ashingda 27
16
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 20th Nov 2009 18:12 Edited at: 20th Nov 2009 20:23
Thanks Latch . Although I only have 2 different objects, I'm still working on an upgrade entry.


Got it done.

Entry2:
Caleb1994
15
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 20th Nov 2009 23:15 Edited at: 21st Nov 2009 19:58
Aaaahhh I only have 2 days I have been working on one but i'm not sure if it will be done. grrrrrr. I have a glitch and can't find it lol


Edit:

got it working. Ignore anything about water didn't get that to work, but i do have 4 types of objects(dust,fire,glass,bouncy ball)



It's based on dots or pixels. although the glass does come down in 10x1 'plates' and shatters, each pixel of the plate is actually a individual entity by itself and can stand alone. If fire touches any other type of dot then it will destroy itself and the other dot.

Something fun i added is the wind. press five and move the mouse around the center of the screen to change the angle and then use left or right mouse clicks or mouse wheel to change the force. it's quite fun with the dust, if i do say so myself lol.

I wanted to make it so if you burnt the dust then it would turn to glass(i want to change it to be more like sand hahaha)

This game gave me the idea:

Dust Game

Check it out! it's very fun game.

New Site! Check it out \/
Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 21st Nov 2009 17:34
@Caleb
Well done. That is quite an interesting entry. All the effects are pretty good! I like the glass and the wind the best. I had to switch the sync rate down to abount 30 or 40 because it ran at around 500 fps when the sync was at 0 - which was way too fast.

Enjoy your day.
Caleb1994
15
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 21st Nov 2009 19:55 Edited at: 21st Nov 2009 21:37
Thanks! I think this is only my first or second entry on this hole thread I had already thought about trying to replicate that game then i saw this challenge and it gave me the incentive lol

Quote: "I had to switch the sync rate down to abount 30 or 40 because it ran at around 500 fps when the sync was at 0 - which was way too fast.
"


Sorry! i always start my programs with sync rate at 0 then as i move on i ussually change it. The frame rate was still locked at 99 on my machine so it was fine for me i will edit the original post with sync rate at 100 which seemed to work good for me.


Edit:


Got the water to work. Although i'm displeased with the speed. with only 2000 dots(of just water) my fps drops to about 15 I also added walls(just inanimate objects to stop dots from passing), and a clear thing(click and it will clear a 5x5 box of dots around the cursor)

Also changed the map width and height to bitmap 0 width and height.

I am adding ice next(MIGHT be done before tomorrow). where if ice touches water, then the water turns to ice. if ice touches fire the ice turns to water woohoo! This might turn into a full blown project.... hmmmm

I know most of the features in this don't count as "Falling Objects" but they were fun lol

Here it is:



New Site! Check it out \/
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 23rd Nov 2009 03:52
sorry, i've had to work a lot the last few days.
Shame I really liked this challenge. I started to set up a memblock to store a 2D object like DB does wih meshes, I might carry on experimenting with that.

"With games, we create these elaborate worlds in our minds, and the computer is there to do the bookkeeping." - Will Wright
Caleb1994
15
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 23rd Nov 2009 04:48
Quote: "I started to set up a memblock to store a 2D object like DB does wih meshes, I might carry on experimenting with that."


So you are creating a mesh with 2d vectors and no normals, or uv data

New Site! Check it out \/
Latch
17
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 23rd Nov 2009 18:41
RESULTS of the Falling Object Challenge:

There were 2 entries

Ashingda : Very nice 2d sphere dropping demo. A series of spheres pouring out of different tubes. Some spheres jumped, others moved from side to side, some destroyed others. This was well done and looked very nice.

Caleb : A demo of multiple "tools" including bouncing balls, water, filing dust (snow?), fire, wind, breaking glass, and building obstacles. The graphcis were very simple, but it was easily understandable what each tool was doing. Very good work, and very nice particle motion.

The winner is :


Enjoy your day.
Ashingda 27
16
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 23rd Nov 2009 20:38
Good job Caleb, congrats
Caleb1994
15
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 24th Nov 2009 03:21
Wow! thanks!

Although i must say, Ashinga I loved your graphics! Yours was great also!

I am willing to judge the next challenge, but I just can't think of one. So I will leave it up to the community for what kind of challenge you want! Throw out suggestions and i will pick one If i think of something i will put it up though.

New Site! Check it out \/
t10dimensional
15
Years of Service
User Offline
Joined: 22nd Mar 2009
Location: Code Cave, USA
Posted: 24th Nov 2009 04:01
How about a rubik's cube race. If someone is willing to, he could build a skeliton of the code(display,mixing and timer) and leave a small part for solving it. And to find the winner you could ethier have a set mixed up cube or whoever has the best out of 10.

Razerx
demons breath
20
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 24th Nov 2009 04:12
Over the last page or two if you don't have any ideas there have been a few ideas which have been quite good. I personally prefer the challenges where there have been basic guidelines but then you have the option to build on them, but again that's just me and I can't get DB to work so I don't know how much my vote counts...

Caleb1994
15
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 24th Nov 2009 05:00 Edited at: 24th Nov 2009 05:05
Banking system

The requirements are that you have to be able to withdraw and put in money, and you must be able to pay a bill or buy something. or in other words spend the money in some way.

It could be in 2d or 3d. It could be as simple as text displayed on the screen or have a actual 3d teller and have it be a actually bank. or even have it be a atm. Whatever you see fit.

Will be judged on creativity, and features. I don't think that speed is really a issue with this challenge.

Because this is during the holidays, I think i will put the Deadline as December 4th If anyone objects the this timeframe(almost 2 weeks) then i will change it, but i figure people will no doubt be busy this week.

New Site! Check it out \/
Ashingda 27
16
Years of Service
User Offline
Joined: 15th Feb 2008
Location:
Posted: 24th Nov 2009 06:54
This sounds fun!
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 24th Nov 2009 07:03
@Caleb
Just to get this straight - we're making something for depositing and withdrawing money. So could this be anything from a piggybank to a stockmarket simulator?
I'm doing an accounting course so I'll put that to good use

"With games, we create these elaborate worlds in our minds, and the computer is there to do the bookkeeping." - Will Wright
Caleb1994
15
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 24th Nov 2009 15:32
Quote: "So could this be anything from a piggybank to a stockmarket simulator?"


Of course! like you said anything that will withdraw/doposit(thanks for that word i couldn't rmember it) money and spend it.

New Site! Check it out \/
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 26th Nov 2009 06:55
I'm probably not awake enough to be having "ideas" so this might sound crazy but what if we had a series of scrapheap code challenges. What I mean by that is instead of starting from scratch every challenge, you have to re-use your old code from the previous challenge and alter it to fit its new purpose. The person with the best program and fewest alterations wins.

"With games, we create these elaborate worlds in our minds, and the computer is there to do the bookkeeping." - Will Wright
jason p sage
16
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 26th Nov 2009 08:51
Neat Idea Obese87.

You know how some game making tutorials kind of take you step by step on how to make a game, and each step is "COOL" but as you progress it keeps getting cooler and cooler (hopefully - )

I like that idea of building ... it's a longer commitment maybe, but that could potentially turn the "small challenges" into a slightly spread out series - that ends up generating a few nearly complete or completed games by multiple people at the same time....

Tired or not Obese87, I know I have a slightly different slant on it, but your idea is really really cool!

TDK
Retired Moderator
21
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 8th Dec 2009 12:49
The deadline has passed - 4 days ago!

Nothing has been posted in 12 days.

Is this thread now officially abandoned? Should it be locked?

Do we all now move to DBPro now the free version is available?

TDK

Login to post a reply

Server time is: 2024-03-29 07:33:24
Your offset time is: 2024-03-29 07:33:24