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
Spopovich
19
Years of Service
User Offline
Joined: 12th Jul 2006
Location:
Posted: 30th Jul 2006 19:21
I'm looking forward to seeing some more code soon. I can't wait to see what people come up with.

@RiiDii
That is an amazing game you have made. Are you planning on adding somthing more to that or just leave a good design alone.

@Hobgoblin Lord
Sorry that you will not be joining us for this project though good luck with your project.
HowDo
23
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 31st Jul 2006 00:35
Round Pinball bumper thingy anyone. or is it your own stuff only allowed, eg no sharing.

I'm not getting you down am I, Ho Look! another fancy Door?
Nicholas Thompson
21
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 31st Jul 2006 00:54
You can share all you like - thats the spirit of these challenges... However they are coding challenges - no media allowed... Unless that jumper thingy was made using DBP commands and which case you could make it into a function for people to use.

[center]
HowDo
23
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 31st Jul 2006 00:57
Ok here's the code to show how I did it and its one object too.



I'm not getting you down am I, Ho Look! another fancy Door?
RiiDii
21
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 31st Jul 2006 09:01
Quote: "That is an amazing game you have made. Are you planning on adding somthing more to that or just leave a good design alone."

Well, the physics from that game are alive and doing well. But for the most part - leaving the good design. Though, I've been thinking about revisiting some of my old 20-liner codes and see if I can add to them.


Open MMORPG: It's your game!
HowDo
23
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 31st Jul 2006 13:49 Edited at: 31st Jul 2006 13:53
Here RiiDii code sorted to run in 6.2



edit forgot to take out 'next i' goes now.

I'm not getting you down am I, Ho Look! another fancy Door?
Julius Caesar
20
Years of Service
User Offline
Joined: 14th Apr 2006
Location:
Posted: 31st Jul 2006 18:53 Edited at: 31st Jul 2006 19:48
Where has Ric gone? His code was amazing! He hasn't posted in ages! NE ways, just wondering for my attempt, can we have Pinball, but without a ball as such?

ie... does it have to completely conform to pinball? I was thinking of a game where you use the flippers to launch your ball up, and it explodes, with the aim being to destroy targets on the board...

Woah, I think TGC has died! No one seems to have posted anything in ages... still good luck to anyone doing this challenge, I'm working on my collision detection now!
RiiDii
21
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 31st Jul 2006 21:54 Edited at: 31st Jul 2006 21:55
I think during the summer, folks are home more, so they work on projects. Working on projects means they don't have time for small challenges like this. When school kicks back in, folks will slow down on their projects, and this thread will pick back up because the challenges are small.

Edit: Thanks HowDo.


Open MMORPG: It's your game!
Spopovich
19
Years of Service
User Offline
Joined: 12th Jul 2006
Location:
Posted: 31st Jul 2006 22:11
@BRAUDE Man
Ric posted a while back that he would be gone for a while because he was moving. He said that he would be staying with family and would not be able to set up his computer for 7 few weeks, that was June first. So he should be returning soon. As for your project idea. I think its best you stick with a regular pinball game, though your game sounds good, I wouldn't really be able to compare to the other entries because of the many differences.
Good luck
Julius Caesar
20
Years of Service
User Offline
Joined: 14th Apr 2006
Location:
Posted: 31st Jul 2006 23:22
kk, I'll try and focus more on the physics then... btw, how do you do decent bouncing? coz mine's rubbish atm all I'm doing is adding 90 deg 2 the angle value!!
Spopovich
19
Years of Service
User Offline
Joined: 12th Jul 2006
Location:
Posted: 31st Jul 2006 23:35
Well my game is pretty bad the arch of the ball is horrible. Though as for bouncing I had the idea of when the ball hit somthing to turn it untill it found away to get past the object and then turning it that amount again, that would be the angle of reflection.(angle of incidnce =angle of reflection) I have some code if your still having some trouble.
HowDo
23
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 1st Aug 2006 06:11
Your welcome Riidii, not sure what #constant A_constant did in it but seem to work without it.

Spopovich , BRAUDE Man, I think someone did demo of bouncing using the ODE command set, not sure where you would start to search ,I'll leave that up to you.

I'm not getting you down am I, Ho Look! another fancy Door?
Julius Caesar
20
Years of Service
User Offline
Joined: 14th Apr 2006
Location:
Posted: 1st Aug 2006 09:46
OK then... lol!

I'm still kinda new, but Ive done by just adding 90 degrees to the object. I was thinking though, could you not somehow use the angle of the other object to improve the bounce?
RiiDii
21
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 1st Aug 2006 10:09
Here is some simple bouncing code. It demonstrates simple bouncing off a surface (90 degrees only). And it demonstrates hitting another ball (which could be like a round kicker in a pinball game). There are a lot of 'estimates' and the physics are calculated one ball at a time, instead of all at once. So there are innaccuracies and some odd looking "sticky" collisions. But this is very low-level. If you want to get more detailed, you would have to start working with vectors.




Open MMORPG: It's your game!
Julius Caesar
20
Years of Service
User Offline
Joined: 14th Apr 2006
Location:
Posted: 1st Aug 2006 10:19
Hockay, well thank you Ridii... I will try to delve into that more complicated stuff...

*Takes a deep breath*

hmmmmmmmmmmmmmmmmmmmmmmmmmmmm

*Comes Up gasping for air*

Whats a vector?!?!?!

I would include a good comment...
BillR
23
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 1st Aug 2006 10:50
Well, I'm using ODE for my pinball game......
And ODE is currently winning the fight, and I am losing.

It can work so well sometimes, then there are these times.
Sometimes its rotation is backward from DBPro.
Also, well I could go on and on.
Some of the commands work great, then there are others that need some work.

Anyway, back to coding.
Julius Caesar
20
Years of Service
User Offline
Joined: 14th Apr 2006
Location:
Posted: 1st Aug 2006 13:34
hockay, what's ODE? And also, is there a way of using the sine rule to work out the direction of an object, given it's last position, current position and speed? I'm sure you must be able to do it with sine, but I just keep getting the values the wrong way round... NE1 no?

I would include a good comment...
Nicholas Thompson
21
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 1st Aug 2006 22:10
1) ODE is a physics extension added to DBP during the 5.8-5.0 era and its buggy and poorly documented, but works well if you can get it to work.
2) You can indeed work it out.


[center]
Braude Interactive
19
Years of Service
User Offline
Joined: 1st Aug 2006
Location: Sheffield, UK
Posted: 1st Aug 2006 22:14
Wow! I was trying to do that as well, for ages! Err... So what then is it using a tangent? and what's the full bit for?

Also, just quickly, it dosent seem to work if you use a z value instead of a y value... wierd!

Because there is no such word as can't...
RiiDii
21
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 1st Aug 2006 22:16
Simply think of a vector as a relative coordinate (3D coordinate in this case). The word "vector" can be a little intimidating, but it really just sounds that way. But it is simply another way of saying relative coordinates (there's a little more to it, but start with that).

So x=2,y=3,z=4 is a 3D vector. If I were to write the same thing using DBPro's built in vector commands, it would look like this:

Set Vector3 1,2,3,4
which is...
Set Vector3 ID,x,y,z

What is nice about using DBPro's built in vector commands is that they do a lot of the math much faster than doing the math the long way. So, if I want to know what the distance is between 0,0,0 and 2,3,4, I would use Sqrt(2^2+3^2+4^2) doing it the long way. Using vector commands, its simply Length Vector3(1).



While it may seem like vectors are more work, they really are not (especially when you start using them for more). And, more importantly, they are about 10 times faster than Squaring and Square Rooting.


Open MMORPG: It's your game!
Braude Interactive
19
Years of Service
User Offline
Joined: 1st Aug 2006
Location: Sheffield, UK
Posted: 1st Aug 2006 22:23
Thank you Ridii!

hockay... so what would you use those vectors for? How would they help in collisions? btw... I am [inset name here], but I changed my e-mail address, so I gotta go through the whole n00b thing again lol!

Because there is no such word as can't...
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 2nd Aug 2006 01:24
I thought we decided ODE and Newton weren't allowed because it requires us to download a separate DLL.

Since I'm not really going to be entering this one, here's a bit of info on how to reflect a vector.

First, find the normal of the wall the ball hit.
For a 2D line, the normal can be found by:

find the slope of the line:
y/x = slope

then invert it:
nx = -y
ny = x

With that normalized(unit length of 1) the following equation can be used to find the reflection.

R = D - 2N(N.D)

R = reflection vector (direction the ball will go after reflection)
D = direction vector (where the ball is currently going)
N = normal of the wall the ball hit

R = D - 2*N*(N dot product D)

"Using Unix is the computing equivalent of listening only to music by David Cassidy" - Rob Pike
Nicholas Thompson
21
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 2nd Aug 2006 01:30
ODE is built into the latest DBP Patch which some people often use without knowing about it (due to obscure "fixes"). So I think ODE is ok... Newton is definately 3rd party though.

[center]
Spopovich
19
Years of Service
User Offline
Joined: 12th Jul 2006
Location:
Posted: 2nd Aug 2006 02:20
I'm also fairly new to the Forums and stuff so ODE is new to me. As long as it is not a plug in I think it is fine to use.
KimoSabi
21
Years of Service
User Offline
Joined: 18th Jan 2005
Location:
Posted: 2nd Aug 2006 18:17
Hello guys, I have noticed that alot of people have been complaining about no media, and I seem to remember a quote from someone:
Quote: "We just want people to be able to copy and paste the code into DBPro"


Well... what if we used FTP? I would be willing to use my server and people could upload small things into it and use them (if my budget permits, if there is to much I would obviously have to stop it). It is just a thought, and I am very cool about it if you guys disagree. Below is the code a wrote up for what people would need to put before there program:


Tell me what ya think,
Kimosabi

www.mightandmagic.com

RiiDii
21
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 2nd Aug 2006 18:27
Ummmm... No.


Open MMORPG: It's your game!
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 2nd Aug 2006 18:55
I'm gonna have to say no on that one too.

How's the mmorpg coming along? Website looks nice.
(mmorpg? you noob, start with pong!)

"Using Unix is the computing equivalent of listening only to music by David Cassidy" - Rob Pike
Spopovich
19
Years of Service
User Offline
Joined: 12th Jul 2006
Location:
Posted: 2nd Aug 2006 19:35
Yea I would have to also agree. Alot of the fun in working on these challenges is making all the media in dark basic.
Julius Caesar
20
Years of Service
User Offline
Joined: 14th Apr 2006
Location:
Posted: 2nd Aug 2006 21:38
I got an entry finally. I tried to do what you said in the collisions, but heck, I guess I'm a slow learner and I don't get it. I got a wind/fam thing going though, instead of using bumping the table.



What d'ya think? Suggestions please! I think I'm the first person to post my code!

Bouncing Physics... How do?
Spopovich
19
Years of Service
User Offline
Joined: 12th Jul 2006
Location:
Posted: 2nd Aug 2006 22:03 Edited at: 2nd Aug 2006 22:48
@Insert Name Here
Your the second person to post your code RiiDii already had made a pinball game and posted his code a while ago though he is not entering with it. Your game is a good start. For suggestions I would recomend making the ball move a little faster and adding more guizmos. Also your collision isnt perfect somtimes the ball just goes in circles. Its a good start so keep working on it. Good Luck.

Edit: When I say guizmos i just mean add more bumpers and stuff, things to rack up points.
Julius Caesar
20
Years of Service
User Offline
Joined: 14th Apr 2006
Location:
Posted: 2nd Aug 2006 22:06
thanks Spopvich. What are guizmos? Is it some other vector like thing I don't yet know about?

And... err, My collision isn't just not perfect... it's f**ked up!

Bouncing Physics... How do?
RiiDii
21
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 2nd Aug 2006 22:31
Quote: "How's the mmorpg coming along? Website looks nice."


Its going great. Check out our WIP thread over in the WIP board; I just posted some screen shots.

Quote: "Your the second person to post your code"


I don't think mine counts since I wrote it and posted it so so long ago. I just put it up for folks to look at and get some ideas, especially inspiration about what DBPro can do without media or plugins.


Open MMORPG: It's your game!
Spopovich
19
Years of Service
User Offline
Joined: 12th Jul 2006
Location:
Posted: 2nd Aug 2006 22:48
Ok RiiDii I will not judge your code but your game is really amazing.
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 3rd Aug 2006 00:26
riidii, the ball goes right through the flippers a lot.

"Using Unix is the computing equivalent of listening only to music by David Cassidy" - Rob Pike
RiiDii
21
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 3rd Aug 2006 09:18 Edited at: 3rd Aug 2006 10:19
Quote: "riidii, the ball goes right through the flippers a lot."


Since the code uses timer-based movement, that is possible with drops in framerate. For a 20 liner, I really couldn't fit in a predictive collision model to prevent that. Instead, I tried to move the ball incrementally between frames so that instead of 1 large move, each frame is composed of 3 small moves. But still, 'jumping' is one of the problems with timer based movement.[b][/b]


Open MMORPG: It's your game!
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 3rd Aug 2006 10:40
not if you use swept-collision.

"Using Unix is the computing equivalent of listening only to music by David Cassidy" - Rob Pike
RiiDii
21
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 3rd Aug 2006 20:28
swept-collision? (I even Googled that one).


Open MMORPG: It's your game!
Darth Vader
21
Years of Service
User Offline
Joined: 10th May 2005
Location: Adelaide SA, I am the only DB user here!
Posted: 4th Aug 2006 11:15
RiiDii I liked your old Avatar! (R2-D2)
Great work everyone, entries look great!


Website under construction Sponsered by Galekus http://ideal-entertainment.galekus.com
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 4th Aug 2006 12:17
Ball is at point A, next step ball is at point B. It forms a line segment. Check that segment for intersection with the flippers. You could probably represent the flipper as a triangle. If the intersection time is within [0,1] then boom!

"Using Unix is the computing equivalent of listening only to music by David Cassidy" - Rob Pike
RiiDii
21
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 4th Aug 2006 20:53
Quote: "RiiDii I liked your old Avatar! (R2-D2)"


I am sure there is some irony in the fact the Darth Vader said that. I might change it back. Just that this came along and it was a cool promo for the OMMORPG Project.

@Phaelax: Thanks. Yeah, I've heard of that method now that its spelled out (thanks). I am not sure how well that works with two moving objects though (the flipper vs. the ball). If there is a drop in the framerate, both the flipper and the ball skip ahead. If they both cast a ray in their respective paths, they may not see a collision because the other object isn't there yet.

Also, we still have the problem of a changing frame rate. Timer based movement is always half a frame behind the frame rate. So, if the FPS drops during a given frame, the movement is scaled on the old framerate. It's not until the next sync update that the drop in FPS is registered and the new movement scale calculated. Here's a demo of how the jump works when the FPS changes.



My solution to this in the OMMORPG project has been to limit the speed of the object despite the timer based movement scale if the object is close to a collidable object. In this case, it would be as the ball approaches the flipper, the movement scale would be limited to some maximum value. Its not too bad, except that (in the OMMRPG project) the PC slows down when navigating collidable objects.


Open MMORPG: It's your game!
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 4th Aug 2006 21:11
You do your time-based movement differently than me. (hence my confusion to see your problem)



"Using Unix is the computing equivalent of listening only to music by David Cassidy" - Rob Pike
RiiDii
21
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 5th Aug 2006 12:37 Edited at: 5th Aug 2006 12:38
Nice! I like it! I will definately have to consider it more.

What happens when all the movement and stuff takes longer than the update setting? Looks like it will sync, but let's say it took 20 miliseconds to update the movement and whatnot. Now the sync update is behind schedule?

Also, there is the issue of drawing the scene. This does not seem to take that into account. Maybe it does. Most of the time spent each frame on our OMMORPG project is the sync drawing the scene. The movement and all the AI and everything hardly compares in resource usage.


Open MMORPG: It's your game!
Cash Curtis II
21
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Corpus Christi Texas
Posted: 6th Aug 2006 08:58
I don't personally like either of those two methods. Riidii, your method lags a bit, depending on the framerate. Phaelax, that is a passive technique and only slows movement down. With low framerates, it does not compensate. I only use that method for my billboard animations, as it's easier on the processor than my main method.

Here's what I do...



Now this works great. I do movement and animations the same way like this. No matter how low the framerate goes, everything will move and animate correct. I've had my RPG sink down to 5 fps with Fraps, and everything still moves correctly. Frames are skipped, of course, but you can't really tell until it gets down to around 15 fps.

Like I said, I use passive timer control for billboard animations. Basically, if x amount of time has passed, advance the animation. However, any amount of time could have passed since the last loop, and the system will not compensate. All it will do is keep it from moving too fast.


Come see the WIP!
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 6th Aug 2006 09:16
I see your point.

I generally just use sync and lock it around a rate I think everyone can reach. Usually around 60, but larger things I might lock to 30 and code everything to run from that speed.

"Using Unix is the computing equivalent of listening only to music by David Cassidy" - Rob Pike
RiiDii
21
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 6th Aug 2006 16:20
Quote: "Riidii, your method lags a bit, depending on the framerate."


True. I was relying on the fact that drawing the scene takes more time than anything else. I was thinking that the difference wouldn't be noticeable, but it seems that it is. I will use your method for updating the player, or any other critical objects. But for general timer updates, I think the single TimeFactor will be adaquate and help reduce using added variables; introducing possible bugs. I am sure you are learning (as I am), keeping the code clean is critical!


Open MMORPG: It's your game!
BillR
23
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 7th Aug 2006 08:18 Edited at: 7th Aug 2006 14:53
As far as my pinball entry - Finally got my flippers to work, it only took 5 days, don't you just love ODE.....well only sometimes.

Do you call them flippers in the UK?

Tuesday night is the deadline.....wow, I will have mine in by 11:59 Tuesday night San Francisco time. Hope that's OK.
Spopovich
19
Years of Service
User Offline
Joined: 12th Jul 2006
Location:
Posted: 7th Aug 2006 17:52
Just wanted to make sure that everyone knows that there is only a little more time left, about a day and a half. The deadline is at 12:00 Tuesday but I'm not going to judge untill the morning so if its a little late that is alright. Again good luck to everyone I can't wait to see what people have come up with.

Do not ask what the forums can do ask what you can do for the forums.
BillR
23
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 8th Aug 2006 11:10
This has been a hard challenge for me, and it looks like for others too. I hope everyone is busy finishing their entry, I will post some code later today, when I get a few more things working right.
Nicholas Thompson
21
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 8th Aug 2006 11:25
I'm so "upset" that I've recently had zero time for these challenges. I read every post - but just cant find time to make an entry.

[center]
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 8th Aug 2006 12:48
Anyone happen to remember which challenge I won? I can't seem to remember nor find it on the challenge site. I know I had one.

@Nic, read less, code more!

"Using Unix is the computing equivalent of listening only to music by David Cassidy" - Rob Pike

Login to post a reply

Server time is: 2026-07-09 11:26:23
Your offset time is: 2026-07-09 11:26:23