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
lower logic
20
Years of Service
User Offline
Joined: 15th Jun 2006
Location:
Posted: 10th Sep 2006 08:00 Edited at: 10th Sep 2006 08:00
Both entries are looking great. Right now both editors are easy to use and have several unique and useful features. It's clear that you have put lots of work into them; it's going to be hard to decide which is better. Anyway, now it looks like there is around 24 hours left, depending on where you live, so now's the time to add any last minute features or fixes. I'll be judging them Monday afternoon EST, so just be sure to get any last minute final versions you may have in before then. Thanks.
Darth Vader
21
Years of Service
User Offline
Joined: 10th May 2005
Location: Adelaide SA, I am the only DB user here!
Posted: 10th Sep 2006 11:37 Edited at: 10th Sep 2006 11:40
I was going to do this one but got sidetracked!
DARN!!
Will look at the entries once there on DBP site!


Hobgoblin Lord
20
Years of Service
User Offline
Joined: 29th Oct 2005
Location: Fall River, MA USA
Posted: 11th Sep 2006 01:23
Wish I had had some time for this, I was thinking about using win32 calls to do most of the work, had a good plan in mind overall but have spent all my time working on my toolsets for my WIP. Good look guys.

http://www.cafepress.com/blackarrowgames
Check out my great stuff here
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 11th Sep 2006 01:57
hmm, win32 calls. Thx, I just figured out how im gonna add my open/save dialogs.

"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: 11th Sep 2006 05:07
Well I have to go to bed school tommarow. So I wasnt able to do everything that i had wanted the print command only half works sometimes it does sometimes it doesnt. It is supposed to open up the internet browser with the text to make is easy to print. I only wish I had more time to debug. A few new features were added including double clicking on words to hilight them and sear and search and replace. Hopefuly there arent too many bugs. And yes I use version 6.2. Adios and good luck Phaelax cant wait to see the final version.


Do not ask what the forums can do ask what you can do for the forums.
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 11th Sep 2006 12:40 Edited at: 12th Sep 2006 00:55
Ok, I guess I'm finished. I could easily spend another week just building up the GUI some more.

I've attached the source for those who don't want to select the 1500 lines of code.

Features:
- Copy/Paste via clipboard
- Word/character count
- multiple windows with a scrollable display
- unlimited number of files opened (limited to system memory)
- open/save via Windows dialog boxes
- line numbers, although not accesible to the user through the GUI yet

Bugs:
- Paste is buggy
- some trouble when multiple windows overlap.

Non-OP related bugs:
- keyboard buffer doesn't store delete key, among others
- no font selection, because i didn't want to work with something DB already handles so inefficiently




"Using Unix is the computing equivalent of listening only to music by David Cassidy" - Rob Pike
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 11th Sep 2006 12:51 Edited at: 12th Sep 2006 00:34
@spopovich,
i like the text attributes and colors. You got a few typos though, such as "copy" and "amount"(when specifying color).

"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: 11th Sep 2006 23:02 Edited at: 11th Sep 2006 23:10
Well I got home from school not long ago and wanted to see if I could fix the print. It seems to work pretty well. Takes you into ie or whatever your browser is. From there just go to print preview or print and you'll have a coppy of your work. Different fonts work better than others due to size limitations on some. I also found that my program still slows alot when alot is typed. Haven't checked your out yet Phaelax just about to do that.
Edit: fixed two typos though there might and proboly are more. I'm not the best speller.


Do not ask what the forums can do ask what you can do for the forums.
lower logic
20
Years of Service
User Offline
Joined: 15th Jun 2006
Location:
Posted: 12th Sep 2006 02:28 Edited at: 12th Sep 2006 02:33
The Text Editor Challenge Has Ended!
***********************************

There were 2 entries for this challenge.

Spopovich
A very good text editor.
The print feature is nice, but things like bold and italics ended up being every other letter in the html document, like bold ended up being "<b>c</b>h<b>a</b>l<b>l</b>e<b>n</b>g<b>e</b>" which made it less useful.
Text formatting was good.
The color is nice, though it could have used a better color picker. Editing colored text sometimes makes the text lose its color, which was disappointing.
There are some problems with word wrap. Several times I was typing along and the word wrap would put me in the middle of the previous word, or something equally weird.
Find works nicely, though I couldn't get replace to work for the life of me.
Would have liked to see an "Import" option to load a normal text file.
The width of the usable text area (before it starts to wrap) could have been wider.
The special character feature is great - most of the time it was simple use, though sometimes it would also move the cursor down off the page.
The definition tool is a nice touch.

Phaelax
A very remarkable text editor.
The windows are a nice touch, though overlapping windows are sort of buggy.
Scrolling let me type and edit files of any size.
The word count and character count tools are also nice, though a few times manually counting words in a file didn't match what it said as a the word count.
Saving and loading normal text files is nice and simple.
Horizontal scrolling and text highlighting don't seem to like each other at times. Other than that the text highlighting is very nice.
Would have liked to see automatic vertical scrolling when the user presses enter at the bottom of the document.
Also would have liked to see the horizontal scroll go back to the left when the enter key is pressed.
Line numbers is a nice feature. Mostly usable though the cursor doesn't offset correctly.
The clock is a nice touch.


The Text Editor Challenge Winner is...

Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 12th Sep 2006 02:41
Sweet!

I'm open for suggestions on the next challenge.

"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: 12th Sep 2006 03:02 Edited at: 12th Sep 2006 04:13
Congrats Phaelax. Guess thats what I get for focusing on what I can add rather than how to make what I already had better... or should I say actualy work. Anyway a thought for the next challenge could be an html writer. A graphic user interface that would do the coding for you. I had started somting like cause I'm not that good in html I wanted to make the commands easier but you have input everything in data statements. Here it is

There are two pages there one is remed out. My friend is thinkin bout rowing so that is the reason for the first one. All you do is make it in data statements run it and input a name for the file. So I was thinkin somthing like this however with a nice gui. Or maybe just a program filled with nick nacs. Analog clocks, lava lamps, and other random programs that are just fun to make!

Do not ask what the forums can do ask what you can do for the forums.
lower logic
20
Years of Service
User Offline
Joined: 15th Jun 2006
Location:
Posted: 12th Sep 2006 08:23 Edited at: 12th Sep 2006 08:24
Perhaps a program where in one mode it is a level editor - you can draw a 2d level (perhaps made up of triangles) and perhaps add other elements of a level editor like placing enemies. In the other mode you can play the level - i.e. jump around it like in Mario or Sonic, kill the enemies, etc. The entry that could create and run the most interesting levels (based on the physics, ai, general gameplay, etc) would be the winner.
Nicholas Thompson
21
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 12th Sep 2006 08:44
Well done phaelax - its about time you won one of them!

[center]
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 12th Sep 2006 08:59
I'd like to keep this as single challenge and not an entire project like we've been doing lately. I did consider an HTML parser, but we did the LOGO parser not too long ago. Plus, LowerLogic usually wins anything involving a parser.

I'm leaning towards a 2D physics simulation, without the use of any physics packs because I'm running 5.8. Yea that sounds good.



*********************
2D PHYSICS SIMULATION
*********************

Time: 2 weeks, September 26.

- Demonstrate whatever physics you feel like sharing
- No existing phyics packs may be used, unless written by you. (this includes the physics in 6.2)
- simulation can be anything you want

User interaction is not required but would gain many points.
Essentially, you could write Mario if you wanted to. Anything involving physics.

Graded on accuracy of physics, speed, and how fun it demonstrates the physics. Impress me and win the title of Challenge Winner!

"Using Unix is the computing equivalent of listening only to music by David Cassidy" - Rob Pike
Ric
21
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 12th Sep 2006 10:44
Congratulations Phaelax - nice piece of code which should be very useful for anyone wanting to add text input into their projects.

2d physics ..... excellent choice!

I have in my mind an idea that I've been wanting to have a go at for quite a while - does everyone know/remember the demonstration your physics teacher probably showed you, where you put a magnet underneath a sheet of paper and sprinkle iron filings ontop to reveal the shape of the magnetic field? I think I'll try that. If I get it right, the idea is that the correct field pattern should 'create itself', based on the physics in the code.

I have no objection to anyone else trying the same idea - infact it would be very interesting to compare and collaborate.

Done right, this could have a real life application in science classrooms.
Nicholas Thompson
21
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 12th Sep 2006 10:55
Wow - thats a nifty idea ric! I might try to adapt my 3d swarming screensaver. Could be quite cool in 2D - depending on the limitations of DBP's 2D engine.

[center]
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 12th Sep 2006 11:47
If you want to fake the appearance of 3D in 2D, I'll allow that. In fact, that'd be neat challenge in itself, but not so much physics related.

DB should handle any 2D drawing effects you need just fine. Remember that you can lock/unlock pixels which can greatly speed up drawing.

I just remembered that the last time I picked a challenge it was spring physics I believe. I'm such a math nerd.
Hopefully, the challenge is general enough to attract many ideas. At least more than 2 people this time.

"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: 12th Sep 2006 13:57
Make a post in the forum to let people know a new one has just started.

[center]
Cave Man
19
Years of Service
User Offline
Joined: 22nd Aug 2006
Location: North Carolina, US
Posted: 12th Sep 2006 15:42
This looks intresting. I think I'll do this one. I'll start thinking of ideas.


Language: DBP 6.2
Dolphins will be the death of us all. They try to fool you with their natural smile...
Mr Kohlenstoff
20
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Germany
Posted: 12th Sep 2006 22:43
Here's my post, I've also posted in the other thread... I mean, at least here's my code.



Visit the DBPro - Speed up your game-Thread. http://forum.thegamecreators.com/?m=forum_view&t=88661&b=1
lower logic
20
Years of Service
User Offline
Joined: 15th Jun 2006
Location:
Posted: 12th Sep 2006 22:58 Edited at: 12th Sep 2006 22:58
Cool. Sounds like a really fun challenge. Does the physics simulation have to be rendered with solely 2d commands, or can we use flat objects like plains and triangles to render our 2d worlds? Can we use sprites?
Nicholas Thompson
21
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 12th Sep 2006 23:58
I cant see why not - I think thats what phaelax meant to say earlier, rather than faking 3D with 2D, I think he meant faking 2D with 3D...

[center]
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 13th Sep 2006 00:03 Edited at: 13th Sep 2006 00:03
Nope, I meant faking 3D with 2D, sort of like a raycast engine?
Sprites are fine and you can use 3D objects that way. IMO, 2D drawing is just easier.

Glad to see some new people.

"Using Unix is the computing equivalent of listening only to music by David Cassidy" - Rob Pike
NewGuy
20
Years of Service
User Offline
Joined: 11th Nov 2005
Location: Interdimensional vortex
Posted: 13th Sep 2006 00:22
I just noticed this form a day before you posted about this challenge (good timeing huh). I got an idea using magnets and gravity. I did something with 2d gravity before, so i should be able to do this...


**Preregistered**



http://darkbasicpro.thegamecreators.com/?m=codebase_view&i=4a44150111c79eebf8571ab7a002c935

Remember remember the fifth of November. The gunpowder treason and plot. I know of no reason why the gunpowder treason should ever be forgot.
Mr Kohlenstoff
20
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Germany
Posted: 13th Sep 2006 00:39 Edited at: 13th Sep 2006 00:41
@ NewGuy:

Doesn't seem to be realistic all the time, but especially at the beginning it's very nice.
But maybe you should add the feature to reposition/restart the simulation... because in the end most of the.. "tiles" fly around more or less senseless.
Nonetheless very interesting.

Edit: Sorry, i just realised that there already is a restart-function. Good work.

Visit the DBPro - Speed up your game-Thread. http://forum.thegamecreators.com/?m=forum_view&t=88661&b=1
Zotoaster
21
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 13th Sep 2006 01:23
Oh man I'm joining in this one.

lower logic
20
Years of Service
User Offline
Joined: 15th Jun 2006
Location:
Posted: 13th Sep 2006 10:55 Edited at: 13th Sep 2006 10:59
Here's the beginning of my entry. I'm aiming at making it similar to the Newton DBPro Wrapper for the Newton Game Dynamics physics library.


Once I add collision detection/response it will start to get interesting .
Lukas W
22
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 13th Sep 2006 12:56
Nicholas Thompson
21
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 13th Sep 2006 13:06
I think so - because you're using a 3rd party module (which I think is against the rules anyway).

Bear in mind:
1) ANYONE must be able to copy and paste the code into DBP and click run without downloading or installing anything else...
2) This challenge specifically says "without the use of any physics packs"
3) The whole point of these challenges is to challenge yourself to code something and, in the process of doing so, learn new techiniques and generally further yourself as a developer.

[center]
Lukas W
22
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 13th Sep 2006 13:49
Quote: "2) This challenge specifically says "without the use of any physics packs""

ah, i read that sentence the wrong way. the challenge makes sence now

lower logic
20
Years of Service
User Offline
Joined: 15th Jun 2006
Location:
Posted: 14th Sep 2006 04:48 Edited at: 14th Sep 2006 04:49
Here's an update. I've added collision detection for convex shapes and an impulse-based collision response.

Basically this means that objects should crash into each other in a realistic manner, but an object resting on another will slowly sink through it as I haven't added a force solver yet. Also, I haven't added any kind of friction.

Currently there's a bug in the collision system when two faces hit each other directly, so for now I've rotated the free-falling boxes by an angle of 0.001 to get around the bug for now. Here's the code:
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 14th Sep 2006 06:11
Neat collision LL. I'm guessing the bug is where the boxes sink through each other?

"Using Unix is the computing equivalent of listening only to music by David Cassidy" - Rob Pike
Ric
21
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 14th Sep 2006 10:48
Woah! Impressive work LL - if that's where you're up to after a couple of days I wonder what we'll be competing with after a couple of weeks!
Cave Man
19
Years of Service
User Offline
Joined: 22nd Aug 2006
Location: North Carolina, US
Posted: 14th Sep 2006 14:36 Edited at: 14th Sep 2006 14:39
That's neat LL, i can't think of any ideas. oh yeah i made a better modulus once.

It runs a little faster with that.

Nicholas Thompson
21
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 14th Sep 2006 15:07
cool! Although the current challenge is a 2D Physics Simulation...

[center]
Cave Man
19
Years of Service
User Offline
Joined: 22nd Aug 2006
Location: North Carolina, US
Posted: 14th Sep 2006 16:58 Edited at: 14th Sep 2006 16:59
I know. That was for lower logic's program.

I don't think i'll do this one cause i can't think of anything to make.

Nicholas Thompson
21
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 14th Sep 2006 18:49
youcould try to replicate SOMETHING like this:
http://www.geocities.com/mr_marble_madness/ragdoll/georgerag.swf

But on a much more simple level - maybe have a ball falling down and bouncing off blocks on the way down?

[center]
NewGuy
20
Years of Service
User Offline
Joined: 11th Nov 2005
Location: Interdimensional vortex
Posted: 14th Sep 2006 23:53 Edited at: 15th Sep 2006 00:20
Very nice LL

I've never used vectors before so your program is hard to understand, I guess I should experiment with them some more.


This is what I've made...



I'm still learning so the more comments the better

Remember remember the fifth of November. The gunpowder treason and plot. I know of no reason why the gunpowder treason should ever be forgot.
Ric
21
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 15th Sep 2006 12:28
That's looking good NG - quite a bit of physics in there. Perhaps the balls should be a bit more bouncy though when they hit the ground?
Zotoaster
21
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 16th Sep 2006 01:00
Just started working on mine today. I like it, it's probably the most physically realistic demo I've made, even the air density plays a part in it .

Demo 1 - Elastic Bands, Lots of balls that appear to be tied onto the mouse with elastic bands.



Demo 2 - Planets, A few planets that orbit round the mouse. Basically just like Demo 1, but without gravity of Air Density (and more mass on the balls).



Notes: Use space to show the vectors of the forces. The green one is the resultant force, the force that the acceleration is actually affected by. If you notice, when you move at a constant speed, you can't see the green one. this proves Newton's 1st law, cool eh?


I suck.

Spopovich
19
Years of Service
User Offline
Joined: 12th Jul 2006
Location:
Posted: 16th Sep 2006 03:07
Everybodys programs look cool. I havent had alot of time to work on this challenge. Heres what I got.

I hope to either make a cool game like billiards or pinball or maybe just make a rube goldburg device. Dont know yet, I'll cross that bridge when I get there.

Do not ask what the forums can do ask what you can do for the forums.
Cave Man
19
Years of Service
User Offline
Joined: 22nd Aug 2006
Location: North Carolina, US
Posted: 16th Sep 2006 03:21
I started playing around. Here's what I've done


Zotoaster
21
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 16th Sep 2006 04:03
All those entries are looking awesome. here's my updated one, it used wind and some water using my 2D Matrix Functions, and the help of the awesome Ric(I guess I should set the viscosity, it doesn't actually affect the objects lol).



lower logic
20
Years of Service
User Offline
Joined: 15th Jun 2006
Location:
Posted: 16th Sep 2006 04:12 Edited at: 16th Sep 2006 05:21
The gravity one looks pretty nice Zotoaster, and the wind one looks really realistic.

Spopovich, it's a good start, but the ball would appear to move and fall more naturally if you keep track of the velocity of the ball, sort of like in Cave Man's example.

Here's an update of my simulator. Before, the moment of inertia wasn't being used correctly in impulses (for the collision response), but I found some equations in a paper online that seem to calculate everything correctly. I also tried to improve the collision response, now if 2 corners of a box are on the ground, it will set the collision point to the middle of the two corners, making things a bit more stable. Objects don't sink through each other any more. Collision points are visually shown as little white squares.

You can drag objects, so it is a lot more fun to play with.
Other controls:
Shiftkey - remove linear velocity from last clicked body;
Controlkey - remove angular velocity from last clicked body.
Pressing either shiftkey or controlkey along with the 'A' key will do the action to all rigid bodies.
G - toggle gravity for last clicked body.
Left/Right arrow keys - rotate the large beam in the middle of the room. You can drag objects on to the beam and then rotate it to watch the objects slide down it.

Code:
[edit] Updated code with new frictional impulses, though they aren't frictional forces, so it doesn't look quite normal for bodies in continuous contact, and it's hard to see a frictional impulse in a collision.
Zotoaster
21
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 16th Sep 2006 04:45
Holy Crap!

Nicholas Thompson
21
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 16th Sep 2006 13:19
Well I think we have a winner already... Lol! Thats fantastic! Its hard to believe all that runs with just pure DBP Code!

[center]
Zotoaster
21
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 16th Sep 2006 13:39
What's moment of inertia?

lower logic
20
Years of Service
User Offline
Joined: 15th Jun 2006
Location:
Posted: 16th Sep 2006 14:16 Edited at: 16th Sep 2006 14:24
It's the angular equivalent of mass. The higher it is for an object, the harder it is to get the object to start or stop spinning. You can tweak the RBD_CalculateMIBoxSolid() function to see what happens when the moment of inertia is increased or decreased by a factor of 10.
Sixty Squares
20
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 16th Sep 2006 14:38
WOAH THAT IS AMAZING, LOWER LOGIC! Just the cubes kept on bouncing...

Amazing work!

Ummm...
Cave Man
19
Years of Service
User Offline
Joined: 22nd Aug 2006
Location: North Carolina, US
Posted: 16th Sep 2006 14:59
lower logic... thats just freaky.

Your signature has been erased by a mod because it's larger than 600x120

Login to post a reply

Server time is: 2026-07-10 23:31:06
Your offset time is: 2026-07-10 23:31:06