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
LongFist
22
Years of Service
User Offline
Joined: 25th May 2004
Location: Winston-Salem, NC
Posted: 11th May 2007 03:17
We (well, some other students in the class) worked on a Sound Recognition App as their final project in AI. They had six weeks and still couldn't quite get a "handle" on it - it spent more time trying to learn the differences in sounds than putting names to those it ("knew") could recognize.

Since there are a few hurdles in native mode operations in DBPRo, maybe we just might want to look elsewhere for a challenge.

Of course - I'm just (another) voice in the darkness, who eagerly awaits joining in, so feel free to ignore me until I produce something viable, okay?

LongFist
SuperProgrammer For Hire
Ric
22
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 11th May 2007 14:16
Spopovich: hope you're not being too rigid with the word 'isometric'? I'm assuming any overhead perspective (eg. top down, aerial view, etc.) is ok? True isometric would rule out any use of 3d objects which have vanishing points, and would be very tough without media.

Also, I'll make a post in the general dbpro thread to let people know a new challenge is starting.

NA170425
User Deleted
Posted: 11th May 2007 18:16 Edited at: 13th May 2007 15:52
Is this what you mean by isometric?



Here's my entry (not finished)

Terra Pugna



"Once there was a polygon mesh who was very sad because he was only Gouraud shaded."
Ric
22
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 11th May 2007 19:09
That made me laugh! Because my default resolution is quite low, it cut off part of the instructions, and I got the message:

Quote: "
Don't leave the battlefield or else the IMS network will blow you
"


Right - I DEFINITELY won't leave the battlefield then!! Also, it's 'soldier' - not 'soilder', nor 'solider'!

Good start - now if you can apply some collision physics to those boxes .......

Spopovich
20
Years of Service
User Offline
Joined: 12th Jul 2006
Location:
Posted: 11th May 2007 22:22
Sorry about that, I'm not too good at explaining what I mean. Yea that's fine, 3D is good as long as its an overhead view.

Do not ask what the forums can do ask what you can do for the forums.
NA170425
User Deleted
Posted: 12th May 2007 00:13 Edited at: 12th May 2007 00:15
Quote: "Don't leave the battlefield or else the IMS network will blow you"


Haha

That's probably the funniest thing I've heard this month.

I just hope eveyone knows that it stands for intelligent munitions system (as seen of Future Weapons), not this...

"Once there was a polygon mesh who was very sad because he was only Gouraud shaded."
Crit
20
Years of Service
User Offline
Joined: 24th May 2006
Location:
Posted: 15th May 2007 00:36
Congratulations on winning the latest round Spopovich! The overhead challenge looks like fun, but I'm getting busy at work so I won't be able to enter. I'll be back eventually though. Good luck everybody!
Dbproguy
19
Years of Service
User Offline
Joined: 1st Nov 2006
Location: At my computer desk no-life programming
Posted: 21st May 2007 07:45
is the overhead game like 2D? and all the sprites could be like for a hot pursuit game the top of cars or something like that?

I'm such a n00b
[/url]
Ric
22
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 21st May 2007 12:37
It can be 2-d or 3-d, so long as the view is from overhead, looking down. And there must be a fighting aspect. The deadline is this Friday.

NA170425
User Deleted
Posted: 22nd May 2007 04:04 Edited at: 22nd May 2007 04:06
Too bad I won't have time to finish my entry. I'm very busy with school, all the teachers seemed to have saved all the hard chapters until the last minute.

I was pretty impressed with how fast DBP can add items to arrays. I believe they are actually arrays of pointers to the actual data and whenever you add an item it has to make a copy of it and delete the old one. If you walk near one of the cones in my entry you'll see it throw dozens of gernades at you in an attempt to blow you up. Even when there's hundreds of gernades it doesn't lag much, surely copying arrays hundreds of bytes large isn't that fast, right?

Beyond this place there be dragons.
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 22nd May 2007 06:16
a few hundred bytes is still less than 1kb, hardly a concern. Plus, I doubt DB copies arrays back and forth when adding an item. Most likely it'll reserve space to a point and only have to copy the contents when the size grows beyond that point.

Let's say you have an array with 10 items with a max reserve of 10. At that point, when you add the 11th item, it may grow the overall size to 20. You'll only see 11 items but the space for 20 is reserved. At least that's how I imagine its done.


Dbproguy
19
Years of Service
User Offline
Joined: 1st Nov 2006
Location: At my computer desk no-life programming
Posted: 22nd May 2007 07:16
My entry is 2d then, Just letting you know wht I'm doing, It's like little cars going around shooting at each other lol it's pretty cheap.

I'm such a n00b
[/url]
MikeB
19
Years of Service
User Offline
Joined: 5th Apr 2007
Location: My Computer, Shropshire, England
Posted: 22nd May 2007 14:09
I'm trying to learn DBP as fast as possible so that I can enter then next comp .

Not to win.... it would just be nice to enter.... I lack direction in most of my projects .

E.D.

NA170425
User Deleted
Posted: 22nd May 2007 22:40
Quote: "Most likely it'll reserve space to a point and only have to copy the contents when the size grows beyond that point. "


Ok sounds like a linked list of arrays where it never gets slower, but in my tests it does get slower:



But the good thing is that you'd need an array of about 5000 items to make the insert operation last more than a few hundred microseconds.

Beyond this place there be dragons.
Diggsey
20
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 22nd May 2007 23:31
The fastest way (I don't know if DBP actually does this) would be to have a pointer to the next data item in each data item. That way, to insert a data item, you just add it on the end, and alter the pointer of the item before it.

NA170425
User Deleted
Posted: 23rd May 2007 03:57 Edited at: 23rd May 2007 04:02
Quote: "The fastest way (I don't know if DBP actually does this) would be to have a pointer to the next data item in each data item."


That would be very fast for insertions/deletions but would really slow down array indexing (a lot) and eat up lots of memory.



If you want to access index, say 500, you can't just add 500 to the array's address and be on your way, you'd have to linearly go through each of the 500 pointers because there's no guarrentee that they're all in a line in memory.

But I've never used these C++ style data engines so there might be easy workarounds.

Beyond this place there be dragons.
Wendox
19
Years of Service
User Offline
Joined: 19th Dec 2006
Location:
Posted: 23rd May 2007 21:13
so this is mine.

Daemon
20
Years of Service
User Offline
Joined: 16th Dec 2005
Location: Everywhere
Posted: 24th May 2007 23:04
Well, everything in my game is a box, but o well.

Arrowkeys move.
Shift shoots.

The goal is to kill the red box. It's not hard to find because there is a bright red line drawn to it. But don't charge forwards, it stings if it touches you. O, and it can divide.



Spopovich
20
Years of Service
User Offline
Joined: 12th Jul 2006
Location:
Posted: 24th May 2007 23:44
I'll be judging tomorrow when I get home from school around 3-3:30 EST. The entries look good so far, and hopefully we will see some more. Good Luck.

Do not ask what the forums can do ask what you can do for the forums.
flashing snall
20
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 25th May 2007 04:16 Edited at: 25th May 2007 04:39
*pant pant*
ahg, i just read this contest thing today, realized there was still time, and whipped a small loopy shooter. I was goin put in muzzle flash, but i didnt.



sorry for the length, its not even anything that wonderful. my bullet system is a pain in the butt, i need a better one.


"these shoes are 300 hundred dollars"-Shoes by Kelly http://smallgroupproductions.com/
Spopovich
20
Years of Service
User Offline
Joined: 12th Jul 2006
Location:
Posted: 26th May 2007 00:34 Edited at: 26th May 2007 00:35
Ok sorry that I'm a little bit late but my internet went down... So without further ado.


Code Dragon
- Good start, you definitely had the basics and a few extras. The ability to move the boxes was a nice touch. The only real thing you were missing, was being able to fire back.

Wendox - You get extra credit because you joined on my birthday. I liked the graphics in your game, they were good for a media less challenge. I did find though that it was very difficult to win, because the two enemies would gang up on you, and I saw no way of defeating them both.

Daemon - Your game was good and complete, I liked the obstacles, and the game was beatable. Two improvements would be the AI which was extremely basic and very difficult, and timer based movement as the game went extremely fast towards the end when you had eliminated most of the boxes.

flashing snall - A nice yet simple game, I especially liked the explosions. Although the game was a little on the easy side, it did pose a challenge. A good game for being thrown together quickly.

The competition was close but...
The winner is:


The runner-up is:


I can't wait for the next challenge.

Do not ask what the forums can do ask what you can do for the forums.
flashing snall
20
Years of Service
User Offline
Joined: 8th Oct 2005
Location: Boston
Posted: 26th May 2007 01:10
sweet.


"these shoes are 300 hundred dollars"-Shoes by Kelly http://smallgroupproductions.com/
Mason
22
Years of Service
User Offline
Joined: 20th Mar 2004
Location: Arizona
Posted: 26th May 2007 01:55 Edited at: 26th May 2007 01:57
So I'm thinking I'm going to join this challenge thread, sounds pretty sick. I read over the rules so if I'm right, Daemon sets the new challenge? And don't worry about me being competition lol, I'm still learning how to use memblocks. Since everyone seems to be using em' in their programs, I figure this would be a good place to learn.


Daemon
20
Years of Service
User Offline
Joined: 16th Dec 2005
Location: Everywhere
Posted: 26th May 2007 06:47 Edited at: 26th May 2007 06:50
Yay I won.
So yes, I set the next challenge. I'm not sure what to make it. Since it is approaching midnight and I'm supposed to be playing a sport tomorrow, I think I'll wait to decide on a challenge until after I sleep. I'm not the best at making these competitions, so you can make suggestions.

@Mason- There was an image memblock challenge a while back. That is where I learned them.

Mason
22
Years of Service
User Offline
Joined: 20th Mar 2004
Location: Arizona
Posted: 26th May 2007 13:29
I looked through Db-Site.com and couldn't find the image memblock challenge. If you know where it is that would help me out a lot. I've learned to make memblocks into meshes, and then into objects using fvf n' such, but haven't learned images yet. At least I understand the concept of memblocks.

As for challenges, maybe writing your own collision (ex: sliding collision, box collision, sphere collision) and showing an example of it. Just throwing that out there though.


Ric
22
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 26th May 2007 16:23
Congratulations Daemon - nice work! Good to see a few last minute entries on this one - it was slow starting but definitely picked up towards the end. Also, good feedback Spopovich!

Welcome to the new people around here - this really is a great way to pick up tips.

Some suggestions for the new challenge (including some ideas which have been suggested before but never set):

A memory game
A rolling marble game/demo
A bowling game
A flocking demo
A 2d lines and gravity demo (eg. along the lines of Line Rider: http://official-linerider.com/play.html )
An optical illusion challenge

Daemon
20
Years of Service
User Offline
Joined: 16th Dec 2005
Location: Everywhere
Posted: 26th May 2007 20:08 Edited at: 26th May 2007 20:11
Well, I like the idea of a 2d game with collision. This would force people not to rely on the inbuilt system Dark Basic Pro has and think of intersecting lines. The math isn't that challenging. And it's a game, yay. If people don't seriously object to this challenge then I will declare it by the end of the day.

@Mason- I couldn't find the challenge, but I'm sure there was one. Phaelax made an interesting image memblock effect and textured an object with it. This isn't really the best place to go into a long explanation of image memblocks, so I will hide it within code boxes so it doesn't take up space.



MikeB
19
Years of Service
User Offline
Joined: 5th Apr 2007
Location: My Computer, Shropshire, England
Posted: 26th May 2007 20:09
Doh!

I'm not gonna be able to cope with collision :$.

E.D.

LongFist
22
Years of Service
User Offline
Joined: 25th May 2004
Location: Winston-Salem, NC
Posted: 26th May 2007 20:12 Edited at: 26th May 2007 20:13
Quote: "I figure this would be a good place to learn."


Truer words were never spoken. I'd been beating my head against the (stone) documentation trying to figure out the basics (and caveats) for LIMBs in developing OBJECTs from primitives (we can't use any media, right?), and ended up getting the most amazing education in route to my destination.

>> Basic(?) Limb Elements?
>> Limb Scale Issues

Naturally, time ran out before I could finish my idea - but it forced me to learn stuff that I previously hadn't bothered with, since I had my "GameSpace/PhotoShop/Reason" combo to provide me with visual/audio *anything* that I needed. It was good to get outside my comfort zone, play with something else that made DBPro that much more useful. And the incredibly helpful people who helped in the Forums actually went further afield, unwittingly teaching me to build textures on the fly as well!

LongFist
SuperProgrammer For Hire
Ric
22
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 27th May 2007 00:07 Edited at: 27th May 2007 00:28
Longfist, off topic a bit, but what do you think of Reason? I'm seriously considering buying it, but I'm hesitating a little as it looks very complicated. Also, I don't see anything in there that looks like a sequencer, but I guess there must be one somewhere? I'm coming from Cubase, which is a great sequencer, but I like the idea of Reason being an 'all in one' package, where you can save everything as one file, and come back to it a year later and carry on. With Cubase, you can't do that - you forget what soundbanks you had loaded, what plugins you were using, etc.

Mason
22
Years of Service
User Offline
Joined: 20th Mar 2004
Location: Arizona
Posted: 27th May 2007 01:48
Ya 2d games sounds good. A little general but its all good


Daemon
20
Years of Service
User Offline
Joined: 16th Dec 2005
Location: Everywhere
Posted: 27th May 2007 02:14 Edited at: 27th May 2007 02:19
Quote: "A little general"


Yeah, I'd been thinking of that. One thing I would require is collision with lines (not just vertical and horizontal lines and not just a one point collision test).

This would not be a 2d physics challenge- that's been done before.

This would be be a game (I consider line rider a game although it doesn't have winning and losing). I have thought, however, about setting the rule that things must slide and/or bounce appropriately when they hit lines, not just stop.

I'm still thinking of clarifications for this challenges rules. I plan to announce the challenge at around 20:00 forum time today.

Daemon
20
Years of Service
User Offline
Joined: 16th Dec 2005
Location: Everywhere
Posted: 27th May 2007 04:09 Edited at: 27th May 2007 04:13
Oops edit went wrong.

Daemon
20
Years of Service
User Offline
Joined: 16th Dec 2005
Location: Everywhere
Posted: 27th May 2007 04:13 Edited at: 6th Jun 2007 23:37
**********************************************************

2D Collision Game Challenge

**********************************************************

Create a 2D game which includes collision with lines that are not just vertical and horizontal. I will be unimpressed if it is simply a one pixel collision test. The collision must be bouncing, sliding, or both, not just bringing it to a stop. You may use sprites since I know these are fast for Dark Basic Pro, but if you do you should have some kind of pixel perfect collision. Don't just use "if sprite collision".
The game will be judged on game-play and the accuracy of this collision. If you have any questions about these rules just ask.
You have 2 weeks. I will judge on June 9th.

Mason
22
Years of Service
User Offline
Joined: 20th Mar 2004
Location: Arizona
Posted: 27th May 2007 05:36
Going to hit some skate spots downtown, hitting up the lake and partying there... Then code time


Ric
22
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 27th May 2007 11:54
This should be a very good challenge. This would be a good time for a discussion about the theory .....

I'm thinking something like this:

- the line is stored as an array of connected x-y coordinates.
- get old position of player
- get new position of player
- draw line between these two points
- .... hmmmm, there I'm stuck .......

gadgetfreak 66
19
Years of Service
User Offline
Joined: 26th Sep 2006
Location: Kulin,WA, Australia
Posted: 27th May 2007 17:18
@Ric: Can I assume you're not going to be doing iteration checks then?

Finding the intersect point between two lines is going to be harder, but this is definitely going to be an interesting challenge I can sink my teeth into...

Ric
22
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 27th May 2007 21:51
Quote: "Can I assume you're not going to be doing iteration checks then?"


I don't know ... but it seems to me that there should be a better way. I'm thinking that, as the computer knows where the line is, and it knows where the player is ... there shouldn't be a need to check anywhere else other than the intersection point .... I just haven't figured out how to go about that though.

I know how to find the intercept point between two lines given their gradients and y-intercepts .... but I don't know how to work out which line segment I should be checking against without iterating through all of them.

gadgetfreak 66
19
Years of Service
User Offline
Joined: 26th Sep 2006
Location: Kulin,WA, Australia
Posted: 28th May 2007 11:42
I agree, it does seem like a bit of a waste, but if the line data is all in an array, checking all of them shouldn't be too time consuming should it? And unless you did some sort of sector arrangement, I think you'd have to go through every line anyway to check if you want to check against it. (I think)

LongFist
22
Years of Service
User Offline
Joined: 25th May 2004
Location: Winston-Salem, NC
Posted: 28th May 2007 15:17 Edited at: 28th May 2007 15:17
Quote: "Yeah, I'd been thinking of that. One thing I would require is collision with lines (not just vertical and horizontal lines and not just a one point collision test)."


:-\ Request for clarity? What exactly is it here that you don't wish to see? I'm confused by:

Quote: "a one point collision test"


When you (well, when I) generate a vector, and move along that vector, the main reason to do so is so that you only have to check (within certain boundaries) a single point, sampler-style. Of course, that's more like C++/OpenGL style development, but it works for games like Pinball, Pachinko, and simulations on that order. I realize that the code looks pretty simple, but if the game is playable, and doesn't eat up too many cycles trying to figure out if the ball cruising down the center aisle is somehow touching the top surface... ...wouldn't that be viable? Or am I reading this wrong?

LongFist
SuperProgrammer For Hire
Ric
22
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 28th May 2007 16:23 Edited at: 28th May 2007 16:31
I agree with what has been said so far - I don't think it'd be too costly to iterate through all the line segments which make up your hill or whatever - what I want to avoid though, is iterating through every pixel on every line segment to find the point of intersection. I think that's what Daemon is saying would be a bad thing - checking for collision one pixel at a time. It's better done by thinking of the players movement as one line - joining its old position to its new position, and the hill segment it is nearest to as a second line, and using a maths formula to work out the point of intersection - which requires no iteration.

Also, when iterating through the line segments (assuming no-one has a method for avoiding this), it would be good to do an 'is intersection likely?' check (ie. are the two lines which might intersect within a certain range?), before then calculating the point of intersection.

Then, only for line segments which are established as in range for possible intersection, would you then apply a formula for working out the exact point of intersection.

I have worked out the formula for finding the x and y coordinates for the point of intersection, xi and yi, for two lines a and b, given two x-y coordinates on each line - (xa1,ya1),(xa2,ya2) for line a and (xb1,yb1),(xb2,yb2) for line b. I derived this on paper rather than looking it up, so there is a good chance it could be simplified, but it does seem to work:

xi=(yb1-mb*xb1-ya1+ma*xa1)*(ma-mb)
yi=ma*xi+ya1-ma*xa1

where ma and mb are the gradients of line a and b, and are given by

ma=(ya2-ya1)/(xa2-xa1)
mb=(yb2-yb1)/(xb2-xb1)

This little test program shows that it works:



... each time you press space, two random lines are drawn, and if they intersect, the point is shown with a circle. At the moment it calculates the point of intersection whether or not the line segments intersect - so this needs refining.

Daemon
20
Years of Service
User Offline
Joined: 16th Dec 2005
Location: Everywhere
Posted: 28th May 2007 20:20 Edited at: 28th May 2007 20:30
As a response to LongFist on what I don't want to see:

Quote: "not just vertical and horizontal lines"

If your game only has vertical and horizontal lines, collision could easily be checked using inequalities and not having to do any math. A game that does this will not win.

Quote: "a one point collision test"

When I say this I mean that the player or whatever it is that you are testing for collision with should not just be one point, a single dot. It is easy, and boring to me, to find whether a point is on a line.
Of course, when reading your post LongFist, I see how a single point could be tested for collision for a moving circle. This is one of the most logical ways to do it. Your program must figure out which point it has to test anyway, so you can do this.

As long as your object is more than a dot and you have atleast one non-vertical, non-horizontal line your game is within the rules for this challenge.

As for a clarification on the sprite note:
Dark Basic Pro is slow to draw lines. Therefore, once a line has been drawn, if it is not going to be moving throughout the program, you may want to use memblocks or get image of the screen and keep this image over the whole screen (by using sprites or now that I think of it, paste image might work better). As it has been pointed out, an array of the information of the lines is probably the best way to detect collision so you won't have to create a complicated system to test the pixels of the image.
What I wanted to prevented was people making a long thin sprite and rotating it so that it looks like a line. Then using "if sprite collision" in their code.

Diggsey
20
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 28th May 2007 22:39
Here's my entry

It's VERY similar to linerider lol!



Enjoy!

Ric
22
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 29th May 2007 11:48
That's very good work Diggsey - it is very close to line rider. It does seem to be able to go through lines though, when it goes too fast - presumably because you are only checking collision within the radius of the circles at a single position, rather than accounting for the distance it has moved since it's position on the previous loop. Perhaps you could measure the distance it travelled each loop, and increase the collision radius accordingly? But then I suppose there's a danger of colliding with lines you go close to but don't actually touch. Anyway - it's still very good.

Diggsey
20
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 29th May 2007 16:23
Thanks

I will see if I can add continuos collision

Diggsey
20
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 29th May 2007 17:20
OK, here's my code WITH continuous collision <- I spelt it right that time



gadgetfreak 66
19
Years of Service
User Offline
Joined: 26th Sep 2006
Location: Kulin,WA, Australia
Posted: 29th May 2007 18:08
Back to Ric's intersect code again, the main problem that code's got is the fact that it assumes the line goes on for infinity, right? To fix that, and you've probably already done this, but you can just check if the intersect point is within a box created by the two lines.



There's probably another cute mathematical way of doing this too, but this seems to work for me.

Ric
22
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 30th May 2007 02:22
Yes - that's the next step complete.

The only thing I don't like with this so far, is that it always calculates the exact point of intersection, even when the lines are nowhere near each other. I was thinking of having an imaginary rectangle which surrounds each line segment (the line joining the corners diagonally), and first checking to see if the two rectangles overlap, or if they are both in the same section of the screen at least, before doing the intersect calculation. This should save a lot of calculations when you eventually have lots of line segments. I tried to get it to do this this morning, and failed - need to have another go at it!

Mason
22
Years of Service
User Offline
Joined: 20th Mar 2004
Location: Arizona
Posted: 30th May 2007 02:41 Edited at: 30th May 2007 03:48
Well I wanted to do this challenge, but I think this one is over my head. I'm going to attempt anyway, but I can't really decide where to even begin.

Edit: I played around with it and now I have sliding collision on lines. I think I am doing it different then you guys? I'm find collision on the line and then calculating its slope and moving across the line till the next point of intersection. Works pretty good still have to finish coding it all though.


enderleit
19
Years of Service
User Offline
Joined: 30th May 2007
Location: Denmark
Posted: 30th May 2007 20:18
Been reading some of the first challenges, and thought it looked like fun. So i skipped to the last page, but I think this challenge might be over my head.

Maths really isn't my strong point.
I'll still have a look at it though... just in case.

- mTin
www.eleit.dk

Login to post a reply

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