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 Discussion / The DB Classic Programming Challenge Thread

Author
Message
Libervurto
19
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 19th Nov 2007 23:00 Edited at: 19th Nov 2007 23:13
RE: Text Sizes in v1.13 and v1.2
Latch said the difference is because v1.13 defaults the character set differently to v1.2.
When you use the SET TEXT FONT command, there is an optional parameter to set the character set.
I'm not really sure what this is but I think each font has several sets of characters of different sizes, because if there was only one set it would have to be stretched horribly to display in all sizes.
Try specifying the charset and see what happens

[edit]
OK it isn't sizes it's for languages and symbols. cool!

[edit]
Ah, I think I've worked it out, charset 0 is huge and charset 1 is smaller so do this
SET TEXT FONT "[font name]",1

Then it should look fine in v1.2 (I think )

"You must be someone's friend to make comments about them." - MySpace lied.
Libervurto
19
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 20th Nov 2007 00:41
Here's the start of my entry
It's a complete mess but I'm just basically dumping stuff in at the moment


"You must be someone's friend to make comments about them." - MySpace lied.
Link102
21
Years of Service
User Offline
Joined: 1st Dec 2004
Location: On your head, weeeeee!
Posted: 20th Nov 2007 21:54
This is not an entry, this is just a lifebar code I'm sharing with you. Because I don't have enough time to code this thing



Don't look at my sig!
Libervurto
19
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 21st Nov 2007 02:05
@link
I like the look of those

Here's a strange way you could display stats


"You must be someone's friend to make comments about them." - MySpace lied.
Sinani201
19
Years of Service
User Offline
Joined: 16th Apr 2007
Location: Aperture Science Enrichment Center
Posted: 21st Nov 2007 17:43 Edited at: 24th Nov 2007 18:46
excellent slider bar technique!! I'm still trying to make add-ons for your "Windowed GUI" so I'll look at how you did the sliding

Seriously, how do you make the little blue text come up below your message?
Libervurto
19
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 21st Nov 2007 22:57
@sinani
nice to hear
The slider works by using the same formula to draw the colours and work out what colour is at the point you select, eliminating the need for the POINT command which can be quite slow.

"You must be someone's friend to make comments about them." - MySpace lied.
Tone3e
19
Years of Service
User Offline
Joined: 17th Feb 2007
Location: here
Posted: 23rd Nov 2007 04:27
I didnt like the last challenge thats why i didnt enter. This one seems pretty intersesting. I will start on an entry but seeing as time is almost over i may not finish.

It is when I am weak, when I am truly strong.
Sinani201
19
Years of Service
User Offline
Joined: 16th Apr 2007
Location: Aperture Science Enrichment Center
Posted: 23rd Nov 2007 06:31 Edited at: 24th Nov 2007 18:46
Hmmm... I might not finish my entry in time... hopefully I will!!

Seriously, how do you make the little blue text come up below your message?
Tone3e
19
Years of Service
User Offline
Joined: 17th Feb 2007
Location: here
Posted: 23rd Nov 2007 23:00
link is it ok if i use your lifebar code in my entry?
i may not finish either, can we maybe extend the deadline?

It is when I am weak, when I am truly strong.
Sinani201
19
Years of Service
User Offline
Joined: 16th Apr 2007
Location: Aperture Science Enrichment Center
Posted: 24th Nov 2007 01:21 Edited at: 24th Nov 2007 18:46
lifebar code? In a program that lets you make characters? What are you up to??

Seriously, how do you make the little blue text come up below your message?
Libervurto
19
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 24th Nov 2007 01:41 Edited at: 24th Nov 2007 02:06
The deadline is next monday (3rd December for those people who don't understand what next means )
mines gonna be pretty cool

@Sinani
Please remove your sig, it's HUGE and annoying!

PS instead of "HUGE" I accidentally typed "HUGS" haha

"You must be someone's friend to make comments about them." - MySpace lied.
Zombie 20
19
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 24th Nov 2007 10:34
I get to code today!!! yay!!! I get to code today!@!!!!!


Coffee coffee coffee coffee coffee coffee cappacino, JAVA!
Link102
21
Years of Service
User Offline
Joined: 1st Dec 2004
Location: On your head, weeeeee!
Posted: 24th Nov 2007 16:26 Edited at: 24th Nov 2007 16:27
Quote: "By Tone3e:
link is it ok if i use your lifebar code in my entry?
i may not finish either, can we maybe extend the deadline?"

why'dd you think I put it there
Quote: "By Sinani201:
lifebar code? In a program that lets you make characters? What are you up to?"

the status bar could be used as a life bar

Don't look at my sig!
Sinani201
19
Years of Service
User Offline
Joined: 16th Apr 2007
Location: Aperture Science Enrichment Center
Posted: 24th Nov 2007 18:45
KK, I removed it. And I really need to know how to make a signature. SOMEONE HELP ME!

Seriously, how do you make the little blue text come up below your message?
Comrade Robski
20
Years of Service
User Offline
Joined: 12th Sep 2005
Location:
Posted: 4th Dec 2007 10:15
Well after a promising start, it looks like this challenge has died on it's feet. The deadline has now passed - only Zombie20, Obese87 and Link102 have made a contribution, but I think it's fair to say none of those can be counted as a finished entry. Is anyone close to submitting an entry? Should we just abandon this challenge?
Zombie 20
19
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 4th Dec 2007 10:30
I apologize for unfinished, work got me down and blah blah, if you want give us one more day, two max to finish it up. Otherwise we'll just do something new, but its up to you.


Coffee coffee coffee coffee coffee coffee cappacino, JAVA!
Comrade Robski
20
Years of Service
User Offline
Joined: 12th Sep 2005
Location:
Posted: 4th Dec 2007 12:46
hey no need to apologise - this is meant to be fun! If the challenge is not interesting enough for people to enter that's my fault not yours!! Sure, take a couple of days - let's push the deadline back to midnight thursday 6th Dec.
Link102
21
Years of Service
User Offline
Joined: 1st Dec 2004
Location: On your head, weeeeee!
Posted: 4th Dec 2007 15:47
I think it has to do with the time of the year

Don't look at my sig!
Zombie 20
19
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 4th Dec 2007 19:47
alright, lets get back to it


Coffee coffee coffee coffee coffee coffee cappacino, JAVA!
Libervurto
19
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 4th Dec 2007 21:23 Edited at: 4th Dec 2007 21:24
I think we need another week, I completely forgot about this challenge

[edit]
Thursday is ok with me

"You must be someone's friend to make comments about them." - MySpace lied.
TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 4th Dec 2007 22:15
Maybe we should get back to basics with the challenges?

We should really make them a lot more simple and get more newcomers interested. We could even base the challenges on questions asked by newcomers and point them to this thread if a question is asked about something covered in an already completed challenge.

OK, some of the more experienced DB'ers amongst us should be able to complete the easier challenges in minutes, but there's always scope for adding bells and whistles to any challenge.

But, if we can cover subjects that newcomers ask about frequently and get them involved, we can generate a little more interest in the thread.

We basically need to advertise that this thread is here!

TDK_Man

Zombie 20
19
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 5th Dec 2007 00:56
Quote: "there's always scope for adding bells and whistles to any challenge."

Exactly, presentation presentation presentation .

I agree, however even if advertising this thread, a lot of newcomers simply don't want to listen and start small..so while they may know its here, they still may not visit. But, it never hurts to let them know.


Coffee coffee coffee coffee coffee coffee cappacino, JAVA!
Tone3e
19
Years of Service
User Offline
Joined: 17th Feb 2007
Location: here
Posted: 5th Dec 2007 05:16
i think this chanllenge was good. I am not near done yet so please wait.

It is when I am weak, when I am truly strong.
Comrade Robski
20
Years of Service
User Offline
Joined: 12th Sep 2005
Location:
Posted: 5th Dec 2007 11:09
@TDK I know what you mean TDK, but I thought this challenge was very accessable to even those with only very basic knowledge. To meet the requirements, you just need to take text input from the user, and display this and a few other numeric variables on the screen. These skills are pretty fundamental - it would be hard to make the challenges less difficult and still be meaningful.

Also, it seems lots of people are interested in creating an RPG, so I thought this would be a good challenge to get them started.
TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 5th Dec 2007 20:27
Quote: "but I thought this challenge was very accessable"


Yes - I was just talking about challenges generally. Sorry if it sounded like I was talking specifically about the current challenge - I wasn't...

More my thoughts for future challenges where someone is considering setting a challenge to write a complete game/program.

The main point of my post though was to suggest that we point new DBC users to this thread and encourage them to participate. Keeping the challenges small (and essentially single command or programming topic specific) was just a by-product.

TDK_Man

Tone3e
19
Years of Service
User Offline
Joined: 17th Feb 2007
Location: here
Posted: 6th Dec 2007 02:43
Here is my entry, I finally finished it yeah. I wanted to add it so it would paste an image at the end too but i just wanted to submit already. Hope i win this time.


It is when I am weak, when I am truly strong.
Libervurto
19
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 6th Dec 2007 08:57
@Tone
I like it. I like the way you used the stat bars, I think all the stats should be displayed all the time though.

"You must be someone's friend to make comments about them." - MySpace lied.
Zombie 20
19
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 6th Dec 2007 10:53
poop, i hope i get to finish, I really liked this challenge.


Coffee coffee coffee coffee coffee coffee cappacino, JAVA!
Libervurto
19
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 6th Dec 2007 23:34
for those still working on their entries, here's a simple stat bar that you can use if you like.

you can change the 1% image to whatever you want

"You must be someone's friend to make comments about them." - MySpace lied.
Tone3e
19
Years of Service
User Offline
Joined: 17th Feb 2007
Location: here
Posted: 7th Dec 2007 00:47
@obese
Yeah I tried but I couldnt figure out how. I like it better how it looks now though. BTW thanks to link for that lifebar function.

Deadline's today. I hope there are some challengers, If not I have a good challenge in mind.

It is when I am weak, when I am truly strong.
Libervurto
19
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 7th Dec 2007 03:18
@Tone
I've made it pretty clear in the program. Read the comments and if you still don't get it I'll explain

"You must be someone's friend to make comments about them." - MySpace lied.
Tone3e
19
Years of Service
User Offline
Joined: 17th Feb 2007
Location: here
Posted: 7th Dec 2007 03:36
lol, not that. I meant your previous suggestion to my entry. Is anybody else gonna enter?

It is when I am weak, when I am truly strong.
Libervurto
19
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 7th Dec 2007 07:24 Edited at: 7th Dec 2007 07:51
@Tone
Ah ok.
The way to do that is to compress all your gosubs into one for loop that displays all the text and stat bars.

You may have thought that all the different strings, stats and screen positions would be impossible to get into one for loop, but they're not.
The positions of the text and stat bars can easily be programmed into the loop e.g.

This code will print the word "Hello" 10 times, each instance of the word will be 20 pixels down from the last.

The tricky part is when you try to get all the different strings and stat values into the for loop. The way to do it is to create an array to store the data in, then inside the for loop we use n to point to each value of the array as its value increases.
In this case we will need two arrays; one for strings and one for integers (DB arrays can only store one variable type).

Now we have all our data neatly stored in arrays
In our string array stat$(1)="Intelligence" so it would make sense to use stat(1) to store the intelligence skill of our character. Oh dear, he's not very smart .
Notice that I haven't used "box" 0 of the arrays, you could store a stat in there if you wanted, but I tend to leave this free as we may need to use the 0 value as meaning "no stats are active".

FUTURE TIP: Since our program is pretty small it is easy to remember that 1=Intelligence, 2=Strength and 3=Speed, but sometimes it is hard to keep track of what each "box" in an array is storing. I get around this problem by doing creating some variables with names that describe what each "box" holds:

Now we have some "label variables" it's easy to see what those numbers mean. The most important thing to remember if you use this method is not to alter these variables, or you'll get in a real mess.

Now lets put it all together:


That's all nice but we can't alter the stats .
This is where arrays make everything very easy.
Here is the complete code:


"You must be someone's friend to make comments about them." - MySpace lied.
Libervurto
19
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 7th Dec 2007 08:05
I've done a version with my bar sprite method.

May as well count this as my entry seeing as I didn't finish my real one

"You must be someone's friend to make comments about them." - MySpace lied.
Comrade Robski
20
Years of Service
User Offline
Joined: 12th Sep 2005
Location:
Posted: 7th Dec 2007 14:13 Edited at: 7th Dec 2007 14:13
OK time up, compertition's closed! I'm really pleased we got some entries, many thanks to Tone3e and Obese87!

Two good entries, both could be used as a basis for an RPG. Overall I've decided the winner is.......


and a very honorable mention to the runner up



The winner can set the next challenge!
Zombie 20
19
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 7th Dec 2007 21:32
well hey hey, work got me down too much couldn't finish, but indeed congrats to winners, and comrade this was one of the best challenges yet. I intend to finish it this weekend when I have some time to work on it and share it with you as I already need it for the rpg I'm creating, good job to the winners and I look forward to the next challenge.


Coffee coffee coffee coffee coffee coffee cappacino, JAVA!
Tone3e
19
Years of Service
User Offline
Joined: 17th Feb 2007
Location: here
Posted: 8th Dec 2007 01:43 Edited at: 8th Dec 2007 02:03
Yay i won.
Menu challenge.
For the next challenge you will have to create an game menu.
Menu may show options like 1 player, 2 player, etc. but can lead to a message instead of a part of the game.
Bonus points for creativity, making it look good, additional features...
I dont really have an idea for the date for the challenge to end and i wanted to see first if this challenge was good enough.

edit: deadline december 15, 12:00 am GMT.

@obese. Wow, thanks for the help that looks a lot simpler yet more effective. I understand how you did it although i dont think i could of come up with that myself. I may include your code in mine and leave as a sippet for when i starty working on a game. I also really like the look of those bars you made.

It is when I am weak, when I am truly strong.
Zombie 20
19
Years of Service
User Offline
Joined: 26th Nov 2006
Location: Etters, PA
Posted: 8th Dec 2007 01:58
nice challenge, good for begginners too considering TDK's tut on it.

Its always been a week for the deadlines at midnight, I think that'll work for everyone.


Coffee coffee coffee coffee coffee coffee cappacino, JAVA!
Insert Name Here
19
Years of Service
User Offline
Joined: 20th Mar 2007
Location: Worcester, England
Posted: 8th Dec 2007 11:17
ALLLLLRIGHTY THEN!
Let's go!


Sudoku arts, the rabi and Nancy DrewG
TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 8th Dec 2007 21:28
Quote: "For the next challenge you will have to create an game menu."


Which sort?

One like I did the tutorial for or the drop-down type that you see running across the top of applications (File/Edit/Tools/Options/Help).

Might be worth clarifying...

TDK_Man

Libervurto
19
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 8th Dec 2007 23:31
I'm going to stay with the RPG theme and make a menu for that
Hey we could make a whole game here!

"You must be someone's friend to make comments about them." - MySpace lied.
Tone3e
19
Years of Service
User Offline
Joined: 17th Feb 2007
Location: here
Posted: 9th Dec 2007 04:30 Edited at: 9th Dec 2007 04:34
I thought that was the point, to make things that help make a game. I am glad you all like the challenge, now to see if you enter it because its easy enough.
@ TDK I meant a menu like the one from your tutorial. Like the kind you see at the beginning of games.

It is when I am weak, when I am truly strong.
Libervurto
19
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 9th Dec 2007 08:13
Here's my first entry.
As basic as they come but it will set the ball rolling.


I've realised I don't really know what I'm doing! I've never made a menu before!!!
How should I link to the sub-menus?

"You must be someone's friend to make comments about them." - MySpace lied.
TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 9th Dec 2007 21:22
The code which displays the menu button and handles the button clicks should be a procedure.

When the game is first run, before dropping into the main program loop, Gosub the Menu procedure.

Only exit this procedure when the user selects 'Start Game'. If the user clicks on the Exit button then end the program.

All the other buttons should jump to procedures which handle whatever the button does.

When program control drops back to the main program Do..Loop, it continues round until the game is over - at which point you Gosub the menu function again and the process repeats until the user clicks the exit button.

Pseudo code example:



TDK_Man

Link102
21
Years of Service
User Offline
Joined: 1st Dec 2004
Location: On your head, weeeeee!
Posted: 9th Dec 2007 23:30 Edited at: 10th Dec 2007 00:24
-wrong post-

Don't look at my sig!
TDK
Retired Moderator
23
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 10th Dec 2007 23:28
OK, a menu screen done (I would guess) a little differently than any of the other entries...



I have to admit that it looks a bit naff, but that's only down to the fact that all the graphics have to be created by the program. Using properly created buttons, I think this would look a lot better.

TDK_Man

demons breath
22
Years of Service
User Offline
Joined: 4th Oct 2003
Location: Surrey, UK
Posted: 11th Dec 2007 00:39 Edited at: 11th Dec 2007 00:40
TDK that's legend. I need to come up with a cool idea like that too for mine... but my brain's completely dry...


EDIT: NEVER MIND! cool idea coming... i think... now I just need to figure out how to code it...

Tone3e
19
Years of Service
User Offline
Joined: 17th Feb 2007
Location: here
Posted: 11th Dec 2007 02:41
Wow, thats incredible TDk.
I am glad to see some entries already and hopefully more to come. I am working on one myself. I will see how it goes and wether to post it up or not.

It is when I am weak, when I am truly strong.
Libervurto
19
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 11th Dec 2007 13:53
@TDK
That's cool, I think you should make it into a function that displays a menu in a circle no matter how many options there are

Insert Name Here
19
Years of Service
User Offline
Joined: 20th Mar 2007
Location: Worcester, England
Posted: 11th Dec 2007 14:01
TDK... that is awesome!!!!
I think we have our winner...


Sudoku arts, the rabi and Nancy DrewG

Login to post a reply

Server time is: 2026-06-08 11:37:31
Your offset time is: 2026-06-08 11:37:31