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
qwe
22
Years of Service
User Offline
Joined: 3rd Sep 2003
Location: place
Posted: 18th Dec 2007 00:37
the fire challenge unfortunately covered finals week

4 player 3D space combat sim! Coding nearly finished! Visit WIP thread!
http://forum.thegamecreators.com/?m=forum_view&t=112036&b=8
Ric
21
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 8th Jan 2008 09:46 Edited at: 8th Jan 2008 09:49
Happy new year to all! After a three week break for the special Christmas Challenge, we're back to normal again with the challenges. To start the year off, I thought it would be nice to go back to basics, and set a challenge that everyone can have a go at - including people who have only just landed a copy of DBPro for Christmas. And for the experts, there's still plenty of scope for innovation.

_________________________________________________________________

Challenge

PONG! It's the classic bat and ball game - and for many is the first game they write in a new language, because although it is simple, it contains some key components common to most games including user input and control, basic motion/physics, collision, simple AI, and score keeping. For the experienced coder that has written Pong many times in many languages, it still never runs out of scope, because there are always new variations to come up with, and improvements you can make to physics, AI, and overall style.

Deadline

Two weeks, which takes us to Tuesday 22nd January 2008.

_________________________________________________________________

Have fun!



Visit www.andromedus.com today!
CuCuMBeR
23
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 8th Jan 2008 13:38 Edited at: 8th Jan 2008 18:33
Hmm..I realised i never had time to enter these challenges but now i think i can join this simple but fun challenge..
Here is somethin i wrote 2 years ago:
Buck1000
18
Years of Service
User Offline
Joined: 10th Dec 2007
Location: Behind you
Posted: 8th Jan 2008 14:27
Can you use external media? And are there any prizes?
DB PROgrammer
19
Years of Service
User Offline
Joined: 9th Feb 2007
Location: Nowhere But Everywhere
Posted: 8th Jan 2008 15:09
@Buck1000
Quote: "Can you use external media?"

No.
Quote: "And are there any prizes?"

No.

@Anyone
I might join this

BMacZero
20
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 8th Jan 2008 15:53
The prize is that you get to set the next challenge.


[i]"Grow food in dirt? Save time — eat dirt."[i]
Buck1000
18
Years of Service
User Offline
Joined: 10th Dec 2007
Location: Behind you
Posted: 8th Jan 2008 21:53
Quote: "The prize is that you get to set the next challenge."

Good enough for me!!!
gadgetfreak 66
19
Years of Service
User Offline
Joined: 26th Sep 2006
Location: Kulin,WA, Australia
Posted: 9th Jan 2008 13:02
there was a pong challenge here not that long ago, wasn't there?

acelepage
22
Years of Service
User Offline
Joined: 2nd Jun 2004
Location: Plattsville
Posted: 9th Jan 2008 17:42
I'm pretty sure there was, because I still have my entry. I did a 3D ping pong table.

( 2b || !2b ), that is the question. The answer: true
Ric
21
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 9th Jan 2008 18:02
Maybe, although I don't remember it if there was. There have been challenges where you could have made pong, like if it was 'write a game which uses a ball'.

Nevertheless, there's always more you can add to a pong game! I love playing pong - so I'm looking forward to seeing if anyone can make one with really good AI and playability.



Visit www.andromedus.com today!
Sven B
21
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 10th Jan 2008 08:02
And with 5,661 messages and 142 pages, I don't think it's that weird to use a previous challenge once in a while...

Sometimes I'm still surprised you guy can still come up with something...

It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.
flashing snall
20
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 10th Jan 2008 13:11
i never made pong when i started coding, so i guess now ill come back to it....
I just got my basic pong game up last night. For my second ever AI attempt i think it came out all right. Now its just time to spruce it up.


This is my WIP, not even ready for a WIP thread yet though.http://smallgroupproductions.com/
dark coder
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 11th Jan 2008 05:44 Edited at: 11th Jan 2008 05:51
Well I've never actually made pong before so I figured I'd enter, without using any line concatenation(though I used concatenation after if/then conditions, that's not the same ) this is the shortest playable pong I could come up with, though I could have further reduced the code but there's no point in inserting pointless lines!



[Edit] One line less

Ric
21
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 11th Jan 2008 16:29
Nice and concise!

quote]without using any line concatenation(though I used concatenation after if/then conditions, that's not the same[/quote]

Makes it just as unreadable though! For those of us who like to be able to read the code:



The only odd thing is that the 'centre' line is offset to the top left of the screen for some reason .... was it like that on your system, or has the code snippet box fiddled with the number of spaces you put into your code?



Visit www.andromedus.com today!
dark coder
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 11th Jan 2008 18:31
Well this is what I see when I open the default IDE, paste my code and F5:



Maybe your system font is different? (sounds like a plot to add more lines to my code!)

Ric
21
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 11th Jan 2008 19:29 Edited at: 11th Jan 2008 19:29
Here's what I see - also the default IDE:



I'm sure using the line command in a simple for-next loop would be the easier way of doing this anyway!



Visit www.andromedus.com today!
BillR
23
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 12th Jan 2008 02:39
Ric - it looks like yours is defaulting to a different font.

Mine seems to work fine.
Bongadoo
20
Years of Service
User Offline
Joined: 4th May 2006
Location:
Posted: 12th Jan 2008 14:25
Because I'm bored this morning I decided to try and condense down that code, I don't know why. 23 lines with no concat. There's room for more though



while death = 0 : life() : endwhile
gbark
20
Years of Service
User Offline
Joined: 14th Oct 2005
Location: US - Virginia
Posted: 12th Jan 2008 20:43 Edited at: 21st Jan 2008 02:30
Here's my pong game so far...



* Arrow keys to move
* Space key to "kick" and serve the ball
* Adaptive CPU difficulty
* First to 10 points wins

Might do some work later to trim it down a bit more, but here it is for now.


By the way dark coder, that code is pretty amazing, never thought you could fit even something like pong into such a small amount of space!


EDIT: New version of code on the next page.
dark coder
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 12th Jan 2008 22:02
@Bongadoo

There's only one issue with your version, the ball never speeds up so it's impossible to win(the enemy can track faster than the ball).

Bongadoo
20
Years of Service
User Offline
Joined: 4th May 2006
Location:
Posted: 12th Jan 2008 23:26
Yea I know Just tried to make the most basic version I could in a couple of hours. I just like to try to condense code, I think it's an illness.

I'm trying to make a soft body physics system for this, so I'll see how far I get before the deadline

while death = 0 : life() : endwhile
qqwy
18
Years of Service
User Offline
Joined: 3rd Jan 2008
Location:
Posted: 14th Jan 2008 20:04
i have almost finished my main pong script.
but... the ball won't fly


please help



parachute for sale, once used, never opened, slightly red stain
BillR
23
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 15th Jan 2008 02:48 Edited at: 15th Jan 2008 02:53
@qqwy - not a bad start, keep up the good work.

I always use debugging print statements when variables don't seem to be doing what I thought they should

1) I put print statements down by your sync command
2) You either have to update the x and y variables (ballx, bally)
or update the same variable newballx=newballx+ballxspeed.
Your ballx variable was never getting updated, so I added 2 lines there.
3)Your ballspeed variables were too large, ballxspeed=100
I set x and y speed to 1, and it works better now.

Try This:


Good Luck!
Ric
21
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 15th Jan 2008 09:25
@gbark - nice to see that you have coded the AI to predict where the ball will end up, rather than just moving with the ball. Having said that, it should be possible to do that with a single calculation once the player has hit the ball, rather than iterating, and re-iterating, every single loop. I think it would be something like this:

predicted_cpu_paddle_y = current_cpu_paddle_y + (ball_velocity_y * projected_distance_x / ball_velocity_x)

and then you'd have to take into account bounces off the top or bottom of the screen as you did before.



Visit www.andromedus.com today!
qqwy
18
Years of Service
User Offline
Joined: 3rd Jan 2008
Location:
Posted: 15th Jan 2008 20:13
thank you BillR,

im now a bit further, but

A: the kick off will not work
B: the score is waving.

help please.



parachute for sale, once used, never opened, slightly red stain
BillR
23
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 16th Jan 2008 08:16
@qqwy - I tried your new code...
1) the space key to kick off the serve works fine for me.
2) I don't see any waving in the score if you mean waving (unsteady) numbers. What do you mean by wavy?

I did notice your computer paddle moves too quickly and always knows where the ball will be. Players can't win a rally, and they won't want to play your game after the first time.
qqwy
18
Years of Service
User Offline
Joined: 3rd Jan 2008
Location:
Posted: 16th Jan 2008 12:07
OOOOOOOOOOOOH, NOOOOOOOO!!!
i was trying the code of Gbark when i made this message, and i put the code of Gbark in my message, thousand times sorry.

when i am home, i will upload my own new code again.

parachute for sale, once used, never opened, slightly red stain
qqwy
18
Years of Service
User Offline
Joined: 3rd Jan 2008
Location:
Posted: 16th Jan 2008 12:07
OOOOOOOOOOOOH, NOOOOOOOO!!!
i was trying the code of Gbark when i made this message, and i put the code of Gbark in my message, thousand times sorry.

when i am home, i will upload my own new code again.

parachute for sale, once used, never opened, slightly red stain
qqwy
18
Years of Service
User Offline
Joined: 3rd Jan 2008
Location:
Posted: 16th Jan 2008 12:07
OOOOOOOOOOOOH, NOOOOOOOO!!!
i was trying the code of Gbark when i made this message, and i put the code of Gbark in my message, thousand times sorry.

when i am home, i will upload my own new code again.

parachute for sale, once used, never opened, slightly red stain
qqwy
18
Years of Service
User Offline
Joined: 3rd Jan 2008
Location:
Posted: 16th Jan 2008 12:09
whaa! please, mods, erease the triple messages.sorry

parachute for sale, once used, never opened, slightly red stain
Benjamin
23
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 16th Jan 2008 12:09
To avoid posting multiple times in a row, when you hit "post message" check that the message hasn't been posted before you try posting it again when you've modified it.

qqwy
18
Years of Service
User Offline
Joined: 3rd Jan 2008
Location:
Posted: 16th Jan 2008 17:36
yeah, sorry

here is the REAL script (and not Dbark ones)



parachute for sale, once used, never opened, slightly red stain
gbark
20
Years of Service
User Offline
Joined: 14th Oct 2005
Location: US - Virginia
Posted: 17th Jan 2008 04:34 Edited at: 20th Jan 2008 22:25
@Ric -

Thanks for your suggestion. I purposefully had the cpu update predict the ball "on the fly" rather than just once per bounce, so that I could control how far it looks ahead and essentially change how fast its "reflexes" are.
That way if the player is really suffering, the reflexes will drop to a point to where the cpu does pretty much just follow the ball as it gets closer (wouldn't be possible if it only checked once per bounce), but if the player is doing good, then the cpu will guess where the ball will move in one movement.

However, you're right about not needing to iterate each time this check is performed. Thanks to your suggestion, I've gotten rid of that for-loop altogether, and now the entire prediction is just one line (exluding the bits to check for border-collisions). Cheers!


Will post updated code once I fine-tune the difficulty a bit.


EDIT:
Final version.
Zergei
21
Years of Service
User Offline
Joined: 9th Feb 2005
Location: Everywhere
Posted: 20th Jan 2008 17:09
Here's a pong game i made quite some time ago.



Further on my stuff at...
TurboSquid.com
The3dStudio.com
Garzu
21
Years of Service
User Offline
Joined: 31st Oct 2004
Location: London
Posted: 21st Jan 2008 00:45
My Entry.
cursor keys to move, ball speeds up every time it hits a bat. possible slight angle change every time it hits a bat to stop looped game. CPU bat gets faster the more score you get.
first to 5 wins.



Finished Projects : Spellmaker (Old Boardgame)
Current Project : PBeM helper for Twilight Imperium III(Boardgame)
yes.... I Like Boardgames!!
Rburke
19
Years of Service
User Offline
Joined: 28th Sep 2006
Location:
Posted: 23rd Jan 2008 11:36 Edited at: 23rd Jan 2008 11:40
I created a space themed pong. I appologize for the wait at the beginning, but I wanted to add a couple of graphics to better the game play experience. (Loading Bar Added)... This Pong is different from just a normal pong. Your score is determined on how fast the ball was going when you scored against the AI.

Controls: Just Use the Mouse to move your paddle up and down.

Ric
21
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 24th Jan 2008 11:06
Ok - judging time!

Hope everyone enjoyed the gentle start to the challenges this year! A close contest this one, but the winner is:

Garzu

Nice presentation (I liked the digital scores too). I also think it's the first 3d Pong game I've played where you can actually tell where the ball is going to hit your bat. The AI is a bit too good - it get's most shots, but overall well executed.

Just to add in with the fun, I created a Pong game too - as I wasn't allowed to enter anyway I thought I'd be diferent and write it in Flash - you can play it here: http://www.themagicblackboard.com/html/pong.html

So, what's the next challenge Garzu?



Visit www.andromedus.com today!
Garzu
21
Years of Service
User Offline
Joined: 31st Oct 2004
Location: London
Posted: 24th Jan 2008 13:53 Edited at: 24th Jan 2008 15:01
Challenge

Animated Stickmen!
2D or 3D animated Stickmen, can be user controllable or just a visible demo.

Deadline

Two weeks, which takes us to Thursday 7th February 2008.

enjoy!!!

I removed my original suggestion because it involved building the exe first then testing (it involved Command line parameters.... way too much aggro!)

I removed my second suggestion as breakout was a previous one!
(I wanted to build upon the prevoous challenge)

Finished Projects : Spellmaker (Old Boardgame)
Current Project : PBeM helper for Twilight Imperium III(Boardgame)
yes.... I Like Boardgames!!
Ric
21
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 24th Jan 2008 17:54
Sounds good.

There actually was an animation challenge some way back, in which some stick man animations were created (including one by me in fact) - but I'd still say stick (no pun intented) with this idea, as it really was a long time ago and most of the competitors then are different from those around now.

It would also be interesting if anyone were to go down the physics/ragdoll route for this, or manage to get some kind of game working involving stick men.



Visit www.andromedus.com today!
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 1st Feb 2008 19:25
I think I remember that old stick animation challenge, I did a basic shooter game.


Garzu
21
Years of Service
User Offline
Joined: 31st Oct 2004
Location: London
Posted: 7th Feb 2008 11:45
is this a first ? no entries at all. according to the rules, does this mean I have to set something else ?

Finished Projects : Spellmaker (Old Boardgame)
Current Project : PBeM helper for Twilight Imperium III(Boardgame)
yes.... I Like Boardgames!!
Ric
21
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 8th Feb 2008 10:00
Wow - was that two weeks already? That flew past, I had intended putting in a last minute entry but looks like I am too late.

It doesn't usually happen, but don't worry - it's not the first time a challenge didn't get an entry. Yes, please set another challenge, and I'd suggest something pretty simple.

Just an idea - how about a simple base defence game like this: http://www.gamegecko.com/red.php



Visit www.andromedus.com today!
Garzu
21
Years of Service
User Offline
Joined: 31st Oct 2004
Location: London
Posted: 8th Feb 2008 11:29
New Coding Challenge

Blackjack

Deadline : Friday 22nd Feb

This should be useful for beginners to get used to using arrays and random numbers.
Card Suit Symbols can be found in the font "symbol"





Finished Projects : Spellmaker (Old Boardgame)
Current Project : PBeM helper for Twilight Imperium III(Boardgame)
yes.... I Like Boardgames!!
BMacZero
20
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 8th Feb 2008 15:30
Sound's pretty good, I think I'll be entering.


Powered by Box2D Physics. Thanks Diggsey!
Rburke
19
Years of Service
User Offline
Joined: 28th Sep 2006
Location:
Posted: 11th Feb 2008 10:27 Edited at: 11th Feb 2008 11:03
I still need to add a split function and also I need to create a random sequence for a set of cards right now its spitting cards out at random. Should be complete soon.

Left clicking on numbers will increase bet
Right clicking on numbers will decrease bet

Ric
21
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 11th Feb 2008 11:43
That's pretty good. Perhaps a nice little message at the end when you wipe out the dealer to say 'Thank you for playing in our casino - now please take your money and don't come back' or something - as it is, it just freezes.

I guess the five card trick rule must be an English thing?



Visit www.andromedus.com today!
Jeff Miller
21
Years of Service
User Offline
Joined: 22nd Mar 2005
Location: New Jersey, USA
Posted: 11th Feb 2008 12:43
The 5-card trick is only applicable in private games in this end of the universe. Also, over here the one of the dealer's cards is always dealt face-up.

There are two other plays used in casinos:

Insurance: If the dealer is showing an ace or a ten(or picture card), you can insure your hand with a side bet, in essence betting on the dealer to have a blackjack. If the dealer does have a blackjack, the insurance bet pays two to one.

Surrender: Before playing your hand, you can surrender it for half of your bet. This is a good play if you are sitting with a 16 and the dealer is showing a 10. In the late 70's they permitted "early surrender", meaning that you could do this before the dealer got to the point of declaring a blackjack. Now, collection of the surrender bet awaits the determination of the dealer's hand. If the dealer was dealt a blackjack, you lose all your bet (unless you have one, which is a "push", in which case you would not have surrendered anyway).

Other casino rules:
You generally can't take a hit after a split of aces.
You can't increase the number of hands you are playing during the course of a shoe (collection of decks from which the cards are dealt, now usually 6 decks). I.e., you can play two hands, but you have to start the shoe playing two hands. You CAN reduce the number of hands you are playing mid-shoe.
Garzu
21
Years of Service
User Offline
Joined: 31st Oct 2004
Location: London
Posted: 11th Feb 2008 13:55
the thin I noticed is that it always used the Ace as an 11, not as 1 OR 11..

Finished Projects : Spellmaker (Old Boardgame)
Current Project : PBeM helper for Twilight Imperium III(Boardgame)
yes.... I Like Boardgames!!
BMacZero
20
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 11th Feb 2008 15:33
That's pretty cool! Here's mine, it's all text at the mo. I think I'm going to stick with text, though though I may add a little color. I too need to add split, surrender, and insurance.




Powered by Box2D Physics. Thanks Diggsey!
Jeff Miller
21
Years of Service
User Offline
Joined: 22nd Mar 2005
Location: New Jersey, USA
Posted: 11th Feb 2008 19:30
For those adding insurance and/or surrender, remember to make the available initial bets evenly divisible by 2.

The first game I ever made was Blackjack, in Fortran on punch cards 40 years ago. Made another - in COLOR Basic, perhaps 25 years ago. Only way to save that code was on audio cassette, but it sure beat punch cards.

Login to post a reply

Server time is: 2026-07-08 04:18:43
Your offset time is: 2026-07-08 04:18:43