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
Philip
23
Years of Service
User Offline
Joined: 15th Jun 2003
Location: United Kingdom
Posted: 21st Mar 2007 00:23 Edited at: 21st Mar 2007 00:23
@Nicholas

Quote: " I know that it is more than possible to join two bezier curves together, "


Oh absolutely. Thats not the point I was making though. I was making the point that splines make it possible to join two splines together with a more smooth and, er, more natural looking (sorry - very inexact use of English there!) curve. It looks more like a continual curve and less like two disjointed curves that have been stuck together.

You can of course do a lot to mitigate this with beziers but that takes quite a lot of effort in my experience.

Cheer if you like bears! Cheer if you like jam sandwiches!
"I highly recommend Philip" (Philip)
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 21st Mar 2007 08:31
I don't understand what you mean by spline over bezier curve, since a bezier curve IS a type of spline.

Ric
22
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 21st Mar 2007 10:36 Edited at: 21st Mar 2007 18:55
How you are going to detect collision with your spline?

@Code Dragon: that looks good - I will do the same, thanks. BTW, I can't seem to find a syntax prompt - ie. when you type a recogised command, it displays the usage so you know what parameters it expects. Is there one? <edit> Never mind ... just updated to the latest version, which has syntax prompting.

Here's my effort so far. Few things still to add, but it kinda works.



Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 21st Mar 2007 21:44
Collision is pretty simple with the spline, its really no more difficult than a simple "line to object" intersection test. It's just with as many lines as you used to draw the curves.

acelepage
22
Years of Service
User Offline
Joined: 2nd Jun 2004
Location: Plattsville
Posted: 21st Mar 2007 22:15 Edited at: 23rd Mar 2007 22:16
Code entry: top down racer

You are the blue car.

Edit: I have updated the code so that it compensates for CPU speed (thanks Ric). I have improved collision detection for the walls, and all the cars have the same top speed now.



( 2b || !2b ), that is the question. The answer: true
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 22nd Mar 2007 06:38
not bad, but needs a few things. Controls were way too sensitive. And the purple car moved faster than I did, leaving me no chance to ever get ahead. Half the cars got stuck in the walls eventually.

Ric
22
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 22nd Mar 2007 13:53
Very nice work Acelepage. I found the controls just about right, but looking at your code I can't see any timer control, so on a fast computer, everythnig is going to be more sensitive. Adding in 'sync rate 60' and whacking the maxspeed# up a bit should do the trick.

Nice AI code - no waypoint data, just maths. The faster you set the max speed, I found, the more likely it is they crash into the walls. Not sure if it was my imagination, but I think the cars swerve to avoid you (great AI if they do) - perhaps you could add the same theory to make them avoid the walls.

I found it was possible to beat the purple car by taking a tighter line around the corners.

acelepage
22
Years of Service
User Offline
Joined: 2nd Jun 2004
Location: Plattsville
Posted: 22nd Mar 2007 15:15
@Phaelax: I set the speed of your car slower on purpose, because otherwise it was too easy to win. You can't beat them on the straight away, but you can take them on the curves, based on my go-cart driver training

@Ric: Yes, I have collision avoidance so the cars swerve to miss other cars. I didn't have time to set it up for the walls as well, just relied on the math to keep the cars on track. But, collision avoidance takes precedense and can drive the car into a wall.
I don't have a good timer control function, so I'll have to work on that. It shows that I run on a slow processor.

( 2b || !2b ), that is the question. The answer: true
Ric
22
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 22nd Mar 2007 20:35
You probably know all this already, but the timer method I use (other than setting the sync rate) is really easy:

before the main loop:



and at the beginning of the main loop:



Then, anywhere you have an incremental value, you just multiply the increment by dt# (the time for each loop).

eg. speed=speed+acceleration becomes speed=speed+acceleration*dt#

You then have to change your max speed values etc. accordingly, but things then work the same for all pc's.

gadgetfreak 66
19
Years of Service
User Offline
Joined: 26th Sep 2006
Location: Kulin,WA, Australia
Posted: 23rd Mar 2007 11:42 Edited at: 23rd Mar 2007 11:44
3 entries so far by my count. Deadline in 18 hours, so if you haven't posted your entry yet, just enter what you've done so far.

@Daemon:
The AI cars just rotate on the spot, collide with the one next to them, and just sit in a row of three on the starting grid. Is the AI not complete or is this not supposed to happen?

acelepage
22
Years of Service
User Offline
Joined: 2nd Jun 2004
Location: Plattsville
Posted: 23rd Mar 2007 17:12
I have updated my code to handle wall collision avoidance, compensates for CPU speed (thanks Ric), and all cars have the same top speed (no handicaps).
The updated code is in the original post (go up 6 posts to find it).

I would invite feedback on the CPU compensation bit. I adjusted it to run OK on my CPU. Not sure how it will react to faster CPUs. Please let me know if it runs too fast. Thanks.

( 2b || !2b ), that is the question. The answer: true
Daemon
20
Years of Service
User Offline
Joined: 16th Dec 2005
Location: Everywhere
Posted: 23rd Mar 2007 22:51
Quote: "@Daemon:
The AI cars just rotate on the spot, collide with the one next to them, and just sit in a row of three on the starting grid. Is the AI not complete or is this not supposed to happen?"

That is not what happens on my computer!!! Here is the code I'm running (All I've added is that it sets display mode).



I've attached the exe my computer makes when it runs this, I don't know why it wouldn't work on your computer.

Ric
22
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 24th Mar 2007 00:44
Didn't quite get time to add everything I wanted to, but here is my final entry. You are the red car in pole position, and it's first to complete 3 laps. By the way, there is shortcut detection, so no cheating! And yes, it is possible to win, although it's not easy!



gadgetfreak 66
19
Years of Service
User Offline
Joined: 26th Sep 2006
Location: Kulin,WA, Australia
Posted: 24th Mar 2007 04:35
@Daemon:
That executable wont even run on my computer, nothing happens when i try to run it. What version of DBPro are you using?

acelepage
22
Years of Service
User Offline
Joined: 2nd Jun 2004
Location: Plattsville
Posted: 24th Mar 2007 06:09
@Daemon: your code works fine on my PC. I checked your executable and it runs the same. When I checked your code I noticed you have sound in it, which does not play on my PC. I have never tried midi files, so it may be an incompatibility.
I run a 1.5GHz processor. I didn't notice any timing in the code. Do you adjust for CPU speed?
My code had a problem with the turn rate, which I did not adjust for CPU speed, so the cars might turn to fast. On a really fast CPU, perhaps the cars end up spinning. These are just guesses to why gadgetfreak might be seeing the problem.

( 2b || !2b ), that is the question. The answer: true
acelepage
22
Years of Service
User Offline
Joined: 2nd Jun 2004
Location: Plattsville
Posted: 24th Mar 2007 06:15
@Ric:
That is a fast racing game. I get the feeling from the steering that I am flying a space ship rather than a car. You should have made it a top-down spaceship racer. Can't imagine how long it would take me to win. It your assurance of a possible win a theory, or did you actually beat the computer?
Of course, when you write the code, it is easier to beat the game. I often make my games too hard for others because I am able to beat my own code.
I'm impressed by the very different interpretations of a top-down racer we got here. I thought they might end of being very similar, and then are all quite unique.

( 2b || !2b ), that is the question. The answer: true
Veron
19
Years of Service
User Offline
Joined: 22nd Nov 2006
Location:
Posted: 24th Mar 2007 06:19
Hmm, nice work there Ric! Only problem was that I cheated in it, and it still said I finished in position 1, but it said "Unlucky"

Other than that, very nice work!

Need web design help with PHP or XHTML? E-mail me!
http://veron.sitesled.com Visit Veron! Free games, programs and applications! Made in DBPRO, FPSC, and C++!
gadgetfreak 66
19
Years of Service
User Offline
Joined: 26th Sep 2006
Location: Kulin,WA, Australia
Posted: 24th Mar 2007 08:42
yeah, the turning might be the problem. Currently I'm running on a 2.4 GHz Pentium M, and often things without timing run at lightspeed.

gadgetfreak 66
19
Years of Service
User Offline
Joined: 26th Sep 2006
Location: Kulin,WA, Australia
Posted: 24th Mar 2007 09:00
actually, now I've looked properly, Daemon has just used a sync rate, and it looks more like an issue with actually moving the ai cars. I'm still running version 1.055 of DBPro, due to the need to have the latest directx for the newest version.

Ric
22
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 24th Mar 2007 10:28
@Acelepage: yes, I didn't quite get time to fine tune the friction settings, so it is a bit like space ship/boat racing!! I can actually beat the computer each time, but you are right - I've practised it a lot while testing it.

gadgetfreak 66
19
Years of Service
User Offline
Joined: 26th Sep 2006
Location: Kulin,WA, Australia
Posted: 24th Mar 2007 16:45 Edited at: 24th Mar 2007 16:46
Okay, I think its definitely time now.
Three entrants: Daemon,Ric and Acelpage.

Runner up:


Winner:


Daemon
20
Years of Service
User Offline
Joined: 16th Dec 2005
Location: Everywhere
Posted: 25th Mar 2007 02:52
Yay, thanks for judging my entry even though it doesn't run on your computer. My guess would be that the sound is what is causing the problem, since I don't actually know exactly how it works. Or, your computer may think the cars are colliding with the ground and that is why they are not moving.
I don't know what version of Dark Basic Pro I am using because the computer with it on is currently having big problems. I hope it is fixed soon, or else I won't be able to judge entries. If after too long we make no progress fixing it, Acelpage may have to judge. For now I will think of what the next competition should be.

Ric
22
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 25th Mar 2007 03:30
Congratulation Daemon - nice work. It ran fine here.

It is worrying though that even the compiled exe file didn't work for Gadgetfreak. It makes the job of writing programs in dbpro extremely difficult if you can't get compatability within the same platform.

Look forward to your new challenge.

acelepage
22
Years of Service
User Offline
Joined: 2nd Jun 2004
Location: Plattsville
Posted: 25th Mar 2007 07:03
@Daemon,
Good job. I thought that your game had a very arcade style play to it. Very smooth, and I always wanted to try it again.

( 2b || !2b ), that is the question. The answer: true
Nicholas Thompson
21
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 25th Mar 2007 13:27
Crap - that went too quick I wanted to enter!

[center]
Daemon
20
Years of Service
User Offline
Joined: 16th Dec 2005
Location: Everywhere
Posted: 25th Mar 2007 18:32 Edited at: 25th Mar 2007 18:34
I was thinking about making the next challenge be to make a team based game like soccer(football) or basketball. It would be judged on the ai of both the human player's team and the opponents. This might be too complicated, however, for a challenge.
Another possibility is something with RTS controls. Possibly a real time strategy capture the flag.
I'm open to suggestions since I'm not confident about either of these ideas being a good competition.
(My computer's still not working.)

Ric
22
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 25th Mar 2007 19:45
Would be a tricky one - I'd be up for the challenge, but I'd see how many other people would be interested too before finalising this one if I were you. I'm thinking top-down, like Kickoff, or Speedball!

Daemon
20
Years of Service
User Offline
Joined: 16th Dec 2005
Location: Everywhere
Posted: 25th Mar 2007 21:35
Well, possibly if I were to reduce the scale. Parts of team games could be done. Like penalty shots against an ai goalie or free throws.

Diggsey
20
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 25th Mar 2007 21:35
What about ULTIMATE PONG
You make a game that includes the basic pong principle, but with cool effects, new gameplay etc. Basically, you try and show off as much as possible in a normally simple game!

Daemon
20
Years of Service
User Offline
Joined: 16th Dec 2005
Location: Everywhere
Posted: 25th Mar 2007 21:38 Edited at: 25th Mar 2007 22:15
The pong idea could be interesting. I think some people would come up with really creative ways of making it challenging.

Edit: My computer is now working so I can be judge! Good ol' system restore.

Ric
22
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 26th Mar 2007 01:29
The pong idea would probably get more entries too.

gadgetfreak 66
19
Years of Service
User Offline
Joined: 26th Sep 2006
Location: Kulin,WA, Australia
Posted: 26th Mar 2007 03:11 Edited at: 26th Mar 2007 03:12
The pong idea sounds good to me. It looks like it'd be fairly easy to code, and have quite a bit of room for innovation.

Nicholas Thompson
21
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 26th Mar 2007 11:19
I already have an entry for this

http://www.thingy-ma-jig.co.uk/projects/pongis

[center]
Diggsey
20
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 26th Mar 2007 18:53
Is anyone actually going to set this pong challenge???

Ric
22
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 26th Mar 2007 19:23
I think we all seem to be in agreement, so on Daemons behalf;

New Challenge: Pong
Deadline: 2 weeks (9th April)

I'll let Daemon add any additional notes for guidance, but at least this kicks things off until he gets back to his PC.

NA170425
User Deleted
Posted: 26th Mar 2007 23:38 Edited at: 27th Mar 2007 22:45
For starters here's a pong game I wrote a few months ago. I'll spice it up a bit and convert to 3D and poof, there's an entry.



[edit2]

Here's another update. Two paddles, one keyboard controlled and one mouse controlled.



By reading this you have given me brief control of your mind.
Figure this out: ¿Un libro? Yo odio los libros. Libro es estúpido.
Foe7
19
Years of Service
User Offline
Joined: 26th Mar 2007
Location:
Posted: 27th Mar 2007 02:24


You are the red paddle. Use your mouse to move. When you hit the spinning-red-cube-thing, the game mode becomes even more fun.
Daemon
20
Years of Service
User Offline
Joined: 16th Dec 2005
Location: Everywhere
Posted: 27th Mar 2007 21:47
Sorry I didn't post before to declare the challenge.

I think this challenge will be most fun if there are not too many guidelines. There must be something similar to a ball and a paddle and it is a game. The competition will mostly be judged on the game play, though looking good is always a plus.

One reason I don't feel I should set too many guideline is that I won't be able to judge. Not only because my computer with Dark Basic Pro is worse than ever (can't run Notepad, Task Manager, etc.) but also I am going on vacation for spring break. I hope Acelepage can judge instead.

Good luck everyone with this challenge.

acelepage
22
Years of Service
User Offline
Joined: 2nd Jun 2004
Location: Plattsville
Posted: 27th Mar 2007 22:12
I got you covered Daemon. I will be available April 9 to judge.

( 2b || !2b ), that is the question. The answer: true
Daemon
20
Years of Service
User Offline
Joined: 16th Dec 2005
Location: Everywhere
Posted: 28th Mar 2007 01:13
NA170425
User Deleted
Posted: 30th Mar 2007 02:59
How about coopertive pong, would that be interesting? The two players have to bounce pong balls around obstacles and into a goal cube to score points. Just an idea, really.

By reading this sentence you have given me brief control of your mind.
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 1st Apr 2007 01:33
sounds like pong soccer! Interesting.

NA170425
User Deleted
Posted: 2nd Apr 2007 15:57 Edited at: 12th Apr 2007 23:47
Actually I was thinking something more like Super Monkey Ball than soccer. Try it out, you'll see what I mean.

The goal is to bounce the pong balls coming from the generator into the green goal cube. The red paddle is controlled by the arrowkeys and the teal one is controlled by WASD. (This is a two player game) You can use the mouse to control the camera manually but you shouldn't have to as I've preset coordinates.



By reading this sentence you have given me brief control of your mind.
TinTin
20
Years of Service
User Offline
Joined: 16th May 2006
Location: BORG Drone Ship - Being Assimilated near Roda Beta (28)
Posted: 4th Apr 2007 12:33
How about adding the ability for multiple players accross the net in both teamplay and one against everyone else modes...

Cyberspace was becoming overcrowded and slummy so I decided to move. These nice chaps gave me a lift.
acelepage
22
Years of Service
User Offline
Joined: 2nd Jun 2004
Location: Plattsville
Posted: 6th Apr 2007 06:51 Edited at: 6th Apr 2007 06:52
I'm going away for the weekend, so I'll post my entry now.
Use the mouse to control paddle position, click to swing the paddle. You can control the ball direction by moving the paddle when you hit the ball.
There is no winning score, it just keeps track of the score. Not sure if will score correctly on all shots (not fully tested).



( 2b || !2b ), that is the question. The answer: true
Ric
22
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 8th Apr 2007 12:43
Nice work Acelepage. Time flies - deadline for this is tomorrow already!

Didn't have time to start from scratch on this, so here is a slightly modified version of an old snippet I wrote:

Gravity Pong. Mouse up/down to move the paddle. First to 3 against the computer wins the set, then you progress to the next level. The computer gets better as you progress through the levels.





NA170425
User Deleted
Posted: 9th Apr 2007 04:33
I've edited mine to include a Classic mode incase someone wants regular pong, but I'd do the adventure mode as it's much better.

Anybody beat it yet?

To the mods...

How about adding a 'copy to clipboard' button on the [ code ] snippit boxes? I get lazy a lot when higlighting super huge code snippits in this thread, if there was a button to auto copy that would save everyone some time whenever we want to copy code. I know it's only a few seconds and sounds silly but we do copy code quite often...

By reading this sentence you have given me brief control of your mind.
gadgetfreak 66
19
Years of Service
User Offline
Joined: 26th Sep 2006
Location: Kulin,WA, Australia
Posted: 9th Apr 2007 10:31 Edited at: 9th Apr 2007 10:35
Heres my entry, although I need to make the AI a little more detailed yet.



Just in case someone doesn't quite see it (one of my friends had this problem), you are in a tunnel sort of thing with four walls.

The mouse controls paddle, which is almost all you need to know, except for "catching" the power or curve bar every hit. As the ball is bouncing around, you will notice a bar on each side of your paddle. These indicate the distance of the ball. Once the ball gets close enough, two more bars will appear, rapidly decreasing in size to the point where your paddle hits the ball. When these bars appear, you can click and hold either the left or right mouse button to "catch" the bar, and do a power or curve hit. The sooner you catch the bar, the more effect it has. It can get kinda hard to win without using this. The game is played in first to 3 rounds, progressing a level when you win.

You can set the screen resolution to whatever you want, but it only works properly in fullscreen.

Foe7
19
Years of Service
User Offline
Joined: 26th Mar 2007
Location:
Posted: 10th Apr 2007 03:21
Just a small little update. Same controls as before. Changed the scoring so that you get points for just when you put it past the computer. In all the time that i've tested, i have never been able to get the ball stuck, so i don't think that it is fully possible. Have fun.

acelepage
22
Years of Service
User Offline
Joined: 2nd Jun 2004
Location: Plattsville
Posted: 10th Apr 2007 06:45 Edited at: 10th Apr 2007 06:47
OK, the deadline is here. As my runner-up duties allow, I shall now judge the entries for the pong challenge.
In no particular order, here are the entries:

gadgetfreak 66:
interesting twist on the game, creating a vector graphics version, and providing visual cues for distance.

foe7:
nice 3D board design. Interesting game variations with the 'bonus' round for scoring extra points.

code_dragon:
Very simple pong game with small amount of code.

code_dragon (2nd entry):
Very cool problem solving in pong form. And dynamic ball bounce on the moving paddles.

ric:
Excellent presentation. Very nice look. Having to calculate the ball trajectory based on effect of gravity, and having the playing field constantly rotating position, makes for a more challenging game. (And dynamic ball bounce on the moving paddles.)

So, the runner up is:


And the winner is:


( 2b || !2b ), that is the question. The answer: true

Login to post a reply

Server time is: 2026-07-18 00:05:04
Your offset time is: 2026-07-18 00:05:04